When a key is pressed, go back to repeat phase 0 again. This is so that we

won't continue a fast repeat with the new key. (Annoying example: It could
be tricky to type upper-case letters because if you didn't type the letter
fast enough "Shift" would begin to repeat, and then whatever letter you
typed would start repeating immediately.)

svn-id: r18423
This commit is contained in:
Torbjörn Andersson 2005-06-21 15:41:35 +00:00
parent ee28783c74
commit d38a41e532
2 changed files with 13 additions and 10 deletions

View file

@ -279,15 +279,15 @@ void Interface::setMode(int mode) {
_panelMode = mode; _panelMode = mode;
switch(_panelMode) { switch (_panelMode) {
case(kPanelMain): case kPanelMain:
_mainPanel.currentButton = NULL; _mainPanel.currentButton = NULL;
break; break;
case(kPanelConverse): case kPanelConverse:
_conversePanel.currentButton = NULL; _conversePanel.currentButton = NULL;
converseDisplayText(); converseDisplayText();
break; break;
case(kPanelOption): case kPanelOption:
_optionPanel.currentButton = NULL; _optionPanel.currentButton = NULL;
_vm->fillSaveList(); _vm->fillSaveList();
calcOptionSaveSlider(); calcOptionSaveSlider();
@ -295,13 +295,13 @@ void Interface::setMode(int mode) {
_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1; _optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
} }
break; break;
case(kPanelLoad): case kPanelLoad:
_loadPanel.currentButton = NULL; _loadPanel.currentButton = NULL;
break; break;
case(kPanelQuit): case kPanelQuit:
_quitPanel.currentButton = NULL; _quitPanel.currentButton = NULL;
break; break;
case(kPanelSave): case kPanelSave:
_savePanel.currentButton = NULL; _savePanel.currentButton = NULL;
_textInputMaxWidth = _saveEdit->width - 10; _textInputMaxWidth = _saveEdit->width - 10;
_textInput = true; _textInput = true;
@ -314,9 +314,11 @@ void Interface::setMode(int mode) {
draw(); draw();
} }
bool Interface::processAscii(uint16 ascii) { bool Interface::processAscii(uint16 ascii, bool synthetic) {
int i; int i;
PanelButton *panelButton; PanelButton *panelButton;
if (!synthetic)
_textInputRepeatPhase = 0;
if (_statusTextInput) { if (_statusTextInput) {
processStatusTextInput(ascii); processStatusTextInput(ascii);
return true; return true;
@ -450,6 +452,7 @@ void Interface::textInputRepeatCallback(void *refCon) {
void Interface::textInputStartRepeat(uint16 ascii) { void Interface::textInputStartRepeat(uint16 ascii) {
if (!_textInputRepeatPhase) { if (!_textInputRepeatPhase) {
_textInputRepeatPhase = 1; _textInputRepeatPhase = 1;
Common::g_timer->removeTimerProc(&textInputRepeatCallback);
Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this); Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this);
} }
@ -462,7 +465,7 @@ void Interface::textInputRepeat() {
Common::g_timer->removeTimerProc(&textInputRepeatCallback); Common::g_timer->removeTimerProc(&textInputRepeatCallback);
Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this); Common::g_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this);
} else if (_textInputRepeatPhase == 2) { } else if (_textInputRepeatPhase == 2) {
processAscii(_textInputRepeatChar); processAscii(_textInputRepeatChar, true);
} }
} }

View file

@ -227,7 +227,7 @@ public:
void drawStatusBar(); void drawStatusBar();
void setVerbState(int verb, int state); void setVerbState(int verb, int state);
bool processAscii(uint16 ascii); bool processAscii(uint16 ascii, bool synthetic = false);
void processKeyUp(uint16 ascii); void processKeyUp(uint16 ascii);
bool _textInput; bool _textInput;