Almost completely finished the Video Dialog interface. Only six more

to go :)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@384 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-03-26 04:19:56 +00:00
parent a4376c52cf
commit 7e3c3de3ce
9 changed files with 256 additions and 97 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: mainSDL.cxx,v 1.28 2005-03-14 04:08:13 stephena Exp $ // $Id: mainSDL.cxx,v 1.29 2005-03-26 04:19:53 stephena Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -845,6 +845,10 @@ int main(int argc, char* argv[])
return 0; return 0;
} }
// Finally, make sure the settings are valid
// We do it once here, so the rest of the program can assume valid settings
//FIXME theSettings->validate();
// Create the event handler for the system // Create the event handler for the system
theEventHandler = new EventHandler(theOSystem); theEventHandler = new EventHandler(theOSystem);

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: Settings.cxx,v 1.33 2005-02-22 18:41:12 stephena Exp $ // $Id: Settings.cxx,v 1.34 2005-03-26 04:19:56 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -40,11 +40,9 @@ Settings::Settings(OSystem* osystem)
// Now fill it with options that are common to all versions of Stella // Now fill it with options that are common to all versions of Stella
set("video", "soft"); set("video", "soft");
set("video_driver", ""); set("video_driver", "");
#ifdef DISPLAY_OPENGL
set("gl_filter", "nearest"); set("gl_filter", "nearest");
set("gl_aspect", "2"); set("gl_aspect", "2.0");
set("gl_fsmax", "false"); set("gl_fsmax", "false");
#endif
set("sound", "true"); set("sound", "true");
set("fragsize", "512"); set("fragsize", "512");
set("fullscreen", "false"); set("fullscreen", "false");
@ -60,11 +58,9 @@ Settings::Settings(OSystem* osystem)
set("mergeprops", "false"); set("mergeprops", "false");
set("paddle", "0"); set("paddle", "0");
set("palette", "standard"); set("palette", "standard");
#ifdef SNAPSHOT_SUPPORT
set("ssdir", "."); set("ssdir", ".");
set("ssname", "romname"); set("ssname", "romname");
set("sssingle", "false"); set("sssingle", "false");
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: Dialog.cxx,v 1.7 2005-03-15 22:28:05 stephena Exp $ // $Id: Dialog.cxx,v 1.8 2005-03-26 04:19:56 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
@ -75,7 +75,6 @@ void Dialog::open()
// Load the config only on the first open (ie, since close was last called) // Load the config only on the first open (ie, since close was last called)
if(_openCount++ == 0) if(_openCount++ == 0)
loadConfig(); loadConfig();
cerr << "_openCount = " << _openCount << endl;
Widget* w = _firstWidget; Widget* w = _firstWidget;

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: GuiUtils.hxx,v 1.2 2005-03-14 04:08:15 stephena Exp $ // $Id: GuiUtils.hxx,v 1.3 2005-03-26 04:19:56 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
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.2 2005-03-14 04:08:15 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.3 2005-03-26 04:19:56 stephena Exp $
*/ */
// Colors indices to use for the various GUI elements // Colors indices to use for the various GUI elements
@ -41,10 +41,16 @@ enum OverlayColor {
kTextColorHi kTextColorHi
}; };
// Standard entries for OK/Cancel buttons // The commands generated by various widgets
enum { enum {
kOKCmd = 'ok ', kOKCmd = 'ok ',
kCloseCmd = 'clos' kCloseCmd = 'clos',
kDefaultsCmd,
kRendererChanged,
kVolumeChanged,
kAspectRatioChanged,
kFrameRateChanged,
kZoomChanged
}; };
static const string EmptyString(""); static const string EmptyString("");

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: PopUpWidget.cxx,v 1.1 2005-03-14 04:08:15 stephena Exp $ // $Id: PopUpWidget.cxx,v 1.2 2005-03-26 04:19:56 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
@ -100,6 +100,9 @@ void PopUpDialog::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCou
_clickY = -1; _clickY = -1;
_openTime = (uInt32)-1; _openTime = (uInt32)-1;
if(_popUpBoss->_cmd)
_popUpBoss->sendCommand(_popUpBoss->_cmd, _selection);
// We remove the dialog and delete the dialog when the user has selected an item // We remove the dialog and delete the dialog when the user has selected an item
_popUpBoss->instance()->menu().removeDialog(); _popUpBoss->instance()->menu().removeDialog();
delete this; delete this;
@ -263,11 +266,12 @@ void PopUpDialog::drawMenuEntry(Int32 entry, bool hilite)
// //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PopUpWidget::PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h, PopUpWidget::PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
const string& label, uInt32 labelWidth) const string& label, uInt32 labelWidth, Int32 cmd)
: Widget(boss, x, y - 1, w, h + 2), : Widget(boss, x, y - 1, w, h + 2),
CommandSender(boss), CommandSender(boss),
_label(label), _label(label),
_labelWidth(labelWidth) _labelWidth(labelWidth),
_cmd(cmd)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kPopUpWidget; _type = kPopUpWidget;

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: PopUpWidget.hxx,v 1.1 2005-03-14 04:08:15 stephena Exp $ // $Id: PopUpWidget.hxx,v 1.2 2005-03-26 04:19:56 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
@ -64,7 +64,7 @@ class PopUpWidget : public Widget, public CommandSender
public: public:
PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h, PopUpWidget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h,
const string& label, uInt32 labelWidth = 0); const string& label, uInt32 labelWidth = 0, Int32 cmd = 0);
void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount); void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount);
@ -84,6 +84,9 @@ class PopUpWidget : public Widget, public CommandSender
protected: protected:
void drawWidget(bool hilite); void drawWidget(bool hilite);
protected:
uInt32 _cmd;
private: private:
PopUpDialog* myPopUpDialog; PopUpDialog* myPopUpDialog;
}; };

