1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Replaced clickReleased with clickPressed where applicable in H3

This commit is contained in:
Ivan Savenko 2023-07-09 17:48:25 +03:00
parent 9449899098
commit 18db944083
18 changed files with 39 additions and 54 deletions

View File

@ -184,7 +184,7 @@ void BattleFieldController::createHeroes()
void BattleFieldController::gesture(bool on, const Point & initialPosition, const Point & finalPosition)
{
if (!on && pos.isInside(finalPosition))
clickReleased(finalPosition);
clickPressed(finalPosition);
}
void BattleFieldController::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
@ -213,7 +213,7 @@ void BattleFieldController::mouseMoved(const Point & cursorPosition, const Point
owner.actionsController->onHoverEnded();
}
void BattleFieldController::clickReleased(const Point & cursorPosition)
void BattleFieldController::clickPressed(const Point & cursorPosition)
{
BattleHex selectedHex = getHoveredHex();

View File

@ -100,7 +100,7 @@ class BattleFieldController : public CIntObject
void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;
void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) override;
void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void activate() override;

View File

@ -122,11 +122,6 @@ void CCommanderArtPlace::clickPressed(const Point & cursorPosition)
LOCPLINT->showYesNoDialog(CGI->generaltexth->translate("vcmi.commanderWindow.artifactMessage"), [this]() { returnArtToHeroCallback(); }, []() {});
}
void CCommanderArtPlace::clickReleased(const Point & cursorPosition)
{
// No-op override
}
void CCommanderArtPlace::showPopupWindow(const Point & cursorPosition)
{
if(ourArt && text.size())
@ -189,11 +184,6 @@ void CHeroArtPlace::clickPressed(const Point & cursorPosition)
leftClickCallback(*this);
}
void CHeroArtPlace::clickReleased(const Point & cursorPosition)
{
// No-op override
}
void CHeroArtPlace::showPopupWindow(const Point & cursorPosition)
{
if(rightClickCallback)

View File

@ -58,7 +58,6 @@ protected:
public:
CCommanderArtPlace(Point position, const CGHeroInstance * commanderOwner, ArtifactPosition artSlot, const CArtifactInstance * Art = nullptr);
void clickPressed(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void setArtifact(const CArtifactInstance * art) override;
};
@ -78,7 +77,6 @@ public:
void selectSlot(bool on);
bool isMarked() const;
void clickPressed(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void showAll(Canvas & to) override;
void setArtifact(const CArtifactInstance * art) override;

View File

@ -50,7 +50,7 @@ CHoverableArea::~CHoverableArea()
{
}
void LRClickableAreaWText::clickReleased(const Point & cursorPosition)
void LRClickableAreaWText::clickPressed(const Point & cursorPosition)
{
if(!text.empty())
LOCPLINT->showInfoDialog(text);
@ -83,7 +83,7 @@ void LRClickableAreaWText::init()
addUsedEvents(LCLICK | SHOW_POPUP | HOVER);
}
void LRClickableAreaWTextComp::clickReleased(const Point & cursorPosition)
void LRClickableAreaWTextComp::clickPressed(const Point & cursorPosition)
{
std::vector<std::shared_ptr<CComponent>> comp(1, createComponent());
LOCPLINT->showInfoDialog(text, comp);
@ -129,7 +129,7 @@ CHeroArea::CHeroArea(int x, int y, const CGHeroInstance * _hero)
portrait = std::make_shared<CAnimImage>("PortraitsLarge", hero->portrait);
}
void CHeroArea::clickReleased(const Point & cursorPosition)
void CHeroArea::clickPressed(const Point & cursorPosition)
{
if(hero)
LOCPLINT->openHeroWindow(hero);
@ -143,7 +143,7 @@ void CHeroArea::hover(bool on)
GH.statusbar()->clear();
}
void LRClickableAreaOpenTown::clickReleased(const Point & cursorPosition)
void LRClickableAreaOpenTown::clickPressed(const Point & cursorPosition)
{
if(town)
{

View File

@ -48,7 +48,7 @@ public:
virtual ~LRClickableAreaWText();
void init();
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
};
@ -135,7 +135,7 @@ class CHeroArea: public CIntObject
public:
CHeroArea(int x, int y, const CGHeroInstance * _hero);
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void hover(bool on) override;
};
@ -146,7 +146,7 @@ public:
int type;
int baseType;
int bonusValue;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
LRClickableAreaWTextComp(const Rect &Pos = Rect(0,0,0,0), int BaseType = -1);
@ -158,7 +158,7 @@ class LRClickableAreaOpenTown: public LRClickableAreaWTextComp
{
public:
const CGTownInstance * town;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
LRClickableAreaOpenTown(const Rect & Pos, const CGTownInstance * Town);
};

View File

@ -446,7 +446,7 @@ void CGStatusBar::show(Canvas & to)
showAll(to);
}
void CGStatusBar::clickReleased(const Point & cursorPosition)
void CGStatusBar::clickPressed(const Point & cursorPosition)
{
if(LOCPLINT && LOCPLINT->cingconsole->isActive())
LOCPLINT->cingconsole->startEnteringText();

View File

@ -138,7 +138,7 @@ class CGStatusBar : public CLabel, public std::enable_shared_from_this<CGStatusB
protected:
Point getBorderSize() override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
public:
~CGStatusBar();

View File

@ -134,7 +134,7 @@ void CBuildingRect::hover(bool on)
}
}
void CBuildingRect::clickReleased(const Point & cursorPosition)
void CBuildingRect::clickPressed(const Point & cursorPosition)
{
if(getBuilding() && area && (parent->selectedBuilding==this))
{
@ -377,7 +377,7 @@ void CHeroGSlot::hover(bool on)
GH.statusbar()->write(temp);
}
void CHeroGSlot::clickReleased(const Point & cursorPosition)
void CHeroGSlot::clickPressed(const Point & cursorPosition)
{
std::shared_ptr<CHeroGSlot> other = upg ? owner->garrisonedHero : owner->visitingHero;
@ -1055,7 +1055,7 @@ void CCreaInfo::hover(bool on)
}
}
void CCreaInfo::clickReleased(const Point & cursorPosition)
void CCreaInfo::clickPressed(const Point & cursorPosition)
{
int offset = LOCPLINT->castleInt? (-87) : 0;
auto recruitCb = [=](CreatureID id, int count)
@ -1374,7 +1374,7 @@ void CHallInterface::CBuildingBox::hover(bool on)
}
}
void CHallInterface::CBuildingBox::clickReleased(const Point & cursorPosition)
void CHallInterface::CBuildingBox::clickPressed(const Point & cursorPosition)
{
GH.windows().createAndPushWindow<CBuildWindow>(town,building,state,0);
}
@ -1734,7 +1734,7 @@ void CFortScreen::RecruitArea::creaturesChangedEventHandler()
}
}
void CFortScreen::RecruitArea::clickReleased(const Point & cursorPosition)
void CFortScreen::RecruitArea::clickPressed(const Point & cursorPosition)
{
LOCPLINT->castleInt->builds->enterDwelling(level);
}

