Remove saved commands from CalculatorManager (#1230)

This commit is contained in:
Rudy Huyn 2020-05-25 10:43:31 -07:00 committed by GitHub
parent 79bd149b12
commit c37f540265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 152 deletions

View file

@ -1655,66 +1655,6 @@ void StandardCalculatorViewModel::UpdateOperand(int pos, String ^ text)
}
}
void StandardCalculatorViewModel::UpdateCommandsInRecordingMode()
{
shared_ptr<vector<int>> commands = make_shared<vector<int>>();
bool isDecimal = false;
bool isNegative = false;
bool isExpMode = false;
bool ePlusMode = false;
bool eMinusMode = false;
for (const auto savedCommand : m_standardCalculatorManager.GetSavedCommands())
{
const Command val = static_cast<Command>(savedCommand);
if (val == Command::CommandSIGN)
{
isNegative = true;
continue;
}
else if ((val >= Command::Command0 && val <= Command::Command9))
{
}
else if (val == Command::CommandPNT)
{
isDecimal = true;
}
else if (val == Command::CommandEXP)
{
isExpMode = true;
}
else if (isExpMode && !ePlusMode && (val == Command::CommandMPLUS))
{
ePlusMode = true;
continue;
}
else if (isExpMode && !eMinusMode && (val == Command::CommandMMINUS))
{
eMinusMode = true;
continue;
}
else
{
// Reset all vars
isDecimal = false;
isNegative = false;
isExpMode = false;
ePlusMode = false;
eMinusMode = false;
commands->clear();
continue;
}
commands->push_back(static_cast<int>(val));
}
if (!commands->empty())
{
shared_ptr<IOpndCommand> sp = make_shared<COpndCommand>(commands, isNegative, isDecimal, isExpMode);
m_commands->push_back(sp);
}
Recalculate();
}
void StandardCalculatorViewModel::OnMaxDigitsReached()
{
if (m_localizedMaxDigitsReachedAutomationFormat == nullptr)