Added 'debuggerres' commandline argument, which can specify the width &

height of the debugger dialog (similar to 'launcherres' argument).  Since
this provides the functionality of 'debugheight', that setting has been
removed.

Added configuration of debugger width/height to UIDialog.  Still TODO is
make the debugger 'resize' its widgets properly.

Changed 'height' debugger command to 'resolution', which will eventually
set the 'debuggerres' argument.

Made UI palette changes from UIDialog dynamic (Stella doesn't have to
be restarted for it to take effect.  Also renamed palette choices to
'Standard' and 'Classic'.

Changed default size of the Launcher to 400x300.

Some cleanups to Widget and CheckboxWidget for recent palette updates.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1342 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-08-10 18:27:12 +00:00
parent f49eb18079
commit afc12e4977
17 changed files with 225 additions and 151 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.cxx,v 1.110 2007-06-20 20:36:28 stephena Exp $
// $Id: Debugger.cxx,v 1.111 2007-08-10 18:27:10 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -101,8 +101,19 @@ Debugger::Debugger(OSystem* osystem)
equateList(NULL),
breakPoints(NULL),
readTraps(NULL),
writeTraps(NULL)
writeTraps(NULL),
myWidth(1030),
myHeight(690)
{
// Get the dialog size
int w, h;
myOSystem->settings().getSize("debuggerres", w, h);
myWidth = BSPF_max(w, 0);
myHeight = BSPF_max(h, 0);
myWidth = BSPF_max(myWidth, 1030u);
myHeight = BSPF_max(myHeight, 690u);
myOSystem->settings().setSize("debuggerres", myWidth, myHeight);
// Init parser
myParser = new DebuggerParser(this);
equateList = new EquateList();
@ -879,22 +890,6 @@ int Debugger::dpeek(int addr) {
return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::setHeight(int height)
{
if(height < kDebuggerLines)
height = kDebuggerLines;
myOSystem->settings().setInt("debugheight", height);
// Inform the debugger dialog about the new size
quit();
resizeDialog();
start();
return height;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::showWatches() {
return myParser->showWatches();
@ -974,25 +969,7 @@ void Debugger::setQuitState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getDialogBounds() const
{
// FIXME - This whole method is due for an overall
// We need to decide if Stella GUI size will be pixel based
// or font based, and update the GUI code everywhere
GUI::Rect tia = getTiaBounds();
int userHeight = myOSystem->settings().getInt("debugheight");
if(userHeight < kDebuggerLines)
{
userHeight = kDebuggerLines;
myOSystem->settings().setInt("debugheight", userHeight);
}
userHeight = (userHeight + 3) * kDebuggerLineHeight - 8;
// Make sure window is always at least 'kDebuggerHeight' high
// We need this to make positioning of widget easier
if(userHeight + tia.height() < kDebuggerHeight)
userHeight = kDebuggerHeight;
GUI::Rect r(0, 0, kDebuggerWidth, userHeight + tia.height());
GUI::Rect r(0, 0, myWidth, myHeight);
return r;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.hxx,v 1.87 2007-01-01 18:04:41 stephena Exp $
// $Id: Debugger.hxx,v 1.88 2007-08-10 18:27:10 stephena Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -69,7 +69,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.87 2007-01-01 18:04:41 stephena Exp $
@version $Id: Debugger.hxx,v 1.88 2007-08-10 18:27:10 stephena Exp $
*/
class Debugger : public DialogContainer
{
@ -321,8 +321,6 @@ class Debugger : public DialogContainer
bool writeTrap(int t);
void clearAllTraps();
int setHeight(int height);
void reloadROM();
/**
@ -350,13 +348,6 @@ class Debugger : public DialogContainer
const string invIfChanged(int reg, int oldReg);
private:
enum {
kDebuggerWidth = 1023,
kDebuggerHeight = 700,
kDebuggerLineHeight = 15, // based on the height of the console font
kDebuggerLines = 27,
};
typedef multimap<string,string> ListFile;
typedef ListFile::const_iterator ListIter;
@ -386,6 +377,10 @@ class Debugger : public DialogContainer
FunctionMap functions;
FunctionDefMap functionDefs;
// Dimensions of the entire debugger window
uInt32 myWidth;
uInt32 myHeight;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.cxx,v 1.96 2007-01-01 18:04:42 stephena Exp $
// $Id: DebuggerParser.cxx,v 1.97 2007-08-10 18:27:10 stephena Exp $
//============================================================================
#include <fstream>
@ -912,15 +912,6 @@ void DebuggerParser::executeExec()
commandResult = exec(argStrings[0]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "height"
void DebuggerParser::executeHeight()
{
int height = debugger->setHeight(args[0]);
commandResult = "height set to " + debugger->valueToString(height, kBASE_10) +
"\nExit debugger and reload ROM to take effect";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "help"
void DebuggerParser::executeHelp()
@ -1363,6 +1354,18 @@ void DebuggerParser::executeZ()
debugger->cpuDebug().setZ(args[0]);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "change resolution"
void DebuggerParser::executeResolution()
{
commandResult = "TODO - add functionality";
/*
int height = debugger->setHeight(args[0]);
commandResult = "height set to " + debugger->valueToString(height, kBASE_10) +
"\nExit debugger and reload ROM to take effect";
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// .hxx
@ -1556,15 +1559,6 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
&DebuggerParser::executeFunction
},
{
"height",
"Change height of debugger window",
true,
false,
{ kARG_WORD, kARG_END_ARGS },
&DebuggerParser::executeHeight
},
{
"help",
"This cruft",
@ -1905,5 +1899,14 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
true,
{ kARG_BOOL, kARG_END_ARGS },
&DebuggerParser::executeZ
},
{
"resolution",
"Change resolution of debugger window",
true,
false,
{ kARG_WORD, kARG_END_ARGS },
&DebuggerParser::executeResolution
}
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.hxx,v 1.48 2007-01-01 18:04:42 stephena Exp $
// $Id: DebuggerParser.hxx,v 1.49 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#ifndef DEBUGGER_PARSER_HXX
@ -156,7 +156,6 @@ class DebuggerParser
void executeExec();
void executeFrame();
void executeFunction();
void executeHeight();
void executeHelp();
void executeList();
void executeListbreaks();
@ -194,6 +193,7 @@ class DebuggerParser
void executeX();
void executeY();
void executeZ();
void executeResolution();
// List of commands available
static Command commands[kNumCommands];

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.121 2007-08-07 14:38:51 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.122 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#include <sstream>
@ -784,7 +784,12 @@ VideoMode FrameBuffer::getSavedVidMode()
}
#ifdef DEBUGGER_SUPPORT
else if(state == EventHandler::S_DEBUGGER)
cerr << "TODO: check debugger size\n";
{
int lw, lh;
myOSystem->settings().getSize("debuggerres", lw, lh);
w = BSPF_max(w, lw);
h = BSPF_max(h, lh);
}
#endif
myCurrentModeList = &myFullscreenModeList;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.cxx,v 1.103 2007-08-07 14:38:51 stephena Exp $
// $Id: OSystem.cxx,v 1.104 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#include <cassert>
@ -219,6 +219,15 @@ void OSystem::setConfigPaths()
mySettings->setString("propsfile", myPropertiesFile);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setUIPalette()
{
int palette = mySettings->getInt("uipalette") - 1;
if(palette < 0 || palette >= kNumUIPalettes) palette = 0;
myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]);
myEventHandler->refreshDisplay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setBaseDir(const string& basedir)
{
@ -282,12 +291,7 @@ bool OSystem::createFrameBuffer(bool showmessage)
if(changeBuffer) myEventHandler->setupJoysticks();
// Update the UI palette
// For now, we just use the standard palette
// Once an interface is created for this, it will be changable
// within the emulation
int palette = mySettings->getInt("uipalette") - 1;
if(palette < 0 || palette >= kNumUIPalettes) palette = 0;
myFrameBuffer->setUIPalette(&ourGUIColors[palette][0]);
setUIPalette();
if(showmessage)
{
@ -799,7 +803,7 @@ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
// Normal mode
{ 0x686868, // kColor
0x000000, // kBGColor
0x606060, // kShadowColor
0x404040, // kShadowColor
0xc8c8ff, // kHiliteColor
0x000000, // kTextColor
0x62a108, // kTextColorHi
@ -816,9 +820,9 @@ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
},
// GP2X
{ 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x0000ff, 0xc80000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000 }
{ 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x00ff00, 0xc80000,
0x000000, 0x000000, 0x000000, 0x000000, 0x20a020, 0x00ff00, 0x000000,
0x000000, 0xc80000 }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.hxx,v 1.53 2007-07-19 16:21:39 stephena Exp $
// $Id: OSystem.hxx,v 1.54 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#ifndef OSYSTEM_HXX
@ -51,7 +51,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong.
@author Stephen Anthony
@version $Id: OSystem.hxx,v 1.53 2007-07-19 16:21:39 stephena Exp $
@version $Id: OSystem.hxx,v 1.54 2007-08-10 18:27:11 stephena Exp $
*/
class OSystem
{
@ -197,6 +197,11 @@ class OSystem
*/
void setConfigPaths();
/**
Set the user-interface palette which is specified in current settings.
*/
void setUIPalette();
/**
Get the current framerate for the video system.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Settings.cxx,v 1.121 2007-08-07 14:38:51 stephena Exp $
// $Id: Settings.cxx,v 1.122 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#include <cassert>
@ -81,7 +81,7 @@ Settings::Settings(OSystem* osystem)
setInternal("palettefile", "");
setInternal("propsfile", "");
setInternal("debugheight", "0");
setInternal("debuggerres", "1030x690");
setInternal("launcherres", "400x300");
setInternal("uipalette", "0");
setInternal("autoslot", "false");
@ -317,8 +317,8 @@ void Settings::usage()
<< " The following options are meant for developers\n"
<< " Arguments are more fully explained in the manual\n"
<< endl
<< " -debuggerres <WxH> The resolution to use in debugger mode\n"
<< " -break <address> Set a breakpoint at 'address'\n"
<< " -debugheight <number> Set height of debugger in lines of text (NOT pixels)\n"
<< " -debug Start in debugger mode\n"
<< " -holdreset Start the emulator with the Game Reset switch held down\n"
<< " -holdselect Start the emulator with the Game Select switch held down\n"

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DialogContainer.hxx,v 1.21 2007-01-01 18:04:52 stephena Exp $
// $Id: DialogContainer.hxx,v 1.22 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#ifndef DIALOG_CONTAINER_HXX
@ -36,7 +36,7 @@ class OSystem;
a stack, and handles their events.
@author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.21 2007-01-01 18:04:52 stephena Exp $
@version $Id: DialogContainer.hxx,v 1.22 2007-08-10 18:27:11 stephena Exp $
*/
class DialogContainer
{
@ -148,11 +148,6 @@ class DialogContainer
*/
const Dialog* baseDialog() const { return myBaseDialog; }
/**
(Re)initialize the menuing system. This isn't necessary in most cases.
*/
virtual void initialize() {}
private:
void reset();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Launcher.cxx,v 1.17 2007-07-31 15:46:21 stephena Exp $
// $Id: Launcher.cxx,v 1.18 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#include <sstream>
@ -29,8 +29,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem* osystem)
: DialogContainer(osystem),
myWidth(320),
myHeight(240)
myWidth(400),
myHeight(300)
{
int w, h;
myOSystem->settings().getSize("launcherres", w, h);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Launcher.hxx,v 1.10 2007-06-20 16:33:23 stephena Exp $
// $Id: Launcher.hxx,v 1.11 2007-08-10 18:27:11 stephena Exp $
//============================================================================
#ifndef LAUNCHER_HXX
@ -27,7 +27,7 @@ class OSystem;
The base dialog for the ROM launcher in Stella.
@author Stephen Anthony
@version $Id: Launcher.hxx,v 1.10 2007-06-20 16:33:23 stephena Exp $
@version $Id: Launcher.hxx,v 1.11 2007-08-10 18:27:11 stephena Exp $
*/
class Launcher : public DialogContainer
{
@ -49,7 +49,6 @@ class Launcher : public DialogContainer
private:
// The width and height of this dialog
// These can only be changed by exiting and restarting Stella
uInt32 myWidth;
uInt32 myHeight;
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OptionsDialog.cxx,v 1.55 2007-08-07 14:38:52 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.56 2007-08-10 18:27:11 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -75,8 +75,8 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
b = addBigButton("Input Settings", kInptCmd);
wid.push_back(b);
b = addBigButton("UI Settings", kUsrIfaceCmd);
wid.push_back(b);
myUIButton = addBigButton("UI Settings", kUsrIfaceCmd);
wid.push_back(myUIButton);
myFileSnapButton = addBigButton("Config Files", kFileSnapCmd);
wid.push_back(myFileSnapButton);
@ -114,17 +114,16 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h);
#ifdef _WIN32_WCE
int sx = myOSystem->desktopWidth();
// we scale the input dialog down a bit in low res devices.
// looks only a little ugly, but the functionality is very welcome
if(sx < 320) { w = 220; h = 176; }
else { w = 230; h = 185; }
if(myOSystem->desktopWidth() < 320) { w = 220; h = 176; }
else { w = 230; h = 185; }
#else
w = 230; h = 185;
#endif
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
w = 200; h = 105;
w = 200; h = 135;
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
w = 280; h = 170;
@ -147,7 +146,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
addToFocusList(wid);
// Certain buttons are always disabled while in game mode
// Certain buttons are disabled depending on mode
if(myIsGlobal)
{
myGameInfoButton->clearFlags(WIDGET_ENABLED);
@ -155,17 +154,17 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
}
#ifdef _WIN32_WCE
myAudioSettingsButton->clearFlags(WIDGET_ENABLED); // not honored in wince port
if(sx < 320)
myAudioSettingsButton->clearFlags(WIDGET_ENABLED); // not honored in wince port
#endif
if(myOSystem->desktopWidth() < 320)
{
// these cannot be displayed in low res devices
// These cannot be displayed in low res devices
myVideoSettingsButton->clearFlags(WIDGET_ENABLED);
myFileSnapButton->clearFlags(WIDGET_ENABLED);
myGameInfoButton->clearFlags(WIDGET_ENABLED);
myHelpButton->clearFlags(WIDGET_ENABLED);
myAboutButton->clearFlags(WIDGET_ENABLED);
}
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OptionsDialog.hxx,v 1.24 2007-01-23 09:37:39 knakos Exp $
// $Id: OptionsDialog.hxx,v 1.25 2007-08-10 18:27:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -63,6 +63,7 @@ class OptionsDialog : public Dialog
ButtonWidget* myVideoSettingsButton;
ButtonWidget* myAudioSettingsButton;
ButtonWidget* myUIButton;
ButtonWidget* myFileSnapButton;
ButtonWidget* myGameInfoButton;
ButtonWidget* myCheatCodeButton;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: UIDialog.cxx,v 1.5 2007-07-31 15:46:21 stephena Exp $
// $Id: UIDialog.cxx,v 1.6 2007-08-10 18:27:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -39,15 +39,15 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight();
int xpos, ypos;
int lwidth = font.getStringWidth("Rom launcher size: "),
pwidth = font.getStringWidth("xxxxxxx");
int lwidth = font.getStringWidth("Debugger Height (*): "),
pwidth = font.getStringWidth("Standard");
WidgetArray wid;
xpos = 10; ypos = 10;
// Launcher width and height
myLauncherWidthSlider = new SliderWidget(this, font, xpos, ypos, pwidth,
lineHeight, "Launcher Width: ",
lineHeight, "Launcher Width (*): ",
lwidth, kLWidthChanged);
myLauncherWidthSlider->setMinValue(320);
myLauncherWidthSlider->setMaxValue(800);
@ -56,12 +56,12 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
myLauncherWidthLabel =
new StaticTextWidget(this, font,
xpos + myLauncherWidthSlider->getWidth() + 4,
ypos + 1, 15, fontHeight, "", kTextAlignLeft);
ypos + 1, 20, fontHeight, "", kTextAlignLeft);
myLauncherWidthLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
myLauncherHeightSlider = new SliderWidget(this, font, xpos, ypos, pwidth,
lineHeight, "Launcher Height: ",
lineHeight, "Launcher Height (*): ",
lwidth, kLHeightChanged);
myLauncherHeightSlider->setMinValue(240);
myLauncherHeightSlider->setMaxValue(600);
@ -70,22 +70,51 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
myLauncherHeightLabel =
new StaticTextWidget(this, font,
xpos + myLauncherHeightSlider->getWidth() + 4,
ypos + 1, 15, fontHeight, "", kTextAlignLeft);
ypos + 1, 20, fontHeight, "", kTextAlignLeft);
myLauncherHeightLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
// Debugger width and height
myDebuggerWidthSlider = new SliderWidget(this, font, xpos, ypos, pwidth,
lineHeight, "Debugger Width (*): ",
lwidth, kDWidthChanged);
myDebuggerWidthSlider->setMinValue(1030);
myDebuggerWidthSlider->setMaxValue(1600);
myDebuggerWidthSlider->setStepValue(10);
wid.push_back(myDebuggerWidthSlider);
myDebuggerWidthLabel =
new StaticTextWidget(this, font,
xpos + myDebuggerWidthSlider->getWidth() + 4,
ypos + 1, 20, fontHeight, "", kTextAlignLeft);
myDebuggerWidthLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
myDebuggerHeightSlider = new SliderWidget(this, font, xpos, ypos, pwidth,
lineHeight, "Debugger Height (*): ",
lwidth, kDHeightChanged);
myDebuggerHeightSlider->setMinValue(690);
myDebuggerHeightSlider->setMaxValue(1200);
myDebuggerHeightSlider->setStepValue(10);
wid.push_back(myDebuggerHeightSlider);
myDebuggerHeightLabel =
new StaticTextWidget(this, font,
xpos + myDebuggerHeightSlider->getWidth() + 4,
ypos + 1, 20, fontHeight, "", kTextAlignLeft);
myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
// UI Palette
myPalettePopup = new PopUpWidget(this, font, xpos, ypos, pwidth, lineHeight,
"Interface Palette: ", lwidth);
myPalettePopup->appendEntry("Classic", 1);
myPalettePopup->appendEntry("GP2X", 2);
myPalettePopup->appendEntry("Standard", 1);
myPalettePopup->appendEntry("Classic", 2);
wid.push_back(myPalettePopup);
ypos += lineHeight + 4;
// Add message concerning usage
lwidth = font.getStringWidth("(*) Changes require application restart");
lwidth = font.getStringWidth("(*) Requires application restart");
new StaticTextWidget(this, font, 10, _h - 38, lwidth, fontHeight,
"(*) Changes require application restart",
"(*) Requires application restart",
kTextAlignLeft);
// Add Defaults, OK and Cancel buttons
@ -110,6 +139,13 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
addToFocusList(wid);
#ifndef DEBUGGER_SUPPORT
myDebuggerWidthSlider->clearFlags(WIDGET_ENABLED);
myDebuggerWidthLabel->clearFlags(WIDGET_ENABLED);
myDebuggerHeightSlider->clearFlags(WIDGET_ENABLED);
myDebuggerHeightLabel->clearFlags(WIDGET_ENABLED);
#endif
#ifdef _WIN32_WCE
myLauncherPopup->clearFlags(WIDGET_ENABLED);
#endif
@ -123,8 +159,9 @@ UIDialog::~UIDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void UIDialog::loadConfig()
{
// Launcher size
int w, h;
// Launcher size
instance()->settings().getSize("launcherres", w, h);
if(w < 320) w = 320;
if(w > 800) w = 800;
@ -136,6 +173,18 @@ void UIDialog::loadConfig()
myLauncherHeightSlider->setValue(h);
myLauncherHeightLabel->setValue(h);
// Debugger size
instance()->settings().getSize("debuggerres", w, h);
if(w < 1030) w = 1030;
if(w > 1600) w = 1600;
if(h < 690) h = 690;
if(h > 1200) h = 1200;
myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h);
myDebuggerHeightLabel->setValue(h);
// UI palette
int i = instance()->settings().getInt("uipalette");
if(i < 1 || i > 2)
@ -150,6 +199,10 @@ void UIDialog::saveConfig()
instance()->settings().setSize("launcherres",
myLauncherWidthSlider->getValue(), myLauncherHeightSlider->getValue());
// Debugger size
instance()->settings().setSize("debuggerres",
myDebuggerWidthSlider->getValue(), myDebuggerHeightSlider->getValue());
// UI palette
instance()->settings().setInt("uipalette",
myPalettePopup->getSelectedTag());
@ -165,11 +218,12 @@ void UIDialog::setDefaults()
myLauncherHeightSlider->setValue(h);
myLauncherHeightLabel->setValue(h);
#if !defined (GP2X)
myDebuggerWidthSlider->setValue(1030);
myDebuggerWidthLabel->setValue(1030);
myDebuggerHeightSlider->setValue(690);
myDebuggerHeightLabel->setValue(690);
myPalettePopup->setSelectedTag(1);
#else
myPalettePopup->setSelectedTag(2);
#endif
_dirty = true;
}
@ -187,9 +241,18 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
myLauncherHeightLabel->setValue(myLauncherHeightSlider->getValue());
break;
case kDWidthChanged:
myDebuggerWidthLabel->setValue(myDebuggerWidthSlider->getValue());
break;
case kDHeightChanged:
myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue());
break;
case kOKCmd:
saveConfig();
close();
instance()->setUIPalette();
break;
case kDefaultsCmd:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: UIDialog.hxx,v 1.3 2007-06-20 16:33:23 stephena Exp $
// $Id: UIDialog.hxx,v 1.4 2007-08-10 18:27:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -45,6 +45,11 @@ class UIDialog : public Dialog
SliderWidget* myLauncherHeightSlider;
StaticTextWidget* myLauncherHeightLabel;
SliderWidget* myDebuggerWidthSlider;
StaticTextWidget* myDebuggerWidthLabel;
SliderWidget* myDebuggerHeightSlider;
StaticTextWidget* myDebuggerHeightLabel;
PopUpWidget* myPalettePopup;
private:
@ -57,6 +62,8 @@ class UIDialog : public Dialog
enum {
kLWidthChanged = 'UIlw',
kLHeightChanged = 'UIlh',
kDWidthChanged = 'UIdw',
kDHeightChanged = 'UIdh'
};
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.cxx,v 1.52 2007-08-07 14:38:52 stephena Exp $
// $Id: Widget.cxx,v 1.53 2007-08-10 18:27:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -76,21 +76,18 @@ void Widget::draw()
if(!isVisible() || !_boss->isVisible())
return;
bool hasBorder = _flags & WIDGET_BORDER;
int oldX = _x, oldY = _y, oldW = _w, oldH = _h;
// Account for our relative position in the dialog
_x = getAbsX();
_y = getAbsY();
// fb.fillRect(_x+1, _y+1, _w-2, _h-2,
// Clear background (unless alpha blending is enabled)
if(_flags & WIDGET_CLEARBG)
{
int x = _x, y = _y, w = _w, h = _h;
if(_flags & WIDGET_BORDER)
if(hasBorder)
{
x++; y++; w-=2; h-=2;
}
@ -98,12 +95,8 @@ void Widget::draw()
}
// Draw border
if(_flags & WIDGET_BORDER) {
int colorA = kColor;
int colorB = kShadowColor;
if((_flags & WIDGET_INV_BORDER) == WIDGET_INV_BORDER)
BSPF_swap(colorA, colorB);
fb.box(_x, _y, _w, _h, colorA, colorB);
if(hasBorder) {
fb.box(_x, _y, _w, _h, kColor, kShadowColor);
_x += 4;
_y += 4;
_w -= 8;
@ -114,7 +107,7 @@ void Widget::draw()
drawWidget((_flags & WIDGET_HILITED) ? true : false);
// Restore x/y
if (_flags & WIDGET_BORDER) {
if (hasBorder) {
_x -= 4;
_y -= 4;
_w += 8;
@ -358,8 +351,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
const string& label, int cmd)
: StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
CommandSender(boss),
_cmd(cmd),
_editable(false)
_cmd(cmd)
{
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
_type = kButtonWidget;
@ -367,6 +359,8 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
_bgcolorhi = kBtnColorHi;
_textcolor = kBtnFntColor;
_textcolorhi = kBtnFntColorHi;
_editable = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -420,7 +414,7 @@ void ButtonWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* 8x8 checkbox bitmap */
static unsigned int checked_img[8] =
static unsigned int checked_img_x[8] =
{
0x00000000,
0x01000010,
@ -432,14 +426,26 @@ static unsigned int checked_img[8] =
0x00000000,
};
static unsigned int checked_img_o[8] =
{
0x00000000,
0x01000010,
0x00100100,
0x00011000,
0x00011000,
0x00000000,
0x00000000,
0x00000000,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, const string& label,
int cmd)
: ButtonWidget(boss, font, x, y, 16, 16, label, cmd),
_state(false),
_editable(true),
_holdFocus(true),
_fillRect(false),
_drawBox(true),
_fillColor(kColor),
_boxY(0),
@ -452,6 +458,8 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
_textcolor = kBtnFntColor;
_textcolorhi = kBtnFntColorHi;
_editable = true;
if(label == "")
_w = 14;
else
@ -506,11 +514,26 @@ void CheckboxWidget::drawWidget(bool hilite)
fb.box(_x, _y + _boxY, 14, 14, kColor, kShadowColor);
// Do we draw a square or cross?
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, _bgcolor);
if(isEnabled())
{
if(_state)
{
unsigned int* img = _fillRect ? checked_img_o : checked_img_x;
fb.drawBitmap(img, _x + 3, _y + _boxY + 3, kBtnColor);
}
}
else
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, kColor);
/*
int checked = !isEnabled() ? kColor : _state ? _bgcolorhi : _bgcolor;
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, checked);
if(!_fillRect && isEnabled() && _state) // draw a cross
fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3, _textcolor);
*/
// Finally draw the label
fb.drawString(_font, _label, _x + 20, _y + _textY, _w,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.hxx,v 1.55 2007-08-06 20:16:51 stephena Exp $
// $Id: Widget.hxx,v 1.56 2007-08-10 18:27:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -88,7 +88,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.55 2007-08-06 20:16:51 stephena Exp $
@version $Id: Widget.hxx,v 1.56 2007-08-10 18:27:12 stephena Exp $
*/
class Widget : public GuiObject
{
@ -238,7 +238,6 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
protected:
int _cmd;
bool _editable;
};
@ -268,7 +267,6 @@ class CheckboxWidget : public ButtonWidget
protected:
bool _state;
bool _editable;
bool _holdFocus;
bool _fillRect;
bool _drawBox;