CommandDialog stays open when changing TV format and palette

This commit is contained in:
thrust26 2019-04-14 19:39:09 +02:00
parent 5dde762b85
commit e4ef7cc01b
2 changed files with 27 additions and 12 deletions

View File

@ -115,16 +115,8 @@ void CommandDialog::loadConfig()
myTimeMachineButton->setLabel(instance().state().mode() == StateManager::Mode::TimeMachine ?
"Time Machine On" : "No Time Machine");
// Column 3
myTVFormatButton->setLabel(instance().console().getFormatString() + " Mode");
string palette, label;
palette = instance().settings().getString("palette");
if(BSPF::equalsIgnoreCase(palette, "standard"))
label = "Stella Palette";
else if(BSPF::equalsIgnoreCase(palette, "z26"))
label = "Z26 Palette";
else
label = "User Palette";
myPaletteButton->setLabel(label);
updateTVFormat();
updatePalette();
myPhosphorButton->setLabel(instance().frameBuffer().tiaSurface().phosphorEnabled() ? "Phosphor On" : "Phosphor Off");
mySoundButton->setLabel(instance().audioSettings().enabled() ? "Sound On" : "Sound Off");
}
@ -199,13 +191,13 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
// Column 3
case kFormatCmd:
instance().eventHandler().leaveMenuMode();
instance().console().toggleFormat();
updateTVFormat();
break;
case kPaletteCmd:
instance().eventHandler().leaveMenuMode();
instance().console().togglePalette();
updatePalette();
break;
case kPhosphorCmd:
@ -251,3 +243,24 @@ void CommandDialog::updateSlot(int slot)
myStateSlotButton->setLabel("State Slot" + buf.str());
myLoadStateButton->setLabel("Load State" + buf.str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CommandDialog::updateTVFormat()
{
myTVFormatButton->setLabel(instance().console().getFormatString() + " Mode");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CommandDialog::updatePalette()
{
string palette, label;
palette = instance().settings().getString("palette");
if(BSPF::equalsIgnoreCase(palette, "standard"))
label = "Stella Palette";
else if(BSPF::equalsIgnoreCase(palette, "z26"))
label = "Z26 Palette";
else
label = "User Palette";
myPaletteButton->setLabel(label);
}

View File

@ -35,6 +35,8 @@ class CommandDialog : public Dialog
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void updateSlot(int slot);
void updateTVFormat();
void updatePalette();
// column 0
ButtonWidget* myColorButton;