move label names into central header

This commit is contained in:
thrust26 2019-05-12 22:23:23 +02:00
parent 88f64473e9
commit 9aa75502b2
6 changed files with 44 additions and 75 deletions

View File

@ -333,14 +333,6 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::handleEvent(Event::Type event, bool pressed) 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 // Take care of special events that aren't part of the emulation core
// or need to be preprocessed before passing them on // or need to be preprocessed before passing them on
switch(event) switch(event)
@ -532,14 +524,14 @@ void EventHandler::handleEvent(Event::Type event, bool pressed)
if(pressed) if(pressed)
{ {
myEvent.set(Event::ConsoleLeftDiffB, 0); myEvent.set(Event::ConsoleLeftDiffB, 0);
myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " A"); myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A");
} }
break; break;
case Event::ConsoleLeftDiffB: case Event::ConsoleLeftDiffB:
if(pressed) if(pressed)
{ {
myEvent.set(Event::ConsoleLeftDiffA, 0); myEvent.set(Event::ConsoleLeftDiffA, 0);
myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " B"); myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B");
} }
break; break;
case Event::ConsoleLeftDiffToggle: case Event::ConsoleLeftDiffToggle:
@ -549,13 +541,13 @@ void EventHandler::handleEvent(Event::Type event, bool pressed)
{ {
myEvent.set(Event::ConsoleLeftDiffA, 0); myEvent.set(Event::ConsoleLeftDiffA, 0);
myEvent.set(Event::ConsoleLeftDiffB, 1); myEvent.set(Event::ConsoleLeftDiffB, 1);
myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " B"); myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " B");
} }
else else
{ {
myEvent.set(Event::ConsoleLeftDiffA, 1); myEvent.set(Event::ConsoleLeftDiffA, 1);
myEvent.set(Event::ConsoleLeftDiffB, 0); myEvent.set(Event::ConsoleLeftDiffB, 0);
myOSystem.frameBuffer().showMessage(LEFT_DIFFICULTY + " A"); myOSystem.frameBuffer().showMessage(GUI::LEFT_DIFFICULTY + " A");
} }
myOSystem.console().switches().update(); myOSystem.console().switches().update();
} }
@ -565,14 +557,14 @@ void EventHandler::handleEvent(Event::Type event, bool pressed)
if(pressed) if(pressed)
{ {
myEvent.set(Event::ConsoleRightDiffB, 0); myEvent.set(Event::ConsoleRightDiffB, 0);
myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " A"); myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A");
} }
break; break;
case Event::ConsoleRightDiffB: case Event::ConsoleRightDiffB:
if(pressed) if(pressed)
{ {
myEvent.set(Event::ConsoleRightDiffA, 0); myEvent.set(Event::ConsoleRightDiffA, 0);
myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " B"); myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B");
} }
break; break;
case Event::ConsoleRightDiffToggle: case Event::ConsoleRightDiffToggle:
@ -582,13 +574,13 @@ void EventHandler::handleEvent(Event::Type event, bool pressed)
{ {
myEvent.set(Event::ConsoleRightDiffA, 0); myEvent.set(Event::ConsoleRightDiffA, 0);
myEvent.set(Event::ConsoleRightDiffB, 1); myEvent.set(Event::ConsoleRightDiffB, 1);
myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " B"); myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " B");
} }
else else
{ {
myEvent.set(Event::ConsoleRightDiffA, 1); myEvent.set(Event::ConsoleRightDiffA, 1);
myEvent.set(Event::ConsoleRightDiffB, 0); myEvent.set(Event::ConsoleRightDiffB, 0);
myOSystem.frameBuffer().showMessage(RIGHT_DIFFICULTY + " A"); myOSystem.frameBuffer().showMessage(GUI::RIGHT_DIFFICULTY + " A");
} }
myOSystem.console().switches().update(); myOSystem.console().switches().update();
} }

View File