View File

@ -13,12 +13,14 @@
// 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.2 2005-03-15 22:28:05 stephena Exp $ // $Id: VideoDialog.cxx,v 1.3 2005-03-26 04:19:56 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
//============================================================================ //============================================================================
#include <sstream>
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "Menu.hxx" #include "Menu.hxx"
@ -39,73 +41,80 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h)
: Dialog(osystem, x, y, w, h), : Dialog(osystem, x, y, w, h)
myDriver(NULL)
{ {
int yoff = 10; int yoff = 10,
const int xoff = 2; xoff = 2,
const int woff = _w - 120; woff = _w - 130,
const int labelWidth = 65; labelWidth = 65;
// Video driver (query FrameBuffer for what's supported) // Video driver (query OSystem for what's supported)
myDriver = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "(*)Driver: ", labelWidth); myDriverPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
myDriver->appendEntry("<default>", 0); "(*)Driver: ", labelWidth);
myDriver->appendEntry(""); myDriverPopup->appendEntry("First one", 1);
myDriver->appendEntry("First one", 1); myDriverPopup->appendEntry("Another one", 2);
myDriver->appendEntry("Another one", 2);
yoff += kVideoRowHeight + 4; yoff += kVideoRowHeight + 4;
// Video renderer // Video renderer
myRenderer = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "(*)Renderer: ", labelWidth); myRendererPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
myRenderer->appendEntry("<default>", 0); "(*)Renderer: ", labelWidth, kRendererChanged);
myRenderer->appendEntry(""); myRendererPopup->appendEntry("Software", 1);
myRenderer->appendEntry("Software", 1); myRendererPopup->appendEntry("OpenGL", 2);
myRenderer->appendEntry("OpenGL", 2);
yoff += kVideoRowHeight + 4; yoff += kVideoRowHeight + 4;
// Video filter // Video filter
myFilter = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "Filter: ", labelWidth); myFilterPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
myFilter->appendEntry("<default>", 0); "GL Filter: ", labelWidth);
myFilter->appendEntry(""); myFilterPopup->appendEntry("Linear", 1);
myFilter->appendEntry("Linear", 1); myFilterPopup->appendEntry("Nearest", 2);
myFilter->appendEntry("Nearest", 2);
yoff += kVideoRowHeight + 4; yoff += kVideoRowHeight + 4;
// Aspect ratio FIXME - maybe this should be a slider ?? // Aspect ratio
myAspectRatio = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "(*)Aspect: ", labelWidth); myAspectRatioSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
myAspectRatio->appendEntry("<default>", 0); "(*)GL Aspect: ", labelWidth, kAspectRatioChanged);
myAspectRatio->appendEntry(""); myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
myAspectRatio->appendEntry("1.0", 1); myAspectRatioLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 24, kLineHeight,
myAspectRatio->appendEntry("1.1", 2); "", kTextAlignLeft);
myAspectRatio->appendEntry("1.2", 3); myAspectRatioLabel->setFlags(WIDGET_CLEARBG);
myAspectRatio->appendEntry("1.3", 4);
myAspectRatio->appendEntry("1.4", 5);
/*
myAspectRatio->appendEntry("1.5", 6);
myAspectRatio->appendEntry("1.6", 7);
myAspectRatio->appendEntry("1.7", 8);
myAspectRatio->appendEntry("1.8", 9);
myAspectRatio->appendEntry("1.9", 10);
myAspectRatio->appendEntry("2.0", 11);
*/
yoff += kVideoRowHeight + 4; yoff += kVideoRowHeight + 4;
// Palette // Palette
myPalette = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "Palette: ", labelWidth); myPalettePopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "Palette: ", labelWidth);
myPalette->appendEntry("<default>", 0); myPalettePopup->appendEntry("Standard", 1);
myPalette->appendEntry(""); myPalettePopup->appendEntry("Original", 2);
myPalette->appendEntry("Standard", 1); myPalettePopup->appendEntry("Z26", 3);
myPalette->appendEntry("Original", 2);
myPalette->appendEntry("Z26", 3);
yoff += kVideoRowHeight + 4; yoff += kVideoRowHeight + 4;
// Add OK & Cancel buttons // Move over to the next column
yoff = 10;
xoff = xoff + 115;
// Framerate
myFrameRateSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
"Framerate: ", labelWidth, kFrameRateChanged);
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
myFrameRateLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
// Zoom level
myZoomSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
"Zoom: ", labelWidth, kZoomChanged);
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
myZoomLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myZoomLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
// Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif #endif
// FIXME - get list of video drivers from OSystem // FIXME - get list of video drivers from OSystem
@ -113,6 +122,8 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
// for (; l->code; ++l) { // for (; l->code; ++l) {
// _langPopUp->appendEntry(l->description, l->id); // _langPopUp->appendEntry(l->description, l->id);
// } // }
setDefaults();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -123,59 +134,156 @@ VideoDialog::~VideoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::loadConfig() void VideoDialog::loadConfig()
{ {
cerr << "VideoDialog::loadConfig()\n";
string s; string s;
bool b; bool b;
uInt32 i; uInt32 i;
float f;
// Driver setting // Driver setting
myDriver->setSelectedTag(0); // FIXME myDriverPopup->setSelectedTag(0); // FIXME
// Renderer setting // Renderer setting
s = instance()->settings().getString("video"); s = instance()->settings().getString("video");
if(s == "soft") if(s == "soft")
myRenderer->setSelectedTag(1); myRendererPopup->setSelectedTag(1);
else if(s == "gl") else if(s == "gl")
myRenderer->setSelectedTag(2); myRendererPopup->setSelectedTag(2);
else
myRenderer->setSelectedTag(0);
// Filter setting // Filter setting
s = instance()->settings().getString("gl_filter"); s = instance()->settings().getString("gl_filter");
if(s == "linear") if(s == "linear")
myFilter->setSelectedTag(1); myFilterPopup->setSelectedTag(1);
else if(s == "nearest") else if(s == "nearest")
myFilter->setSelectedTag(2); myFilterPopup->setSelectedTag(2);
else
myFilter->setSelectedTag(0);
// Aspect ratio // Aspect ratio - another huge hack
s = instance()->settings().getString("gl_aspect"); s = instance()->settings().getString("gl_aspect");
// TODO f = instance()->settings().getFloat("gl_aspect");
if(f == -1.0)
{
f = 1.1;
s = "1.1";
}
else if(f < 1.1)
{
f = 1.1;
s = "1.1";
}
else if(f > 2.0)
{
f = 2.0;
s = "2.0";
}
i = (uInt32)((f * 10) - 10) * 10;
myAspectRatioSlider->setValue(i);
myAspectRatioLabel->setLabel(s);
// Palette // Palette
// Filter setting
s = instance()->settings().getString("palette"); s = instance()->settings().getString("palette");
if(s == "standard") if(s == "standard")
myPalette->setSelectedTag(1); myPalettePopup->setSelectedTag(1);
else if(s == "original") else if(s == "original")
myPalette->setSelectedTag(2); myPalettePopup->setSelectedTag(2);
else if(s == "z26") else if(s == "z26")
myPalette->setSelectedTag(3); myPalettePopup->setSelectedTag(3);
else
myPalette->setSelectedTag(0); // Framerate
myFrameRateSlider->setValue(instance()->settings().getInt("framerate"));
myFrameRateLabel->setLabel(instance()->settings().getString("framerate"));
// Zoom
i = (instance()->settings().getInt("zoom") - 1) * 10;
myZoomSlider->setValue(i);
myZoomLabel->setLabel(instance()->settings().getString("zoom"));
// Make sure that mutually-exclusive items are not enabled at the same time
i = myRendererPopup->getSelectedTag() - 1;
handleRendererChange(i);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::saveConfig() void VideoDialog::saveConfig()
{ {
cerr << "VideoDialog::saveConfig()\n";
string s; string s;
uInt32 i;
// Driver setting
instance()->settings().setString("video_driver", ""); // FIXME
// Renderer setting
i = myRendererPopup->getSelectedTag();
if(i == 1)
instance()->settings().setString("video", "soft");
else if(i == 2)
instance()->settings().setString("video", "gl");
// Filter setting
i = myFilterPopup->getSelectedTag();
if(i == 1)
instance()->settings().setString("gl_filter", "linear");
else if(i == 2)
instance()->settings().setString("gl_filter", "nearest");
// FIXME - immediately change the filtering
// Aspect ratio
s = myAspectRatioLabel->getLabel();
instance()->settings().setString("gl_aspect", s);
// Palette // Palette
s = myPalette->getSelectedString(); i = myPalettePopup->getSelectedTag();
instance()->settings().setString("palette", s); if(i == 1)
instance()->settings().setString("palette", "standard");
else if(i == 2)
instance()->settings().setString("palette", "original");
else if(i == 3)
instance()->settings().setString("palette", "z26");
s = myPalettePopup->getSelectedString();
instance()->settings().setString("palette", s); // FIXME - make this more efficient
instance()->console().togglePalette(s); instance()->console().togglePalette(s);
// Framerate
i = myFrameRateSlider->getValue();
instance()->settings().setInt("framerate", i);
// FIXME - immediately change the framerate
// Zoom
i = (myZoomSlider->getValue() / 10) + 1;
instance()->settings().setInt("zoom", i);
// FIXME - immediately change the zoom
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::setDefaults()
{
myDriverPopup->setSelectedTag(0);
myRendererPopup->setSelectedTag(1);
myFilterPopup->setSelectedTag(1);
myPalettePopup->setSelectedTag(1);
myFrameRateSlider->setValue(60);
myFrameRateLabel->setLabel("60");
// For some unknown reason (ie, a bug), slider widgets can only
// take certain ranges of numbers. So we have to fudge things ...
myZoomSlider->setValue(10);
myZoomLabel->setLabel("2");
myAspectRatioSlider->setValue(100);
myAspectRatioLabel->setLabel("2.0");
// Make sure that mutually-exclusive items are not enabled at the same time
handleRendererChange(0); // 0 indicates software mode
instance()->frameBuffer().refresh();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleRendererChange(uInt32 item)
{
// When we're in software mode, certain OpenGL-related options are disabled
bool active = item == 0 ? false : true;
myFilterPopup->setEnabled(active);
myAspectRatioSlider->setEnabled(active);
myAspectRatioLabel->setEnabled(active);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -188,6 +296,35 @@ void VideoDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data)
close(); close();
break; break;
case kDefaultsCmd:
setDefaults();
break;
case kRendererChanged:
handleRendererChange(data);
break;
case kAspectRatioChanged:
{
// This is terribly dirty, but what can we do?
float ratio = (((myAspectRatioSlider->getValue() + 9) / 10) / 10.0) + 1.0;
ostringstream r;
if(ratio == 2.0)
r << ratio << ".0";
else
r << ratio;
myAspectRatioLabel->setLabel(r.str());
break;
}
case kFrameRateChanged:
myFrameRateLabel->setValue(myFrameRateSlider->getValue());
break;
case kZoomChanged:
myZoomLabel->setValue((myZoomSlider->getValue() + 10) / 10);
break;
default: default:
Dialog::handleCommand(sender, cmd, data); Dialog::handleCommand(sender, cmd, data);
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.1 2005-03-14 04:08:15 stephena Exp $ // $Id: VideoDialog.hxx,v 1.2 2005-03-26 04:19:56 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
@ -25,6 +25,8 @@
class CommandSender; class CommandSender;
class Dialog; class Dialog;
class PopUpWidget; class PopUpWidget;
class SliderWidget;
class StaticTextWidget;
#include "OSystem.hxx" #include "OSystem.hxx"
#include "bspf.hxx" #include "bspf.hxx"
@ -38,15 +40,23 @@ class VideoDialog : public Dialog
virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data);
protected: protected:
PopUpWidget* myDriver; PopUpWidget* myDriverPopup;
PopUpWidget* myRenderer; PopUpWidget* myRendererPopup;
PopUpWidget* myFilter; PopUpWidget* myFilterPopup;
PopUpWidget* myAspectRatio; SliderWidget* myAspectRatioSlider;
PopUpWidget* myPalette; StaticTextWidget* myAspectRatioLabel;
PopUpWidget* myPalettePopup;
SliderWidget* myFrameRateSlider;
StaticTextWidget* myFrameRateLabel;
SliderWidget* myZoomSlider;
StaticTextWidget* myZoomLabel;
private: private:
void loadConfig(); void loadConfig();
void saveConfig(); void saveConfig();
void setDefaults();
void handleRendererChange(uInt32 item);
}; };
#endif #endif

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: Widget.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $ // $Id: Widget.hxx,v 1.7 2005-03-26 04:19:56 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
@ -56,7 +56,7 @@ enum {
}; };
enum { enum {
kButtonWidth = 72, kButtonWidth = 50,
kButtonHeight = 16 kButtonHeight = 16
}; };
@ -64,7 +64,7 @@ enum {
This is the base class for all widgets. This is the base class for all widgets.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Widget.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $ @version $Id: Widget.hxx,v 1.7 2005-03-26 04:19:56 stephena Exp $
*/ */
class Widget : public GuiObject class Widget : public GuiObject
{ {