corrected controller labels in GameInfoDialog/Controller

This commit is contained in:
thrust26 2019-02-15 18:29:35 +01:00
parent 83636b9791
commit e3d40f9285
2 changed files with 48 additions and 46 deletions

View File

@ -201,35 +201,37 @@ GameInfoDialog::GameInfoDialog(
ypos = VBORDER; ypos = VBORDER;
pwidth = font.getStringWidth("Paddles_IAxis"); pwidth = font.getStringWidth("Paddles_IAxis");
myP0Label = new StaticTextWidget(myTab, font, HBORDER, ypos+1, "P0 controller "); myLeftPortLabel = new StaticTextWidget(myTab, font, HBORDER, ypos+1, "Left port ");
myP0Controller = new PopUpWidget(myTab, font, myP0Label->getRight(), myP0Label->getTop()-1, myLeftPort = new PopUpWidget(myTab, font, myLeftPortLabel->getRight(),
pwidth, lineHeight, ctrls, "", 0, kLeftCChanged); myLeftPortLabel->getTop()-1,
wid.push_back(myP0Controller); pwidth, lineHeight, ctrls, "", 0, kLeftCChanged);
wid.push_back(myLeftPort);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myP0ControllerDetected = new StaticTextWidget(myTab, ifont, myP0Controller->getLeft(), ypos, myLeftPortDetected = new StaticTextWidget(myTab, ifont, myLeftPort->getLeft(), ypos,
"BoosterGrip detected"); "BoosterGrip detected");
ypos += ifont.getLineHeight() + VGAP; ypos += ifont.getLineHeight() + VGAP;
myP1Label = new StaticTextWidget(myTab, font, HBORDER, ypos+1, "P1 controller "); myRightPortLabel = new StaticTextWidget(myTab, font, HBORDER, ypos+1, "Right port ");
myP1Controller = new PopUpWidget(myTab, font, myP1Label->getRight(), myP1Label->getTop()-1, myRightPort = new PopUpWidget(myTab, font, myRightPortLabel->getRight(),
pwidth, lineHeight, ctrls, "", 0, kRightCChanged); myRightPortLabel->getTop()-1,
wid.push_back(myP1Controller); pwidth, lineHeight, ctrls, "", 0, kRightCChanged);
wid.push_back(myRightPort);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myP1ControllerDetected = new StaticTextWidget(myTab, ifont, myP1Controller->getLeft(), ypos, myRightPortDetected = new StaticTextWidget(myTab, ifont, myRightPort->getLeft(), ypos,
"BoosterGrip detected"); "BoosterGrip detected");
ypos += ifont.getLineHeight() + VGAP + 4; ypos += ifont.getLineHeight() + VGAP + 4;
mySwapPorts = new CheckboxWidget(myTab, font, myP0Controller->getRight() + fontWidth*4, myP0Controller->getTop()+1, mySwapPorts = new CheckboxWidget(myTab, font, myLeftPort->getRight() + fontWidth*4,
"Swap ports"); myLeftPort->getTop()+1, "Swap ports");
wid.push_back(mySwapPorts); wid.push_back(mySwapPorts);
mySwapPaddles = new CheckboxWidget(myTab, font, myP1Controller->getRight() + fontWidth*4, myP1Controller->getTop()+1, mySwapPaddles = new CheckboxWidget(myTab, font, myRightPort->getRight() + fontWidth*4,
"Swap paddles"); myRightPort->getTop()+1, "Swap paddles");
wid.push_back(mySwapPaddles); wid.push_back(mySwapPaddles);
// EEPROM erase button for P0/P1 // EEPROM erase button for left/right controller
//ypos += lineHeight + VGAP + 4; //ypos += lineHeight + VGAP + 4;
pwidth = myP1Controller->getWidth(); //font.getStringWidth("Erase EEPROM ") + 23; pwidth = myRightPort->getWidth(); //font.getStringWidth("Erase EEPROM ") + 23;
myEraseEEPROMLabel = new StaticTextWidget(myTab, font, HBORDER, ypos, "AtariVox/SaveKey "); myEraseEEPROMLabel = new StaticTextWidget(myTab, font, HBORDER, ypos, "AtariVox/SaveKey ");
myEraseEEPROMButton = new ButtonWidget(myTab, font, myEraseEEPROMLabel->getRight(), ypos - 4, myEraseEEPROMButton = new ButtonWidget(myTab, font, myEraseEEPROMLabel->getRight(), ypos - 4,
pwidth, buttonHeight, "Erase EEPROM", kEEButtonPressed); pwidth, buttonHeight, "Erase EEPROM", kEEButtonPressed);
@ -412,21 +414,21 @@ void GameInfoDialog::loadConsoleProperties(const Properties& props)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::loadControllerProperties(const Properties& props) void GameInfoDialog::loadControllerProperties(const Properties& props)
{ {
myP0Controller->setSelected(props.get(Controller_Left), "AUTO"); myLeftPort->setSelected(props.get(Controller_Left), "AUTO");
if(instance().hasConsole() && myP0Controller->getSelectedTag().toString() == "AUTO") if(instance().hasConsole() && myLeftPort->getSelectedTag().toString() == "AUTO")
{ {
myP0ControllerDetected->setLabel(instance().console().leftController().name() + " detected"); myLeftPortDetected->setLabel(instance().console().leftController().name() + " detected");
} }
else else
myP0ControllerDetected->setLabel(""); myLeftPortDetected->setLabel("");
myP1Controller->setSelected(props.get(Controller_Right), "AUTO"); myRightPort->setSelected(props.get(Controller_Right), "AUTO");
if(instance().hasConsole() && myP1Controller->getSelectedTag().toString() == "AUTO") if(instance().hasConsole() && myRightPort->getSelectedTag().toString() == "AUTO")
{ {
myP1ControllerDetected->setLabel(instance().console().rightController().name() + " detected"); myRightPortDetected->setLabel(instance().console().rightController().name() + " detected");
} }
else else
myP1ControllerDetected->setLabel(""); myRightPortDetected->setLabel("");
mySwapPorts->setState(props.get(Console_SwapPorts) == "YES"); mySwapPorts->setState(props.get(Console_SwapPorts) == "YES");
mySwapPaddles->setState(props.get(Controller_SwapPaddles) == "YES"); mySwapPaddles->setState(props.get(Controller_SwapPaddles) == "YES");
@ -490,8 +492,8 @@ void GameInfoDialog::saveConfig()
myGameProperties.set(Console_TelevisionType, myTVTypeGroup->getSelected() ? "BW" : "COLOR"); myGameProperties.set(Console_TelevisionType, myTVTypeGroup->getSelected() ? "BW" : "COLOR");
// Controller properties // Controller properties
myGameProperties.set(Controller_Left, myP0Controller->getSelectedTag().toString()); myGameProperties.set(Controller_Left, myLeftPort->getSelectedTag().toString());
myGameProperties.set(Controller_Right, myP1Controller->getSelectedTag().toString()); myGameProperties.set(Controller_Right, myRightPort->getSelectedTag().toString());
myGameProperties.set(Console_SwapPorts, (mySwapPorts->isEnabled() && mySwapPorts->getState()) ? "YES" : "NO"); myGameProperties.set(Console_SwapPorts, (mySwapPorts->isEnabled() && mySwapPorts->getState()) ? "YES" : "NO");
myGameProperties.set(Controller_SwapPaddles, (mySwapPaddles->isEnabled() && mySwapPaddles->getState()) ? "YES" : "NO"); myGameProperties.set(Controller_SwapPaddles, (mySwapPaddles->isEnabled() && mySwapPaddles->getState()) ? "YES" : "NO");
@ -568,15 +570,15 @@ void GameInfoDialog::setDefaults()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::updateControllerStates() void GameInfoDialog::updateControllerStates()
{ {
const string& contrP0 = myP0Controller->getSelectedTag().toString(); const string& contrLeft = myLeftPort->getSelectedTag().toString();
const string& contrP1 = myP1Controller->getSelectedTag().toString(); const string& contrRight = myRightPort->getSelectedTag().toString();
bool enableEEEraseButton = false; bool enableEEEraseButton = false;
// Compumate bankswitching scheme doesn't allow to select controllers // Compumate bankswitching scheme doesn't allow to select controllers
bool enableSelectControl = myBSType->getSelectedTag() != "CM"; bool enableSelectControl = myBSType->getSelectedTag() != "CM";
bool enableSwapPaddles = BSPF::startsWithIgnoreCase(contrP0, "PADDLES") || bool enableSwapPaddles = BSPF::startsWithIgnoreCase(contrLeft, "PADDLES") ||
BSPF::startsWithIgnoreCase(contrP1, "PADDLES"); BSPF::startsWithIgnoreCase(contrRight, "PADDLES");
if(instance().hasConsole()) if(instance().hasConsole())
{ {
@ -584,16 +586,16 @@ void GameInfoDialog::updateControllerStates()
const Controller& rport = instance().console().rightController(); const Controller& rport = instance().console().rightController();
// we only enable the button if we have a valid previous and new controller. // we only enable the button if we have a valid previous and new controller.
enableEEEraseButton = ((lport.type() == Controller::SaveKey && contrP0 == "SAVEKEY") || enableEEEraseButton = ((lport.type() == Controller::SaveKey && contrLeft == "SAVEKEY") ||
(rport.type() == Controller::SaveKey && contrP1 == "SAVEKEY") || (rport.type() == Controller::SaveKey && contrRight == "SAVEKEY") ||
(lport.type() == Controller::AtariVox && contrP0 == "ATARIVOX") || (lport.type() == Controller::AtariVox && contrLeft == "ATARIVOX") ||
(rport.type() == Controller::AtariVox && contrP1 == "ATARIVOX")); (rport.type() == Controller::AtariVox && contrRight == "ATARIVOX"));
} }
myP0Label->setEnabled(enableSelectControl); myLeftPortLabel->setEnabled(enableSelectControl);
myP1Label->setEnabled(enableSelectControl); myRightPortLabel->setEnabled(enableSelectControl);
myP0Controller->setEnabled(enableSelectControl); myLeftPort->setEnabled(enableSelectControl);
myP1Controller->setEnabled(enableSelectControl); myRightPort->setEnabled(enableSelectControl);
mySwapPorts->setEnabled(enableSelectControl); mySwapPorts->setEnabled(enableSelectControl);
mySwapPaddles->setEnabled(enableSwapPaddles); mySwapPaddles->setEnabled(enableSwapPaddles);

View File

@ -75,12 +75,12 @@ class GameInfoDialog : public Dialog, public CommandSender
RadioButtonGroup* myTVTypeGroup; RadioButtonGroup* myTVTypeGroup;
// Controller properties // Controller properties
StaticTextWidget* myP0Label; StaticTextWidget* myLeftPortLabel;
StaticTextWidget* myP1Label; StaticTextWidget* myRightPortLabel;
PopUpWidget* myP0Controller; PopUpWidget* myLeftPort;
StaticTextWidget* myP0ControllerDetected; StaticTextWidget* myLeftPortDetected;
PopUpWidget* myP1Controller; PopUpWidget* myRightPort;
StaticTextWidget* myP1ControllerDetected; StaticTextWidget* myRightPortDetected;
CheckboxWidget* mySwapPorts; CheckboxWidget* mySwapPorts;
CheckboxWidget* mySwapPaddles; CheckboxWidget* mySwapPaddles;
StaticTextWidget* myEraseEEPROMLabel; StaticTextWidget* myEraseEEPROMLabel;