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 ? myTimeMachineButton->setLabel(instance().state().mode() == StateManager::Mode::TimeMachine ?
"Time Machine On" : "No Time Machine"); "Time Machine On" : "No Time Machine");
// Column 3 // Column 3
myTVFormatButton->setLabel(instance().console().getFormatString() + " Mode"); updateTVFormat();
string palette, label; updatePalette();
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);
myPhosphorButton->setLabel(instance().frameBuffer().tiaSurface().phosphorEnabled() ? "Phosphor On" : "Phosphor Off"); myPhosphorButton->setLabel(instance().frameBuffer().tiaSurface().phosphorEnabled() ? "Phosphor On" : "Phosphor Off");
mySoundButton->setLabel(instance().audioSettings().enabled() ? "Sound On" : "Sound Off"); mySoundButton->setLabel(instance().audioSettings().enabled() ? "Sound On" : "Sound Off");
} }
@ -199,13 +191,13 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
// Column 3 // Column 3
case kFormatCmd: case kFormatCmd:
instance().eventHandler().leaveMenuMode();
instance().console().toggleFormat(); instance().console().toggleFormat();
updateTVFormat();
break; break;
case kPaletteCmd: case kPaletteCmd:
instance().eventHandler().leaveMenuMode();
instance().console().togglePalette(); instance().console().togglePalette();
updatePalette();
break; break;
case kPhosphorCmd: case kPhosphorCmd:
@ -251,3 +243,24 @@ void CommandDialog::updateSlot(int slot)
myStateSlotButton->setLabel("State Slot" + buf.str()); myStateSlotButton->setLabel("State Slot" + buf.str());
myLoadStateButton->setLabel("Load State" + 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 loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void updateSlot(int slot); void updateSlot(int slot);
void updateTVFormat();
void updatePalette();
// column 0 // column 0
ButtonWidget* myColorButton; ButtonWidget* myColorButton;