View File

@ -66,7 +66,7 @@ public:
CBuildingRect(CCastleBuildings * Par, const CGTownInstance *Town, const CStructure *Str);
bool operator<(const CBuildingRect & p2) const;
void hover(bool on) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void mouseMoved (const Point & cursorPosition, const Point & lastUpdateDistance) override;
bool receiveEvent(const Point & position, int eventType) const override;
@ -112,7 +112,7 @@ public:
void set(const CGHeroInstance * newHero);
void hover (bool on) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void deactivate() override;
};
@ -192,7 +192,7 @@ public:
void update();
void hover(bool on) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
bool getShowAvailable();
};
@ -274,7 +274,7 @@ class CHallInterface : public CStatusbarWindow
public:
CBuildingBox(int x, int y, const CGTownInstance * Town, const CBuilding * Building);
void hover(bool on) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
};
const CGTownInstance * town;
@ -346,7 +346,7 @@ class CFortScreen : public CStatusbarWindow
void creaturesChangedEventHandler();
void hover(bool on) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
};
std::shared_ptr<CLabel> title;
std::vector<std::shared_ptr<RecruitArea>> recAreas;

View File

@ -85,7 +85,7 @@ CHeroWithMaybePickedArtifact::CHeroWithMaybePickedArtifact(CWindowWithArtifacts
{
}
void CHeroSwitcher::clickReleased(const Point & cursorPosition)
void CHeroSwitcher::clickPressed(const Point & cursorPosition)
{
//TODO: do not recreate window
if (false)

View File

@ -41,7 +41,7 @@ class CHeroSwitcher : public CIntObject
std::shared_ptr<CAnimImage> image;
CHeroWindow * owner;
public:
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
CHeroSwitcher(CHeroWindow * owner_, Point pos_, const CGHeroInstance * hero_);
};

View File

@ -101,7 +101,7 @@ void InfoBox::showPopupWindow(const Point & cursorPosition)
CRClickPopup::createAndPush(text);
}
void InfoBox::clickReleased(const Point & cursorPosition)
void InfoBox::clickPressed(const Point & cursorPosition)
{
std::shared_ptr<CComponent> comp;
std::string text;

View File

@ -74,10 +74,7 @@ public:
~InfoBox();
void showPopupWindow(const Point & cursorPosition) override;
void clickReleased(const Point & cursorPosition) override;
//Update object if data may have changed
//void update();
void clickPressed(const Point & cursorPosition) override;
};
class IInfoBoxData

