Some cleanups of the FrameBuffer class; 'uipalette' is no longer suported.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2845 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-01-31 16:23:10 +00:00
parent 53c053a2d9
commit 37b30e7b66
9 changed files with 64 additions and 121 deletions

View File

@ -18,6 +18,9 @@
context menu item to the debugger TIA output area. This saves the
current TIA image to a PNG file.
* Removed 'uipalette' option, as the original palette is no longer
supported.
* Updated included PNG library to latest stable version.
-Have fun!

View File

@ -2112,12 +2112,6 @@
given zoom level (1 or 2).</td>
</tr>
<tr>
<td><pre>-uipalette &lt;1|2&gt;</pre></td>
<td>Used the specified palette for UI elements. This isn't yet
complete.</td>
</tr>
<tr>
<td><pre>-listdelay &lt;delay&gt;</pre></td>
<td>Set the amount of time to wait between treating successive

View File

@ -116,10 +116,7 @@ FBInitStatus FrameBuffer::initialize(const string& title,
VideoMode mode = getSavedVidMode();
if(width <= mode.screen_w && height <= mode.screen_h)
{
// Set window title and icon
setWindowTitle(title);
if(myInitializedCount == 1) setWindowIcon();
if(initSubsystem(mode, useFullscreen))
{
centerAppWindow(mode);
@ -165,10 +162,13 @@ FBInitStatus FrameBuffer::initialize(const string& title,
myMsg.surface = surface(surfaceID);
}
// Finally, show some information about the framebuffer,
// but only on the first initialization
// Take care of some items that are only done once per framebuffer creation.
if(myInitializedCount == 1)
{
myOSystem->logMessage(about(), 1);
setUIPalette();
setWindowIcon();
}
return kSuccess;
}
@ -654,14 +654,14 @@ void FrameBuffer::setTIAPalette(const uInt32* palette)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setUIPalette(const uInt32* palette)
void FrameBuffer::setUIPalette()
{
// Set palette for GUI
for(int i = 0, j = 256; i < kNumColors-256; ++i, ++j)
{
Uint8 r = (palette[i] >> 16) & 0xff;
Uint8 g = (palette[i] >> 8) & 0xff;
Uint8 b = palette[i] & 0xff;
Uint8 r = (ourGUIColors[i] >> 16) & 0xff;
Uint8 g = (ourGUIColors[i] >> 8) & 0xff;
Uint8 b = ourGUIColors[i] & 0xff;
myDefPalette[j] = mapRGB(r, g, b);
}
@ -1301,3 +1301,47 @@ FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = {
{ GFX_Zoom9x, "zoom9x", "Zoom 9x", 9, 0x3 },
{ GFX_Zoom10x, "zoom10x", "Zoom 10x", 10, 0x3 }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
Palette is defined as follows:
// Base colors
kColor Normal foreground color (non-text)
kBGColor Normal background color (non-text)
kShadowColor Item is disabled
kTextColor Normal text color
kTextColorHi Highlighted text color
kTextColorEm Emphasized text color
// UI elements (dialog and widgets)
kDlgColor Dialog background
kWidColor Widget background
kWidFrameColor Border for currently selected widget
// Button colors
kBtnColor Normal button background
kBtnColorHi Highlighted button background
kBtnTextColor Normal button font color
kBtnTextColorHi Highlighted button font color
// Checkbox colors
kCheckColor Color of 'X' in checkbox
// Scrollbar colors
kScrollColor Normal scrollbar color
kScrollColorHi Highlighted scrollbar color
// Debugger colors
kDbgChangedColor Background color for changed cells
kDbgChangedTextColor Text color for changed cells
kDbgColorHi Highlighted color in debugger data cells
*/
uInt32 FrameBuffer::ourGUIColors[kNumColors-256] = {
0x686868, 0x000000, 0x404040, 0x000000, 0x62a108, 0x9f0000,
0xc9af7c, 0xf0f0cf, 0xc80000,
0xac3410, 0xd55941, 0xffffff, 0xffd652,
0xac3410,
0xac3410, 0xd55941,
0xac3410, 0xd55941,
0xc80000, 0x00ff00, 0xc8c8ff
};

View File

@ -264,13 +264,6 @@ class FrameBuffer
*/
virtual void setTIAPalette(const uInt32* palette);
/**
Set up the user interface palette for a screen of any depth > 8.
@param palette The array of colors
*/
virtual void setUIPalette(const uInt32* palette);
/**
Informs the Framebuffer of a change in EventHandler state.
*/
@ -573,6 +566,11 @@ class FrameBuffer
*/
void centerAppWindow(const VideoMode& mode);
/**
Set up the user interface palette for a screen of any depth > 8.
*/
void setUIPalette();
private:
/**
This class implements an iterator around an array of VideoMode objects.
@ -645,6 +643,9 @@ class FrameBuffer
// Holds static strings for the remap menu (emulation and menu events)
static GraphicsMode ourGraphicsModes[GFX_NumModes];
// Holds UI palette data
static uInt32 ourGUIColors[kNumColors-256];
};

View File

@ -331,15 +331,6 @@ void OSystem::setConfigPaths()
mySettings->setValue("propsfile", node.getShortPath());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setUIPalette()
{
int palette = mySettings->getInt("uipalette") - 1;
if(palette < 0 || palette >= kNumUIPalettes) palette = 0;
myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]);
myFrameBuffer->refresh();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setBaseDir(const string& basedir)
{
@ -416,9 +407,6 @@ FBInitStatus OSystem::createFrameBuffer()
{
// Setup the SDL joysticks (must be done after FrameBuffer is created)
myEventHandler->setupJoysticks();
// Update the UI palette
setUIPalette();
}
return fbstatus;
@ -1002,62 +990,6 @@ bool OSystem::queryVideoHardware()
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
Palette is defined as follows:
// Base colors
kColor Normal foreground color (non-text)
kBGColor Normal background color (non-text)
kShadowColor Item is disabled
kTextColor Normal text color
kTextColorHi Highlighted text color
kTextColorEm Emphasized text color
// UI elements (dialog and widgets)
kDlgColor Dialog background
kWidColor Widget background
kWidFrameColor Border for currently selected widget
// Button colors
kBtnColor Normal button background
kBtnColorHi Highlighted button background
kBtnTextColor Normal button font color
kBtnTextColorHi Highlighted button font color
// Checkbox colors
kCheckColor Color of 'X' in checkbox
// Scrollbar colors
kScrollColor Normal scrollbar color
kScrollColorHi Highlighted scrollbar color
// Debugger colors
kDbgChangedColor Background color for changed cells
kDbgChangedTextColor Text color for changed cells
kDbgColorHi Highlighted color in debugger data cells
*/
uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
// Standard
{ 0x686868, 0x000000, 0x404040, 0x000000, 0x62a108, 0x9f0000,
0xc9af7c, 0xf0f0cf, 0xc80000,
0xac3410, 0xd55941, 0xffffff, 0xffd652,
0xac3410,
0xac3410, 0xd55941,
0xac3410, 0xd55941,
0xc80000, 0x00ff00, 0xc8c8ff
},
// Classic
{ 0x686868, 0x000000, 0x404040, 0x20a020, 0x00ff00, 0xc80000,
0x000000, 0x000000, 0xc80000,
0x000000, 0x000000, 0x20a020, 0x00ff00,
0x20a020,
0x20a020, 0x00ff00,
0x20a020, 0x00ff00,
0xc80000, 0x00ff00, 0xc8c8ff
}
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem(const OSystem& osystem)
{

View File

@ -271,11 +271,6 @@ class OSystem
*/
void setConfigPaths();
/**
Set the user-interface palette which is specified in current settings.
*/
void setUIPalette();
/**
Get the current framerate for the video system.
@ -598,7 +593,6 @@ class OSystem
static ZipHandler* myZipHandler;
private:
enum { kNumUIPalettes = 2 };
string myBaseDir;
string myStateDir;
string mySnapshotSaveDir;
@ -632,9 +626,6 @@ class OSystem
// Indicates whether the main processing loop should proceed
TimingInfo myTimingInfo;
// Table of RGB values for GUI elements
static uInt32 ourGUIColors[kNumUIPalettes][kNumColors-256];
private:
/**
Creates the various framebuffers/renderers available in this system

View File

@ -128,7 +128,6 @@ Settings::Settings(OSystem* osystem)
GUI::Size(DebuggerDialog::kMediumFontMinW,
DebuggerDialog::kMediumFontMinH));
#endif
setInternal("uipalette", "0");
setInternal("listdelay", "300");
setInternal("mwheel", "4");
@ -432,7 +431,6 @@ void Settings::usage()
<< " allroms| (exts is a ':' separated list of extensions)\n"
<< " exts\n"
<< " -romviewer <0|1|2> Show ROM info viewer at given zoom level in ROM launcher (0 for off)\n"
<< " -uipalette <1|2> Used the specified palette for UI elements\n"
<< " -listdelay <delay> Time to wait between keypresses in list widgets (300-1000)\n"
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in UI\n"
<< " -statedir <dir> Directory in which to save/load state files\n"

View File

@ -254,16 +254,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
lwidth = font.getStringWidth("Mouse wheel scroll: ");
pwidth = font.getStringWidth("Standard");
xpos = ypos = vBorder;
// UI Palette
ypos += 1;
items.clear();
items.push_back("Standard", "1");
items.push_back("Classic", "2");
myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Interface Palette: ", lwidth);
wid.push_back(myPalettePopup);
ypos += lineHeight + 4;
// Delay between quick-selecting characters in ListWidget
items.clear();
@ -365,10 +356,6 @@ void UIDialog::loadConfig()
myDebuggerFontStyle->setSelected(style, "0");
#endif
// UI palette
const string& pal = instance().settings().getString("uipalette");
myPalettePopup->setSelected(pal, "1");
// Listwidget quick delay
const string& delay = instance().settings().getString("listdelay");
myListDelayPopup->setSelected(delay, "300");
@ -409,10 +396,6 @@ void UIDialog::saveConfig()
instance().settings().setValue("dbg.fontstyle",
myDebuggerFontStyle->getSelectedTag().toString());
// UI palette
instance().settings().setValue("uipalette",
myPalettePopup->getSelectedTag().toString());
// Listwidget quick delay
instance().settings().setValue("listdelay",
myListDelayPopup->getSelectedTag().toString());
@ -458,7 +441,6 @@ void UIDialog::setDefaults()
}
case 2: // Misc. options
myPalettePopup->setSelected("1");
myListDelayPopup->setSelected("300");
myWheelLinesPopup->setSelected("4");
break;
@ -517,7 +499,6 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kOKCmd:
saveConfig();
close();
instance().setUIPalette();
break;
case kDefaultsCmd:

View File

@ -58,7 +58,6 @@ class UIDialog : public Dialog
PopUpWidget* myDebuggerFontStyle;
// Misc options
PopUpWidget* myPalettePopup;
PopUpWidget* myListDelayPopup;
PopUpWidget* myWheelLinesPopup;