@ -62,4 +62,21 @@ enum EventMode {
kNumModes = 2 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 #endif // EVENTHANDLER_CONSTANTS_HXX

View File

@ -29,16 +29,6 @@
#include "TIASurface.hxx" #include "TIASurface.hxx"
#include "CommandDialog.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) CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands") : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands")
@ -67,7 +57,7 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
}; };
// Column 1 // Column 1
bw = ADD_CD_BUTTON(SELECT, kSelectCmd); bw = ADD_CD_BUTTON(GUI::SELECT, kSelectCmd);
wid.push_back(bw); wid.push_back(bw);
bw = ADD_CD_BUTTON("Reset", kResetCmd); bw = ADD_CD_BUTTON("Reset", kResetCmd);
wid.push_back(bw); wid.push_back(bw);
@ -122,8 +112,8 @@ void CommandDialog::loadConfig()
{ {
// Column 1 // Column 1
myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode"); myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode");
myLeftDiffButton->setLabel(LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); myLeftDiffButton->setLabel(GUI::LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B"));
myRightDiffButton->setLabel(RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); myRightDiffButton->setLabel(GUI::RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B"));
// Column 2 // Column 2
updateSlot(instance().state().currentSlot()); updateSlot(instance().state().currentSlot());
myTimeMachineButton->setLabel(instance().state().mode() == StateManager::Mode::TimeMachine ? myTimeMachineButton->setLabel(instance().state().mode() == StateManager::Mode::TimeMachine ?

View File

@ -137,51 +137,41 @@ GameInfoDialog::GameInfoDialog(
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// 2) Console properties // 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(); wid.clear();
tabID = myTab->addTab("Console"); tabID = myTab->addTab("Console");
xpos = HBORDER; ypos = VBORDER; 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(); 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); "Color", myTVTypeGroup);
wid.push_back(r); wid.push_back(r);
ypos += lineHeight; ypos += lineHeight;
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1,
"B/W", myTVTypeGroup); "B/W", myTVTypeGroup);
wid.push_back(r); wid.push_back(r);
ypos += lineHeight + VGAP * 2; 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(); myLeftDiffGroup = new RadioButtonGroup();
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1,
"A (Expert)", myLeftDiffGroup); "A (Expert)", myLeftDiffGroup);
wid.push_back(r); wid.push_back(r);
ypos += lineHeight; ypos += lineHeight;
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1,
"B (Novice)", myLeftDiffGroup); "B (Novice)", myLeftDiffGroup);
wid.push_back(r); wid.push_back(r);
ypos += lineHeight + VGAP * 2; 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(); myRightDiffGroup = new RadioButtonGroup();
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1,
"A (Expert)", myRightDiffGroup); "A (Expert)", myRightDiffGroup);
wid.push_back(r); wid.push_back(r);
ypos += lineHeight; ypos += lineHeight;
r = new RadioButtonWidget(myTab, font, s->getRight(), ypos + 1, r = new RadioButtonWidget(myTab, font, xpos + lwidth, ypos + 1,
"B (Novice)", myRightDiffGroup); "B (Novice)", myRightDiffGroup);
wid.push_back(r); wid.push_back(r);

View File

@ -28,16 +28,6 @@
#include "LauncherDialog.hxx" #include "LauncherDialog.hxx"
#include "GlobalPropsDialog.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) GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), font, "Power-on options"), : Dialog(boss->instance(), boss->parent(), font, "Power-on options"),
@ -84,7 +74,7 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Left difficulty // Left difficulty
new StaticTextWidget(this, font, xpos, ypos+1, LEFT_DIFFICULTY); new StaticTextWidget(this, font, xpos, ypos+1, GUI::LEFT_DIFFICULTY);
items.clear(); items.clear();
VarList::push_back(items, "Default", "DEFAULT"); VarList::push_back(items, "Default", "DEFAULT");
VarList::push_back(items, "A (Expert)", "A"); VarList::push_back(items, "A (Expert)", "A");
@ -95,7 +85,7 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
// Right difficulty // 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 // ... use same items as above
myRightDiff = new PopUpWidget(this, font, xpos+lwidth, ypos, myRightDiff = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, ""); pwidth, lineHeight, items, "");
@ -183,7 +173,7 @@ int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y,
// Console Select/Reset // Console Select/Reset
t = new StaticTextWidget(this, font, xpos, ypos+2, "Console"); t = new StaticTextWidget(this, font, xpos, ypos+2, "Console");
ypos += t->getHeight() + VGAP; 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; ypos += myHoldSelect->getHeight() + VGAP;
myHoldReset = new CheckboxWidget(this, font, xpos, ypos, "Reset"); myHoldReset = new CheckboxWidget(this, font, xpos, ypos, "Reset");

View File

@ -31,16 +31,6 @@
#include "MinUICommandDialog.hxx" #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) MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"), : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"),
@ -71,7 +61,7 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent
}; };
// Column 1 // Column 1
bw = ADD_CD_BUTTON(SELECT, kSelectCmd); bw = ADD_CD_BUTTON(GUI::SELECT, kSelectCmd);
wid.push_back(bw); wid.push_back(bw);
bw = ADD_CD_BUTTON("Reset", kResetCmd); bw = ADD_CD_BUTTON("Reset", kResetCmd);
wid.push_back(bw); wid.push_back(bw);
@ -133,8 +123,8 @@ void MinUICommandDialog::loadConfig()
{ {
// Column 1 // Column 1
myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode"); myColorButton->setLabel(instance().console().switches().tvColor() ? "Color Mode" : "B/W Mode");
myLeftDiffButton->setLabel(LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B")); myLeftDiffButton->setLabel(GUI::LEFT_DIFF + (instance().console().switches().leftDifficultyA() ? " A" : " B"));
myRightDiffButton->setLabel(RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B")); myRightDiffButton->setLabel(GUI::RIGHT_DIFF + (instance().console().switches().rightDifficultyA() ? " A" : " B"));
// Column 2 // Column 2
updateSlot(instance().state().currentSlot()); updateSlot(instance().state().currentSlot());
updateWinds(); updateWinds();