View File

@ -51,7 +51,7 @@ CSpellWindow::InteractiveArea::InteractiveArea(const Rect & myRect, std::functio
owner = _owner;
}
void CSpellWindow::InteractiveArea::clickReleased(const Point & cursorPosition)
void CSpellWindow::InteractiveArea::clickPressed(const Point & cursorPosition)
{
onLeft();
}
@ -471,7 +471,7 @@ CSpellWindow::SpellArea::SpellArea(Rect pos, CSpellWindow * owner)
CSpellWindow::SpellArea::~SpellArea() = default;
void CSpellWindow::SpellArea::clickReleased(const Point & cursorPosition)
void CSpellWindow::SpellArea::clickPressed(const Point & cursorPosition)
{
if(mySpell)
{

View File

@ -44,7 +44,7 @@ class CSpellWindow : public CWindowObject
~SpellArea();
void setSpell(const CSpell * spell);
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void hover(bool on) override;
};
@ -57,7 +57,7 @@ class CSpellWindow : public CWindowObject
std::string hoverText;
std::string helpText;
public:
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void hover(bool on) override;

View File

@ -551,7 +551,7 @@ void CTavernWindow::show(Canvas & to)
CCS->videoh->update(pos.x+70, pos.y+56, to.getInternalSurface(), true, false);
}
void CTavernWindow::HeroPortrait::clickReleased(const Point & cursorPosition)
void CTavernWindow::HeroPortrait::clickPressed(const Point & cursorPosition)
{
if(h)
*_sel = _id;
@ -1149,7 +1149,7 @@ void CTransformerWindow::CItem::move()
left = !left;
}
void CTransformerWindow::CItem::clickReleased(const Point & cursorPosition)
void CTransformerWindow::CItem::clickPressed(const Point & cursorPosition)
{
move();
parent->redraw();
@ -1254,7 +1254,7 @@ CUniversityWindow::CItem::CItem(CUniversityWindow * _parent, int _ID, int X, int
pos.w = icon->pos.w;
}
void CUniversityWindow::CItem::clickReleased(const Point & cursorPosition)
void CUniversityWindow::CItem::clickPressed(const Point & cursorPosition)
{
if(state() == 2)
GH.windows().createAndPushWindow<CUnivConfirmWindow>(parent, ID, LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) >= 2000);
@ -1785,7 +1785,7 @@ void CObjectListWindow::CItem::select(bool on)
redraw();//???
}
void CObjectListWindow::CItem::clickReleased(const Point & cursorPosition)
void CObjectListWindow::CItem::clickPressed(const Point & cursorPosition)
{
parent->changeSelection(index);
}

View File

@ -161,7 +161,7 @@ class CObjectListWindow : public CWindowObject
CItem(CObjectListWindow * parent, size_t id, std::string text);
void select(bool on);
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void clickDouble(const Point & cursorPosition) override;
};
@ -205,7 +205,7 @@ public:
std::string description; // "XXX is a level Y ZZZ with N artifacts"
const CGHeroInstance * h;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void hover (bool on) override;
HeroPortrait(int & sel, int id, int x, int y, const CGHeroInstance * H);
@ -376,7 +376,7 @@ class CTransformerWindow : public CStatusbarWindow, public CGarrisonHolder
std::shared_ptr<CLabel> count;
void move();
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void update();
CItem(CTransformerWindow * parent, int size, int id);
};
@ -417,7 +417,7 @@ class CUniversityWindow : public CStatusbarWindow
CUniversityWindow * parent;
void showAll(Canvas & to) override;
void clickReleased(const Point & cursorPosition) override;
void clickPressed(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;
void hover(bool on) override;
int state();//0=can't learn, 1=learned, 2=can learn