diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 91fdbb576..21242c45e 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -333,14 +333,6 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::handleEvent(Event::Type event, bool pressed) { -#ifdef RETRON77 - static const string LEFT_DIFFICULTY = "P1 Skill"; - static const string RIGHT_DIFFICULTY = "P2 Skill"; -#else - static const string LEFT_DIFFICULTY = "Left Difficulty"; - static const string RIGHT_DIFFICULTY = "Right Difficulty"; -#endif - // Take care of special events that aren't part of the emulation core // or need to be preprocessed before passing them on switch(event) @@ -532,14 +524,14 @@ void EventHandler::handleEvent(Event::Type event, bool pressed) if(pressed) { myEvent.set(Event::ConsoleLeftDiffB, 0); - myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " A"); + myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A"); } break; case Event::ConsoleLeftDiffB: if(pressed) { myEvent.set(Event::ConsoleLeftDiffA, 0); - myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " B"); + myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B"); } break; case Event::ConsoleLeftDiffToggle: @@ -549,13 +541,13 @@ void EventHandler::handleEvent(Event::Type event, bool pressed) { myEvent.set(Event::ConsoleLeftDiffA, 0); myEvent.set(Event::ConsoleLeftDiffB, 1); - myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " B"); + myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B"); } else { myEvent.set(Event::ConsoleLeftDiffA, 1); myEvent.set(Event::ConsoleLeftDiffB, 0); - myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " A"); + myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A"); } myOSystem.console().switches().update(); } @@ -565,14 +557,14 @@ void EventHandler::handleEvent(Event::Type event, bool pressed) if(pressed) { myEvent.set(Event::ConsoleRightDiffB, 0); - myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " A"); + myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A"); } break; case Event::ConsoleRightDiffB: if(pressed) { myEvent.set(Event::ConsoleRightDiffA, 0); - myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " B"); + myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B"); } break; case Event::ConsoleRightDiffToggle: @@ -582,13 +574,13 @@ void EventHandler::handleEvent(Event::Type event, bool pressed) { myEvent.set(Event::ConsoleRightDiffA, 0); myEvent.set(Event::ConsoleRightDiffB, 1); - myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " B"); + myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B"); } else { myEvent.set(Event::ConsoleRightDiffA, 1); myEvent.set(Event::ConsoleRightDiffB, 0); - myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " A"); + myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A"); } myOSystem.console().switches().update(); } diff --git a/src/emucore/EventHandlerConstants.hxx b/src/emucore/EventHandlerConstants.hxx index 620c29ce6..686198fbd 100644 --- a/src/emucore/EventHandlerConstants.hxx +++ b/src/emucore/EventHandlerConstants.hxx @@ -62,4 +62,21 @@ enum EventMode { kNumModes = 2 }; +namespace GUI +{ +#ifdef RETRON77 + static const string SELECT = "Mode"; + static const string LEFT_DIFFICULTY = "P1 skill"; + static const string RIGHT_DIFFICULTY = "P2 skill"; + static const string LEFT_DIFF = "P1 Skill"; + static const string RIGHT_DIFF = "P2 Skill"; +#else + static const string SELECT = "Select"; + static const string LEFT_DIFFICULTY = "Left difficulty"; + static const string RIGHT_DIFFICULTY = "Right difficulty"; + static const string LEFT_DIFF = "Left Diff"; + static const string RIGHT_DIFF = "Right Diff"; +#endif +} + #endif // EVENTHANDLER_CONSTANTS_HXX diff --git a/src/gui/CommandDialog.cxx b/src/gui/CommandDialog.cxx index 2dd8399f3..b138a9b1c 100644 --- a/src/gui/CommandDialog.cxx +++ b/src/gui/CommandDialog.cxx @@ -29,16 +29,6 @@ #include "TIASurface.hxx" #include "CommandDialog.hxx" -#ifdef RETRON77 - static const string SELECT = "Mode"; - static const string LEFT_DIFF = "P1 Skill"; - static const string RIGHT_DIFF = "P2 Skill"; -#else - static const string SELECT = "Select"; - static const string LEFT_DIFF = "Left Diff"; - static const string RIGHT_DIFF = "Right Diff"; -#endif - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands") @@ -67,7 +57,7 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent) }; // Column 1 - bw = ADD_CD_BUTTON(SELECT, kSelectCmd); + bw = ADD_CD_BUTTON(GUI::SELECT, kSelectCmd); wid.push_back(bw); bw = ADD_CD_BUTTON("Reset", kResetCmd); wid.push_back(bw); @@ -122,8 +112,8 @@ void CommandDialog::loadConfig() { // Column 1 myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode"); - myLeftDiffButton->setLabel(LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); - myRightDiffButton->setLabel(RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); + myLeftDiffButton->setLabel(GUI::LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); + myRightDiffButton->setLabel(GUI::RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); // Column 2 updateSlot(instance().state().currentSlot()); myTimeMachineButton->setLabel(instance().state().mode() == StateManager::Mode::TimeMachine ? diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index f5e6e08c4..df457b279 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -137,51 +137,41 @@ GameInfoDialog::GameInfoDialog( ////////////////////////////////////////////////////////////////////////////// // 2) Console properties -#ifdef RETRON77 - static const string TV_TYPE = "TV type "; - static const string LEFT_DIFFICULTY = "P1 Skill "; - static const string RIGHT_DIFFICULTY = "P2 Skill "; - -#else - static const string TV_TYPE = "TV type "; - static const string LEFT_DIFFICULTY = "Left Difficulty "; - static const string RIGHT_DIFFICULTY = "Right Difficulty "; -#endif - wid.clear(); tabID = myTab->addTab("Console"); xpos = HBORDER; ypos = VBORDER; + lwidth = font.getStringWidth(GUI::RIGHT_DIFFICULTY + " "); - StaticTextWidget* s = new StaticTextWidget(myTab, font, xpos, ypos + 1, TV_TYPE); + StaticTextWidget* s = new StaticTextWidget(myTab, font, xpos, ypos + 1, "TV type"); myTVTypeGroup = new RadioButtonGroup(); - RadioButtonWidget* r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + RadioButtonWidget* r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "Color", myTVTypeGroup); wid.push_back(r); ypos += lineHeight; - r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "B/W", myTVTypeGroup); wid.push_back(r); ypos += lineHeight + VGAP * 2; - s = new StaticTextWidget(myTab, font, xpos, ypos+1, LEFT_DIFFICULTY); + s = new StaticTextWidget(myTab, font, xpos, ypos+1, GUI::LEFT_DIFFICULTY); myLeftDiffGroup = new RadioButtonGroup(); - r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "A (Expert)", myLeftDiffGroup); wid.push_back(r); ypos += lineHeight; - r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "B (Novice)", myLeftDiffGroup); wid.push_back(r); ypos += lineHeight + VGAP * 2; - s = new StaticTextWidget(myTab, font, xpos, ypos+1, RIGHT_DIFFICULTY); + s = new StaticTextWidget(myTab, font, xpos, ypos+1, GUI::RIGHT_DIFFICULTY); myRightDiffGroup = new RadioButtonGroup(); - r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "A (Expert)", myRightDiffGroup); wid.push_back(r); ypos += lineHeight; - r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, + r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1, "B (Novice)", myRightDiffGroup); wid.push_back(r); diff --git a/src/gui/GlobalPropsDialog.cxx b/src/gui/GlobalPropsDialog.cxx index 1a43265d4..c12b8c0a5 100644 --- a/src/gui/GlobalPropsDialog.cxx +++ b/src/gui/GlobalPropsDialog.cxx @@ -28,16 +28,6 @@ #include "LauncherDialog.hxx" #include "GlobalPropsDialog.hxx" -#ifdef RETRON77 - static const string SELECT = "Mode"; - static const string LEFT_DIFFICULTY = "P1 Skill"; - static const string RIGHT_DIFFICULTY = "P2 Skill"; -#else - static const string SELECT = "Select"; - static const string LEFT_DIFFICULTY = "Left Difficulty"; - static const string RIGHT_DIFFICULTY = "Right Difficulty"; -#endif - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font) : Dialog(boss->instance(), boss->parent(), font, "Power-on options"), @@ -84,7 +74,7 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font) ypos += lineHeight + VGAP; // Left difficulty - new StaticTextWidget(this, font, xpos, ypos+1, LEFT_DIFFICULTY); + new StaticTextWidget(this, font, xpos, ypos+1, GUI::LEFT_DIFFICULTY); items.clear(); VarList::push_back(items, "Default", "DEFAULT"); VarList::push_back(items, "A (Expert)", "A"); @@ -95,7 +85,7 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font) ypos += lineHeight + VGAP; // Right difficulty - new StaticTextWidget(this, font, xpos, ypos+1, RIGHT_DIFFICULTY); + new StaticTextWidget(this, font, xpos, ypos+1, GUI::RIGHT_DIFFICULTY); // ... use same items as above myRightDiff = new PopUpWidget(this, font, xpos+lwidth, ypos, pwidth, lineHeight, items, ""); @@ -183,7 +173,7 @@ int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y, // Console Select/Reset t = new StaticTextWidget(this, font, xpos, ypos+2, "Console"); ypos += t->getHeight() + VGAP; - myHoldSelect = new CheckboxWidget(this, font, xpos, ypos, SELECT); + myHoldSelect = new CheckboxWidget(this, font, xpos, ypos, GUI::SELECT); ypos += myHoldSelect->getHeight() + VGAP; myHoldReset = new CheckboxWidget(this, font, xpos, ypos, "Reset"); diff --git a/src/gui/MinUICommandDialog.cxx b/src/gui/MinUICommandDialog.cxx index 0326d3cf8..4d9975ebf 100644 --- a/src/gui/MinUICommandDialog.cxx +++ b/src/gui/MinUICommandDialog.cxx @@ -31,16 +31,6 @@ #include "MinUICommandDialog.hxx" -#ifdef RETRON77 - static const string SELECT = "Mode"; - static const string LEFT_DIFF = "P1 Skill"; - static const string RIGHT_DIFF = "P2 Skill"; -#else - static const string SELECT = "Select"; - static const string LEFT_DIFF = "Left Diff"; - static const string RIGHT_DIFF = "Right Diff"; -#endif - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"), @@ -71,7 +61,7 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent }; // Column 1 - bw = ADD_CD_BUTTON(SELECT, kSelectCmd); + bw = ADD_CD_BUTTON(GUI::SELECT, kSelectCmd); wid.push_back(bw); bw = ADD_CD_BUTTON("Reset", kResetCmd); wid.push_back(bw); @@ -133,8 +123,8 @@ void MinUICommandDialog::loadConfig() { // Column 1 myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode"); - myLeftDiffButton->setLabel(LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); - myRightDiffButton->setLabel(RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); + myLeftDiffButton->setLabel(GUI::LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); + myRightDiffButton->setLabel(GUI::RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); // Column 2 updateSlot(instance().state().currentSlot()); updateWinds();