From 3bd4f4324405a4be468a9b45ca758d65f12a624f Mon Sep 17 00:00:00 2001 From: johns <> Date: Fri, 9 Mar 2001 02:03:25 +0000 Subject: [PATCH] Fixed bug #233916: Centermap shortcut conflicts with death coil command. --- src/include/interface.h | 4 ++-- src/stratagus/interface.cpp | 10 ++++++++++ src/ui/botpanel.cpp | 27 +++++++++++++++------------ src/video/X11.cpp | 2 -- src/video/sdl.cpp | 2 -- src/video/svgalib.cpp | 2 -- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/include/interface.h b/src/include/interface.h index c71f9daf6..7e0523cfb 100644 --- a/src/include/interface.h +++ b/src/include/interface.h @@ -286,8 +286,8 @@ extern void DrawButtonPanel(void); extern void UpdateButtonPanel(void); /// FIXME: more docu extern void DoButtonButtonClicked(int button); - /// FIXME: more docu -extern void DoButtonPanelKey(int key); + /// Lookup key for bottom panel buttons. +extern int DoButtonPanelKey(int key); //@} diff --git a/src/stratagus/interface.cpp b/src/stratagus/interface.cpp index 1479404db..7ddd6c983 100644 --- a/src/stratagus/interface.cpp +++ b/src/stratagus/interface.cpp @@ -159,6 +159,13 @@ local int CommandKey(int key) } break; + case KeyCodeF1: + case KeyCodeF2: + case KeyCodeF3: + case KeyCodeF4: // Set/Goto place + DebugLevel0("FIXME: not written\n"); + break; + case KeyCodeF10: GamePaused=1; SetStatusLine("Game Paused"); @@ -400,6 +407,9 @@ global int HandleKeyDown(int key) case IfaceStateNormal: // Normal Game state switch( KeyState ) { case KeyStateCommand: + if( DoButtonPanelKey(key) ) { + return 1; + } return CommandKey(key); case KeyStateInput: return InputKey(key); diff --git a/src/ui/botpanel.cpp b/src/ui/botpanel.cpp index b2105f56b..1aa3bcdaa 100644 --- a/src/ui/botpanel.cpp +++ b/src/ui/botpanel.cpp @@ -847,26 +847,29 @@ global void DoButtonButtonClicked(int button) ** Lookup key for bottom panel buttons. ** ** @param key Internal key symbol for pressed key. +** +** @returns True, if button is handled (consumed). */ -global void DoButtonPanelKey(int key) +global int DoButtonPanelKey(int key) { int i; - if( !CurrentButtons ) { // no buttons - return; - } + if( CurrentButtons ) { // buttons - // cade: this is required for action queues SHIFT+M should be `m' - if ( key >= 'A' && key <= 'Z' ) { - key = tolower(key); - } + // cade: this is required for action queues SHIFT+M should be `m' + if ( key >= 'A' && key <= 'Z' ) { + key = tolower(key); + } - for( i=0; i<9; ++i ) { - if( CurrentButtons[i].Pos!=-1 && key==CurrentButtons[i].Key ) { - DoButtonButtonClicked(i); - return; + for( i=0; i<9; ++i ) { + if( CurrentButtons[i].Pos!=-1 && key==CurrentButtons[i].Key ) { + DoButtonButtonClicked(i); + return 1; + } } } + + return 0; } //@} diff --git a/src/video/X11.cpp b/src/video/X11.cpp index 0dcaf2ed9..ec37a7a80 100644 --- a/src/video/X11.cpp +++ b/src/video/X11.cpp @@ -549,8 +549,6 @@ local void X11HandleKey(KeySym code) if( HandleKeyDown(icode) ) { return; } - // FIXME: Should come first - DoButtonPanelKey(icode); } /** diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index 28155fb9b..79db08fbc 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -439,8 +439,6 @@ local void SdlHandleKey(const SDL_keysym* code) if( HandleKeyDown(icode) ) { return; } - // FIXME: Should come first, move this into low level!!!! - DoButtonPanelKey(icode); } /** diff --git a/src/video/svgalib.cpp b/src/video/svgalib.cpp index 647c67a26..d3c8d3198 100644 --- a/src/video/svgalib.cpp +++ b/src/video/svgalib.cpp @@ -650,8 +650,6 @@ local void KeyboardEvent(int scancode, int press) { if(HandleKeyDown(icode)) { return; } - // FIXME: Should come first - DoButtonPanelKey(icode); } else if(press == KEY_EVENTRELEASE) { // FIXME: combine scancode -> internal keycode of press and release switch(scancode) {