Browse Source

renamed keyDown -> keyPressed

Ivan Savenko 2 years ago
parent
commit
cfcaf5cbb6

+ 1 - 1
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;

+ 1 - 1
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();

+ 1 - 1
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
 

+ 1 - 1
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;

+ 1 - 1
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)
 	{

+ 1 - 1
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;

+ 1 - 1
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);
 			}

+ 1 - 1
client/gui/CIntObject.cpp

@@ -342,7 +342,7 @@ CKeyShortcut::CKeyShortcut(std::set<int> 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)))

+ 2 - 2
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<int> Keys);
-	void keyDown(const SDL_Keycode & key) override;
+	void keyPressed(const SDL_Keycode & key) override;
 	void keyReleased(const SDL_Keycode & key) override;
 
 };

+ 2 - 2
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)

+ 1 - 1
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);
 };
 

+ 1 - 1
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)

+ 1 - 1
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;
 

+ 1 - 1
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)

+ 1 - 1
client/widgets/Buttons.h

@@ -270,7 +270,7 @@ public:
 
 	void addCallback(std::function<void(int)> 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;

+ 1 - 1
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;

+ 1 - 1
client/widgets/TextControls.h

@@ -225,7 +225,7 @@ public:
 	CTextInput(const Rect & Pos, std::shared_ptr<IImage> 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;
 

+ 1 - 1
client/windows/CCastleInterface.cpp

@@ -1255,7 +1255,7 @@ void CCastleInterface::recreateIcons()
 		creainfo.push_back(std::make_shared<CCreaInfo>(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)
 	{

+ 1 - 1
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);

+ 1 - 1
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)
 	{

+ 1 - 1
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;
 };

+ 1 - 1
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<int>(selected);
 

+ 1 - 1
client/windows/GUIClasses.h

@@ -195,7 +195,7 @@ public:
 	std::shared_ptr<CIntObject> 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