From cfcaf5cbb69b329c45812cfa858ba4f527100050 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 2 Feb 2023 18:42:44 +0200 Subject: [PATCH] renamed keyDown -> keyPressed --- client/adventureMap/CAdvMapInt.cpp | 2 +- client/adventureMap/CAdvMapInt.h | 2 +- client/adventureMap/CInGameConsole.cpp | 2 +- client/adventureMap/CInGameConsole.h | 2 +- client/battle/BattleWindow.cpp | 2 +- client/battle/BattleWindow.h | 2 +- client/gui/CGuiHandler.cpp | 2 +- client/gui/CIntObject.cpp | 2 +- client/gui/CIntObject.h | 4 ++-- client/lobby/CSelectionBase.cpp | 4 ++-- client/lobby/CSelectionBase.h | 2 +- client/lobby/SelectionTab.cpp | 2 +- client/lobby/SelectionTab.h | 2 +- client/widgets/Buttons.cpp | 2 +- client/widgets/Buttons.h | 2 +- client/widgets/TextControls.cpp | 2 +- client/widgets/TextControls.h | 2 +- client/windows/CCastleInterface.cpp | 2 +- client/windows/CCastleInterface.h | 2 +- client/windows/CSpellWindow.cpp | 2 +- client/windows/CSpellWindow.h | 2 +- client/windows/GUIClasses.cpp | 2 +- client/windows/GUIClasses.h | 2 +- 23 files changed, 25 insertions(+), 25 deletions(-) diff --git a/client/adventureMap/CAdvMapInt.cpp b/client/adventureMap/CAdvMapInt.cpp index db776f95e..7ca493dff 100644 --- a/client/adventureMap/CAdvMapInt.cpp +++ b/client/adventureMap/CAdvMapInt.cpp @@ -739,7 +739,7 @@ void CAdvMapInt::keyReleased(const SDL_Keycode &key) } } -void CAdvMapInt::keyDown(const SDL_Keycode & key) +void CAdvMapInt::keyPressed(const SDL_Keycode & key) { if (mode == EAdvMapMode::WORLD_VIEW) return; diff --git a/client/adventureMap/CAdvMapInt.h b/client/adventureMap/CAdvMapInt.h index d5e60f6a3..d4ebbb5d6 100644 --- a/client/adventureMap/CAdvMapInt.h +++ b/client/adventureMap/CAdvMapInt.h @@ -160,7 +160,7 @@ public: void centerOn(const CGObjectInstance *obj, bool fade = false); int3 verifyPos(int3 ver); void handleRightClick(std::string text, tribool down); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void keyReleased(const SDL_Keycode & key) override; void mouseMoved (const Point & cursorPosition) override; bool isActive(); diff --git a/client/adventureMap/CInGameConsole.cpp b/client/adventureMap/CInGameConsole.cpp index 2a5a2d92f..1f98ace1c 100644 --- a/client/adventureMap/CInGameConsole.cpp +++ b/client/adventureMap/CInGameConsole.cpp @@ -91,7 +91,7 @@ void CInGameConsole::print(const std::string &txt) } } -void CInGameConsole::keyDown (const SDL_Keycode & key) +void CInGameConsole::keyPressed (const SDL_Keycode & key) { if(!captureAllKeys && key != SDLK_TAB) return; //because user is not entering any text diff --git a/client/adventureMap/CInGameConsole.h b/client/adventureMap/CInGameConsole.h index e3e0ac099..c6c9f0802 100644 --- a/client/adventureMap/CInGameConsole.h +++ b/client/adventureMap/CInGameConsole.h @@ -26,7 +26,7 @@ public: std::string enteredText; void show(SDL_Surface * to) override; void print(const std::string &txt); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void textInputed(const SDL_TextInputEvent & event) override; void textEdited(const SDL_TextEditingEvent & event) override; diff --git a/client/battle/BattleWindow.cpp b/client/battle/BattleWindow.cpp index bc2d4d3d4..6fff81a2b 100644 --- a/client/battle/BattleWindow.cpp +++ b/client/battle/BattleWindow.cpp @@ -164,7 +164,7 @@ void BattleWindow::deactivate() LOCPLINT->cingconsole->deactivate(); } -void BattleWindow::keyDown(const SDL_Keycode & key) +void BattleWindow::keyPressed(const SDL_Keycode & key) { if(key == SDLK_q) { diff --git a/client/battle/BattleWindow.h b/client/battle/BattleWindow.h index afb87bc5e..702684104 100644 --- a/client/battle/BattleWindow.h +++ b/client/battle/BattleWindow.h @@ -79,7 +79,7 @@ public: void activate() override; void deactivate() override; - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void clickRight(tribool down, bool previousState) override; void show(SDL_Surface *to) override; void showAll(SDL_Surface *to) override; diff --git a/client/gui/CGuiHandler.cpp b/client/gui/CGuiHandler.cpp index 77b1f1224..48282d6b0 100644 --- a/client/gui/CGuiHandler.cpp +++ b/client/gui/CGuiHandler.cpp @@ -415,7 +415,7 @@ void CGuiHandler::handleCurrentEvent( SDL_Event & current ) if(vstd::contains(keyinterested,*i) && (!keysCaptured || (*i)->captureThisKey(key.keysym.sym))) { if (key.state == SDL_PRESSED) - (**i).keyDown(key.keysym.sym); + (**i).keyPressed(key.keysym.sym); if (key.state == SDL_RELEASED) (**i).keyReleased(key.keysym.sym); } diff --git a/client/gui/CIntObject.cpp b/client/gui/CIntObject.cpp index a87d93b27..1ad61a130 100644 --- a/client/gui/CIntObject.cpp +++ b/client/gui/CIntObject.cpp @@ -342,7 +342,7 @@ CKeyShortcut::CKeyShortcut(std::set Keys) :assignedKeys(Keys) {} -void CKeyShortcut::keyDown(const SDL_Keycode & key) +void CKeyShortcut::keyPressed(const SDL_Keycode & key) { if(vstd::contains(assignedKeys,key) || vstd::contains(assignedKeys, CGuiHandler::numToDigit(key))) diff --git a/client/gui/CIntObject.h b/client/gui/CIntObject.h index d3ecf10ad..ea9589f4e 100644 --- a/client/gui/CIntObject.h +++ b/client/gui/CIntObject.h @@ -119,7 +119,7 @@ public: //keyboard handling bool captureAllKeys; //if true, only this object should get info about pressed keys - virtual void keyDown(const SDL_Keycode & key){} + virtual void keyPressed(const SDL_Keycode & key){} virtual void keyReleased(const SDL_Keycode & key){} virtual bool captureThisKey(const SDL_Keycode & key); //allows refining captureAllKeys against specific events (eg. don't capture ENTER) @@ -203,7 +203,7 @@ public: CKeyShortcut(); CKeyShortcut(int key); CKeyShortcut(std::set Keys); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void keyReleased(const SDL_Keycode & key) override; }; diff --git a/client/lobby/CSelectionBase.cpp b/client/lobby/CSelectionBase.cpp index 534ff98fb..0e561b6e6 100644 --- a/client/lobby/CSelectionBase.cpp +++ b/client/lobby/CSelectionBase.cpp @@ -318,7 +318,7 @@ CChatBox::CChatBox(const Rect & rect) chatHistory->label->color = Colors::GREEN; } -void CChatBox::keyDown(const SDL_Keycode & key) +void CChatBox::keyPressed(const SDL_Keycode & key) { if(key == SDLK_RETURN && inputBox->getText().size()) { @@ -326,7 +326,7 @@ void CChatBox::keyDown(const SDL_Keycode & key) inputBox->setText(""); } else - inputBox->keyDown(key); + inputBox->keyPressed(key); } void CChatBox::addNewMessage(const std::string & text) diff --git a/client/lobby/CSelectionBase.h b/client/lobby/CSelectionBase.h index fe2fa27fc..fb219570e 100644 --- a/client/lobby/CSelectionBase.h +++ b/client/lobby/CSelectionBase.h @@ -120,7 +120,7 @@ public: CChatBox(const Rect & rect); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void addNewMessage(const std::string & text); }; diff --git a/client/lobby/SelectionTab.cpp b/client/lobby/SelectionTab.cpp index 97bc1982d..32119c073 100644 --- a/client/lobby/SelectionTab.cpp +++ b/client/lobby/SelectionTab.cpp @@ -278,7 +278,7 @@ void SelectionTab::clickLeft(tribool down, bool previousState) } } -void SelectionTab::keyDown(const SDL_Keycode & key) +void SelectionTab::keyPressed(const SDL_Keycode & key) { int moveBy = 0; switch(key) diff --git a/client/lobby/SelectionTab.h b/client/lobby/SelectionTab.h index 67ee916ec..d785a9a9e 100644 --- a/client/lobby/SelectionTab.h +++ b/client/lobby/SelectionTab.h @@ -66,7 +66,7 @@ public: void toggleMode(); void clickLeft(tribool down, bool previousState) override; - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void onDoubleClick() override; diff --git a/client/widgets/Buttons.cpp b/client/widgets/Buttons.cpp index a8724fa33..af3159cb1 100644 --- a/client/widgets/Buttons.cpp +++ b/client/widgets/Buttons.cpp @@ -778,7 +778,7 @@ void CSlider::wheelScrolled(bool down, bool in) moveTo(value + 3 * (down ? +scrollStep : -scrollStep)); } -void CSlider::keyDown(const SDL_Keycode & key) +void CSlider::keyPressed(const SDL_Keycode & key) { int moveDest = value; switch(key) diff --git a/client/widgets/Buttons.h b/client/widgets/Buttons.h index 2efcd4981..34ce8161f 100644 --- a/client/widgets/Buttons.h +++ b/client/widgets/Buttons.h @@ -270,7 +270,7 @@ public: void addCallback(std::function callback); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void wheelScrolled(bool down, bool in) override; void clickLeft(tribool down, bool previousState) override; void mouseMoved (const Point & cursorPosition) override; diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index f7a0b8e45..1defe586f 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -549,7 +549,7 @@ void CTextInput::clickLeft(tribool down, bool previousState) giveFocus(); } -void CTextInput::keyDown(const SDL_Keycode & key) +void CTextInput::keyPressed(const SDL_Keycode & key) { if(!focus) return; diff --git a/client/widgets/TextControls.h b/client/widgets/TextControls.h index 680fa6d3c..405c350be 100644 --- a/client/widgets/TextControls.h +++ b/client/widgets/TextControls.h @@ -225,7 +225,7 @@ public: CTextInput(const Rect & Pos, std::shared_ptr srf); void clickLeft(tribool down, bool previousState) override; - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; bool captureThisKey(const SDL_Keycode & key) override; diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 4ed00b01f..7a6cd0fef 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -1255,7 +1255,7 @@ void CCastleInterface::recreateIcons() creainfo.push_back(std::make_shared(Point(14+55*(int)i, 507), town, (int)i+4)); } -void CCastleInterface::keyDown(const SDL_Keycode & key) +void CCastleInterface::keyPressed(const SDL_Keycode & key) { switch(key) { diff --git a/client/windows/CCastleInterface.h b/client/windows/CCastleInterface.h index 667be94e7..910ba4d6d 100644 --- a/client/windows/CCastleInterface.h +++ b/client/windows/CCastleInterface.h @@ -245,7 +245,7 @@ public: void castleTeleport(int where); void townChange(); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void close(); void addBuilding(BuildingID bid); diff --git a/client/windows/CSpellWindow.cpp b/client/windows/CSpellWindow.cpp index fdaf94498..55e13af05 100644 --- a/client/windows/CSpellWindow.cpp +++ b/client/windows/CSpellWindow.cpp @@ -420,7 +420,7 @@ void CSpellWindow::turnPageRight() CCS->videoh->openAndPlayVideo("PGTRNRGH.SMK", pos.x+13, pos.y+15); } -void CSpellWindow::keyDown(const SDL_Keycode & key) +void CSpellWindow::keyPressed(const SDL_Keycode & key) { if(key == SDLK_ESCAPE || key == SDLK_RETURN) { diff --git a/client/windows/CSpellWindow.h b/client/windows/CSpellWindow.h index d2eee99b8..51f93caee 100644 --- a/client/windows/CSpellWindow.h +++ b/client/windows/CSpellWindow.h @@ -112,7 +112,7 @@ public: void selectSchool(int school); //schools: 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic, 4 - all schools int pagesWithinCurrentTab(); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; void show(SDL_Surface * to) override; }; diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index a21464559..46b6332be 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -2170,7 +2170,7 @@ void CObjectListWindow::changeSelection(size_t which) selected = which; } -void CObjectListWindow::keyDown (const SDL_Keycode & key) +void CObjectListWindow::keyPressed (const SDL_Keycode & key) { int sel = static_cast(selected); diff --git a/client/windows/GUIClasses.h b/client/windows/GUIClasses.h index 17ed2542d..9e46652c0 100644 --- a/client/windows/GUIClasses.h +++ b/client/windows/GUIClasses.h @@ -195,7 +195,7 @@ public: std::shared_ptr genItem(size_t index); void elementSelected();//call callback and close this window void changeSelection(size_t which); - void keyDown(const SDL_Keycode & key) override; + void keyPressed(const SDL_Keycode & key) override; }; class CSystemOptionsWindow : public CWindowObject