Fix hotkey detection

develop
Anuradha Dissanayake 2013-01-03 22:01:01 +13:00
parent 581a8dd955
commit 7b561f108b
1 changed files with 71 additions and 71 deletions

@ -1679,98 +1679,99 @@ namespace wf_ui
bool AdjustmentScreen::feed(set<df::interface_key> *input, ItemConstraint *cv, ProtectedJob *pj /* = NULL */)
{
if ((edit_limit || edit_gap))
if (input->count(interface_key::CUSTOM_T) && !edit_limit && !edit_gap)
{
df::interface_key last_token = *input->rbegin();
if (last_token == interface_key::STRING_A000)
if (!cv)
{
// Backspace
if (edit_string.length() > 0)
{
edit_string.erase(edit_string.length()-1);
}
return true;
// Add tracking
return false;
}
if (edit_string.length() >= 6)
return true;
if (last_token >= interface_key::STRING_A048 && last_token <= interface_key::STRING_A057)
// Remove tracking
if (pj)
{
// Numeric character
edit_string += last_token - ascii_to_enum_offset;
}
else if (input->count(interface_key::SELECT) || input->count(interface_key::LEAVESCREEN))
{
if (input->count(interface_key::SELECT) && edit_string.length() > 0)
{
if (edit_limit)
cv->setGoalCount(atoi(edit_string.c_str()));
else
cv->setGoalGap(atoi(edit_string.c_str()));
for (vector<ItemConstraint*>::iterator it = pj->constraints.begin(); it < pj->constraints.end(); it++)
delete_constraint(*it);
onConstraintChanged();
}
edit_string.clear();
edit_limit = false;
edit_gap = false;
forget_job(color_ostream_proxy(Core::getInstance().getConsole()), pj);
}
else if (last_token == interface_key::STRING_A000)
else
{
// Backspace
if (edit_string.length() > 0)
{
edit_string.erase(edit_string.length()-1);
}
delete_constraint(cv);
}
onConstraintChanged();
return true;
}
else if (input->count(interface_key::CUSTOM_L))
{
edit_string = int_to_string(cv->goalCount());
edit_limit = true;
}
else if (input->count(interface_key::CUSTOM_G))
{
edit_string = int_to_string(cv->goalGap());
edit_gap = true;
}
else if (input->count(interface_key::CUSTOM_N))
{
cv->setGoalByCount(!cv->goalByCount());
onModeChanged();
}
else if (input->count(interface_key::CUSTOM_T))
if (cv)
{
if (cv)
if (edit_limit || edit_gap)
{
// Remove tracking
if (pj)
df::interface_key last_token = *input->rbegin();
if (last_token == interface_key::STRING_A000)
{
for (vector<ItemConstraint*>::iterator it = pj->constraints.begin(); it < pj->constraints.end(); it++)
delete_constraint(*it);
// Backspace
if (edit_string.length() > 0)
{
edit_string.erase(edit_string.length()-1);
}
forget_job(color_ostream_proxy(Core::getInstance().getConsole()), pj);
return true;
}
else
delete_constraint(cv);
if (edit_string.length() >= 6)
return true;
if (last_token >= interface_key::STRING_A048 && last_token <= interface_key::STRING_A057)
{
// Numeric character
edit_string += last_token - ascii_to_enum_offset;
}
else if (input->count(interface_key::SELECT) || input->count(interface_key::LEAVESCREEN))
{
if (input->count(interface_key::SELECT) && edit_string.length() > 0)
{
if (edit_limit)
cv->setGoalCount(atoi(edit_string.c_str()));
else
cv->setGoalGap(atoi(edit_string.c_str()));
onConstraintChanged();
}
edit_string.clear();
edit_limit = false;
edit_gap = false;
}
else if (last_token == interface_key::STRING_A000)
{
// Backspace
if (edit_string.length() > 0)
{
edit_string.erase(edit_string.length()-1);
}
}
return true;
}
else
else if (input->count(interface_key::CUSTOM_L))
{
// Add tracking
return false;
edit_string = int_to_string(cv->goalCount());
edit_limit = true;
}
else if (input->count(interface_key::CUSTOM_G))
{
edit_string = int_to_string(cv->goalGap());
edit_gap = true;
}
else if (input->count(interface_key::CUSTOM_N))
{
cv->setGoalByCount(!cv->goalByCount());
onModeChanged();
}
onConstraintChanged();
}
else
{
return false;
}
return true;
return false;
}
void AdjustmentScreen::render(ItemConstraint *cv, bool in_monitor)
@ -2934,7 +2935,6 @@ namespace wf_ui
last_job = job;
}
return job != NULL;
}