made UI theme change immediate

This commit is contained in:
thrust26 2018-08-12 23:01:43 +02:00
parent 1fe5cd2b3f
commit 4bc3373b37
3 changed files with 22 additions and 18 deletions

View File

@ -131,14 +131,27 @@ bool FrameBuffer::initialize()
VarList::push_back(myTIAZoomLevels, desc.str(), zoom); VarList::push_back(myTIAZoomLevels, desc.str(), zoom);
} }
// Set palette for GUI (upper area of array, doesn't change during execution) setUIPalette();
myGrabMouse = myOSystem.settings().getBool("grabmouse");
// Create a TIA surface; we need it for rendering TIA images
myTIASurface = make_unique<TIASurface>(myOSystem);
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setUIPalette()
{
// Set palette for GUI (upper area of array)
int palID = 0; int palID = 0;
if(myOSystem.settings().getString("uipalette") == "classic") if(myOSystem.settings().getString("uipalette") == "classic")
palID = 1; palID = 1;
else if(myOSystem.settings().getString("uipalette") == "light") else if(myOSystem.settings().getString("uipalette") == "light")
palID = 2; palID = 2;
for(uInt32 i = 0, j = 256; i < kNumColors-256; ++i, ++j) for(uInt32 i = 0, j = 256; i < kNumColors - 256; ++i, ++j)
{ {
uInt8 r = (ourGUIColors[palID][i] >> 16) & 0xff; uInt8 r = (ourGUIColors[palID][i] >> 16) & 0xff;
uInt8 g = (ourGUIColors[palID][i] >> 8) & 0xff; uInt8 g = (ourGUIColors[palID][i] >> 8) & 0xff;
@ -147,13 +160,6 @@ bool FrameBuffer::initialize()
myPalette[j] = mapRGB(r, g, b); myPalette[j] = mapRGB(r, g, b);
} }
FBSurface::setPalette(myPalette); FBSurface::setPalette(myPalette);
myGrabMouse = myOSystem.settings().getBool("grabmouse");
// Create a TIA surface; we need it for rendering TIA images
myTIASurface = make_unique<TIASurface>(myOSystem);
return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -99,6 +99,11 @@ class FrameBuffer
*/ */
bool initialize(); bool initialize();
/**
Set palette for user interface
*/
void setUIPalette();
/** /**
(Re)creates the framebuffer display. This must be called before any (Re)creates the framebuffer display. This must be called before any
calls are made to derived methods. calls are made to derived methods.

View File

@ -74,7 +74,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
VarList::push_back(items, "Classic", "classic"); VarList::push_back(items, "Classic", "classic");
VarList::push_back(items, "Light", "light"); VarList::push_back(items, "Light", "light");
myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Theme (*) ", lwidth); items, "Theme ", lwidth);
wid.push_back(myPalettePopup); wid.push_back(myPalettePopup);
ypos += lineHeight + 4 * 4; ypos += lineHeight + 4 * 4;
@ -99,14 +99,6 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
myWheelLinesPopup->setTickmarkInterval(3); myWheelLinesPopup->setTickmarkInterval(3);
wid.push_back(myWheelLinesPopup); wid.push_back(myWheelLinesPopup);
// Add message concerning usage
xpos = HBORDER;
ypos = myTab->getHeight() - 5 - fontHeight - ifont.getFontHeight() - 10;
lwidth = ifont.getStringWidth("(*) Requires application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos, std::min(lwidth, _w-20), fontHeight,
"(*) Requires application restart",
TextAlign::Left);
// Add items for tab 0 // Add items for tab 0
addToFocusList(wid, myTab, tabID); addToFocusList(wid, myTab, tabID);
@ -247,6 +239,7 @@ void UIDialog::saveConfig()
// UI palette // UI palette
instance().settings().setValue("uipalette", instance().settings().setValue("uipalette",
myPalettePopup->getSelectedTag().toString()); myPalettePopup->getSelectedTag().toString());
instance().frameBuffer().setUIPalette();
// Listwidget quick delay // Listwidget quick delay
instance().settings().setValue("listdelay", myListDelayPopup->getValue()); instance().settings().setValue("listdelay", myListDelayPopup->getValue());