From 7b561f108b0a2a38973be33b643f4145032f6d3e Mon Sep 17 00:00:00 2001 From: Anuradha Dissanayake Date: Thu, 3 Jan 2013 22:01:01 +1300 Subject: [PATCH] Fix hotkey detection --- plugins/workflow.cpp | 142 +++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 5d8abc107..bb309fff9 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -1679,98 +1679,99 @@ namespace wf_ui bool AdjustmentScreen::feed(set *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::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::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; }