Some restructuring and cleanup of PopUpWidget/ContextMenu functionality.

Those widgets now take two items per entry; the string to display, and
the one to use (in essence a key/value pair).  This really shortens the
code in quite a few places.

TIA graphical filters are now selectable from the UI, and correctly change
video mode (in TIA mode).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1545 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-07-25 12:41:41 +00:00
parent b1ac5bd951
commit a661d6b804
19 changed files with 430 additions and 693 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: RiotWidget.cxx,v 1.6 2008-06-13 13:14:50 stephena Exp $ // $Id: RiotWidget.cxx,v 1.7 2008-07-25 12:41:41 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
@ -91,7 +91,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = 9 * fontWidth, col = 0; int xpos = 10, ypos = 25, lwidth = 9 * fontWidth, col = 0;
StaticTextWidget* t; StaticTextWidget* t;
StringList items; StringMap items;
// Set the strings to be used in the various bit registers // Set the strings to be used in the various bit registers
// We only do this once because it's the state that changes, not the strings // We only do this once because it's the state that changes, not the strings
@ -159,8 +159,8 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
lwidth = font.getStringWidth("P0 Diff: "); lwidth = font.getStringWidth("P0 Diff: ");
xpos = col; ypos += 3 * lineHeight; xpos = col; ypos += 3 * lineHeight;
items.clear(); items.clear();
items.push_back("B/easy"); items.push_back("B/easy", "b");
items.push_back("A/hard"); items.push_back("A/hard", "a");
myP0Diff = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight, items, myP0Diff = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight, items,
"P0 Diff: ", lwidth, kP0DiffChanged); "P0 Diff: ", lwidth, kP0DiffChanged);
myP0Diff->setTarget(this); myP0Diff->setTarget(this);
@ -174,8 +174,8 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
// TV Type // TV Type
ypos += myP1Diff->getHeight() + 5; ypos += myP1Diff->getHeight() + 5;
items.clear(); items.clear();
items.push_back("B&W"); items.push_back("B&W", "bw");
items.push_back("Color"); items.push_back("Color", "color");
myTVType = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight, items, myTVType = new PopUpWidget(boss, font, xpos, ypos, pwidth, lineHeight, items,
"TV Type: ", lwidth, kTVTypeChanged); "TV Type: ", lwidth, kTVTypeChanged);
myTVType->setTarget(this); myTVType->setTarget(this);
@ -345,11 +345,11 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
break; break;
case kP0DiffChanged: case kP0DiffChanged:
riot.diffP0((bool)myP0Diff->getSelected()); riot.diffP0(myP0Diff->getSelectedTag() != "b");
break; break;
case kP1DiffChanged: case kP1DiffChanged:
riot.diffP1((bool)myP1Diff->getSelected()); riot.diffP1(myP1Diff->getSelectedTag() != "b");
break; break;
case kTVTypeChanged: case kTVTypeChanged:

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: RomListWidget.cxx,v 1.14 2008-06-19 12:01:30 stephena Exp $ // $Id: RomListWidget.cxx,v 1.15 2008-07-25 12:41:41 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
@ -32,10 +32,10 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
{ {
_type = kRomListWidget; _type = kRomListWidget;
StringList l; StringMap l;
// l.push_back("Add bookmark"); // l.push_back("Add bookmark");
l.push_back("Save ROM"); l.push_back("Save ROM", "saverom");
l.push_back("Set PC"); l.push_back("Set PC", "setpc");
myMenu = new ContextMenu(this, font, l); myMenu = new ContextMenu(this, font, l);
// Take advantage of a wide debugger window when possible // Take advantage of a wide debugger window when possible

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: RomWidget.cxx,v 1.26 2008-06-19 19:15:44 stephena Exp $ // $Id: RomWidget.cxx,v 1.27 2008-07-25 12:41:41 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
@ -126,15 +126,15 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kCMenuItemSelectedCmd: case kCMenuItemSelectedCmd:
{ {
const string& rmb = myRomList->myMenu->getSelectedString(); const string& rmb = myRomList->myMenu->getSelectedTag();
if(rmb == "Save ROM") if(rmb == "saverom")
{ {
mySaveRom->show(_x + 50, _y + 80); mySaveRom->show(_x + 50, _y + 80);
mySaveRom->setTitle(""); mySaveRom->setTitle("");
mySaveRom->setEmitSignal(kRomNameEntered); mySaveRom->setEmitSignal(kRomNameEntered);
} }
else if(rmb == "Set PC") else if(rmb == "setpc")
setPC(myRomList->getSelected()); setPC(myRomList->getSelected());
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: TiaOutputWidget.cxx,v 1.17 2008-06-19 12:01:30 stephena Exp $ // $Id: TiaOutputWidget.cxx,v 1.18 2008-07-25 12:41:41 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
@ -44,10 +44,10 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
_type = kTiaOutputWidget; _type = kTiaOutputWidget;
// Create context menu for commands // Create context menu for commands
StringList l; StringMap l;
l.push_back("Fill to scanline"); l.push_back("Fill to scanline", "scanline");
l.push_back("Set breakpoint"); l.push_back("Set breakpoint", "bp");
l.push_back("Set zoom position"); l.push_back("Set zoom position", "zoom");
myMenu = new ContextMenu(this, font, l); myMenu = new ContextMenu(this, font, l);
} }
@ -109,36 +109,34 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
switch(cmd) switch(cmd)
{ {
case kCMenuItemSelectedCmd: case kCMenuItemSelectedCmd:
switch(myMenu->getSelected()) {
const string& rmb = myMenu->getSelectedTag();
if(rmb == "scanline")
{ {
case 0: ostringstream command;
int lines = myClickY + ystart -
instance().debugger().tiaDebug().scanlines();
if(lines > 0)
{ {
ostringstream command; command << "scanline #" << lines;
int lines = myClickY + ystart -
instance().debugger().tiaDebug().scanlines();
if(lines > 0)
{
command << "scanline #" << lines;
instance().debugger().parser().run(command.str());
}
break;
}
case 1:
{
ostringstream command;
int scanline = myClickY + ystart;
command << "breakif _scan==#" << scanline;
instance().debugger().parser().run(command.str()); instance().debugger().parser().run(command.str());
break;
} }
}
case 2: else if(rmb == "bp")
if(myZoom) {
myZoom->setPos(myClickX, myClickY); ostringstream command;
break; int scanline = myClickY + ystart;
command << "breakif _scan==#" << scanline;
instance().debugger().parser().run(command.str());
}
else if(rmb == "zoom")
{
if(myZoom)
myZoom->setPos(myClickX, myClickY);
} }
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: TiaZoomWidget.cxx,v 1.17 2008-06-19 12:01:30 stephena Exp $ // $Id: TiaZoomWidget.cxx,v 1.18 2008-07-25 12:41:41 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,10 +56,10 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
myYCenter = myNumRows >> 1; myYCenter = myNumRows >> 1;
// Create context menu for zoom levels // Create context menu for zoom levels
StringList l; StringMap l;
l.push_back("2x zoom"); l.push_back("2x zoom", "2");
l.push_back("4x zoom"); l.push_back("4x zoom", "4");
l.push_back("8x zoom"); l.push_back("8x zoom", "8");
myMenu = new ContextMenu(this, font, l); myMenu = new ContextMenu(this, font, l);
} }
@ -204,14 +204,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
{ {
case kCMenuItemSelectedCmd: case kCMenuItemSelectedCmd:
{ {
int item = myMenu->getSelected(), level = 0; int level = (int) atoi(myMenu->getSelectedTag().c_str());
if(item == 0)
level = 2;
else if(item == 1)
level = 4;
else if(item == 2)
level = 8;
if(level > 0) if(level > 0)
zoom(level); zoom(level);
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: FrameBuffer.cxx,v 1.136 2008-07-22 14:54:39 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.137 2008-07-25 12:41:41 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -625,21 +625,25 @@ uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const StringList& FrameBuffer::supportedTIAFilters(const string& type) const StringMap& FrameBuffer::supportedTIAFilters(const string& type)
{ {
myTIAFilters.clear(); uInt32 max_zoom = maxWindowSizeForScreen(320, 210,
myOSystem->desktopWidth(), myOSystem->desktopHeight());
#ifdef SMALL_SCREEN #ifdef SMALL_SCREEN
uInt32 firstmode = 0; uInt32 firstmode = 0;
#else #else
uInt32 firstmode = 1; uInt32 firstmode = 1;
#endif #endif
myTIAFilters.clear();
for(uInt32 i = firstmode; i < GFX_NumModes; ++i) for(uInt32 i = firstmode; i < GFX_NumModes; ++i)
{ {
// For now, just include all filters // For now, just include all filters
// This will change once OpenGL-only filters are added // This will change once OpenGL-only filters are added
myTIAFilters.push_back(ourGraphicsModes[i].description); if(ourGraphicsModes[i].zoom <= max_zoom)
cerr << ourGraphicsModes[i].description << endl; {
myTIAFilters.push_back(ourGraphicsModes[i].description,
ourGraphicsModes[i].name);
}
} }
return myTIAFilters; return myTIAFilters;
} }
@ -1073,14 +1077,14 @@ void FBSurface::drawString(const GUI::Font* font, const string& s,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = { FrameBuffer::GraphicsMode FrameBuffer::ourGraphicsModes[GFX_NumModes] = {
{ GFX_Zoom1x, "zoom1x", "Zoom 1x", 1 }, { GFX_Zoom1x, "zoom1x", "Zoom 1x", 1, 0x3 },
{ GFX_Zoom2x, "zoom2x", "Zoom 2x", 2 }, { GFX_Zoom2x, "zoom2x", "Zoom 2x", 2, 0x3 },
{ GFX_Zoom3x, "zoom3x", "Zoom 3x", 3 }, { GFX_Zoom3x, "zoom3x", "Zoom 3x", 3, 0x3 },
{ GFX_Zoom4x, "zoom4x", "Zoom 4x", 4 }, { GFX_Zoom4x, "zoom4x", "Zoom 4x", 4, 0x3 },
{ GFX_Zoom5x, "zoom5x", "Zoom 5x", 5 }, { GFX_Zoom5x, "zoom5x", "Zoom 5x", 5, 0x3 },
{ GFX_Zoom6x, "zoom6x", "Zoom 6x", 6 }, { GFX_Zoom6x, "zoom6x", "Zoom 6x", 6, 0x3 },
{ GFX_Zoom7x, "zoom7x", "Zoom 7x", 7 }, { GFX_Zoom7x, "zoom7x", "Zoom 7x", 7, 0x3 },
{ GFX_Zoom8x, "zoom8x", "Zoom 8x", 8 }, { GFX_Zoom8x, "zoom8x", "Zoom 8x", 8, 0x3 },
{ GFX_Zoom9x, "zoom9x", "Zoom 9x", 9 }, { GFX_Zoom9x, "zoom9x", "Zoom 9x", 9, 0x3 },
{ GFX_Zoom10x, "zoom10x", "Zoom 10x", 10 } { GFX_Zoom10x, "zoom10x", "Zoom 10x", 10, 0x3 }
}; };

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: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.102 2008-07-25 12:41:41 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -90,7 +90,7 @@ enum {
turn drawn here as well. turn drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.102 2008-07-25 12:41:41 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -223,7 +223,7 @@ class FrameBuffer
/** /**
Get the supported TIA filters for the given framebuffer type. Get the supported TIA filters for the given framebuffer type.
*/ */
const StringList& supportedTIAFilters(const string& type); const StringMap& supportedTIAFilters(const string& type);
/** /**
Set up the TIA/emulation palette for a screen of any depth > 8. Set up the TIA/emulation palette for a screen of any depth > 8.
@ -307,6 +307,7 @@ class FrameBuffer
const char* name; const char* name;
const char* description; const char* description;
uInt32 zoom; uInt32 zoom;
uInt8 avail; // 0x1 bit -> software, 0x2 bit -> opengl
}; };
// Contains all relevant info for the dimensions of an SDL screen // Contains all relevant info for the dimensions of an SDL screen
@ -382,7 +383,7 @@ class FrameBuffer
Uint32 myAvgPalette[256][256]; Uint32 myAvgPalette[256][256];
// Names of the TIA filters that can be used for this framebuffer // Names of the TIA filters that can be used for this framebuffer
StringList myTIAFilters; StringMap myTIAFilters;
private: private:
/** /**
@ -510,7 +511,7 @@ class FrameBuffer
FrameBuffer type. FrameBuffer type.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.101 2008-07-22 14:54:39 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.102 2008-07-25 12:41:41 stephena Exp $
*/ */
// Text alignment modes for drawString() // Text alignment modes for drawString()
enum TextAlignment { enum TextAlignment {

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: AudioDialog.cxx,v 1.28 2008-06-13 13:14:51 stephena Exp $ // $Id: AudioDialog.cxx,v 1.29 2008-07-25 12:41:41 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
@ -50,7 +50,7 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
int lwidth = font.getStringWidth("Fragment Size: "), int lwidth = font.getStringWidth("Fragment Size: "),
pwidth = font.getStringWidth("4096"); pwidth = font.getStringWidth("4096");
WidgetArray wid; WidgetArray wid;
StringList items; StringMap items;
// Set real dimensions // Set real dimensions
// _w = 35 * fontWidth + 10; // _w = 35 * fontWidth + 10;
@ -73,12 +73,12 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
// Fragment size // Fragment size
items.clear(); items.clear();
items.push_back("128"); items.push_back("128", "128");
items.push_back("256"); items.push_back("256", "256");
items.push_back("512"); items.push_back("512", "512");
items.push_back("1024"); items.push_back("1024", "1024");
items.push_back("2048"); items.push_back("2048", "2048");
items.push_back("4096"); items.push_back("4096", "4096");
myFragsizePopup = new PopUpWidget(this, font, xpos, ypos, myFragsizePopup = new PopUpWidget(this, font, xpos, ypos,
pwidth + myVolumeLabel->getWidth() - 4, lineHeight, pwidth + myVolumeLabel->getWidth() - 4, lineHeight,
items, "Fragment size: ", lwidth); items, "Fragment size: ", lwidth);
@ -87,11 +87,11 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
// Output frequency // Output frequency
items.clear(); items.clear();
items.push_back("11025"); items.push_back("11025", "11025");
items.push_back("22050"); items.push_back("22050", "22050");
items.push_back("31400"); items.push_back("31400", "31400");
items.push_back("44100"); items.push_back("44100", "44100");
items.push_back("48000"); items.push_back("48000", "48000");
myFreqPopup = new PopUpWidget(this, font, xpos, ypos, myFreqPopup = new PopUpWidget(this, font, xpos, ypos,
pwidth + myVolumeLabel->getWidth() - 4, lineHeight, pwidth + myVolumeLabel->getWidth() - 4, lineHeight,
items, "Output freq: ", lwidth); items, "Output freq: ", lwidth);
@ -136,50 +136,24 @@ AudioDialog::~AudioDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioDialog::loadConfig() void AudioDialog::loadConfig()
{ {
bool b;
int i;
// Volume // Volume
myVolumeSlider->setValue(instance().settings().getInt("volume")); myVolumeSlider->setValue(instance().settings().getInt("volume"));
myVolumeLabel->setLabel(instance().settings().getString("volume")); myVolumeLabel->setLabel(instance().settings().getString("volume"));
// Fragsize // Fragsize
i = instance().settings().getInt("fragsize"); myFragsizePopup->setSelected(instance().settings().getString("fragsize"), "512");
if(i == 128) i = 0;
else if(i == 256) i = 1;
else if(i == 512) i = 2;
else if(i == 1024) i = 3;
else if(i == 2048) i = 4;
else if(i == 4096) i = 5;
else i = 2; // default to '512'
myFragsizePopup->setSelected(i);
// Output frequency // Output frequency
i = instance().settings().getInt("freq"); myFreqPopup->setSelected(instance().settings().getString("freq"), "31400");
if(i == 11025) i = 0;
else if(i == 22050) i = 1;
else if(i == 31400) i = 2;
else if(i == 44100) i = 3;
else if(i == 48000) i = 4;
else i = 2; // default to '31400'
myFreqPopup->setSelected(i);
// TIA frequency // TIA frequency
i = instance().settings().getInt("tiafreq"); myTiaFreqPopup->setSelected(instance().settings().getString("tiafreq"), "31400");
if(i == 11025) i = 0;
else if(i == 22050) i = 1;
else if(i == 31400) i = 2;
else if(i == 44100) i = 3;
else if(i == 48000) i = 4;
else i = 2; // default to '31400'
myTiaFreqPopup->setSelected(i);
// Clip volume // Clip volume
b = instance().settings().getBool("clipvol"); myClipVolumeCheckbox->setState(instance().settings().getBool("clipvol"));
myClipVolumeCheckbox->setState(b);
// Enable sound // Enable sound
b = instance().settings().getBool("sound"); bool b = instance().settings().getBool("sound");
mySoundEnableCheckbox->setState(b); mySoundEnableCheckbox->setState(b);
// 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
@ -190,33 +164,24 @@ void AudioDialog::loadConfig()
void AudioDialog::saveConfig() void AudioDialog::saveConfig()
{ {
Settings& settings = instance().settings(); Settings& settings = instance().settings();
string s;
bool b;
int i;
// Volume // Volume
i = myVolumeSlider->getValue(); instance().sound().setVolume(myVolumeSlider->getValue());
instance().sound().setVolume(i);
// Fragsize // Fragsize
s = myFragsizePopup->getSelectedString(); settings.setString("fragsize", myFragsizePopup->getSelectedTag());
settings.setString("fragsize", s);
// Output frequency // Output frequency
s = myFreqPopup->getSelectedString(); settings.setString("freq", myFreqPopup->getSelectedTag());
settings.setString("freq", s);
// TIA frequency // TIA frequency
s = myTiaFreqPopup->getSelectedString(); settings.setString("tiafreq", myTiaFreqPopup->getSelectedTag());
settings.setString("tiafreq", s);
// Enable/disable volume clipping (requires a restart to take effect) // Enable/disable volume clipping (requires a restart to take effect)
b = myClipVolumeCheckbox->getState(); settings.setBool("clipvol", myClipVolumeCheckbox->getState());
settings.setBool("clipvol", b);
// Enable/disable sound (requires a restart to take effect) // Enable/disable sound (requires a restart to take effect)
b = mySoundEnableCheckbox->getState(); instance().sound().setEnabled(mySoundEnableCheckbox->getState());
instance().sound().setEnabled(b);
// Only force a re-initialization when necessary, since it can // Only force a re-initialization when necessary, since it can
// be a time-consuming operation // be a time-consuming operation
@ -230,9 +195,9 @@ void AudioDialog::setDefaults()
myVolumeSlider->setValue(100); myVolumeSlider->setValue(100);
myVolumeLabel->setLabel("100"); myVolumeLabel->setLabel("100");
myFragsizePopup->setSelected(2); // 512 bytes myFragsizePopup->setSelected("512", "");
myFreqPopup->setSelected(2); // 31400 Hz myFreqPopup->setSelected("31400", "");
myTiaFreqPopup->setSelected(2); // 31400 Hz myTiaFreqPopup->setSelected("31400", "");
myClipVolumeCheckbox->setState(true); myClipVolumeCheckbox->setState(true);
mySoundEnableCheckbox->setState(true); mySoundEnableCheckbox->setState(true);

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: ContextMenu.cxx,v 1.4 2008-06-19 19:15:44 stephena Exp $ // $Id: ContextMenu.cxx,v 1.5 2008-07-25 12:41:41 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,10 +27,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font, ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
const StringList& items, int cmd) const StringMap& items, int cmd)
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16), : Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
CommandSender(boss), CommandSender(boss),
_entries(items),
_currentItem(-1), _currentItem(-1),
_selectedItem(-1), _selectedItem(-1),
_rowHeight(font.getLineHeight()), _rowHeight(font.getLineHeight()),
@ -40,6 +39,21 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
_xorig(0), _xorig(0),
_yorig(0) _yorig(0)
{ {
addItems(items);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ContextMenu::~ContextMenu()
{
_entries.clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::addItems(const StringMap& items)
{
_entries.clear();
_entries = items;
// Create two columns of entries if there are more than 10 items // Create two columns of entries if there are more than 10 items
if(_entries.size() > 10) if(_entries.size() > 10)
{ {
@ -59,7 +73,7 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
int maxwidth = 0; int maxwidth = 0;
for(unsigned int i = 0; i < _entries.size(); ++i) for(unsigned int i = 0; i < _entries.size(); ++i)
{ {
int length = _font->getStringWidth(_entries[i]); int length = _font->getStringWidth(_entries[i].first);
if(length > maxwidth) if(length > maxwidth)
maxwidth = length; maxwidth = length;
} }
@ -69,12 +83,6 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
_h = _entriesPerColumn * _rowHeight + 4; _h = _entriesPerColumn * _rowHeight + 4;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ContextMenu::~ContextMenu()
{
_entries.clear();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::show(uInt32 x, uInt32 y, int item) void ContextMenu::show(uInt32 x, uInt32 y, int item)
{ {
@ -124,11 +132,21 @@ void ContextMenu::setSelected(int item)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ContextMenu::setSelected(const string& name) void ContextMenu::setSelected(const string& tag, const string& defaultTag)
{ {
for(unsigned int item = 0; item < _entries.size(); ++item) for(unsigned int item = 0; item < _entries.size(); ++item)
{ {
if(_entries[item] == name) if(BSPF_strcasecmp(_entries[item].second.c_str(), tag.c_str()) == 0)
{
setSelected(item);
return;
}
}
// If we get this far, the value wasn't found; use the default value
for(unsigned int item = 0; item < _entries.size(); ++item)
{
if(BSPF_strcasecmp(_entries[item].second.c_str(), defaultTag.c_str()) == 0)
{ {
setSelected(item); setSelected(item);
return; return;
@ -155,9 +173,15 @@ int ContextMenu::getSelected() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& ContextMenu::getSelectedString() const const string& ContextMenu::getSelectedName() const
{ {
return (_selectedItem >= 0) ? _entries[_selectedItem] : EmptyString; return (_selectedItem >= 0) ? _entries[_selectedItem].first : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& ContextMenu::getSelectedTag() const
{
return (_selectedItem >= 0) ? _entries[_selectedItem].second : EmptyString;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -324,8 +348,6 @@ void ContextMenu::drawDialog()
if(_dirty) if(_dirty)
{ {
FBSurface& s = surface();
// Draw menu border and background // Draw menu border and background
s.fillRect(_x+1, _y+1, _w-2, _h-2, kWidColor); s.fillRect(_x+1, _y+1, _w-2, _h-2, kWidColor);
s.box(_x, _y, _w, _h, kColor, kShadowColor); s.box(_x, _y, _w, _h, kColor, kShadowColor);
@ -363,7 +385,7 @@ void ContextMenu::drawDialog()
w = _w - 4; w = _w - 4;
} }
if(hilite) s.fillRect(x, y, w, _rowHeight, kTextColorHi); if(hilite) s.fillRect(x, y, w, _rowHeight, kTextColorHi);
s.drawString(_font, _entries[i], x + 1, y + 2, w - 2, s.drawString(_font, _entries[i].first, x + 1, y + 2, w - 2,
hilite ? kWidColor : kTextColor); hilite ? kWidColor : kTextColor);
} }
s.addDirtyRect(_x, _y, _w, _h); s.addDirtyRect(_x, _y, _w, _h);

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: ContextMenu.hxx,v 1.4 2008-06-19 19:15:44 stephena Exp $ // $Id: ContextMenu.hxx,v 1.5 2008-07-25 12:41:41 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
@ -43,17 +43,20 @@ class ContextMenu : public Dialog, public CommandSender
{ {
public: public:
ContextMenu(GuiObject* boss, const GUI::Font& font, ContextMenu(GuiObject* boss, const GUI::Font& font,
const StringList& items, int cmd = 0); const StringMap& items, int cmd = 0);
virtual ~ContextMenu(); virtual ~ContextMenu();
/** Add the given items to the widget. */
void addItems(const StringMap& items);
/** Show context menu onscreen at the specified coordinates */ /** Show context menu onscreen at the specified coordinates */
void show(uInt32 x, uInt32 y, int item = -1); void show(uInt32 x, uInt32 y, int item = -1);
/** Select the entry at the given index. */ /** Select the entry at the given index. */
void setSelected(int item); void setSelected(int item);
/** Select the first entry matching the given name. */ /** Select the first entry matching the given tag. */
void setSelected(const string& name); void setSelected(const string& tag, const string& defaultTag);
/** Select the highest/last entry in the internal list. */ /** Select the highest/last entry in the internal list. */
void setSelectedMax(); void setSelectedMax();
@ -63,7 +66,8 @@ class ContextMenu : public Dialog, public CommandSender
/** Accessor methods for the currently selected item. */ /** Accessor methods for the currently selected item. */
int getSelected() const; int getSelected() const;
const string& getSelectedString() const; const string& getSelectedName() const;
const string& getSelectedTag() const;
/** This dialog uses its own positioning, so we override Dialog::center() */ /** This dialog uses its own positioning, so we override Dialog::center() */
void center(); void center();
@ -92,7 +96,7 @@ class ContextMenu : public Dialog, public CommandSender
void sendSelection(); void sendSelection();
private: private:
StringList _entries; StringMap _entries;
int _currentItem; int _currentItem;
int _selectedItem; int _selectedItem;

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: GameInfoDialog.cxx,v 1.57 2008-06-13 13:14:51 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.58 2008-07-25 12:41:41 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
@ -48,9 +48,8 @@ GameInfoDialog::GameInfoDialog(
buttonHeight = font.getLineHeight() + 4; buttonHeight = font.getLineHeight() + 4;
const int vBorder = 4; const int vBorder = 4;
int xpos, ypos, lwidth, fwidth, pwidth, tabID; int xpos, ypos, lwidth, fwidth, pwidth, tabID;
unsigned int i;
WidgetArray wid; WidgetArray wid;
StringList items; StringMap items, ports, ctrls;
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
@ -111,8 +110,8 @@ GameInfoDialog::GameInfoDialog(
"Sound:", kTextAlignLeft); "Sound:", kTextAlignLeft);
pwidth = font.getStringWidth("Stereo"); pwidth = font.getStringWidth("Stereo");
items.clear(); items.clear();
items.push_back("Mono"); items.push_back("Mono", "MONO");
items.push_back("Stereo"); items.push_back("Stereo", "STEREO");
mySound = new PopUpWidget(myTab, font, xpos+lwidth, ypos, mySound = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(mySound); wid.push_back(mySound);
@ -122,8 +121,31 @@ GameInfoDialog::GameInfoDialog(
"Type:", kTextAlignLeft); "Type:", kTextAlignLeft);
pwidth = font.getStringWidth("SB (128-256k SUPERbanking)"); pwidth = font.getStringWidth("SB (128-256k SUPERbanking)");
items.clear(); items.clear();
for(i = 0; i < kNumCartTypes; ++i) items.push_back("Auto-detect", "AUTO-DETECT");
items.push_back(ourCartridgeList[i][0]); items.push_back("0840 (8K ECONObanking)", "0840" );
items.push_back("2K (2K Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FASC (CBS RAM Plus)", "FASC" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MB (Dynacom Megaboy)", "MB" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256k SUPERbanking)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myType); wid.push_back(myType);
@ -142,8 +164,8 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Left Difficulty:", kTextAlignLeft); "Left Difficulty:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("B"); items.push_back("B", "B");
items.push_back("A"); items.push_back("A", "A");
myLeftDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myLeftDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myLeftDiff); wid.push_back(myLeftDiff);
@ -160,8 +182,8 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"TV Type:", kTextAlignLeft); "TV Type:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("Color"); items.push_back("Color", "COLOR");
items.push_back("B & W"); items.push_back("B & W", "BLACKANDWHITE");
myTVType = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myTVType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myTVType); wid.push_back(myTVType);
@ -179,43 +201,45 @@ GameInfoDialog::GameInfoDialog(
pwidth = font.getStringWidth("CX-22 Trakball"); pwidth = font.getStringWidth("CX-22 Trakball");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"P0 Controller:", kTextAlignLeft); "P0 Controller:", kTextAlignLeft);
items.clear(); ctrls.clear();
for(i = 0; i < kNumControllerTypes; ++i) ctrls.push_back("Joystick", "JOYSTICK" );
items.push_back(ourControllerList[i][0]); ctrls.push_back("Paddles", "PADDLES" );
ctrls.push_back("BoosterGrip", "BOOSTERGRIP" );
ctrls.push_back("Driving", "DRIVING" );
ctrls.push_back("Keyboard", "KEYBOARD" );
ctrls.push_back("CX-22 Trakball", "TRACKBALL22" );
ctrls.push_back("CX-80 Mouse", "TRACKBALL80" );
ctrls.push_back("AmigaMouse", "AMIGAMOUSE" );
ctrls.push_back("AtariVox", "ATARIVOX" );
ctrls.push_back("SaveKey", "SAVEKEY" );
myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myP0Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, ctrls, "", 0, 0);
wid.push_back(myP0Controller); wid.push_back(myP0Controller);
xpos += lwidth+myP0Controller->getWidth() + 4; xpos += lwidth+myP0Controller->getWidth() + 4;
new StaticTextWidget(myTab, font, xpos, ypos+1, font.getStringWidth("in "), new StaticTextWidget(myTab, font, xpos, ypos+1, font.getStringWidth("in "),
fontHeight, "in ", kTextAlignLeft); fontHeight, "in ", kTextAlignLeft);
xpos += font.getStringWidth("in "); xpos += font.getStringWidth("in ");
items.clear(); ports.clear();
items.push_back("left port"); ports.push_back("left port", "L");
items.push_back("right port"); ports.push_back("right port", "R");
myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "", 0, kLeftCChanged); ports, "", 0, kLeftCChanged);
wid.push_back(myLeftPort); wid.push_back(myLeftPort);
xpos = 10; ypos += lineHeight + 5; xpos = 10; ypos += lineHeight + 5;
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"P1 Controller:", kTextAlignLeft); "P1 Controller:", kTextAlignLeft);
items.clear();
for(i = 0; i < kNumControllerTypes; ++i)
items.push_back(ourControllerList[i][0]);
myP1Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myP1Controller = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, ctrls, "", 0, 0);
wid.push_back(myP1Controller); wid.push_back(myP1Controller);
xpos += lwidth+myP1Controller->getWidth() + 4; xpos += lwidth+myP1Controller->getWidth() + 4;
new StaticTextWidget(myTab, font, xpos, ypos+1, font.getStringWidth("in "), new StaticTextWidget(myTab, font, xpos, ypos+1, font.getStringWidth("in "),
fontHeight, "in ", kTextAlignLeft); fontHeight, "in ", kTextAlignLeft);
xpos += font.getStringWidth("in "); xpos += font.getStringWidth("in ");
items.clear();
items.push_back("left port");
items.push_back("right port");
myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "", 0, kRightCChanged); ports, "", 0, kRightCChanged);
wid.push_back(myRightPort); wid.push_back(myRightPort);
xpos = 10; ypos += lineHeight + 5; xpos = 10; ypos += lineHeight + 5;
@ -223,8 +247,8 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Swap Paddles:", kTextAlignLeft); "Swap Paddles:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("Yes"); items.push_back("Yes", "YES");
items.push_back("No"); items.push_back("No", "NO");
mySwapPaddles = new PopUpWidget(myTab, font, xpos+lwidth, ypos, mySwapPaddles = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(mySwapPaddles); wid.push_back(mySwapPaddles);
@ -244,13 +268,13 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Format:", kTextAlignLeft); "Format:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("Auto-detect"); items.push_back("Auto-detect", "AUTO-DETECT");
items.push_back("NTSC"); items.push_back("NTSC", "NTSC");
items.push_back("PAL"); items.push_back("PAL", "PAL");
items.push_back("SECAM"); items.push_back("SECAM", "SECAM");
items.push_back("NTSC50"); items.push_back("NTSC50", "NTSC50");
items.push_back("PAL60"); items.push_back("PAL60", "PAL60");
items.push_back("SECAM60"); items.push_back("SECAM60", "SECAM60");
myFormat = new PopUpWidget(myTab, font, xpos+lwidth, ypos, myFormat = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0); pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myFormat); wid.push_back(myFormat);
@ -274,8 +298,8 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use Phosphor:", kTextAlignLeft); "Use Phosphor:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("Yes"); items.push_back("Yes", "YES");
items.push_back("No"); items.push_back("No", "NO");
myPhosphor = new PopUpWidget(myTab, font, xpos+lwidth, ypos, pwidth, myPhosphor = new PopUpWidget(myTab, font, xpos+lwidth, ypos, pwidth,
lineHeight, items, "", 0, kPhosphorChanged); lineHeight, items, "", 0, kPhosphorChanged);
wid.push_back(myPhosphor); wid.push_back(myPhosphor);
@ -297,8 +321,8 @@ GameInfoDialog::GameInfoDialog(
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use HMBlanks:", kTextAlignLeft); "Use HMBlanks:", kTextAlignLeft);
items.clear(); items.clear();
items.push_back("Yes"); items.push_back("Yes", "YES");
items.push_back("No"); items.push_back("No", "NO");
myHmoveBlanks = new PopUpWidget(myTab, font, xpos+lwidth, ypos, pwidth, myHmoveBlanks = new PopUpWidget(myTab, font, xpos+lwidth, ypos, pwidth,
lineHeight, items, "", 0, 0); lineHeight, items, "", 0, 0);
wid.push_back(myHmoveBlanks); wid.push_back(myHmoveBlanks);
@ -362,126 +386,45 @@ void GameInfoDialog::loadView()
if(!myPropertiesLoaded) if(!myPropertiesLoaded)
return; return;
string s;
int i;
// Cartridge properties // Cartridge properties
s = myGameProperties.get(Cartridge_Name); myName->setEditString(myGameProperties.get(Cartridge_Name));
myName->setEditString(s); myMD5->setLabel(myGameProperties.get(Cartridge_MD5));
myManufacturer->setEditString(myGameProperties.get(Cartridge_Manufacturer));
s = myGameProperties.get(Cartridge_MD5); myModelNo->setEditString(myGameProperties.get(Cartridge_ModelNo));
myMD5->setLabel(s); myRarity->setEditString(myGameProperties.get(Cartridge_Rarity));
myNote->setEditString(myGameProperties.get(Cartridge_Note));
s = myGameProperties.get(Cartridge_Manufacturer); mySound->setSelected(myGameProperties.get(Cartridge_Sound), "MONO");
myManufacturer->setEditString(s); myType->setSelected(myGameProperties.get(Cartridge_Type), "AUTO-DETECT");
s = myGameProperties.get(Cartridge_ModelNo);
myModelNo->setEditString(s);
s = myGameProperties.get(Cartridge_Rarity);
myRarity->setEditString(s);
s = myGameProperties.get(Cartridge_Note);
myNote->setEditString(s);
s = myGameProperties.get(Cartridge_Sound);
mySound->clearSelection();
if(s == "MONO") mySound->setSelected(0);
else if(s == "STEREO") mySound->setSelected(1);
s = myGameProperties.get(Cartridge_Type);
myType->clearSelection();
for(i = 0; i < kNumCartTypes; ++i)
{
if(s == ourCartridgeList[i][1])
break;
}
myType->setSelected(i);
// Console properties // Console properties
s = myGameProperties.get(Console_LeftDifficulty); myLeftDiff->setSelected(myGameProperties.get(Console_LeftDifficulty), "B");
myLeftDiff->clearSelection(); myRightDiff->setSelected(myGameProperties.get(Console_RightDifficulty), "B");
if(s == "B") myLeftDiff->setSelected(0); myTVType->setSelected(myGameProperties.get(Console_TelevisionType), "COLOR");
else if(s == "A") myLeftDiff->setSelected(1);
s = myGameProperties.get(Console_RightDifficulty); const string& swap = myGameProperties.get(Console_SwapPorts);
myRightDiff->clearSelection(); myLeftPort->setSelected((swap == "NO" ? "L" : "R"), "L");
if(s == "B") myRightDiff->setSelected(0); myRightPort->setSelected((swap == "NO" ? "R" : "L"), "R");
else if(s == "A") myRightDiff->setSelected(1);
s = myGameProperties.get(Console_TelevisionType);
myTVType->clearSelection();
if(s == "COLOR") myTVType->setSelected(0);
else if(s == "BLACKANDWHITE") myTVType->setSelected(1);
s = myGameProperties.get(Console_SwapPorts);
myLeftPort->clearSelection();
myRightPort->clearSelection();
myLeftPort->setSelected(s == "NO" ? 0 : 1);
myRightPort->setSelected(s == "NO" ? 1 : 0);
// Controller properties // Controller properties
s = myGameProperties.get(Controller_Left); myP0Controller->setSelected(myGameProperties.get(Controller_Left), "JOYSTICK");
myP0Controller->clearSelection(); myP1Controller->setSelected(myGameProperties.get(Controller_Right), "JOYSTICK");
for(i = 0; i < kNumControllerTypes; ++i) mySwapPaddles->setSelected(myGameProperties.get(Controller_SwapPaddles), "NO");
{
if(s == ourControllerList[i][1])
break;
}
myP0Controller->setSelected(i);
s = myGameProperties.get(Controller_Right);
myP1Controller->clearSelection();
for(i = 0; i < kNumControllerTypes; ++i)
{
if(s == ourControllerList[i][1])
break;
}
myP1Controller->setSelected(i);
s = myGameProperties.get(Controller_SwapPaddles);
mySwapPaddles->clearSelection();
if(s == "YES") mySwapPaddles->setSelected(0);
else if(s == "NO") mySwapPaddles->setSelected(1);
// Display properties // Display properties
s = myGameProperties.get(Display_Format); myFormat->setSelected(myGameProperties.get(Display_Format), "AUTO-DETECT");
myFormat->clearSelection(); myYStart->setEditString(myGameProperties.get(Display_YStart));
if(s == "AUTO-DETECT") myFormat->setSelected(0); myHeight->setEditString(myGameProperties.get(Display_Height));
else if(s == "NTSC") myFormat->setSelected(1);
else if(s == "PAL") myFormat->setSelected(2);
else if(s == "SECAM") myFormat->setSelected(3);
else if(s == "NTSC50") myFormat->setSelected(4);
else if(s == "PAL60") myFormat->setSelected(5);
else if(s == "SECAM60") myFormat->setSelected(6);
s = myGameProperties.get(Display_YStart); const string& phos = myGameProperties.get(Display_Phosphor);
myYStart->setEditString(s); myPhosphor->setSelected(phos, "NO");
myPPBlend->setEnabled(phos != "NO");
myPPBlendLabel->setEnabled(phos != "NO");
s = myGameProperties.get(Display_Height); const string& blend = myGameProperties.get(Display_PPBlend);
myHeight->setEditString(s); myPPBlend->setValue(atoi(blend.c_str()));
myPPBlendLabel->setLabel(blend);
s = myGameProperties.get(Display_Phosphor); myHmoveBlanks->setSelected(myGameProperties.get(Emulation_HmoveBlanks), "YES");
myPhosphor->clearSelection();
myPPBlend->setEnabled(false);
myPPBlendLabel->setEnabled(false);
if(s == "YES")
{
myPhosphor->setSelected(0);
myPPBlend->setEnabled(true);
myPPBlendLabel->setEnabled(true);
}
else if(s == "NO")
myPhosphor->setSelected(1);
s = myGameProperties.get(Display_PPBlend);
myPPBlend->setValue(atoi(s.c_str()));
myPPBlendLabel->setLabel(s);
s = myGameProperties.get(Emulation_HmoveBlanks);
myHmoveBlanks->clearSelection();
if(s == "YES") myHmoveBlanks->setSelected(0);
else if(s == "NO") myHmoveBlanks->setSelected(1);
myTab->loadConfig(); myTab->loadConfig();
} }
@ -492,101 +435,33 @@ void GameInfoDialog::saveConfig()
if(!myPropertiesLoaded) if(!myPropertiesLoaded)
return; return;
string s;
int i, tag;
// Cartridge properties // Cartridge properties
s = myName->getEditString(); myGameProperties.set(Cartridge_Name, myName->getEditString());
myGameProperties.set(Cartridge_Name, s); myGameProperties.set(Cartridge_Manufacturer, myManufacturer->getEditString());
myGameProperties.set(Cartridge_ModelNo, myModelNo->getEditString());
s = myManufacturer->getEditString(); myGameProperties.set(Cartridge_Rarity, myRarity->getEditString());
myGameProperties.set(Cartridge_Manufacturer, s); myGameProperties.set(Cartridge_Note, myNote->getEditString());
myGameProperties.set(Cartridge_Sound, mySound->getSelectedTag());
s = myModelNo->getEditString(); myGameProperties.set(Cartridge_Type, myType->getSelectedTag());
myGameProperties.set(Cartridge_ModelNo, s);
s = myRarity->getEditString();
myGameProperties.set(Cartridge_Rarity, s);
s = myNote->getEditString();
myGameProperties.set(Cartridge_Note, s);
tag = mySound->getSelected();
s = (tag == 0) ? "Mono" : "Stereo";
myGameProperties.set(Cartridge_Sound, s);
tag = myType->getSelected();
for(i = 0; i < kNumCartTypes; ++i)
{
if(i == tag)
{
myGameProperties.set(Cartridge_Type, ourCartridgeList[i][1]);
break;
}
}
// Console properties // Console properties
tag = myLeftDiff->getSelected(); myGameProperties.set(Console_LeftDifficulty, myLeftDiff->getSelectedTag());
s = (tag == 0) ? "B" : "A"; myGameProperties.set(Console_RightDifficulty, myRightDiff->getSelectedTag());
myGameProperties.set(Console_LeftDifficulty, s); myGameProperties.set(Console_TelevisionType, myTVType->getSelectedTag());
tag = myRightDiff->getSelected();
s = (tag == 0) ? "B" : "A";
myGameProperties.set(Console_RightDifficulty, s);
tag = myTVType->getSelected();
s = (tag == 0) ? "Color" : "BlackAndWhite";
myGameProperties.set(Console_TelevisionType, s);
// Controller properties // Controller properties
tag = myP0Controller->getSelected(); myGameProperties.set(Controller_Left, myP0Controller->getSelectedTag());
for(i = 0; i < kNumControllerTypes; ++i) myGameProperties.set(Controller_Right, myP1Controller->getSelectedTag());
{ myGameProperties.set(Console_SwapPorts, myLeftPort->getSelectedTag());
if(i == tag) myGameProperties.set(Controller_SwapPaddles, mySwapPaddles->getSelectedTag());
{
myGameProperties.set(Controller_Left, ourControllerList[i][1]);
break;
}
}
tag = myP1Controller->getSelected();
for(i = 0; i < kNumControllerTypes; ++i)
{
if(i == tag)
{
myGameProperties.set(Controller_Right, ourControllerList[i][1]);
break;
}
}
tag = myLeftPort->getSelected();
s = (tag == 0) ? "No" : "Yes";
myGameProperties.set(Console_SwapPorts, s);
tag = mySwapPaddles->getSelected();
s = (tag == 0) ? "Yes" : "No";
myGameProperties.set(Controller_SwapPaddles, s);
// Display properties // Display properties
s = myFormat->getSelectedString(); // use string directly myGameProperties.set(Display_Format, myFormat->getSelectedTag());
myGameProperties.set(Display_Format, s); myGameProperties.set(Display_YStart, myYStart->getEditString());
myGameProperties.set(Display_Height, myHeight->getEditString());
s = myYStart->getEditString(); myGameProperties.set(Display_Phosphor, myPhosphor->getSelectedTag());
myGameProperties.set(Display_YStart, s); myGameProperties.set(Display_PPBlend, myPPBlendLabel->getLabel());
myGameProperties.set(Emulation_HmoveBlanks, myHmoveBlanks->getSelectedTag());
s = myHeight->getEditString();
myGameProperties.set(Display_Height, s);
tag = myPhosphor->getSelected();
s = (tag == 0) ? "Yes" : "No";
myGameProperties.set(Display_Phosphor, s);
s = myPPBlendLabel->getLabel();
myGameProperties.set(Display_PPBlend, s);
tag = myHmoveBlanks->getSelected();
s = (tag == 0) ? "Yes" : "No";
myGameProperties.set(Emulation_HmoveBlanks, s);
// Determine whether to add or remove an entry from the properties set // Determine whether to add or remove an entry from the properties set
if(myDefaultsSelected) if(myDefaultsSelected)
@ -639,7 +514,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
case kPhosphorChanged: case kPhosphorChanged:
{ {
bool status = myPhosphor->getSelected() == 0 ? true : false; bool status = myPhosphor->getSelectedTag() == "YES";
myPPBlend->setEnabled(status); myPPBlend->setEnabled(status);
myPPBlendLabel->setEnabled(status); myPPBlendLabel->setEnabled(status);
break; break;
@ -654,46 +529,3 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GameInfoDialog::ourControllerList[kNumControllerTypes][2] = {
{ "Joystick", "JOYSTICK" },
{ "Paddles", "PADDLES" },
{ "BoosterGrip", "BOOSTERGRIP" },
{ "Driving", "DRIVING" },
{ "Keyboard", "KEYBOARD" },
{ "CX-22 Trakball", "TRACKBALL22" },
{ "CX-80 Mouse", "TRACKBALL80" },
{ "AmigaMouse", "AMIGAMOUSE" },
{ "AtariVox", "ATARIVOX" },
{ "SaveKey", "SAVEKEY" }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* GameInfoDialog::ourCartridgeList[kNumCartTypes][2] = {
{ "Auto-detect", "AUTO-DETECT" },
{ "0840 (8K ECONObanking)", "0840" },
{ "2K (2K Atari)", "2K" },
{ "3E (32K Tigervision)", "3E" },
{ "3F (512K Tigervision)", "3F" },
{ "4A50 (64K 4A50 + ram)", "4A50" },
{ "4K (4K Atari)", "4K" },
{ "AR (Supercharger)", "AR" },
{ "CV (Commavid extra ram)", "CV" },
{ "DPC (Pitfall II)", "DPC" },
{ "E0 (8K Parker Bros)", "E0" },
{ "E7 (16K M-network)", "E7" },
{ "F4 (32K Atari)", "F4" },
{ "F4SC (32K Atari + ram)", "F4SC" },
{ "F6 (16K Atari)", "F6" },
{ "F6SC (16K Atari + ram)", "F6SC" },
{ "F8 (8K Atari)", "F8" },
{ "F8SC (8K Atari + ram)", "F8SC" },
{ "FASC (CBS RAM Plus)", "FASC" },
{ "FE (8K Decathlon)", "FE" },
{ "MB (Dynacom Megaboy)", "MB" },
{ "MC (C. Wilkson Megacart)", "MC" },
{ "SB (128-256k SUPERbanking)", "SB" },
{ "UA (8K UA Ltd.)", "UA" },
{ "X07 (64K AtariAge)", "X07" }
};

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: GameInfoDialog.hxx,v 1.33 2008-05-12 22:40:26 stephena Exp $ // $Id: GameInfoDialog.hxx,v 1.34 2008-07-25 12:41:41 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
@ -87,19 +87,11 @@ class GameInfoDialog : public Dialog, public CommandSender
StaticTextWidget* myPPBlendLabel; StaticTextWidget* myPPBlendLabel;
PopUpWidget* myHmoveBlanks; PopUpWidget* myHmoveBlanks;
// Structure used for cartridge and controller types
struct PropType {
const char* name;
const char* comparitor;
};
enum { enum {
kLeftCChanged = 'LCch', kLeftCChanged = 'LCch',
kRightCChanged = 'RCch', kRightCChanged = 'RCch',
kPhosphorChanged = 'PPch', kPhosphorChanged = 'PPch',
kPPBlendChanged = 'PBch', kPPBlendChanged = 'PBch'
kNumCartTypes = 25,
kNumControllerTypes = 10
}; };
/** Game properties for currently loaded ROM */ /** Game properties for currently loaded ROM */
@ -110,12 +102,6 @@ class GameInfoDialog : public Dialog, public CommandSender
/** Indicates that the default properties have been loaded */ /** Indicates that the default properties have been loaded */
bool myDefaultsSelected; bool myDefaultsSelected;
/** Holds static strings for Cartridge type */
static const char* ourCartridgeList[kNumCartTypes][2];
/** Holds static strings for Controller type */
static const char* ourControllerList[kNumControllerTypes][2];
}; };
#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: InputDialog.cxx,v 1.33 2008-06-13 13:14:51 stephena Exp $ // $Id: InputDialog.cxx,v 1.34 2008-07-25 12:41:41 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -99,7 +99,7 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
fontHeight = font.getFontHeight(); fontHeight = font.getFontHeight();
int xpos, ypos, lwidth, pwidth, tabID; int xpos, ypos, lwidth, pwidth, tabID;
WidgetArray wid; WidgetArray wid;
StringList items; StringMap items;
// Virtual device/ports // Virtual device/ports
tabID = myTab->addTab("Virtual Devs"); tabID = myTab->addTab("Virtual Devs");
@ -110,8 +110,8 @@ void InputDialog::addVDeviceTab(const GUI::Font& font)
pwidth = font.getStringWidth("right virtual port"); pwidth = font.getStringWidth("right virtual port");
items.clear(); items.clear();
items.push_back("left virtual port"); items.push_back("left virtual port", "left");
items.push_back("right virtual port"); items.push_back("right virtual port", "right");
myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items,
"Stelladaptor 1 is: ", lwidth, kLeftChanged); "Stelladaptor 1 is: ", lwidth, kLeftChanged);
wid.push_back(myLeftPort); wid.push_back(myLeftPort);
@ -205,8 +205,8 @@ void InputDialog::loadConfig()
void InputDialog::saveConfig() void InputDialog::saveConfig()
{ {
// Left & right ports // Left & right ports
const string& sa1 = myLeftPort->getSelected() == 1 ? "right" : "left"; const string& sa1 = myLeftPort->getSelectedTag();
const string& sa2 = myRightPort->getSelected() == 1 ? "right" : "left"; const string& sa2 = myRightPort->getSelectedTag();
instance().eventHandler().mapStelladaptors(sa1, sa2); instance().eventHandler().mapStelladaptors(sa1, sa2);
// Joystick deadzone // Joystick deadzone

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.41 2008-06-19 12:01:31 stephena Exp $ // $Id: PopUpWidget.cxx,v 1.42 2008-07-25 12:41:41 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
@ -43,7 +43,7 @@ static unsigned int up_down_arrows[8] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const StringList& list, int x, int y, int w, int h, const StringMap& list,
const string& label, int labelWidth, int cmd) const string& label, int labelWidth, int cmd)
: Widget(boss, font, x, y - 1, w, h + 2), : Widget(boss, font, x, y - 1, w, h + 2),
CommandSender(boss), CommandSender(boss),
@ -133,7 +133,7 @@ void PopUpWidget::drawWidget(bool hilite)
!isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor); !isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor);
// Draw the selected entry, if any // Draw the selected entry, if any
const string& name = myMenu->getSelectedString(); const string& name = myMenu->getSelectedName();
TextAlignment align = (_font->getStringWidth(name) > w-6) ? TextAlignment align = (_font->getStringWidth(name) > w-6) ?
kTextAlignRight : kTextAlignLeft; kTextAlignRight : kTextAlignLeft;
s.drawString(_font, name, x+2, _y+myTextY, w-6, s.drawString(_font, name, x+2, _y+myTextY, w-6,

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.21 2008-06-13 13:14:51 stephena Exp $ // $Id: PopUpWidget.hxx,v 1.22 2008-07-25 12:41:41 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
@ -44,19 +44,24 @@ class PopUpWidget : public Widget, public CommandSender
{ {
public: public:
PopUpWidget(GuiObject* boss, const GUI::Font& font, PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const StringList& items, int x, int y, int w, int h, const StringMap& items,
const string& label, int labelWidth = 0, int cmd = 0); const string& label, int labelWidth = 0, int cmd = 0);
~PopUpWidget(); ~PopUpWidget();
/** Add the given items to the widget. */
/** Various selection methods passed directly to the underlying menu /** Various selection methods passed directly to the underlying menu
See ContextMenu.hxx for more information. */ See ContextMenu.hxx for more information. */
void setSelected(int item) { myMenu->setSelected(item); } void addItems(const StringMap& items) { myMenu->addItems(items); }
void setSelected(const string& name) { myMenu->setSelected(name); } void setSelected(int item) { myMenu->setSelected(item); }
void setSelectedMax() { myMenu->setSelectedMax(); } void setSelected(const string& tag,
void clearSelection() { myMenu->clearSelection(); } const string& def) { myMenu->setSelected(tag, def); }
void setSelectedMax() { myMenu->setSelectedMax(); }
void clearSelection() { myMenu->clearSelection(); }
int getSelected() const { return myMenu->getSelected(); } int getSelected() const { return myMenu->getSelected(); }
const string& getSelectedString() const { return myMenu->getSelectedString(); } const string& getSelectedName() const { return myMenu->getSelectedName(); }
const string& getSelectedTag() const { return myMenu->getSelectedTag(); }
bool wantsFocus() { return true; } bool wantsFocus() { return true; }

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: StringList.hxx,v 1.8 2008-02-06 13:45:24 stephena Exp $ // $Id: StringList.hxx,v 1.9 2008-07-25 12:41:41 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
@ -62,4 +62,14 @@ class StringList : public Common::Array<string>
} }
}; };
class StringMap : public Common::Array< pair<string,string> >
{
public:
void push_back(const string& name, const string& tag)
{
ensureCapacity(_size + 1);
_data[_size++] = make_pair(name, tag);
}
};
#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: UIDialog.cxx,v 1.14 2008-06-13 13:14:52 stephena Exp $ // $Id: UIDialog.cxx,v 1.15 2008-07-25 12:41:41 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
@ -48,7 +48,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
int xpos, ypos, tabID; int xpos, ypos, tabID;
int lwidth, pwidth = font.getStringWidth("Standard"); int lwidth, pwidth = font.getStringWidth("Standard");
WidgetArray wid; WidgetArray wid;
StringList items; StringMap items;
// Set real dimensions // Set real dimensions
// _w = 36 * fontWidth + 10; // _w = 36 * fontWidth + 10;
@ -97,8 +97,8 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
// Launcher font // Launcher font
items.clear(); items.clear();
items.push_back("Small"); items.push_back("Small", "small");
items.push_back("Large"); items.push_back("Large", "large");
myLauncherFontPopup = myLauncherFontPopup =
new PopUpWidget(myTab, font, xpos, ypos+1, pwidth, lineHeight, items, new PopUpWidget(myTab, font, xpos, ypos+1, pwidth, lineHeight, items,
"Launcher Font: ", lwidth); "Launcher Font: ", lwidth);
@ -176,8 +176,8 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
// UI Palette // UI Palette
ypos += 1; ypos += 1;
items.clear(); items.clear();
items.push_back("Standard"); items.push_back("Standard", "1");
items.push_back("Classic"); items.push_back("Classic", "2");
myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Interface Palette: ", lwidth); items, "Interface Palette: ", lwidth);
wid.push_back(myPalettePopup); wid.push_back(myPalettePopup);
@ -249,11 +249,10 @@ void UIDialog::loadConfig()
// Launcher font // Launcher font
const string& s = instance().settings().getString("launcherfont"); const string& s = instance().settings().getString("launcherfont");
myLauncherFontPopup->setSelected(s == "large" ? 1 : 0); myLauncherFontPopup->setSelected(s, "small");
// ROM launcher info viewer // ROM launcher info viewer
bool b = instance().settings().getBool("romviewer"); myRomViewerCheckbox->setState(instance().settings().getBool("romviewer"));
myRomViewerCheckbox->setState(b);
// Debugger size // Debugger size
instance().settings().getSize("debuggerres", w, h); instance().settings().getSize("debuggerres", w, h);
@ -268,9 +267,8 @@ void UIDialog::loadConfig()
myDebuggerHeightLabel->setValue(h); myDebuggerHeightLabel->setValue(h);
// UI palette // UI palette
int i = instance().settings().getInt("uipalette"); const string& pal = instance().settings().getString("uipalette");
if(i < 1 || i > 2) i = 1; myPalettePopup->setSelected(pal, "1");
myPalettePopup->setSelected(i-1);
// Mouse wheel lines // Mouse wheel lines
int mw = instance().settings().getInt("mwheel"); int mw = instance().settings().getInt("mwheel");
@ -290,7 +288,7 @@ void UIDialog::saveConfig()
// Launcher font // Launcher font
instance().settings().setString("launcherfont", instance().settings().setString("launcherfont",
myLauncherFontPopup->getSelected() == 1 ? "large" : "small"); myLauncherFontPopup->getSelectedTag());
// ROM launcher info viewer // ROM launcher info viewer
instance().settings().setBool("romviewer", myRomViewerCheckbox->getState()); instance().settings().setBool("romviewer", myRomViewerCheckbox->getState());
@ -300,8 +298,8 @@ void UIDialog::saveConfig()
myDebuggerWidthSlider->getValue(), myDebuggerHeightSlider->getValue()); myDebuggerWidthSlider->getValue(), myDebuggerHeightSlider->getValue());
// UI palette // UI palette
instance().settings().setInt("uipalette", instance().settings().setString("uipalette",
myPalettePopup->getSelected() + 1); myPalettePopup->getSelectedTag());
// Mouse wheel lines // Mouse wheel lines
int mw = myWheelLinesSlider->getValue(); int mw = myWheelLinesSlider->getValue();
@ -334,7 +332,7 @@ void UIDialog::setDefaults()
break; break;
case 2: // Misc. options case 2: // Misc. options
myPalettePopup->setSelected(0); myPalettePopup->setSelected("1", "1");
myWheelLinesSlider->setValue(4); myWheelLinesSlider->setValue(4);
myWheelLinesLabel->setValue(4); myWheelLinesLabel->setValue(4);
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.cxx,v 1.53 2008-07-22 14:54:39 stephena Exp $ // $Id: VideoDialog.cxx,v 1.54 2008-07-25 12:41:41 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
@ -49,7 +49,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
int lwidth = font.getStringWidth("Dirty Rects: "), int lwidth = font.getStringWidth("Dirty Rects: "),
pwidth = font.getStringWidth("1920x1200"); pwidth = font.getStringWidth("1920x1200");
WidgetArray wid; WidgetArray wid;
StringList items; StringMap items;
// Set real dimensions // Set real dimensions
// _w = 46 * fontWidth + 10; // _w = 46 * fontWidth + 10;
@ -59,9 +59,9 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Video renderer // Video renderer
items.clear(); items.clear();
items.push_back("Software"); items.push_back("Software", "soft");
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
items.push_back("OpenGL"); 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, "Renderer: ", lwidth,
@ -69,79 +69,52 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myRendererPopup); wid.push_back(myRendererPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Video filter // TIA filters (will be dynamically filled later)
items.clear(); items.clear();
items.push_back("Linear"); myTIAFilterPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
items.push_back("Nearest"); lineHeight, items, "TIA Filter: ", lwidth);
myFilterPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, wid.push_back(myTIAFilterPopup);
items, "GL Filter: ", lwidth);
wid.push_back(myFilterPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL FS stretch // TIA Palette
items.clear(); items.clear();
items.push_back("Never"); items.push_back("Standard", "standard");
items.push_back("UI mode"); items.push_back("Z26", "z26");
items.push_back("TIA mode"); items.push_back("User", "user");
items.push_back("Always"); myTIAPalettePopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
myFSStretchPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight, lineHeight, items, "TIA Palette: ", lwidth);
items, "GL Stretch: ", lwidth); wid.push_back(myTIAPalettePopup);
wid.push_back(myFSStretchPopup);
ypos += lineHeight + 4;
// Palette
items.clear();
items.push_back("Standard");
items.push_back("Z26");
items.push_back("User");
myPalettePopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
lineHeight, items, "Palette: ", lwidth);
wid.push_back(myPalettePopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Fullscreen resolution // Fullscreen resolution
items.clear(); items.clear();
items.push_back("Auto"); items.push_back("Auto", "auto");
for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i) for(uInt32 i = 0; i < instance().supportedResolutions().size(); ++i)
items.push_back(instance().supportedResolutions()[i].name); items.push_back(instance().supportedResolutions()[i].name,
instance().supportedResolutions()[i].name);
myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
lineHeight, items, "FS Res: ", lwidth); lineHeight, items, "FS Res: ", lwidth);
wid.push_back(myFSResPopup); wid.push_back(myFSResPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
#if 0 // GL Video filter
// Available TIA filters
items.clear(); items.clear();
for(uInt32 i = 0; i < instance().frameBuffer().supportedTIAFilters().size(); ++i) items.push_back("Linear", "linear");
items.push_back(instance().supportedResolutions()[i].name); items.push_back("Nearest", "nearest");
myFSResPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, myGLFilterPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
lineHeight, items, "FS Res: ", lwidth); items, "GL Filter: ", lwidth);
wid.push_back(myFSResPopup); wid.push_back(myGLFilterPopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
#endif
#if 0 // GL FS stretch
// Available UI zoom levels items.clear();
myUIZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight, items.push_back("Never", "never");
"UI Zoom: ", lwidth, kUIZoomChanged); items.push_back("UI mode", "ui");
myUIZoomSlider->setMinValue(1); myUIZoomSlider->setMaxValue(10); items.push_back("TIA mode", "tia");
wid.push_back(myUIZoomSlider); items.push_back("Always", "always");
myUIZoomLabel = myGLStretchPopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
new StaticTextWidget(this, font, xpos + myUIZoomSlider->getWidth() + 4, items, "GL Stretch: ", lwidth);
ypos + 1, fontWidth * 2, fontHeight, "", kTextAlignLeft); wid.push_back(myGLStretchPopup);
myUIZoomLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
#endif
// Available TIA zoom levels
myTIAZoomSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"TIA Zoom: ", lwidth, kTIAZoomChanged);
myTIAZoomSlider->setMinValue(1); myTIAZoomSlider->setMaxValue(10);
wid.push_back(myTIAZoomSlider);
myTIAZoomLabel =
new StaticTextWidget(this, font, xpos + myTIAZoomSlider->getWidth() + 4,
ypos + 1, fontWidth * 2, fontHeight, "", kTextAlignLeft);
myTIAZoomLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// GL aspect ratio // GL aspect ratio
@ -212,15 +185,13 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Disable certain functions when we know they aren't present // Disable certain functions when we know they aren't present
#ifndef DISPLAY_GL #ifndef DISPLAY_GL
myFilterPopup->clearFlags(WIDGET_ENABLED); myGLFilterPopup->clearFlags(WIDGET_ENABLED);
myGLStretchPopup->clearFlags(WIDGET_ENABLED);
myAspectRatioSlider->clearFlags(WIDGET_ENABLED); myAspectRatioSlider->clearFlags(WIDGET_ENABLED);
myAspectRatioLabel->clearFlags(WIDGET_ENABLED); myAspectRatioLabel->clearFlags(WIDGET_ENABLED);
myFSStretchPopup->clearFlags(WIDGET_ENABLED);
myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED); myUseVSyncCheckbox->clearFlags(WIDGET_ENABLED);
#endif #endif
#ifndef WINDOWED_SUPPORT #ifndef WINDOWED_SUPPORT
myTIAZoomSlider->clearFlags(WIDGET_ENABLED);
myTIAZoomLabel->clearFlags(WIDGET_ENABLED);
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
myCenterCheckbox->clearFlags(WIDGET_ENABLED); myCenterCheckbox->clearFlags(WIDGET_ENABLED);
#endif #endif
@ -234,135 +205,84 @@ VideoDialog::~VideoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::loadConfig() void VideoDialog::loadConfig()
{ {
string s;
bool b;
int i;
// Renderer setting // Renderer setting
s = BSPF_tolower(instance().settings().getString("video")); myRendererPopup->setSelected(
myRendererPopup->clearSelection(); instance().settings().getString("video"), "soft");
if(s == "soft") myRendererPopup->setSelected(0);
else if(s == "gl") myRendererPopup->setSelected(1);
// Filter setting // TIA Filter
s = BSPF_tolower(instance().settings().getString("gl_filter")); // taken care of in ::handleRendererChange()
myFilterPopup->clearSelection();
if(s == "linear") myFilterPopup->setSelected(0);
else if(s == "nearest") myFilterPopup->setSelected(1);
// GL stretch setting // TIA Palette
s = BSPF_tolower(instance().settings().getString("gl_fsmax")); myTIAPalettePopup->setSelected(
myFSStretchPopup->clearSelection(); instance().settings().getString("palette"), "standard");
if(s == "never") myFSStretchPopup->setSelected(0);
else if(s == "ui") myFSStretchPopup->setSelected(1);
else if(s == "tia") myFSStretchPopup->setSelected(2);
else if(s == "always") myFSStretchPopup->setSelected(3);
// Palette
s = BSPF_tolower(instance().settings().getString("palette"));
myPalettePopup->clearSelection();
if(s == "standard") myPalettePopup->setSelected(0);
else if(s == "z26") myPalettePopup->setSelected(1);
else if(s == "user") myPalettePopup->setSelected(2);
// Fullscreen resolution // Fullscreen resolution
s = BSPF_tolower(instance().settings().getString("fullres")); myFSResPopup->setSelected(
myFSResPopup->clearSelection(); instance().settings().getString("fullres"), "auto");
if(s == "auto") myFSResPopup->setSelected(0);
else myFSResPopup->setSelected(s);
if(myFSResPopup->getSelected() < 0)
myFSResPopup->setSelectedMax();
/* // GL Filter setting
// TIA zoom level myGLFilterPopup->setSelected(
s = instance().settings().getString("zoom_tia"); instance().settings().getString("gl_filter"), "linear");
i = instance().settings().getInt("zoom_tia");
myTIAZoomSlider->setValue(i); // GL stretch setting
myTIAZoomLabel->setLabel(s); myGLStretchPopup->setSelected(
*/ instance().settings().getString("gl_fsmax"), "never");
// GL aspect ratio setting // GL aspect ratio setting
s = instance().settings().getString("gl_aspect"); myAspectRatioSlider->setValue(instance().settings().getInt("gl_aspect"));
i = instance().settings().getInt("gl_aspect"); myAspectRatioLabel->setLabel(instance().settings().getString("gl_aspect"));
myAspectRatioSlider->setValue(i);
myAspectRatioLabel->setLabel(s);
// Framerate (0 or -1 means disabled) // Framerate (0 or -1 means disabled)
s = instance().settings().getString("framerate"); int rate = instance().settings().getInt("framerate");
i = instance().settings().getInt("framerate"); myFrameRateSlider->setValue(rate < 0 ? 0 : rate);
myFrameRateSlider->setValue(i < 0 ? 0 : i); myFrameRateLabel->setLabel(rate < 0 ? "0" :
myFrameRateLabel->setLabel(i < 0 ? "0" : s); instance().settings().getString("framerate"));
// Fullscreen // Fullscreen
b = instance().settings().getBool("fullscreen"); bool b = instance().settings().getBool("fullscreen");
myFullscreenCheckbox->setState(b); myFullscreenCheckbox->setState(b);
handleFullscreenChange(b); handleFullscreenChange(b);
// PAL color-loss effect // PAL color-loss effect
b = instance().settings().getBool("colorloss"); myColorLossCheckbox->setState(instance().settings().getBool("colorloss"));
myColorLossCheckbox->setState(b);
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
b = instance().settings().getBool("gl_vsync"); myUseVSyncCheckbox->setState(instance().settings().getBool("gl_vsync"));
myUseVSyncCheckbox->setState(b);
// Center window // Center window
b = instance().settings().getBool("center"); myCenterCheckbox->setState(instance().settings().getBool("center"));
myCenterCheckbox->setState(b);
// 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
i = myRendererPopup->getSelected(); // Also, this sets the TIA filters, so it cannot be removed from here
handleRendererChange(i); handleRendererChange(myRendererPopup->getSelectedTag());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::saveConfig() void VideoDialog::saveConfig()
{ {
string s;
int i;
bool b;
// Renderer setting // Renderer setting
i = myRendererPopup->getSelected(); instance().settings().setString("video", myRendererPopup->getSelectedTag());
if(i == 0) s = "soft";
else if(i == 1) s = "gl";
instance().settings().setString("video", s);
// Filter setting // TIA Filter
i = myFilterPopup->getSelected(); instance().settings().setString("tia_filter", myTIAFilterPopup->getSelectedTag());
if(i == 0) s = "linear";
else if(i == 1) s = "nearest";
instance().settings().setString("gl_filter", s);
// GL stretch setting // TIA Palette
i = myFSStretchPopup->getSelected(); instance().settings().setString("palette", myTIAPalettePopup->getSelectedTag());
if(i == 0) s = "never";
else if(i == 1) s = "ui";
else if(i == 2) s = "tia";
else if(i == 3) s = "always";
instance().settings().setString("gl_fsmax", s);
// Palette
i = myPalettePopup->getSelected();
if(i == 0) s = "standard";
else if(i == 1) s = "z26";
else if(i == 2) s = "user";
instance().settings().setString("palette", s);
// Fullscreen resolution // Fullscreen resolution
s = myFSResPopup->getSelectedString(); instance().settings().setString("fullres", myFSResPopup->getSelectedTag());
instance().settings().setString("fullres", s);
// TIA Scaler // GL Filter setting
s = myTIAZoomLabel->getLabel(); instance().settings().setString("gl_filter", myGLFilterPopup->getSelectedTag());
instance().settings().setString("zoom_tia", s);
// GL stretch setting
instance().settings().setString("gl_fsmax", myGLStretchPopup->getSelectedTag());
// GL aspect ratio setting // GL aspect ratio setting
s = myAspectRatioLabel->getLabel(); instance().settings().setString("gl_aspect", myAspectRatioLabel->getLabel());
instance().settings().setString("gl_aspect", s);
// Framerate // Framerate
i = myFrameRateSlider->getValue(); int i = myFrameRateSlider->getValue();
instance().settings().setInt("framerate", i); instance().settings().setInt("framerate", i);
if(&instance().console()) if(&instance().console())
{ {
@ -372,20 +292,16 @@ void VideoDialog::saveConfig()
} }
// Fullscreen // Fullscreen
b = myFullscreenCheckbox->getState(); instance().settings().setBool("fullscreen", myFullscreenCheckbox->getState());
instance().settings().setBool("fullscreen", b);
// PAL color-loss effect // PAL color-loss effect
b = myColorLossCheckbox->getState(); instance().settings().setBool("colorloss", myColorLossCheckbox->getState());
instance().settings().setBool("colorloss", b);
// Use sync to vertical blank (GL mode only) // Use sync to vertical blank (GL mode only)
b = myUseVSyncCheckbox->getState(); instance().settings().setBool("gl_vsync", myUseVSyncCheckbox->getState());
instance().settings().setBool("gl_vsync", b);
// Center window // Center window
b = myCenterCheckbox->getState(); instance().settings().setBool("center", myCenterCheckbox->getState());
instance().settings().setBool("center", b);
// Finally, issue a complete framebuffer re-initialization // Finally, issue a complete framebuffer re-initialization
instance().createFrameBuffer(false); instance().createFrameBuffer(false);
@ -394,13 +310,17 @@ void VideoDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::setDefaults() void VideoDialog::setDefaults()
{ {
myRendererPopup->setSelected(0); myRendererPopup->setSelected("soft", "");
myFilterPopup->setSelected(0); myTIAFilterPopup->setSelected(
myFSStretchPopup->setSelected(0); #ifdef SMALL_SCREEN
myPalettePopup->setSelected(0); "zoom1x", "");
myFSResPopup->setSelectedMax(); #else
myTIAZoomSlider->setValue(2); "zoom2x", "");
myTIAZoomLabel->setLabel("2"); #endif
myTIAPalettePopup->setSelected("standard", "");
myFSResPopup->setSelected("auto", "");
myGLFilterPopup->setSelected("linear", "");
myGLStretchPopup->setSelected("never", "");
myAspectRatioSlider->setValue(100); myAspectRatioSlider->setValue(100);
myAspectRatioLabel->setLabel("100"); myAspectRatioLabel->setLabel("100");
myFrameRateSlider->setValue(0); myFrameRateSlider->setValue(0);
@ -412,25 +332,36 @@ 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(0); // 0 indicates software mode handleRendererChange("soft");
handleFullscreenChange(false); // indicates fullscreen deactivated handleFullscreenChange(false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::handleRendererChange(int item) 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 #ifdef DISPLAY_OPENGL
// When we're in software mode, certain OpenGL-related options are disabled // When we're in software mode, certain OpenGL-related options are disabled
bool gl = (item > 0) ? true : false; bool gl = (mode == "gl");
myFilterPopup->setEnabled(gl); myGLFilterPopup->setEnabled(gl);
myFSStretchPopup->setEnabled(gl); myGLStretchPopup->setEnabled(gl);
myAspectRatioSlider->setEnabled(gl); myAspectRatioSlider->setEnabled(gl);
myAspectRatioLabel->setEnabled(gl); myAspectRatioLabel->setEnabled(gl);
myUseVSyncCheckbox->setEnabled(gl); myUseVSyncCheckbox->setEnabled(gl);
#endif
_dirty = true; _dirty = true;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -439,9 +370,6 @@ void VideoDialog::handleFullscreenChange(bool enable)
#ifdef WINDOWED_SUPPORT #ifdef WINDOWED_SUPPORT
myFSResPopup->setEnabled(enable); myFSResPopup->setEnabled(enable);
myTIAZoomSlider->setEnabled(!enable);
myTIAZoomLabel->setEnabled(!enable);
_dirty = true; _dirty = true;
#endif #endif
} }
@ -462,11 +390,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case kRendererChanged: case kRendererChanged:
handleRendererChange(data); handleRendererChange(myRendererPopup->getSelectedTag());
break;
case kTIAZoomChanged:
myTIAZoomLabel->setValue(myTIAZoomSlider->getValue());
break; break;
case kAspectRatioChanged: case kAspectRatioChanged:

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.23 2008-02-06 13:45:24 stephena Exp $ // $Id: VideoDialog.hxx,v 1.24 2008-07-25 12:41:41 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
@ -45,22 +45,19 @@ class VideoDialog : public Dialog
void saveConfig(); void saveConfig();
void setDefaults(); void setDefaults();
void handleRendererChange(int item); 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:
PopUpWidget* myRendererPopup; PopUpWidget* myRendererPopup;
PopUpWidget* myFilterPopup; PopUpWidget* myTIAFilterPopup;
PopUpWidget* myFSStretchPopup; PopUpWidget* myTIAPalettePopup;
PopUpWidget* myFSResPopup;
PopUpWidget* myGLFilterPopup;
PopUpWidget* myGLStretchPopup;
SliderWidget* myAspectRatioSlider; SliderWidget* myAspectRatioSlider;
StaticTextWidget* myAspectRatioLabel; StaticTextWidget* myAspectRatioLabel;
PopUpWidget* myPalettePopup;
PopUpWidget* myFSResPopup;
SliderWidget* myUIZoomSlider;
StaticTextWidget* myUIZoomLabel;
SliderWidget* myTIAZoomSlider;
StaticTextWidget* myTIAZoomLabel;
SliderWidget* myFrameRateSlider; SliderWidget* myFrameRateSlider;
StaticTextWidget* myFrameRateLabel; StaticTextWidget* myFrameRateLabel;
@ -72,8 +69,6 @@ class VideoDialog : public Dialog
enum { enum {
kRendererChanged = 'VDrd', kRendererChanged = 'VDrd',
kAspectRatioChanged = 'VDar', kAspectRatioChanged = 'VDar',
kUIZoomChanged = 'VDui',
kTIAZoomChanged = 'VDti',
kFrameRateChanged = 'VDfr', kFrameRateChanged = 'VDfr',
kFullScrChanged = 'VDfs' kFullScrChanged = 'VDfs'
}; };