Changed VideoDialog so that it shows the current framebuffer type,

and allows you to change it for the next Stella run, but doesn't
actually change it for this run (since Stella now has to be
restarted for toggling between software and OpenGL mode).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1575 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-12-26 21:39:17 +00:00
parent 5147356c96
commit 311c0f717f
3 changed files with 36 additions and 48 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OptionsDialog.cxx,v 1.73 2008-12-26 20:05:17 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.74 2008-12-26 21:39:17 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -119,7 +119,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
int x = 0, y = 0, w, h; int x = 0, y = 0, w, h;
// Now create all the dialogs attached to each menu button // Now create all the dialogs attached to each menu button
w = 410; h = 280; w = 410; h = 300;
myVideoDialog = new VideoDialog(osystem, parent, font, x, y, w, h); myVideoDialog = new VideoDialog(osystem, parent, font, x, y, w, h);
w = 285; h = 200; w = 285; h = 200;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: VideoDialog.cxx,v 1.56 2008-12-26 20:05:17 stephena Exp $ // $Id: VideoDialog.cxx,v 1.57 2008-12-26 21:39:17 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -27,6 +27,7 @@
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Menu.hxx" #include "Menu.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "Console.hxx" #include "Console.hxx"
#include "Settings.hxx" #include "Settings.hxx"
@ -47,21 +48,27 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
int xpos, ypos; int xpos, ypos;
int lwidth = font.getStringWidth("Dirty Rects: "), int lwidth = font.getStringWidth("Dirty Rects: "),
pwidth = font.getStringWidth("1920x1200"); pwidth = font.getStringWidth("1920x1200"),
fwidth = font.getStringWidth("Renderer: ");
WidgetArray wid; WidgetArray wid;
StringMap items; StringMap items;
xpos = 5; ypos = 10; xpos = 5; ypos = 10;
// Video renderer // Video renderer
new StaticTextWidget(this, font, xpos + (lwidth-fwidth), ypos, fwidth,
fontHeight, "Renderer:", kTextAlignLeft);
myRenderer = new EditTextWidget(this, font, xpos+lwidth, ypos,
pwidth, fontHeight, "");
ypos += lineHeight + 4;
items.clear(); items.clear();
items.push_back("Software", "soft"); items.push_back("Software", "soft");
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
items.push_back("OpenGL", "gl"); items.push_back("OpenGL", "gl");
#endif #endif
myRendererPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, myRendererPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
items, "Renderer: ", lwidth, items, "(*) ", lwidth);
kRendererChanged);
wid.push_back(myRendererPopup); wid.push_back(myRendererPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
@ -202,12 +209,25 @@ VideoDialog::~VideoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::loadConfig() void VideoDialog::loadConfig()
{ {
// Renderer setting bool gl = (instance().frameBuffer().type() == kGLBuffer);
// Renderer settings
myRenderer->setEditString(gl ? "OpenGL" : "Software");
myRendererPopup->setSelected( myRendererPopup->setSelected(
instance().settings().getString("video"), "soft"); instance().settings().getString("video"), "soft");
// TIA Filter // TIA Filter
// taken care of in ::handleRendererChange() // These are dynamically loaded, since they depend on the size of
// the desktop and which renderer we're using
const StringMap& items =
instance().frameBuffer().supportedTIAFilters(gl ? "gl" : "soft");
myTIAFilterPopup->addItems(items);
myTIAFilterPopup->setSelected(instance().settings().getString("tia_filter"),
#ifdef SMALL_SCREEN
"zoom1x");
#else
"zoom2x");
#endif
// TIA Palette // TIA Palette
myTIAPalettePopup->setSelected( myTIAPalettePopup->setSelected(
@ -220,14 +240,18 @@ void VideoDialog::loadConfig()
// GL Filter setting // GL Filter setting
myGLFilterPopup->setSelected( myGLFilterPopup->setSelected(
instance().settings().getString("gl_filter"), "linear"); instance().settings().getString("gl_filter"), "linear");
myGLFilterPopup->setEnabled(gl);
// GL stretch setting // GL stretch setting
myGLStretchPopup->setSelected( myGLStretchPopup->setSelected(
instance().settings().getString("gl_fsmax"), "never"); instance().settings().getString("gl_fsmax"), "never");
myGLStretchPopup->setEnabled(gl);
// GL aspect ratio setting // GL aspect ratio setting
myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect")); myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect"));
myAspectRatioSlider->setEnabled(gl);
myAspectRatioLabel->setLabel(instance().settings().getString("gl_aspect")); myAspectRatioLabel->setLabel(instance().settings().getString("gl_aspect"));
myAspectRatioLabel->setEnabled(gl);
// Framerate (0 or -1 means disabled) // Framerate (0 or -1 means disabled)
int rate = instance().settings().getInt("framerate"); int rate = instance().settings().getInt("framerate");
@ -245,13 +269,10 @@ void VideoDialog::loadConfig()
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync")); myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync"));
myUseVSyncCheckbox->setEnabled(gl);
// Center window // Center window
myCenterCheckbox->setState(instance().settings().getBool("center")); myCenterCheckbox->setState(instance().settings().getBool("center"));
// Make sure that mutually-exclusive items are not enabled at the same time
// Also, this sets the TIA filters, so it cannot be removed from here
handleRendererChange(myRendererPopup->getSelectedTag());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -329,38 +350,9 @@ void VideoDialog::setDefaults()
myCenterCheckbox->setState(true); myCenterCheckbox->setState(true);
// Make sure that mutually-exclusive items are not enabled at the same time // Make sure that mutually-exclusive items are not enabled at the same time
handleRendererChange("soft");
handleFullscreenChange(false); handleFullscreenChange(false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleRendererChange(const string& mode)
{
// TIA filters are dynamically loaded, since they depend on the size of
// the desktop and which renderer we're using
const StringMap& items = instance().frameBuffer().supportedTIAFilters(mode);
myTIAFilterPopup->addItems(items);
myTIAFilterPopup->setSelected(instance().settings().getString("tia_filter"),
#ifdef SMALL_SCREEN
"zoom1x");
#else
"zoom2x");
#endif
#ifdef DISPLAY_OPENGL
// When we're in software mode, certain OpenGL-related options are disabled
bool gl = (mode == "gl");
myGLFilterPopup->setEnabled(gl);
myGLStretchPopup->setEnabled(gl);
myAspectRatioSlider->setEnabled(gl);
myAspectRatioLabel->setEnabled(gl);
myUseVSyncCheckbox->setEnabled(gl);
#endif
_dirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleFullscreenChange(bool enable) void VideoDialog::handleFullscreenChange(bool enable)
{ {
@ -386,10 +378,6 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
setDefaults(); setDefaults();
break; break;
case kRendererChanged:
handleRendererChange(myRendererPopup->getSelectedTag());
break;
case kAspectRatioChanged: case kAspectRatioChanged:
myAspectRatioLabel->setValue(myAspectRatioSlider->getValue()); myAspectRatioLabel->setValue(myAspectRatioSlider->getValue());
break; break;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: VideoDialog.hxx,v 1.24 2008-07-25 12:41:41 stephena Exp $ // $Id: VideoDialog.hxx,v 1.25 2008-12-26 21:39:17 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -24,6 +24,7 @@
class CommandSender; class CommandSender;
class DialogContainer; class DialogContainer;
class EditTextWidget;
class PopUpWidget; class PopUpWidget;
class SliderWidget; class SliderWidget;
class StaticTextWidget; class StaticTextWidget;
@ -45,11 +46,11 @@ class VideoDialog : public Dialog
void saveConfig(); void saveConfig();
void setDefaults(); void setDefaults();
void handleRendererChange(const string& mode);
void handleFullscreenChange(bool enable); void handleFullscreenChange(bool enable);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
private: private:
EditTextWidget* myRenderer;
PopUpWidget* myRendererPopup; PopUpWidget* myRendererPopup;
PopUpWidget* myTIAFilterPopup; PopUpWidget* myTIAFilterPopup;
PopUpWidget* myTIAPalettePopup; PopUpWidget* myTIAPalettePopup;
@ -67,7 +68,6 @@ class VideoDialog : public Dialog
CheckboxWidget* myCenterCheckbox; CheckboxWidget* myCenterCheckbox;
enum { enum {
kRendererChanged = 'VDrd',
kAspectRatioChanged = 'VDar', kAspectRatioChanged = 'VDar',
kFrameRateChanged = 'VDfr', kFrameRateChanged = 'VDfr',
kFullScrChanged = 'VDfs' kFullScrChanged = 'VDfs'