From 29e53093ba4e9e815d2161e6a8d0814f7f408f2c Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Wed, 4 Oct 2017 18:33:24 -0230 Subject: [PATCH] Various UI classes now have their commands prefixed by class name. --- src/cheat/CheatCodeDialog.cxx | 4 ++-- src/debugger/gui/BoosterWidget.cxx | 23 +++++++++++++++-------- src/debugger/gui/DataGridWidget.cxx | 4 ++-- src/debugger/gui/GenesisWidget.cxx | 22 ++++++++++++++-------- src/debugger/gui/JoystickWidget.cxx | 19 ++++++++++++------- src/debugger/gui/KeyboardWidget.cxx | 5 +++-- src/debugger/gui/PromptWidget.cxx | 2 +- src/debugger/gui/RamWidget.cxx | 2 +- src/debugger/gui/RiotWidget.cxx | 16 ++++++++-------- src/debugger/gui/RomListWidget.cxx | 7 ++++--- src/debugger/gui/TiaWidget.cxx | 22 +++++++++++----------- src/debugger/gui/ToggleWidget.cxx | 2 +- src/gui/AboutDialog.cxx | 10 +++++----- src/gui/AudioDialog.cxx | 6 +++--- src/gui/BrowserDialog.cxx | 4 ++-- src/gui/CheckListWidget.cxx | 7 ++++--- src/gui/CheckListWidget.hxx | 2 +- src/gui/ComboDialog.cxx | 6 +++--- src/gui/ConfigPathDialog.cxx | 6 +++--- src/gui/Dialog.cxx | 12 ++++++------ src/gui/GameInfoDialog.cxx | 8 ++++---- src/gui/GlobalPropsDialog.cxx | 6 +++--- src/gui/GuiObject.hxx | 25 +++++++++++-------------- src/gui/HelpDialog.cxx | 10 +++++----- src/gui/InputDialog.cxx | 10 +++++----- src/gui/InputTextDialog.cxx | 4 ++-- src/gui/JoystickDialog.cxx | 4 ++-- src/gui/LauncherFilterDialog.cxx | 6 +++--- src/gui/ListWidget.cxx | 2 +- src/gui/ListWidget.hxx | 2 +- src/gui/LoggerDialog.cxx | 7 ++++--- src/gui/MessageBox.cxx | 2 +- src/gui/RomAuditDialog.cxx | 2 +- src/gui/ScrollBarWidget.cxx | 2 +- src/gui/SnapshotDialog.cxx | 6 +++--- src/gui/TabWidget.cxx | 4 ++-- src/gui/TabWidget.hxx | 5 +++++ src/gui/UIDialog.cxx | 6 +++--- src/gui/VideoDialog.cxx | 8 ++++---- src/gui/Widget.hxx | 3 ++- 40 files changed, 164 insertions(+), 139 deletions(-) diff --git a/src/cheat/CheatCodeDialog.cxx b/src/cheat/CheatCodeDialog.cxx index 71382b061..b94fbe5ce 100644 --- a/src/cheat/CheatCodeDialog.cxx +++ b/src/cheat/CheatCodeDialog.cxx @@ -196,12 +196,12 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kCloseCmd: + case GuiObject::kCloseCmd: close(); break; diff --git a/src/debugger/gui/BoosterWidget.cxx b/src/debugger/gui/BoosterWidget.cxx index fd2aec940..d1a3640c3 100644 --- a/src/debugger/gui/BoosterWidget.cxx +++ b/src/debugger/gui/BoosterWidget.cxx @@ -33,39 +33,46 @@ BoosterWidget::BoosterWidget(GuiObject* boss, const GUI::Font& font, t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, label, kTextAlignLeft); xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10; - myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJUp]->setID(kJUp); myPins[kJUp]->setTarget(this); ypos += myPins[kJUp]->getHeight() * 2 + 10; - myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJDown]->setID(kJDown); myPins[kJDown]->setTarget(this); xpos -= myPins[kJUp]->getWidth() + 5; ypos -= myPins[kJUp]->getHeight() + 5; - myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJLeft]->setID(kJLeft); myPins[kJLeft]->setTarget(this); xpos += (myPins[kJUp]->getWidth() + 5) * 2; - myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJRight]->setID(kJRight); myPins[kJRight]->setTarget(this); xpos -= (myPins[kJUp]->getWidth() + 5) * 2; ypos = 20 + (myPins[kJUp]->getHeight() + 10) * 3; - myPins[kJFire] = new CheckboxWidget(boss, font, xpos, ypos, "Fire", kCheckActionCmd); + myPins[kJFire] = new CheckboxWidget(boss, font, xpos, ypos, "Fire", + CheckboxWidget::kCheckActionCmd); myPins[kJFire]->setID(kJFire); myPins[kJFire]->setTarget(this); ypos += myPins[kJFire]->getHeight() + 5; - myPins[kJBooster] = new CheckboxWidget(boss, font, xpos, ypos, "Booster", kCheckActionCmd); + myPins[kJBooster] = new CheckboxWidget(boss, font, xpos, ypos, "Booster", + CheckboxWidget::kCheckActionCmd); myPins[kJBooster]->setID(kJBooster); myPins[kJBooster]->setTarget(this); ypos += myPins[kJBooster]->getHeight() + 5; - myPins[kJTrigger] = new CheckboxWidget(boss, font, xpos, ypos, "Trigger", kCheckActionCmd); + myPins[kJTrigger] = new CheckboxWidget(boss, font, xpos, ypos, "Trigger", + CheckboxWidget::kCheckActionCmd); myPins[kJTrigger]->setID(kJTrigger); myPins[kJTrigger]->setTarget(this); } @@ -89,7 +96,7 @@ void BoosterWidget::loadConfig() void BoosterWidget::handleCommand( CommandSender* sender, int cmd, int data, int id) { - if(cmd == kCheckActionCmd) + if(cmd == CheckboxWidget::kCheckActionCmd) { switch(id) { diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index bcf0bb6f6..568fea2a8 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -540,9 +540,9 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: // Chain access; pass to parent - sendCommand(kSetPositionCmd, data, _id); + sendCommand(GuiObject::kSetPositionCmd, data, _id); break; case kDGZeroCmd: diff --git a/src/debugger/gui/GenesisWidget.cxx b/src/debugger/gui/GenesisWidget.cxx index 5cfb6e435..86554777d 100644 --- a/src/debugger/gui/GenesisWidget.cxx +++ b/src/debugger/gui/GenesisWidget.cxx @@ -24,7 +24,7 @@ GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font, int x, int y, Controller& controller) : ControllerWidget(boss, font, x, y, controller) { - const string& label = getHeader(); + const string& label = getHeader(); const int fontHeight = font.getFontHeight(); int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)"); @@ -33,34 +33,40 @@ GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font, t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, label, kTextAlignLeft); xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 20; - myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJUp]->setID(kJUp); myPins[kJUp]->setTarget(this); ypos += myPins[kJUp]->getHeight() * 2 + 10; - myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJDown]->setID(kJDown); myPins[kJDown]->setTarget(this); xpos -= myPins[kJUp]->getWidth() + 5; ypos -= myPins[kJUp]->getHeight() + 5; - myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJLeft]->setID(kJLeft); myPins[kJLeft]->setTarget(this); xpos += (myPins[kJUp]->getWidth() + 5) * 2; - myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJRight]->setID(kJRight); myPins[kJRight]->setTarget(this); xpos -= (myPins[kJUp]->getWidth() + 5) * 2; ypos = 30 + (myPins[kJUp]->getHeight() + 10) * 3; - myPins[kJBbtn] = new CheckboxWidget(boss, font, xpos, ypos, "B button", kCheckActionCmd); + myPins[kJBbtn] = new CheckboxWidget(boss, font, xpos, ypos, "B button", + CheckboxWidget::kCheckActionCmd); myPins[kJBbtn]->setID(kJBbtn); myPins[kJBbtn]->setTarget(this); ypos += myPins[kJBbtn]->getHeight() + 5; - myPins[kJCbtn] = new CheckboxWidget(boss, font, xpos, ypos, "C button", kCheckActionCmd); + myPins[kJCbtn] = new CheckboxWidget(boss, font, xpos, ypos, "C button", + CheckboxWidget::kCheckActionCmd); myPins[kJCbtn]->setID(kJCbtn); myPins[kJCbtn]->setTarget(this); } @@ -82,7 +88,7 @@ void GenesisWidget::loadConfig() void GenesisWidget::handleCommand( CommandSender* sender, int cmd, int data, int id) { - if(cmd == kCheckActionCmd) + if(cmd == CheckboxWidget::kCheckActionCmd) { switch(id) { diff --git a/src/debugger/gui/JoystickWidget.cxx b/src/debugger/gui/JoystickWidget.cxx index 97a1929ab..7b480b2c3 100644 --- a/src/debugger/gui/JoystickWidget.cxx +++ b/src/debugger/gui/JoystickWidget.cxx @@ -24,7 +24,7 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font, int x, int y, Controller& controller) : ControllerWidget(boss, font, x, y, controller) { - const string& label = getHeader(); + const string& label = getHeader(); const int fontHeight = font.getFontHeight(); int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)"); StaticTextWidget* t; @@ -32,29 +32,34 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font, t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, label, kTextAlignLeft); xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 20; - myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJUp]->setID(kJUp); myPins[kJUp]->setTarget(this); ypos += myPins[kJUp]->getHeight() * 2 + 10; - myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJDown] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJDown]->setID(kJDown); myPins[kJDown]->setTarget(this); xpos -= myPins[kJUp]->getWidth() + 5; ypos -= myPins[kJUp]->getHeight() + 5; - myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJLeft] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJLeft]->setID(kJLeft); myPins[kJLeft]->setTarget(this); xpos += (myPins[kJUp]->getWidth() + 5) * 2; - myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myPins[kJRight] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myPins[kJRight]->setID(kJRight); myPins[kJRight]->setTarget(this); xpos -= (myPins[kJUp]->getWidth() + 5) * 2; ypos = 30 + (myPins[kJUp]->getHeight() + 10) * 3; - myPins[kJFire] = new CheckboxWidget(boss, font, xpos, ypos, "Fire", kCheckActionCmd); + myPins[kJFire] = new CheckboxWidget(boss, font, xpos, ypos, "Fire", + CheckboxWidget::kCheckActionCmd); myPins[kJFire]->setID(kJFire); myPins[kJFire]->setTarget(this); } @@ -73,7 +78,7 @@ void JoystickWidget::loadConfig() void JoystickWidget::handleCommand( CommandSender* sender, int cmd, int data, int id) { - if(cmd == kCheckActionCmd) + if(cmd == CheckboxWidget::kCheckActionCmd) myController.set(ourPinNo[id], !myPins[id]->getState()); } diff --git a/src/debugger/gui/KeyboardWidget.cxx b/src/debugger/gui/KeyboardWidget.cxx index e38af14bd..0d790aa0e 100644 --- a/src/debugger/gui/KeyboardWidget.cxx +++ b/src/debugger/gui/KeyboardWidget.cxx @@ -38,7 +38,8 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font, for(int i = 0; i < 12; ++i) { - myBox[i] = new CheckboxWidget(boss, font, xpos, ypos, "", kCheckActionCmd); + myBox[i] = new CheckboxWidget(boss, font, xpos, ypos, "", + CheckboxWidget::kCheckActionCmd); myBox[i]->setID(i); myBox[i]->setTarget(this); xpos += myBox[i]->getWidth() + 5; @@ -63,7 +64,7 @@ void KeyboardWidget::loadConfig() void KeyboardWidget::handleCommand( CommandSender* sender, int cmd, int data, int id) { - if(cmd == kCheckActionCmd) + if(cmd == CheckboxWidget::kCheckActionCmd) instance().eventHandler().handleEvent(myEvent[id], myBox[id]->getState()); } diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 66b6b9a92..65105d19a 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -475,7 +475,7 @@ void PromptWidget::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: int newPos = int(data) + _linesPerPage - 1 + _firstLineInBuffer; if (newPos != _scrollLine) { diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 4dd6d4b66..84b4c38a6 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -257,7 +257,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; } - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: myCurrentRamBank = data; showSearchResults(); fillGrid(false); diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index d9424c6d4..9b8b656c8 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -202,13 +202,13 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, // Select and Reset xpos += myP0Diff->getWidth() + 20; ypos = col2_ypos + lineHeight; mySelect = new CheckboxWidget(boss, lfont, xpos, ypos, "Select", - kCheckActionCmd); + CheckboxWidget::kCheckActionCmd); mySelect->setID(kSelectID); mySelect->setTarget(this); addFocusWidget(mySelect); ypos += mySelect->getHeight() + 5; myReset = new CheckboxWidget(boss, lfont, xpos, ypos, "Reset", - kCheckActionCmd); + CheckboxWidget::kCheckActionCmd); myReset->setID(kResetID); myReset->setTarget(this); addFocusWidget(myReset); @@ -222,7 +222,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, // Randomize RAM xpos += 30; ypos += lineHeight + 4; myRandomizeRAM = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Randomize zero-page and extended RAM", kCheckActionCmd); + "Randomize zero-page and extended RAM", CheckboxWidget::kCheckActionCmd); myRandomizeRAM->setID(kRandRAMID); myRandomizeRAM->setTarget(this); addFocusWidget(myRandomizeRAM); @@ -237,7 +237,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, for(int i = 0; i < 5; ++i) { myRandomizeCPU[i] = new CheckboxWidget(boss, lfont, xpos, ypos+1, - cpuregs[i], kCheckActionCmd); + cpuregs[i], CheckboxWidget::kCheckActionCmd); myRandomizeCPU[i]->setID(kRandCPUID); myRandomizeCPU[i]->setTarget(this); addFocusWidget(myRandomizeCPU[i]); @@ -415,7 +415,7 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } break; - case kCheckActionCmd: + case CheckboxWidget::kCheckActionCmd: switch(id) { case kSelectID: @@ -453,9 +453,9 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& { switch(controller.type()) { - case Controller::AmigaMouse: + case Controller::AmigaMouse: return new AmigaMouseWidget(boss, font, x, y, controller); - case Controller::AtariMouse: + case Controller::AtariMouse: return new AtariMouseWidget(boss, font, x, y, controller); case Controller::AtariVox: return new AtariVoxWidget(boss, font, x, y, controller); @@ -475,7 +475,7 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& return new PaddleWidget(boss, font, x, y, controller); case Controller::SaveKey: return new SaveKeyWidget(boss, font, x, y, controller); - case Controller::TrakBall: + case Controller::TrakBall: return new TrakBallWidget(boss, font, x, y, controller); default: return new NullControlWidget(boss, font, x, y, controller); diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index a2fe75564..19e30b4dd 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -80,7 +80,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, CheckboxWidget* t = nullptr; for(int i = 0; i < _rows; ++i) { - t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "", kCheckActionCmd); + t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "", + CheckboxWidget::kCheckActionCmd); t->setTarget(this); t->setID(i); t->setFill(CheckboxWidget::Circle); @@ -414,14 +415,14 @@ void RomListWidget::handleCommand(CommandSender* sender, int cmd, int data, int { switch (cmd) { - case kCheckActionCmd: + case CheckboxWidget::kCheckActionCmd: // We let the parent class handle this // Pass it as a kRLBreakpointChangedCmd command, since that's the intent sendCommand(RomListWidget::kBPointChangedCmd, _currentPos+id, myCheckList[id]->getState()); break; - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: if (_currentPos != data) { _currentPos = data; diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index aac78501a..d6ef0c074 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -202,7 +202,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // P0 reflect xpos += myHMP0->getWidth() + 15; myRefP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Reflect", kCheckActionCmd); + "Reflect", CheckboxWidget::kCheckActionCmd); myRefP0->setTarget(this); myRefP0->setID(kRefP0ID); addFocusWidget(myRefP0); @@ -226,7 +226,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // P0 delay xpos += myGRP0Old->getWidth() + 12; myDelP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "VDel", kCheckActionCmd); + "VDel", CheckboxWidget::kCheckActionCmd); myDelP0->setTarget(this); myDelP0->setID(kDelP0ID); addFocusWidget(myDelP0); @@ -287,7 +287,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // P1 reflect xpos += myHMP1->getWidth() + 15; myRefP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Reflect", kCheckActionCmd); + "Reflect", CheckboxWidget::kCheckActionCmd); myRefP1->setTarget(this); myRefP1->setID(kRefP1ID); addFocusWidget(myRefP1); @@ -310,7 +310,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // P1 delay xpos += myGRP1Old->getWidth() + 12; myDelP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "VDel", kCheckActionCmd); + "VDel", CheckboxWidget::kCheckActionCmd); myDelP1->setTarget(this); myDelP1->setID(kDelP1ID); addFocusWidget(myDelP1); @@ -382,7 +382,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // M0 reset to player 0 xpos += myNusizM0->getWidth() + 15; myResMP0 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Reset to P0", kCheckActionCmd); + "Reset to P0", CheckboxWidget::kCheckActionCmd); myResMP0->setTarget(this); myResMP0->setID(kResMP0ID); addFocusWidget(myResMP0); @@ -445,7 +445,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // M1 reset to player 0 xpos += myNusizM1->getWidth() + 15; myResMP1 = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Reset to P1", kCheckActionCmd); + "Reset to P1", CheckboxWidget::kCheckActionCmd); myResMP1->setTarget(this); myResMP1->setID(kResMP1ID); addFocusWidget(myResMP1); @@ -523,7 +523,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // Ball delay xpos += myEnaBLOld->getWidth() + 12; myDelBL = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "VDel", kCheckActionCmd); + "VDel", CheckboxWidget::kCheckActionCmd); myDelBL->setTarget(this); myDelBL->setID(kDelBLID); addFocusWidget(myDelBL); @@ -590,21 +590,21 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // PF reflect, score, priority xpos = 10 + 4*fontWidth; ypos += lineHeight + 6; myRefPF = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Reflect", kCheckActionCmd); + "Reflect", CheckboxWidget::kCheckActionCmd); myRefPF->setTarget(this); myRefPF->setID(kRefPFID); addFocusWidget(myRefPF); xpos += myRefPF->getWidth() + 15; myScorePF = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Score", kCheckActionCmd); + "Score", CheckboxWidget::kCheckActionCmd); myScorePF->setTarget(this); myScorePF->setID(kScorePFID); addFocusWidget(myScorePF); xpos += myScorePF->getWidth() + 15; myPriorityPF = new CheckboxWidget(boss, lfont, xpos, ypos+1, - "Priority", kCheckActionCmd); + "Priority", CheckboxWidget::kCheckActionCmd); myPriorityPF->setTarget(this); myPriorityPF->setID(kPriorityPFID); addFocusWidget(myPriorityPF); @@ -833,7 +833,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } break; - case kCheckActionCmd: + case CheckboxWidget::kCheckActionCmd: switch(id) { case kRefP0ID: diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index 82fcb23b6..f4777e590 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -202,7 +202,7 @@ void ToggleWidget::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: if (_selectedItem != data) { _selectedItem = data; diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx index 61080951c..e404c2c47 100644 --- a/src/gui/AboutDialog.cxx +++ b/src/gui/AboutDialog.cxx @@ -46,20 +46,20 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent, xpos = 10; ypos = _h - buttonHeight - 10; myPrevButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Previous", kPrevCmd); + "Previous", GuiObject::kPrevCmd); myPrevButton->clearFlags(WIDGET_ENABLED); wid.push_back(myPrevButton); xpos += buttonWidth + 7; myNextButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Next", kNextCmd); + "Next", GuiObject::kNextCmd); wid.push_back(myNextButton); xpos = _w - buttonWidth - 10; ButtonWidget* b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Close", kCloseCmd); + "Close", GuiObject::kCloseCmd); wid.push_back(b); addOKWidget(b); addCancelWidget(b); @@ -229,7 +229,7 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id { switch(cmd) { - case kNextCmd: + case GuiObject::kNextCmd: myPage++; if(myPage >= myNumPages) myNextButton->clearFlags(WIDGET_ENABLED); @@ -239,7 +239,7 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id displayInfo(); break; - case kPrevCmd: + case GuiObject::kPrevCmd: myPage--; if(myPage <= myNumPages) myNextButton->setFlags(WIDGET_ENABLED); diff --git a/src/gui/AudioDialog.cxx b/src/gui/AudioDialog.cxx index 475846fed..7091fba10 100644 --- a/src/gui/AudioDialog.cxx +++ b/src/gui/AudioDialog.cxx @@ -109,7 +109,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent, // Add Defaults, OK and Cancel buttons ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -193,12 +193,12 @@ void AudioDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index 2ad9fd396..b43565285 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -98,12 +98,12 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font, addFocusWidget(b); addOKWidget(b); b = new ButtonWidget(this, font, _w - (buttonWidth + 10), _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Cancel", kCloseCmd); + buttonWidth, buttonHeight, "Cancel", GuiObject::kCloseCmd); addFocusWidget(b); addCancelWidget(b); #else b = new ButtonWidget(this, font, _w - 2 * (buttonWidth + 7), _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Cancel", kCloseCmd); + buttonWidth, buttonHeight, "Cancel", GuiObject::kCloseCmd); addFocusWidget(b); addCancelWidget(b); b = new ButtonWidget(this, font, _w - (buttonWidth + 10), _h - buttonHeight - 10, diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 0cce5416c..982f8a825 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -34,7 +34,8 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font, CheckboxWidget* t = nullptr; for(int i = 0; i < _rows; ++i) { - t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd); + t = new CheckboxWidget(boss, font, _x + 2, ypos, "", + CheckboxWidget::kCheckActionCmd); t->setTextColor(kTextColor); t->setTarget(this); t->setID(i); @@ -171,14 +172,14 @@ void CheckListWidget::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kCheckActionCmd: + case CheckboxWidget::kCheckActionCmd: { // Figure out which line has been checked int line = _currentPos + id; _stateList[line] = bool(data); // Let the boss know about it - sendCommand(kListItemChecked, line, _id); + sendCommand(CheckListWidget::kListItemChecked, line, _id); break; } diff --git a/src/gui/CheckListWidget.hxx b/src/gui/CheckListWidget.hxx index 52611891e..e1c3121b9 100644 --- a/src/gui/CheckListWidget.hxx +++ b/src/gui/CheckListWidget.hxx @@ -29,7 +29,7 @@ using CheckboxArray = vector; class CheckListWidget : public ListWidget { public: - enum { kListItemChecked = 'LIct' /* checkbox toggled on current line*/ }; + enum { kListItemChecked = 'LIct' /* checkbox toggled on current line*/ }; enum CheckStyle { XFill, SolidFill }; public: diff --git a/src/gui/ComboDialog.cxx b/src/gui/ComboDialog.cxx index feefac42c..b706d3a8e 100644 --- a/src/gui/ComboDialog.cxx +++ b/src/gui/ComboDialog.cxx @@ -81,7 +81,7 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font, // Add Defaults, OK and Cancel buttons ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -142,12 +142,12 @@ void ComboDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/ConfigPathDialog.cxx b/src/gui/ConfigPathDialog.cxx index 5fd82fd35..fed8f177e 100644 --- a/src/gui/ConfigPathDialog.cxx +++ b/src/gui/ConfigPathDialog.cxx @@ -115,7 +115,7 @@ ConfigPathDialog::ConfigPathDialog( // Add Defaults, OK and Cancel buttons b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, font.getStringWidth("Defaults") + 20, buttonHeight, - "Defaults", kDefaultsCmd); + "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -192,14 +192,14 @@ void ConfigPathDialog::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); if(myIsGlobal) // Let the boss know romdir has changed sendCommand(LauncherDialog::kRomDirChosenCmd, 0, 0); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 452eed1a5..952f33377 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -629,12 +629,12 @@ void Dialog::handleCommand(CommandSender* sender, int cmd, int data, int id) { switch(cmd) { - case kTabChangedCmd: + case TabWidget::kTabChangedCmd: if(_visible) buildCurrentFocusList(id); break; - case kCloseCmd: + case GuiObject::kCloseCmd: close(); break; } @@ -663,23 +663,23 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font, #ifndef BSPF_MAC_OSX b = new ButtonWidget(this, font, _w - 2 * (buttonWidth + 7), _h - buttonHeight - 10, buttonWidth, buttonHeight, - okText == "" ? "OK" : okText, kOKCmd); + okText == "" ? "OK" : okText, GuiObject::kOKCmd); wid.push_back(b); addOKWidget(b); b = new ButtonWidget(this, font, _w - (buttonWidth + 10), _h - buttonHeight - 10, buttonWidth, buttonHeight, - cancelText == "" ? "Cancel" : cancelText, kCloseCmd); + cancelText == "" ? "Cancel" : cancelText, GuiObject::kCloseCmd); wid.push_back(b); addCancelWidget(b); #else b = new ButtonWidget(this, font, _w - 2 * (buttonWidth + 7), _h - buttonHeight - 10, buttonWidth, buttonHeight, - cancelText == "" ? "Cancel" : cancelText, kCloseCmd); + cancelText == "" ? "Cancel" : cancelText, GuiObject::kCloseCmd); wid.push_back(b); addCancelWidget(b); b = new ButtonWidget(this, font, _w - (buttonWidth + 10), _h - buttonHeight - 10, buttonWidth, buttonHeight, - okText == "" ? "OK" : okText, kOKCmd); + okText == "" ? "OK" : okText, GuiObject::kOKCmd); wid.push_back(b); addOKWidget(b); #endif diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 80f62b5be..816ee55a0 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -364,7 +364,7 @@ GameInfoDialog::GameInfoDialog( wid.clear(); ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); addBGroupToFocusList(wid); @@ -612,16 +612,16 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; - case kTabChangedCmd: + case TabWidget::kTabChangedCmd: if(data == 2) // 'Controller' tab selected updateControllerStates(); diff --git a/src/gui/GlobalPropsDialog.cxx b/src/gui/GlobalPropsDialog.cxx index 658dcd1b4..9b8ceb91f 100644 --- a/src/gui/GlobalPropsDialog.cxx +++ b/src/gui/GlobalPropsDialog.cxx @@ -135,7 +135,7 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font) // Add Defaults, OK and Cancel buttons ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font, "Load ROM", "Close"); @@ -289,14 +289,14 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); // Inform parent to load the ROM sendCommand(LauncherDialog::kLoadROMCmd, 0, 0); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); saveConfig(); break; diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx index a9a5cc42f..60f40766c 100644 --- a/src/gui/GuiObject.hxx +++ b/src/gui/GuiObject.hxx @@ -31,20 +31,6 @@ class Widget; using WidgetArray = vector; -// The commands generated by various widgets -enum { - kOKCmd = 'OK ', - kCloseCmd = 'CLOS', - kNextCmd = 'NEXT', - kPrevCmd = 'PREV', - kEditCmd = 'EDIT', - kDefaultsCmd = 'DEFA', - kSetPositionCmd = 'SETP', - kTabChangedCmd = 'TBCH', - kCheckActionCmd = 'CBAC', - kRefreshAllCmd = 'REFA' -}; - /** This is the base class for all GUI objects/widgets. @@ -55,6 +41,17 @@ class GuiObject : public CommandReceiver friend class Widget; friend class DialogContainer; + public: + // The commands generated by various widgets + enum { + kOKCmd = 'OK ', + kCloseCmd = 'CLOS', + kNextCmd = 'NEXT', + kPrevCmd = 'PREV', + kDefaultsCmd = 'DEFA', + kSetPositionCmd = 'SETP' + }; + public: GuiObject(OSystem& osystem, DialogContainer& parent, Dialog& dialog, int x, int y, int w, int h) diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index 7e0ad499d..a5fa8affa 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -46,20 +46,20 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent, xpos = 10; ypos = _h - buttonHeight - 10; myPrevButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Previous", kPrevCmd); + "Previous", GuiObject::kPrevCmd); myPrevButton->clearFlags(WIDGET_ENABLED); wid.push_back(myPrevButton); xpos += buttonWidth + 7; myNextButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Next", kNextCmd); + "Next", GuiObject::kNextCmd); wid.push_back(myNextButton); xpos = _w - buttonWidth - 10; ButtonWidget* b = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, - "Close", kCloseCmd); + "Close", GuiObject::kCloseCmd); wid.push_back(b); addOKWidget(b); addCancelWidget(b); @@ -192,7 +192,7 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kNextCmd: + case GuiObject::kNextCmd: myPage++; if(myPage >= myNumPages) myNextButton->clearFlags(WIDGET_ENABLED); @@ -202,7 +202,7 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd, displayInfo(); break; - case kPrevCmd: + case GuiObject::kPrevCmd: myPage--; if(myPage <= myNumPages) myNextButton->setFlags(WIDGET_ENABLED); diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 4741409c9..ea02e52ff 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -86,7 +86,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, WidgetArray wid; ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); addBGroupToFocusList(wid); @@ -222,7 +222,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) new StaticTextWidget(myTab, font, _w - 14 - (fwidth + lwidth) / 2, ypos+2, "AtariVox/SaveKey"); - // Show joystick database + // Show joystick database ypos += lineHeight; myJoyDlgButton = new ButtonWidget(myTab, font, hSpace, ypos, 20, "Joystick database" + ELLIPSIS, kDBButtonPressed); @@ -481,17 +481,17 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kCloseCmd: + case GuiObject::kCloseCmd: // Revert changes made to event mapping close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx index b2e9d2a5a..ab4f801cc 100644 --- a/src/gui/InputTextDialog.cxx +++ b/src/gui/InputTextDialog.cxx @@ -189,7 +189,7 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: case EditableWidget::kAcceptCmd: { // Send a signal to the calling class that a selection has been made @@ -212,7 +212,7 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd, break; case EditableWidget::kCancelCmd: - Dialog::handleCommand(sender, kCloseCmd, data, id); + Dialog::handleCommand(sender, GuiObject::kCloseCmd, data, id); break; diff --git a/src/gui/JoystickDialog.cxx b/src/gui/JoystickDialog.cxx index c72c2d2bc..0094bbcea 100644 --- a/src/gui/JoystickDialog.cxx +++ b/src/gui/JoystickDialog.cxx @@ -55,7 +55,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font, // Add buttons at bottom xpos = _w - buttonWidth - 10; myCloseBtn = new ButtonWidget(this, font, xpos, ypos, - buttonWidth, buttonHeight, "Close", kCloseCmd); + buttonWidth, buttonHeight, "Close", GuiObject::kCloseCmd); addOKWidget(myCloseBtn); addCancelWidget(myCloseBtn); buttonWidth = font.getStringWidth("Remove") + 20; @@ -95,7 +95,7 @@ void JoystickDialog::handleCommand(CommandSender* sender, int cmd, int data, int { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: close(); break; diff --git a/src/gui/LauncherFilterDialog.cxx b/src/gui/LauncherFilterDialog.cxx index e1f58d4e4..4cc4ed209 100644 --- a/src/gui/LauncherFilterDialog.cxx +++ b/src/gui/LauncherFilterDialog.cxx @@ -76,7 +76,7 @@ LauncherFilterDialog::LauncherFilterDialog(GuiObject* boss, const GUI::Font& fon // Add Defaults, OK and Cancel buttons ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -229,12 +229,12 @@ void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index 0890f0b94..e5afbeb4b 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -410,7 +410,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) { switch (cmd) { - case kSetPositionCmd: + case GuiObject::kSetPositionCmd: if (_currentPos != data) { _currentPos = data; diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx index 193c4339e..aefba04fb 100644 --- a/src/gui/ListWidget.hxx +++ b/src/gui/ListWidget.hxx @@ -38,7 +38,7 @@ class ListWidget : public EditableWidget kSelectionChangedCmd = 'Lsch', // selection changed - 'data' will be item index kScrolledCmd = 'Lscl', // list scrolled - 'data' will be current position kPrevDirCmd = 'Lpdr' // request to go to parent list, if applicable - }; + }; public: ListWidget(GuiObject* boss, const GUI::Font& font, diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx index 606e7bc50..d34b6a860 100644 --- a/src/gui/LoggerDialog.cxx +++ b/src/gui/LoggerDialog.cxx @@ -79,7 +79,8 @@ LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent, // Add Defaults, OK and Cancel buttons ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Save log to disk", kDefaultsCmd); + buttonWidth, buttonHeight, "Save log to disk", + GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -123,12 +124,12 @@ void LoggerDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: saveLogFile(); break; diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index 4e562bc98..4343ddfc9 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -85,7 +85,7 @@ void MessageBox::handleCommand(CommandSender* sender, int cmd, int data, int id) { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: { close(); diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index 96d62a181..ede1124f1 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -169,7 +169,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kOKCmd: + case GuiObject::kOKCmd: if(!myConfirmMsg) { StringList msg; diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx index 1e7728835..8911a8dca 100644 --- a/src/gui/ScrollBarWidget.cxx +++ b/src/gui/ScrollBarWidget.cxx @@ -201,7 +201,7 @@ void ScrollBarWidget::checkBounds(int old_pos) if (old_pos != _currentPos) { recalc(); - sendCommand(kSetPositionCmd, _currentPos, _id); + sendCommand(GuiObject::kSetPositionCmd, _currentPos, _id); } } diff --git a/src/gui/SnapshotDialog.cxx b/src/gui/SnapshotDialog.cxx index 225f7b10a..ba65f1369 100644 --- a/src/gui/SnapshotDialog.cxx +++ b/src/gui/SnapshotDialog.cxx @@ -117,7 +117,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent, // Add Defaults, OK and Cancel buttons b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, font.getStringWidth("Defaults") + 20, buttonHeight, - "Defaults", kDefaultsCmd); + "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); @@ -170,12 +170,12 @@ void SnapshotDialog::handleCommand(CommandSender* sender, int cmd, { switch (cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 779dc467d..b4c19a045 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -101,7 +101,7 @@ void TabWidget::setActiveTab(int tabID, bool show) // Let parent know about the tab change if(show) - sendCommand(kTabChangedCmd, _activeTab, _id); + sendCommand(TabWidget::kTabChangedCmd, _activeTab, _id); } #if 0 // FIXME @@ -134,7 +134,7 @@ void TabWidget::updateActiveTab() void TabWidget::activateTabs() { for(uInt32 i = 0; i <_tabs.size(); ++i) - sendCommand(kTabChangedCmd, i-1, _id); + sendCommand(TabWidget::kTabChangedCmd, i-1, _id); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx index 53f69fc85..4c71d0858 100644 --- a/src/gui/TabWidget.hxx +++ b/src/gui/TabWidget.hxx @@ -25,6 +25,11 @@ class TabWidget : public Widget, public CommandSender { + public: + enum { + kTabChangedCmd = 'TBCH' + }; + public: TabWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h); virtual ~TabWidget(); diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index b192f75d6..14c1bfa49 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -295,7 +295,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, // Add Defaults, OK and Cancel buttons wid.clear(); b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); addBGroupToFocusList(wid); @@ -498,12 +498,12 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id) break; #endif - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 0e803f150..6ba00650b 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -49,7 +49,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, int lwidth = font.getStringWidth("NTSC Aspect "), pwidth = font.getStringWidth("XXXXxXXXX"), swidth = 69; - + WidgetArray wid; VariantList items; @@ -375,7 +375,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, wid.clear(); ButtonWidget* b; b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10, - buttonWidth, buttonHeight, "Defaults", kDefaultsCmd); + buttonWidth, buttonHeight, "Defaults", GuiObject::kDefaultsCmd); wid.push_back(b); addOKCancelBGroup(wid, font); addBGroupToFocusList(wid); @@ -792,12 +792,12 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd, { switch(cmd) { - case kOKCmd: + case GuiObject::kOKCmd: saveConfig(); close(); break; - case kDefaultsCmd: + case GuiObject::kDefaultsCmd: setDefaults(); break; diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index 1f7cf2c91..a657f2a81 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -214,7 +214,7 @@ class ButtonWidget : public StaticTextWidget, public CommandSender int x, int y, int w, int h, const string& label, int cmd = 0); ButtonWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int dw, + int x, int y, int dw, const string& label, int cmd = 0); ButtonWidget(GuiObject* boss, const GUI::Font& font, int x, int y, @@ -248,6 +248,7 @@ class ButtonWidget : public StaticTextWidget, public CommandSender class CheckboxWidget : public ButtonWidget { public: + enum { kCheckActionCmd = 'CBAC' }; enum FillType { Normal, Inactive, Circle }; public: