First pass at making the GUI font-sensitive. Except for the debugger,

everything should look exactly the same.  This infrastructure will
eventually allow a set of fonts to be included in Stella, and for the user
to select a bigger or smaller font and have the GUI automatically resize
to it.

At some point, the ability to zoom the ROM launcher and debugger
will be removed, and will be replaced by selection of different font
sizes.  As well, zooming of the MediaSource will be converted to a
graphics filter (scale2x/3x/4x), and others such as hq2x or mame2x
will also be available.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1009 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-02-22 17:38:04 +00:00
parent 8962a96dd1
commit 419c35cf6a
77 changed files with 918 additions and 899 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: CheatCodeDialog.cxx,v 1.7 2005-12-20 00:56:31 stephena Exp $ // $Id: CheatCodeDialog.cxx,v 1.8 2006-02-22 17:38:03 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
@ -47,10 +47,9 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent, CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h) : Dialog(osystem, parent, x, y, w, h)
{ {
const GUI::Font& font = instance()->font();
int xpos, ypos; int xpos, ypos;
// List of cheats, with checkboxes to enable/disable // List of cheats, with checkboxes to enable/disable
@ -63,10 +62,10 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
addFocusWidget(myCheatList); addFocusWidget(myCheatList);
xpos += myCheatList->getWidth() + 15; ypos = 15; xpos += myCheatList->getWidth() + 15; ypos = 15;
addButton(xpos, ypos, "Add", kAddCheatCmd, 0); addButton(font, xpos, ypos, "Add", kAddCheatCmd, 0);
myEditButton = addButton(xpos, ypos+=20, "Edit", kEditCheatCmd, 0); myEditButton = addButton(font, xpos, ypos+=20, "Edit", kEditCheatCmd, 0);
myRemoveButton = addButton(xpos, ypos+=20, "Remove", kRemCheatCmd, 0); myRemoveButton = addButton(font, xpos, ypos+=20, "Remove", kRemCheatCmd, 0);
addButton(xpos, ypos+=30, "One shot", kAddOneShotCmd, 0); addButton(font, xpos, ypos+=30, "One shot", kAddOneShotCmd, 0);
// Inputbox which will pop up when adding/editing a cheat // Inputbox which will pop up when adding/editing a cheat
StringList labels; StringList labels;
@ -75,15 +74,15 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
myCheatInput = new InputTextDialog(this, font, labels, _x+20, _y+20); myCheatInput = new InputTextDialog(this, font, labels, _x+20, _y+20);
myCheatInput->setTarget(this); myCheatInput->setTarget(this);
// Add OK and Cancel buttons // Add OK and Cancel buttons **** FIXME - coordinates
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
myCancelButton = addButton(_w - (kButtonWidth + 10), _h - 24, myCancelButton = addButton(font, _w - (kButtonWidth + 10), _h - 24,
"Cancel", kCloseCmd, 0); "Cancel", kCloseCmd, 0);
#else #else
myCancelButton = addButton(_w - 2 * (kButtonWidth + 7), _h - 24, myCancelButton = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24,
"Cancel", kCloseCmd, 0); "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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: CheatCodeDialog.hxx,v 1.4 2005-12-18 18:37:01 stephena Exp $ // $Id: CheatCodeDialog.hxx,v 1.5 2006-02-22 17:38:03 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
@ -42,7 +42,7 @@ class CheatCodeDialog : public Dialog
{ {
public: public:
CheatCodeDialog(OSystem* osystem, DialogContainer* parent, CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~CheatCodeDialog(); ~CheatCodeDialog();
protected: protected:

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: AudioWidget.cxx,v 1.1 2005-10-13 18:53:07 stephena Exp $ // $Id: AudioWidget.cxx,v 1.2 2006-02-22 17:38:04 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
@ -37,22 +37,20 @@ enum {
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h) AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& font = instance()->consoleFont();
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = font.getStringWidth("AUDW: "); int xpos = 10, ypos = 25, lwidth = font.getStringWidth("AUDW: ");
StaticTextWidget* t;
// AudF registers // AudF registers
t = new StaticTextWidget(boss, xpos, ypos+2, new StaticTextWidget(boss, font, xpos, ypos+2,
lwidth, fontHeight, lwidth, fontHeight,
"AUDF:", kTextAlignLeft); "AUDF:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth; xpos += lwidth;
myAudF = new DataGridWidget(boss, font, xpos, ypos, myAudF = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 5, kBASE_16); 2, 1, 2, 5, kBASE_16);
@ -63,20 +61,15 @@ AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h)
for(int col = 0; col < 2; ++col) for(int col = 0; col < 2; ++col)
{ {
t = new StaticTextWidget(boss, xpos + col*myAudF->colWidth() + 7, new StaticTextWidget(boss, font, xpos + col*myAudF->colWidth() + 7,
ypos - lineHeight, ypos - lineHeight, fontWidth, fontHeight,
fontWidth, fontHeight, Debugger::to_hex_4(col), kTextAlignLeft);
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
} }
// AudC registers // AudC registers
xpos = 10; ypos += lineHeight + 5; xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2, new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight,
lwidth, fontHeight, "AUDC:", kTextAlignLeft);
"AUDC:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth; xpos += lwidth;
myAudC = new DataGridWidget(boss, font, xpos, ypos, myAudC = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16); 2, 1, 2, 4, kBASE_16);
@ -87,10 +80,8 @@ AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h)
// AudV registers // AudV registers
xpos = 10; ypos += lineHeight + 5; xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2, new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight,
lwidth, fontHeight, "AUDV:", kTextAlignLeft);
"AUDV:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth; xpos += lwidth;
myAudV = new DataGridWidget(boss, font, xpos, ypos, myAudV = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16); 2, 1, 2, 4, kBASE_16);

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: AudioWidget.hxx,v 1.1 2005-10-13 18:53:07 stephena Exp $ // $Id: AudioWidget.hxx,v 1.2 2006-02-22 17:38:04 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,7 +32,8 @@ class DataGridWidget;
class AudioWidget : public Widget, public CommandSender class AudioWidget : public Widget, public CommandSender
{ {
public: public:
AudioWidget(GuiObject* boss, int x, int y, int w, int h); AudioWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~AudioWidget(); virtual ~AudioWidget();
void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);

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: ColorWidget.cxx,v 1.2 2005-09-06 22:25:40 stephena Exp $ // $Id: ColorWidget.cxx,v 1.3 2006-02-22 17:38:04 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
@ -28,8 +28,9 @@
#include "ColorWidget.hxx" #include "ColorWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ColorWidget::ColorWidget(GuiObject* boss, int x, int y, int w, int h, int cmd) ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h, int cmd)
: Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
_color(0), _color(0),
_cmd(cmd) _cmd(cmd)

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: ColorWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ // $Id: ColorWidget.hxx,v 1.2 2006-02-22 17:38:04 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
@ -35,14 +35,15 @@ class GuiObject;
be expanded with a TIA palette table, to set the color visually. be expanded with a TIA palette table, to set the color visually.
@author Stephen Anthony @author Stephen Anthony
@version $Id: ColorWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ @version $Id: ColorWidget.hxx,v 1.2 2006-02-22 17:38:04 stephena Exp $
*/ */
class ColorWidget : public Widget, public CommandSender class ColorWidget : public Widget, public CommandSender
{ {
friend class ColorDialog; friend class ColorDialog;
public: public:
ColorWidget(GuiObject* boss, int x, int y, int w, int h, int cmd = 0); ColorWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int cmd = 0);
~ColorWidget(); ~ColorWidget();
void setColor(int color); void setColor(int color);

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.5 2006-01-15 20:46:19 stephena Exp $ // $Id: ContextMenu.cxx,v 1.6 2006-02-22 17:38:04 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
@ -30,9 +30,9 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16),
CommandSender(boss), CommandSender(boss),
_selectedItem(-1), _selectedItem(-1),
_rowHeight(font.getLineHeight()) _rowHeight(font.getLineHeight()),
_font(&font)
{ {
setFont(font);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.2 2005-08-31 22:34:43 stephena Exp $ // $Id: ContextMenu.hxx,v 1.3 2006-02-22 17:38:04 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
@ -76,6 +76,9 @@ class ContextMenu : public Dialog, public CommandSender
int _selectedItem; int _selectedItem;
int _rowHeight; int _rowHeight;
private:
const GUI::Font* _font;
}; };
#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: CpuWidget.cxx,v 1.3 2005-10-14 13:50:00 stephena Exp $ // $Id: CpuWidget.cxx,v 1.4 2006-02-22 17:38:04 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
@ -60,20 +60,18 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss) CommandSender(boss)
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos, ypos, lwidth; int xpos, ypos, lwidth;
StaticTextWidget* t;
// Create a 1x1 grid with label for the PC register // Create a 1x1 grid with label for the PC register
xpos = x; ypos = y; lwidth = 4 * fontWidth; xpos = x; ypos = y; lwidth = 4 * fontWidth;
t = new StaticTextWidget(boss, xpos, ypos+2, lwidth-2, fontHeight, new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight,
"PC:", kTextAlignLeft); "PC:", kTextAlignLeft);
t->setFont(font);
myPCGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 16, 16); myPCGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 16, 16);
myPCGrid->setTarget(this); myPCGrid->setTarget(this);
myPCGrid->setID(kPCRegID); myPCGrid->setID(kPCRegID);
@ -81,8 +79,8 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Create a read-only textbox containing the current PC label // Create a read-only textbox containing the current PC label
xpos += lwidth + myPCGrid->getWidth() + 10; xpos += lwidth + myPCGrid->getWidth() + 10;
myPCLabel = new EditTextWidget(boss, xpos, ypos, fontWidth*15, lineHeight, ""); myPCLabel = new EditTextWidget(boss, font, xpos, ypos, fontWidth*15,
myPCLabel->setFont(font); lineHeight, "");
myPCLabel->setEditable(false); myPCLabel->setEditable(false);
// Create a 1x4 grid with labels for the other CPU registers // Create a 1x4 grid with labels for the other CPU registers
@ -95,17 +93,15 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
string labels[4] = { "SP:", "A:", "X:", "Y:" }; string labels[4] = { "SP:", "A:", "X:", "Y:" };
for(int row = 0; row < 4; ++row) for(int row = 0; row < 4; ++row)
{ {
t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2, new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 2,
lwidth-2, fontHeight, lwidth-2, fontHeight,
labels[row], kTextAlignLeft); labels[row], kTextAlignLeft);
t->setFont(font);
} }
// Create a bitfield widget for changing the processor status // Create a bitfield widget for changing the processor status
xpos = x; ypos += 4*lineHeight + 2; xpos = x; ypos += 4*lineHeight + 2;
t = new StaticTextWidget(boss, xpos, ypos+2, lwidth-2, fontHeight, new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight,
"PS:", kTextAlignLeft); "PS:", kTextAlignLeft);
t->setFont(font);
myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos, 8, 1); myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos, 8, 1);
myPSRegister->setTarget(this); myPSRegister->setTarget(this);
addFocusWidget(myPSRegister); addFocusWidget(myPSRegister);

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: DataGridOpsWidget.cxx,v 1.2 2006-01-15 20:46:19 stephena Exp $ // $Id: DataGridOpsWidget.cxx,v 1.3 2006-02-22 17:38:04 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
@ -22,8 +22,9 @@
#include "DataGridOpsWidget.hxx" #include "DataGridOpsWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, int x, int y) DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, 16, 16), int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
_zeroButton(NULL), _zeroButton(NULL),
_invButton(NULL), _invButton(NULL),
@ -34,38 +35,38 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, int x, int y)
_shiftRightButton(NULL) _shiftRightButton(NULL)
{ {
const int bwidth = _font->getMaxCharWidth() * 3, const int bwidth = _font->getMaxCharWidth() * 3,
bheight = 16, // FIXME - magic number bheight = _font->getFontHeight() + 2,
space = 6; space = 6;
int xpos, ypos; int xpos, ypos;
// Create operations buttons // Create operations buttons
xpos = x; ypos = y; xpos = x; ypos = y;
_zeroButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"0", kDGZeroCmd, 0); "0", kDGZeroCmd, 0);
ypos += bheight + space; ypos += bheight + space;
_invButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Inv", kDGInvertCmd, 0); "Inv", kDGInvertCmd, 0);
ypos += bheight + space; ypos += bheight + space;
_incButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"++", kDGIncCmd, 0); "++", kDGIncCmd, 0);
ypos += bheight + space; ypos += bheight + space;
_shiftLeftButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"<<", kDGShiftLCmd, 0); "<<", kDGShiftLCmd, 0);
// Move to next column, skip a row // Move to next column, skip a row
xpos = x + bwidth + space; ypos = y + bheight + space; xpos = x + bwidth + space; ypos = y + bheight + space;
_negButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _negButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Neg", kDGNegateCmd, 0); "Neg", kDGNegateCmd, 0);
ypos += bheight + space; ypos += bheight + space;
_decButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"--", kDGDecCmd, 0); "--", kDGDecCmd, 0);
ypos += bheight + space; ypos += bheight + space;
_shiftRightButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, _shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
">>", kDGShiftRCmd, 0); ">>", kDGShiftRCmd, 0);
// Calculate real dimensions // Calculate real dimensions

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: DataGridOpsWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ // $Id: DataGridOpsWidget.hxx,v 1.2 2006-02-22 17:38:04 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
@ -40,7 +40,7 @@ enum {
class DataGridOpsWidget : public Widget, public CommandSender class DataGridOpsWidget : public Widget, public CommandSender
{ {
public: public:
DataGridOpsWidget(GuiObject* boss, int x, int y); DataGridOpsWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
virtual ~DataGridOpsWidget() {} virtual ~DataGridOpsWidget() {}
void setTarget(CommandReceiver* target); void setTarget(CommandReceiver* target);

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: DataGridWidget.cxx,v 1.5 2006-01-15 20:46:19 stephena Exp $ // $Id: DataGridWidget.cxx,v 1.6 2006-02-22 17:38:04 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
@ -31,7 +31,8 @@
DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font, DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int x, int y, int cols, int rows,
int colchars, int bits, BaseFormat base) int colchars, int bits, BaseFormat base)
: EditableWidget(boss, x, y, cols*(colchars * font.getMaxCharWidth() + 8) + 1, : EditableWidget(boss, font, x, y,
cols*(colchars * font.getMaxCharWidth() + 8) + 1,
font.getLineHeight()*rows + 1), font.getLineHeight()*rows + 1),
_rows(rows), _rows(rows),
_cols(cols), _cols(cols),
@ -44,8 +45,6 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
_selectedItem(0), _selectedItem(0),
_opsWidget(NULL) _opsWidget(NULL)
{ {
setFont(font);
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kDataGridWidget; _type = kDataGridWidget;
_editMode = false; _editMode = false;

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: DebuggerDialog.cxx,v 1.11 2006-01-15 20:46:19 stephena Exp $ // $Id: DebuggerDialog.cxx,v 1.12 2006-02-22 17:38:04 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
@ -145,7 +145,8 @@ void DebuggerDialog::addTiaArea()
{ {
GUI::Rect r = instance()->debugger().getTiaBounds(); GUI::Rect r = instance()->debugger().getTiaBounds();
myTiaOutput = new TiaOutputWidget(this, r.left, r.top, r.width(), r.height()); myTiaOutput = new TiaOutputWidget(this, instance()->consoleFont(),
r.left, r.top, r.width(), r.height());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -154,30 +155,34 @@ void DebuggerDialog::addTabArea()
GUI::Rect r = instance()->debugger().getTabBounds(); GUI::Rect r = instance()->debugger().getTabBounds();
const int vBorder = 4; const int vBorder = 4;
const int widWidth = r.width() - vBorder;
const int widHeight = r.height() - 25; // FIXME - magic number/font height
int tabID;
// The tab widget // The tab widget
myTab = new TabWidget(this, r.left, r.top + vBorder, myTab = new TabWidget(this, instance()->consoleFont(), r.left, r.top + vBorder,
r.width(), r.height() - vBorder); r.width(), r.height() - vBorder);
addTabWidget(myTab); addTabWidget(myTab);
const int widWidth = r.width() - vBorder;
const int widHeight = r.height() - myTab->getTabHeight() - vBorder - 4;
int tabID;
// The Prompt/console tab // The Prompt/console tab
tabID = myTab->addTab("Prompt"); tabID = myTab->addTab("Prompt");
myPrompt = new PromptWidget(myTab, 2, 2, widWidth, widHeight); myPrompt = new PromptWidget(myTab, instance()->consoleFont(),
2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, myPrompt); myTab->setParentWidget(tabID, myPrompt);
addToFocusList(myPrompt->getFocusList(), tabID); addToFocusList(myPrompt->getFocusList(), tabID);
// The TIA tab // The TIA tab
tabID = myTab->addTab("TIA"); tabID = myTab->addTab("TIA");
TiaWidget* tia = new TiaWidget(myTab, 2, 2, widWidth, widHeight); TiaWidget* tia = new TiaWidget(myTab, instance()->consoleFont(),
2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, tia); myTab->setParentWidget(tabID, tia);
addToFocusList(tia->getFocusList(), tabID); addToFocusList(tia->getFocusList(), tabID);
// The Audio tab // The Audio tab
tabID = myTab->addTab("Audio"); tabID = myTab->addTab("Audio");
AudioWidget* aud = new AudioWidget(myTab, 2, 2, widWidth, widHeight); AudioWidget* aud = new AudioWidget(myTab, instance()->consoleFont(),
2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, aud); myTab->setParentWidget(tabID, aud);
addToFocusList(aud->getFocusList(), tabID); addToFocusList(aud->getFocusList(), tabID);
@ -195,16 +200,16 @@ void DebuggerDialog::addStatusArea()
int xpos, ypos; int xpos, ypos;
xpos = r.left; ypos = r.top; xpos = r.left; ypos = r.top;
myTiaInfo = new TiaInfoWidget(this, xpos+20, ypos); myTiaInfo = new TiaInfoWidget(this, instance()->consoleFont(), xpos+20, ypos);
ypos += myTiaInfo->getHeight() + 10; ypos += myTiaInfo->getHeight() + 10;
myTiaZoom = new TiaZoomWidget(this, xpos+10, ypos); myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos);
addToFocusList(myTiaZoom->getFocusList()); addToFocusList(myTiaZoom->getFocusList());
xpos += 10; ypos += myTiaZoom->getHeight() + 20; xpos += 10; ypos += myTiaZoom->getHeight() + 20;
myMessageBox = new EditTextWidget(this, xpos, ypos, myTiaZoom->getWidth(), myMessageBox = new EditTextWidget(this, instance()->consoleFont(),
xpos, ypos, myTiaZoom->getWidth(),
font.getLineHeight(), ""); font.getLineHeight(), "");
myMessageBox->setFont(font);
myMessageBox->setEditable(false); myMessageBox->setEditable(false);
myMessageBox->setColor(kTextColorEm); myMessageBox->setColor(kTextColorEm);
} }
@ -224,18 +229,19 @@ void DebuggerDialog::addRomArea()
addToFocusList(myRam->getFocusList()); addToFocusList(myRam->getFocusList());
xpos = r.left + 10 + myCpu->getWidth() + 20; xpos = r.left + 10 + myCpu->getWidth() + 20;
DataGridOpsWidget* ops = new DataGridOpsWidget(this, xpos, 20); DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(),
xpos, 20);
int buttonX = r.right - kButtonWidth - 5, buttonY = r.top + 5; int buttonX = r.right - kButtonWidth - 5, buttonY = r.top + 5;
addButton(buttonX, buttonY, "Step", kDDStepCmd, 0); addButton(instance()->consoleFont(), buttonX, buttonY, "Step", kDDStepCmd, 0);
buttonY += 22; buttonY += 22;
addButton(buttonX, buttonY, "Trace", kDDTraceCmd, 0); addButton(instance()->consoleFont(), buttonX, buttonY, "Trace", kDDTraceCmd, 0);
buttonY += 22; buttonY += 22;
addButton(buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0); addButton(instance()->consoleFont(), buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0);
buttonY += 22; buttonY += 22;
addButton(buttonX, buttonY, "Frame +1", kDDAdvCmd, 0); addButton(instance()->consoleFont(), buttonX, buttonY, "Frame +1", kDDAdvCmd, 0);
buttonY += 22; buttonY += 22;
addButton(buttonX, buttonY, "Exit", kDDExitCmd, 0); addButton(instance()->consoleFont(), buttonX, buttonY, "Exit", kDDExitCmd, 0);
xpos = r.left + 10; ypos += myRam->getHeight() + 5; xpos = r.left + 10; ypos += myRam->getHeight() + 5;
myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos); myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos);

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: PromptWidget.cxx,v 1.6 2006-01-15 20:46:19 stephena Exp $ // $Id: PromptWidget.cxx,v 1.7 2006-02-22 17:38:04 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,8 +44,9 @@
*/ */
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h) PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w - kScrollBarWidth, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w - kScrollBarWidth, h),
CommandSender(boss), CommandSender(boss),
_makeDirty(false), _makeDirty(false),
_firstTime(true) _firstTime(true)
@ -54,8 +55,8 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
WIDGET_WANTS_TAB; WIDGET_WANTS_TAB;
_type = kPromptWidget; _type = kPromptWidget;
_kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth(); _kConsoleCharWidth = font.getMaxCharWidth();
_kConsoleCharHeight = instance()->consoleFont().getFontHeight(); _kConsoleCharHeight = font.getFontHeight();
_kConsoleLineHeight = _kConsoleCharHeight + 2; _kConsoleLineHeight = _kConsoleCharHeight + 2;
// Calculate depending values // Calculate depending values
@ -70,7 +71,7 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
_firstLineInBuffer = 0; _firstLineInBuffer = 0;
// Add scrollbar // Add scrollbar
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h); _scrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar->setTarget(this); _scrollBar->setTarget(this);
// Init colors // Init colors

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: PromptWidget.hxx,v 1.3 2005-10-11 17:14:35 stephena Exp $ // $Id: PromptWidget.hxx,v 1.4 2006-02-22 17:38:04 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
@ -41,7 +41,8 @@ enum {
class PromptWidget : public Widget, public CommandSender class PromptWidget : public Widget, public CommandSender
{ {
public: public:
PromptWidget(GuiObject* boss, int x, int y, int w, int h); PromptWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~PromptWidget(); virtual ~PromptWidget();
public: public:

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: RamWidget.cxx,v 1.2 2005-11-27 22:37:24 stephena Exp $ // $Id: RamWidget.cxx,v 1.3 2006-02-22 17:38:04 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,7 +44,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
myUndoAddress(-1), myUndoAddress(-1),
myUndoValue(-1) myUndoValue(-1)
@ -55,7 +55,6 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
bwidth = 44, bwidth = 44,
bheight = 16; bheight = 16;
int xpos, ypos, lwidth; int xpos, ypos, lwidth;
StaticTextWidget* t;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels // Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth; xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth;
@ -66,27 +65,27 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Create actions buttons to the left of the RAM grid // Create actions buttons to the left of the RAM grid
xpos += lwidth + myRamGrid->getWidth() + 4; xpos += lwidth + myRamGrid->getWidth() + 4;
myUndoButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, myUndoButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Undo", kUndoCmd, 0); "Undo", kUndoCmd, 0);
myUndoButton->setTarget(this); myUndoButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + bheight/2;
myRevertButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Revert", kRevertCmd, 0); "Revert", kRevertCmd, 0);
myRevertButton->setTarget(this); myRevertButton->setTarget(this);
ypos += 2 * bheight + 2; ypos += 2 * bheight + 2;
mySearchButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Search", kSearchCmd, 0); "Search", kSearchCmd, 0);
mySearchButton->setTarget(this); mySearchButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + bheight/2;
myCompareButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Compare", kCmpCmd, 0); "Compare", kCmpCmd, 0);
myCompareButton->setTarget(this); myCompareButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + bheight/2;
myRestartButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Reset", kRestartCmd, 0); "Reset", kRestartCmd, 0);
myRestartButton->setTarget(this); myRestartButton->setTarget(this);
@ -94,50 +93,43 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
xpos = x; ypos = y + lineHeight; xpos = x; ypos = y + lineHeight;
for(int row = 0; row < 8; ++row) for(int row = 0; row < 8; ++row)
{ {
t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2, new StaticTextWidget(boss, font, xpos-2, ypos + row*lineHeight + 2,
lwidth-2, fontHeight, lwidth-2, fontHeight,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"), Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft); kTextAlignLeft);
t->setFont(font);
} }
for(int col = 0; col < 16; ++col) for(int col = 0; col < 16; ++col)
{ {
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 8, new StaticTextWidget(boss, font, xpos + col*myRamGrid->colWidth() + lwidth + 8,
ypos - lineHeight, ypos - lineHeight,
fontWidth, fontHeight, fontWidth, fontHeight,
Debugger::to_hex_4(col), Debugger::to_hex_4(col),
kTextAlignLeft); kTextAlignLeft);
t->setFont(font);
} }
xpos = x + 10; ypos += 9 * lineHeight; xpos = x + 10; ypos += 9 * lineHeight;
t = new StaticTextWidget(boss, xpos, ypos, new StaticTextWidget(boss, font, xpos, ypos,
6*fontWidth, fontHeight, 6*fontWidth, fontHeight,
"Label:", kTextAlignLeft); "Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*fontWidth + 5; xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 17*fontWidth, lineHeight, ""); myLabel = new EditTextWidget(boss, font, xpos, ypos-2, 17*fontWidth,
myLabel->setFont(font); lineHeight, "");
myLabel->setEditable(false); myLabel->setEditable(false);
xpos += 17*fontWidth + 20; xpos += 17*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos, new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight, "Dec:", kTextAlignLeft);
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, ""); myDecValue = new EditTextWidget(boss, font, xpos, ypos-2, 4*fontWidth,
myDecValue->setFont(font); lineHeight, "");
myDecValue->setEditable(false); myDecValue->setEditable(false);
xpos += 4*fontWidth + 20; xpos += 4*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos, new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight, "Bin:", kTextAlignLeft);
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, ""); myBinValue = new EditTextWidget(boss, font, xpos, ypos-2, 9*fontWidth,
myBinValue->setFont(font); lineHeight, "");
myBinValue->setEditable(false); myBinValue->setEditable(false);
// Calculate real dimensions // Calculate real dimensions

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.4 2005-09-07 18:34:52 stephena Exp $ // $Id: RomListWidget.cxx,v 1.5 2006-02-22 17:38:04 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
myMenu(NULL), myMenu(NULL),
myHighlightedItem(-1) myHighlightedItem(-1)
{ {
setFont(font);
myMenu = new ContextMenu(this, font); myMenu = new ContextMenu(this, font);
StringList l; StringList l;
@ -96,7 +95,7 @@ void RomListWidget::drawWidget(bool hilite)
_checkList[i]->setDirty(); _checkList[i]->setDirty();
_checkList[i]->draw(); _checkList[i]->draw();
const int y = _y + 2 + _rowHeight * i; const int y = _y + 2 + _fontHeight * i;
GUI::Rect l = getLineRect(); GUI::Rect l = getLineRect();
GUI::Rect r = getEditRect(); GUI::Rect r = getEditRect();
@ -104,8 +103,8 @@ void RomListWidget::drawWidget(bool hilite)
// Draw highlighted item in a frame // Draw highlighted item in a frame
if (_highlightedItem == pos) if (_highlightedItem == pos)
{ {
fb.frameRect(_x + l.left - 3, _y + 1 + _rowHeight * i, fb.frameRect(_x + l.left - 3, _y + 1 + _fontHeight * i,
_w - l.left, _rowHeight, _w - l.left, _fontHeight,
kHiliteColor); kHiliteColor);
} }
@ -113,12 +112,12 @@ void RomListWidget::drawWidget(bool hilite)
if (_selectedItem == pos && _hasFocus) if (_selectedItem == pos && _hasFocus)
{ {
if (!_editMode) if (!_editMode)
fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i, fb.fillRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
r.width(), _rowHeight, r.width(), _fontHeight,
kTextColorHi); kTextColorHi);
else else
fb.frameRect(_x + r.left - 3, _y + 1 + _rowHeight * i, fb.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
r.width(), _rowHeight, r.width(), _fontHeight,
kTextColorHi); kTextColorHi);
} }
@ -156,8 +155,8 @@ void RomListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect RomListWidget::getLineRect() const GUI::Rect RomListWidget::getLineRect() const
{ {
GUI::Rect r(2, 1, _w, _rowHeight); GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight, const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10; xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset; r.top += yoffset;
r.bottom += yoffset; r.bottom += yoffset;
@ -170,8 +169,8 @@ GUI::Rect RomListWidget::getLineRect() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect RomListWidget::getEditRect() const GUI::Rect RomListWidget::getEditRect() const
{ {
GUI::Rect r(2, 1, _w, _rowHeight); GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight, const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10; xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset; r.top += yoffset;
r.bottom += yoffset; r.bottom += yoffset;

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.15 2005-11-27 22:37:24 stephena Exp $ // $Id: RomWidget.cxx,v 1.16 2006-02-22 17:38:04 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
@ -39,7 +39,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y) RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
myListIsDirty(true), myListIsDirty(true),
mySourceAvailable(false), mySourceAvailable(false),
@ -51,11 +51,10 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Create bank editable area // Create bank editable area
xpos = x + 40; ypos = y + 7; xpos = x + 40; ypos = y + 7;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos,
font.getStringWidth("Current bank: "), font.getStringWidth("Current bank: "),
font.getFontHeight(), font.getFontHeight(),
"Current bank:", kTextAlignLeft); "Current bank:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10; xpos += t->getWidth() + 10;
myBank = new DataGridWidget(boss, font, xpos, ypos-2, myBank = new DataGridWidget(boss, font, xpos, ypos-2,
@ -68,16 +67,14 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Show number of banks // Show number of banks
xpos += myBank->getWidth() + 45; xpos += myBank->getWidth() + 45;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos,
font.getStringWidth("Total banks: "), font.getStringWidth("Total banks: "),
font.getFontHeight(), font.getFontHeight(),
"Total banks:", kTextAlignLeft); "Total banks:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10; xpos += t->getWidth() + 10;
myBankCount = new EditTextWidget(boss, xpos, ypos-2, myBankCount = new EditTextWidget(boss, font, xpos, ypos-2,
20, font.getLineHeight(), ""); 20, font.getLineHeight(), "");
myBankCount->setFont(font);
myBankCount->setEditable(false); myBankCount->setEditable(false);
// Create rom listing // Create rom listing

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: TiaInfoWidget.cxx,v 1.3 2005-09-06 22:25:40 stephena Exp $ // $Id: TiaInfoWidget.cxx,v 1.4 2006-02-22 17:38:04 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
@ -30,63 +30,63 @@
#include "TiaInfoWidget.hxx" #include "TiaInfoWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y) TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, 16, 16), int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& font = instance()->consoleFont();
const int lineHeight = font.getLineHeight(); const int lineHeight = font.getLineHeight();
int xpos = x, ypos = y, lwidth = 45; int xpos = x, ypos = y, lwidth = 45;
// Add frame info // Add frame info
xpos = x; ypos = y + 10; xpos = x; ypos = y + 10;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Frame:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Frame:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myFrameCount = new EditTextWidget(boss, xpos, ypos-2, 45, lineHeight, ""); myFrameCount = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
myFrameCount->setFont(font);
myFrameCount->setEditable(false); myFrameCount->setEditable(false);
xpos = x; ypos += kLineHeight + 5; xpos = x; ypos += lineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "F. Cycles:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"F. Cycles:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myFrameCycles = new EditTextWidget(boss, xpos, ypos-2, 45, lineHeight, ""); myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
myFrameCycles->setFont(font);
myFrameCycles->setEditable(false); myFrameCycles->setEditable(false);
xpos = x + 10; ypos += kLineHeight + 5; xpos = x + 10; ypos += lineHeight + 5;
myVSync = new CheckboxWidget(boss, instance()->font(), xpos, ypos-3, "VSync", 0); myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0);
myVSync->setEditable(false); myVSync->setEditable(false);
xpos = x + 10; ypos += kLineHeight + 5; xpos = x + 10; ypos += lineHeight + 5;
myVBlank = new CheckboxWidget(boss, instance()->font(), xpos, ypos-3, "VBlank", 0); myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0);
myVBlank->setEditable(false); myVBlank->setEditable(false);
xpos = x + 100; ypos = y + 10; xpos = x + 100; ypos = y + 10;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Scanline:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Scanline:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myScanlineCount = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, ""); myScanlineCount = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myScanlineCount->setFont(font);
myScanlineCount->setEditable(false); myScanlineCount->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5; xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "S. Cycles:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"S. Cycles:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myScanlineCycles = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, ""); myScanlineCycles = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myScanlineCycles->setFont(font);
myScanlineCycles->setEditable(false); myScanlineCycles->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5; xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Pixel Pos:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Pixel Pos:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myPixelPosition = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, ""); myPixelPosition = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myPixelPosition->setFont(font);
myPixelPosition->setEditable(false); myPixelPosition->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5; xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Color Clk:", kTextAlignLeft); new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Color Clk:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myColorClocks = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, ""); myColorClocks = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myColorClocks->setFont(font);
myColorClocks->setEditable(false); myColorClocks->setEditable(false);
// Calculate actual dimensions // Calculate actual dimensions

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: TiaInfoWidget.hxx,v 1.2 2005-08-31 19:15:10 stephena Exp $ // $Id: TiaInfoWidget.hxx,v 1.3 2006-02-22 17:38:04 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,7 +32,7 @@ class EditTextWidget;
class TiaInfoWidget : public Widget, public CommandSender class TiaInfoWidget : public Widget, public CommandSender
{ {
public: public:
TiaInfoWidget(GuiObject *boss, int x, int y); TiaInfoWidget(GuiObject *boss, const GUI::Font& font, int x, int y);
virtual ~TiaInfoWidget(); virtual ~TiaInfoWidget();
void loadConfig(); void loadConfig();

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.8 2006-01-15 20:46:19 stephena Exp $ // $Id: TiaOutputWidget.cxx,v 1.9 2006-02-22 17:38:04 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
@ -34,14 +34,15 @@
#include "TiaOutputWidget.hxx" #include "TiaOutputWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaOutputWidget::TiaOutputWidget(GuiObject* boss, int x, int y, int w, int h) TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
myMenu(NULL), myMenu(NULL),
myZoom(NULL) myZoom(NULL)
{ {
// Create context menu for commands // Create context menu for commands
myMenu = new ContextMenu(this, instance()->consoleFont()); myMenu = new ContextMenu(this, font);
StringList l; StringList l;
l.push_back("Fill to scanline"); l.push_back("Fill to scanline");

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.hxx,v 1.2 2005-08-31 22:34:43 stephena Exp $ // $Id: TiaOutputWidget.hxx,v 1.3 2006-02-22 17:38:04 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
@ -33,7 +33,8 @@ class TiaZoomWidget;
class TiaOutputWidget : public Widget, public CommandSender class TiaOutputWidget : public Widget, public CommandSender
{ {
public: public:
TiaOutputWidget(GuiObject *boss, int x, int y, int w, int h); TiaOutputWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~TiaOutputWidget(); virtual ~TiaOutputWidget();
void loadConfig(); void loadConfig();

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: TiaWidget.cxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ // $Id: TiaWidget.cxx,v 1.2 2006-02-22 17:38:04 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
@ -81,11 +81,11 @@ enum {
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& font = instance()->consoleFont();
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
@ -100,48 +100,40 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myRamGrid->setID(kRamID); myRamGrid->setID(kRamID);
addFocusWidget(myRamGrid); addFocusWidget(myRamGrid);
t = new StaticTextWidget(boss, xpos, ypos + 2, t = new StaticTextWidget(boss, font, xpos, ypos + 2,
lwidth-2, fontHeight, lwidth-2, fontHeight,
"00:", kTextAlignLeft); "00:", kTextAlignLeft);
t->setFont(font);
for(int col = 0; col < 16; ++col) for(int col = 0; col < 16; ++col)
{ {
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7, t = new StaticTextWidget(boss, font, xpos + col*myRamGrid->colWidth() + lwidth + 7,
ypos - lineHeight, ypos - lineHeight,
fontWidth, fontHeight, fontWidth, fontHeight,
Debugger::to_hex_4(col), Debugger::to_hex_4(col),
kTextAlignLeft); kTextAlignLeft);
t->setFont(font);
} }
xpos = 20; ypos += 2 * lineHeight; xpos = 20; ypos += 2 * lineHeight;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos, 6*fontWidth, fontHeight,
6*fontWidth, fontHeight,
"Label:", kTextAlignLeft); "Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*fontWidth + 5; xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*fontWidth, lineHeight, ""); myLabel = new EditTextWidget(boss, font, xpos, ypos-2, 15*fontWidth,
myLabel->setFont(font); lineHeight, "");
myLabel->setEditable(false); myLabel->setEditable(false);
xpos += 15*fontWidth + 20; xpos += 15*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Dec:", kTextAlignLeft); "Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, ""); myDecValue = new EditTextWidget(boss, font, xpos, ypos-2, 4*fontWidth,
myDecValue->setFont(font); lineHeight, "");
myDecValue->setEditable(false); myDecValue->setEditable(false);
xpos += 4*fontWidth + 20; xpos += 4*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Bin:", kTextAlignLeft); "Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, ""); myBinValue = new EditTextWidget(boss, font, xpos, ypos-2, 9*fontWidth,
myBinValue->setFont(font); lineHeight, "");
myBinValue->setEditable(false); myBinValue->setEditable(false);
// Color registers // Color registers
@ -149,11 +141,10 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos = 10; ypos += 3*lineHeight; xpos = 10; ypos += 3*lineHeight;
for(int row = 0; row < 4; ++row) for(int row = 0; row < 4; ++row)
{ {
t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2, t = new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 2,
7*fontWidth, fontHeight, 7*fontWidth, fontHeight,
regNames[row], regNames[row],
kTextAlignLeft); kTextAlignLeft);
t->setFont(font);
} }
xpos += 7*fontWidth + 5; xpos += 7*fontWidth + 5;
myColorRegs = new DataGridWidget(boss, font, xpos, ypos, myColorRegs = new DataGridWidget(boss, font, xpos, ypos,
@ -163,19 +154,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
addFocusWidget(myColorRegs); addFocusWidget(myColorRegs);
xpos += myColorRegs->colWidth() + 5; xpos += myColorRegs->colWidth() + 5;
myCOLUP0Color = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); myCOLUP0Color = new ColorWidget(boss, font, xpos, ypos+2, 20, lineHeight - 4);
myCOLUP0Color->setTarget(this); myCOLUP0Color->setTarget(this);
ypos += lineHeight; ypos += lineHeight;
myCOLUP1Color = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); myCOLUP1Color = new ColorWidget(boss, font, xpos, ypos+2, 20, lineHeight - 4);
myCOLUP1Color->setTarget(this); myCOLUP1Color->setTarget(this);
ypos += lineHeight; ypos += lineHeight;
myCOLUPFColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); myCOLUPFColor = new ColorWidget(boss, font, xpos, ypos+2, 20, lineHeight - 4);
myCOLUPFColor->setTarget(this); myCOLUPFColor->setTarget(this);
ypos += lineHeight; ypos += lineHeight;
myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); myCOLUBKColor = new ColorWidget(boss, font, xpos, ypos+2, 20, lineHeight - 4);
myCOLUBKColor->setTarget(this); myCOLUBKColor->setTarget(this);
//////////////////////////// ////////////////////////////
@ -183,26 +174,22 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// Add horizontal labels // Add horizontal labels
xpos += myCOLUBKColor->getWidth() + 2*fontWidth + 30; ypos -= 4*lineHeight + 5; xpos += myCOLUBKColor->getWidth() + 2*fontWidth + 30; ypos -= 4*lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos, t = new StaticTextWidget(boss, font, xpos, ypos, 14*fontWidth, fontHeight,
14*fontWidth, fontHeight, "PF BL M1 M0 P1", kTextAlignLeft);
"PF BL M1 M0 P1", kTextAlignLeft);
t->setFont(font);
// Add label for Strobes; buttons will be added later // Add label for Strobes; buttons will be added later
t = new StaticTextWidget(boss, xpos + t->getWidth() + 9*fontWidth, ypos, t = new StaticTextWidget(boss, font, xpos + t->getWidth() + 9*fontWidth, ypos,
8*fontWidth, fontHeight, 8*fontWidth, fontHeight,
"Strobes:", kTextAlignLeft); "Strobes:", kTextAlignLeft);
t->setFont(font);
// Add vertical labels // Add vertical labels
xpos -= 2*fontWidth + 5; ypos += lineHeight; xpos -= 2*fontWidth + 5; ypos += lineHeight;
const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" }; const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" };
for(int row = 0; row < 5; ++row) for(int row = 0; row < 5; ++row)
{ {
t = new StaticTextWidget(boss, xpos, ypos + row*(lineHeight+3), t = new StaticTextWidget(boss, font, xpos, ypos + row*(lineHeight+3),
2*fontWidth, fontHeight, 2*fontWidth, fontHeight,
collLabel[row], kTextAlignLeft); collLabel[row], kTextAlignLeft);
t->setFont(font);
} }
// Finally, add all 15 collision bits // Finally, add all 15 collision bits
@ -214,7 +201,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
{ {
myCollision[idx] = new CheckboxWidget(boss, font, collX, collY, myCollision[idx] = new CheckboxWidget(boss, font, collX, collY,
"", kCheckActionCmd); "", kCheckActionCmd);
myCollision[idx]->setFont(font);
myCollision[idx]->setTarget(this); myCollision[idx]->setTarget(this);
myCollision[idx]->setID(idx); myCollision[idx]->setID(idx);
// TODO - make collisions editable in TIA // // TODO - make collisions editable in TIA //
@ -235,52 +221,52 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
ButtonWidget* b; ButtonWidget* b;
unsigned int buttonX, buttonY; unsigned int buttonX, buttonY;
buttonX = collX + 20*fontWidth; buttonY = ypos; buttonX = collX + 20*fontWidth; buttonY = ypos;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"WSync", kWsyncCmd); "WSync", kWsyncCmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResP0", kResP0Cmd); "ResP0", kResP0Cmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResM0", kResM0Cmd); "ResM0", kResM0Cmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResBL", kResBLCmd); "ResBL", kResBLCmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"HmClr", kHmclrCmd); "HmClr", kHmclrCmd);
b->setTarget(this); b->setTarget(this);
buttonX += 50 + 10; buttonY = ypos; buttonX += 50 + 10; buttonY = ypos;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"RSync", kRsyncCmd); "RSync", kRsyncCmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResP1", kResP1Cmd); "ResP1", kResP1Cmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResM1", kResM1Cmd); "ResM1", kResM1Cmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"HMove", kHmoveCmd); "HMove", kHmoveCmd);
b->setTarget(this); b->setTarget(this);
buttonY += lineHeight + 3; buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"CxClr", kCxclrCmd); "CxClr", kCxclrCmd);
b->setTarget(this); b->setTarget(this);
@ -300,22 +286,20 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// grP0 // grP0
xpos = 10; ypos = 13*lineHeight; xpos = 10; ypos = 13*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2,
7*fontWidth, fontHeight, 7*fontWidth, fontHeight,
"P0: GR:", kTextAlignLeft); "P0: GR:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5; xpos += 7*fontWidth + 5;
myGRP0 = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); myGRP0 = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1);
myGRP0->setTarget(this); myGRP0->setTarget(this);
myGRP0->setID(kGRP0ID); myGRP0->setID(kGRP0ID);
addFocusWidget(myGRP0); addFocusWidget(myGRP0);
// posP0 // posP0
xpos += myGRP0->getWidth() + 8; xpos += myGRP0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2,
4*fontWidth, fontHeight, 4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft); "Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myPosP0 = new DataGridWidget(boss, font, xpos, ypos, myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16); 1, 1, 2, 8, kBASE_16);
@ -325,10 +309,9 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmP0 // hmP0
xpos += myPosP0->getWidth() + 8; xpos += myPosP0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2,
3*fontWidth, fontHeight, 3*fontWidth, fontHeight,
"HM:", kTextAlignLeft); "HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5; xpos += 3*fontWidth + 5;
myHMP0 = new DataGridWidget(boss, font, xpos, ypos, myHMP0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4); 1, 1, 1, 4, kBASE_16_4);
@ -340,7 +323,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myHMP0->getWidth() + 15; xpos += myHMP0->getWidth() + 15;
myRefP0 = new CheckboxWidget(boss, font, xpos, ypos+1, myRefP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd); "Reflect", kCheckActionCmd);
myRefP0->setFont(font);
myRefP0->setTarget(this); myRefP0->setTarget(this);
myRefP0->setID(kRefP0ID); myRefP0->setID(kRefP0ID);
addFocusWidget(myRefP0); addFocusWidget(myRefP0);
@ -348,17 +330,15 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefP0->getWidth() + 15; xpos += myRefP0->getWidth() + 15;
myDelP0 = new CheckboxWidget(boss, font, xpos, ypos+1, myDelP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd); "Delay", kCheckActionCmd);
myDelP0->setFont(font);
myDelP0->setTarget(this); myDelP0->setTarget(this);
myDelP0->setID(kDelP0ID); myDelP0->setID(kDelP0ID);
addFocusWidget(myDelP0); addFocusWidget(myDelP0);
// NUSIZ0 (player portion) // NUSIZ0 (player portion)
xpos = 10 + lwidth; ypos += myGRP0->getHeight() + 5; xpos = 10 + lwidth; ypos += myGRP0->getHeight() + 5;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2,
8*fontWidth, fontHeight, 8*fontWidth, fontHeight,
"NusizP0:", kTextAlignLeft); "NusizP0:", kTextAlignLeft);
t->setFont(font);
xpos += 8*fontWidth + 5; xpos += 8*fontWidth + 5;
myNusizP0 = new DataGridWidget(boss, font, xpos, ypos, myNusizP0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4); 1, 1, 1, 3, kBASE_16_4);
@ -367,8 +347,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
addFocusWidget(myNusizP0); addFocusWidget(myNusizP0);
xpos += myNusizP0->getWidth() + 5; xpos += myNusizP0->getWidth() + 5;
myNusizP0Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, ""); myNusizP0Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth,
myNusizP0Text->setFont(font); lineHeight, "");
myNusizP0Text->setEditable(false); myNusizP0Text->setEditable(false);
//////////////////////////// ////////////////////////////
@ -376,22 +356,18 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// grP1 // grP1
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 7*fontWidth, fontHeight,
7*fontWidth, fontHeight,
"P1: GR:", kTextAlignLeft); "P1: GR:", kTextAlignLeft);
t->setFont(font);
xpos += 7*fontWidth + 5; xpos += 7*fontWidth + 5;
myGRP1 = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); myGRP1 = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1);
myGRP1->setTarget(this); myGRP1->setTarget(this);
myGRP1->setID(kGRP1ID); myGRP1->setID(kGRP1ID);
addFocusWidget(myGRP1); addFocusWidget(myGRP1);
// posP1 // posP1
xpos += myGRP1->getWidth() + 8; xpos += myGRP1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft); "Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myPosP1 = new DataGridWidget(boss, font, xpos, ypos, myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16); 1, 1, 2, 8, kBASE_16);
@ -401,10 +377,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmP1 // hmP1
xpos += myPosP1->getWidth() + 8; xpos += myPosP1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft); "HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5; xpos += 3*fontWidth + 5;
myHMP1 = new DataGridWidget(boss, font, xpos, ypos, myHMP1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4); 1, 1, 1, 4, kBASE_16_4);
@ -416,7 +390,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myHMP1->getWidth() + 15; xpos += myHMP1->getWidth() + 15;
myRefP1 = new CheckboxWidget(boss, font, xpos, ypos+1, myRefP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd); "Reflect", kCheckActionCmd);
myRefP1->setFont(font);
myRefP1->setTarget(this); myRefP1->setTarget(this);
myRefP1->setID(kRefP1ID); myRefP1->setID(kRefP1ID);
addFocusWidget(myRefP1); addFocusWidget(myRefP1);
@ -424,17 +397,14 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefP1->getWidth() + 15; xpos += myRefP1->getWidth() + 15;
myDelP1 = new CheckboxWidget(boss, font, xpos, ypos+1, myDelP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd); "Delay", kCheckActionCmd);
myDelP1->setFont(font);
myDelP1->setTarget(this); myDelP1->setTarget(this);
myDelP1->setID(kDelP1ID); myDelP1->setID(kDelP1ID);
addFocusWidget(myDelP1); addFocusWidget(myDelP1);
// NUSIZ1 (player portion) // NUSIZ1 (player portion)
xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 5; xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 5;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 8*fontWidth, fontHeight,
8*fontWidth, fontHeight,
"NusizP1:", kTextAlignLeft); "NusizP1:", kTextAlignLeft);
t->setFont(font);
xpos += 8*fontWidth + 5; xpos += 8*fontWidth + 5;
myNusizP1 = new DataGridWidget(boss, font, xpos, ypos, myNusizP1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 3, kBASE_16_4); 1, 1, 1, 3, kBASE_16_4);
@ -443,8 +413,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
addFocusWidget(myNusizP1); addFocusWidget(myNusizP1);
xpos += myNusizP1->getWidth() + 5; xpos += myNusizP1->getWidth() + 5;
myNusizP1Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, ""); myNusizP1Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth,
myNusizP1Text->setFont(font); lineHeight, "");
myNusizP1Text->setEditable(false); myNusizP1Text->setEditable(false);
//////////////////////////// ////////////////////////////
@ -452,24 +422,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// enaM0 // enaM0
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"M0:", kTextAlignLeft); "M0:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8; xpos += 3*fontWidth + 8;
myEnaM0 = new CheckboxWidget(boss, font, xpos, ypos+2, myEnaM0 = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd); "Enable", kCheckActionCmd);
myEnaM0->setFont(font);
myEnaM0->setTarget(this); myEnaM0->setTarget(this);
myEnaM0->setID(kEnaM0ID); myEnaM0->setID(kEnaM0ID);
addFocusWidget(myEnaM0); addFocusWidget(myEnaM0);
// posM0 // posM0
xpos += myEnaM0->getWidth() + 12; xpos += myEnaM0->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft); "Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myPosM0 = new DataGridWidget(boss, font, xpos, ypos, myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16); 1, 1, 2, 8, kBASE_16);
@ -479,10 +444,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmM0 // hmM0
xpos += myPosM0->getWidth() + 8; xpos += myPosM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft); "HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5; xpos += 3*fontWidth + 5;
myHMM0 = new DataGridWidget(boss, font, xpos, ypos, myHMM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4); 1, 1, 1, 4, kBASE_16_4);
@ -492,10 +455,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// NUSIZ0 (missile portion) // NUSIZ0 (missile portion)
xpos += myHMM0->getWidth() + 8; xpos += myHMM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft); "Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5; xpos += 5*fontWidth + 5;
myNusizM0 = new DataGridWidget(boss, font, xpos, ypos, myNusizM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4); 1, 1, 1, 2, kBASE_16_4);
@ -507,7 +468,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myNusizM0->getWidth() + 15; xpos += myNusizM0->getWidth() + 15;
myResMP0 = new CheckboxWidget(boss, font, xpos, ypos+1, myResMP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reset", kCheckActionCmd); "Reset", kCheckActionCmd);
myResMP0->setFont(font);
myResMP0->setTarget(this); myResMP0->setTarget(this);
myResMP0->setID(kResMP0ID); myResMP0->setID(kResMP0ID);
addFocusWidget(myResMP0); addFocusWidget(myResMP0);
@ -517,24 +477,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// enaM1 // enaM1
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"M1:", kTextAlignLeft); "M1:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8; xpos += 3*fontWidth + 8;
myEnaM1 = new CheckboxWidget(boss, font, xpos, ypos+2, myEnaM1 = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd); "Enable", kCheckActionCmd);
myEnaM1->setFont(font);
myEnaM1->setTarget(this); myEnaM1->setTarget(this);
myEnaM1->setID(kEnaM1ID); myEnaM1->setID(kEnaM1ID);
addFocusWidget(myEnaM1); addFocusWidget(myEnaM1);
// posM0 // posM0
xpos += myEnaM1->getWidth() + 12; xpos += myEnaM1->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft); "Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myPosM1 = new DataGridWidget(boss, font, xpos, ypos, myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16); 1, 1, 2, 8, kBASE_16);
@ -544,10 +499,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmM0 // hmM0
xpos += myPosM1->getWidth() + 8; xpos += myPosM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft); "HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5; xpos += 3*fontWidth + 5;
myHMM1 = new DataGridWidget(boss, font, xpos, ypos, myHMM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4); 1, 1, 1, 4, kBASE_16_4);
@ -557,10 +510,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// NUSIZ1 (missile portion) // NUSIZ1 (missile portion)
xpos += myHMM1->getWidth() + 8; xpos += myHMM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft); "Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5; xpos += 5*fontWidth + 5;
myNusizM1 = new DataGridWidget(boss, font, xpos, ypos, myNusizM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4); 1, 1, 1, 2, kBASE_16_4);
@ -572,7 +523,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myNusizM1->getWidth() + 15; xpos += myNusizM1->getWidth() + 15;
myResMP1 = new CheckboxWidget(boss, font, xpos, ypos+1, myResMP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reset", kCheckActionCmd); "Reset", kCheckActionCmd);
myResMP1->setFont(font);
myResMP1->setTarget(this); myResMP1->setTarget(this);
myResMP1->setID(kResMP1ID); myResMP1->setID(kResMP1ID);
addFocusWidget(myResMP1); addFocusWidget(myResMP1);
@ -582,24 +532,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// enaBL // enaBL
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"BL:", kTextAlignLeft); "BL:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8; xpos += 3*fontWidth + 8;
myEnaBL = new CheckboxWidget(boss, font, xpos, ypos+2, myEnaBL = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd); "Enable", kCheckActionCmd);
myEnaBL->setFont(font);
myEnaBL->setTarget(this); myEnaBL->setTarget(this);
myEnaBL->setID(kEnaBLID); myEnaBL->setID(kEnaBLID);
addFocusWidget(myEnaBL); addFocusWidget(myEnaBL);
// posBL // posBL
xpos += myEnaBL->getWidth() + 12; xpos += myEnaBL->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft); "Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5; xpos += 4*fontWidth + 5;
myPosBL = new DataGridWidget(boss, font, xpos, ypos, myPosBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16); 1, 1, 2, 8, kBASE_16);
@ -609,10 +554,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmBL // hmBL
xpos += myPosBL->getWidth() + 8; xpos += myPosBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft); "HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5; xpos += 3*fontWidth + 5;
myHMBL = new DataGridWidget(boss, font, xpos, ypos, myHMBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 4, kBASE_16_4); 1, 1, 1, 4, kBASE_16_4);
@ -622,10 +565,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// CTRLPF (size portion) // CTRLPF (size portion)
xpos += myHMBL->getWidth() + 8; xpos += myHMBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
5*fontWidth, fontHeight,
"Size:", kTextAlignLeft); "Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5; xpos += 5*fontWidth + 5;
mySizeBL = new DataGridWidget(boss, font, xpos, ypos, mySizeBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 1, 2, kBASE_16_4); 1, 1, 1, 2, kBASE_16_4);
@ -637,7 +578,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += mySizeBL->getWidth() + 15; xpos += mySizeBL->getWidth() + 15;
myDelBL = new CheckboxWidget(boss, font, xpos, ypos+1, myDelBL = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd); "Delay", kCheckActionCmd);
myDelBL->setFont(font);
myDelBL->setTarget(this); myDelBL->setTarget(this);
myDelBL->setID(kDelBLID); myDelBL->setID(kDelBLID);
addFocusWidget(myDelBL); addFocusWidget(myDelBL);
@ -647,26 +587,24 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
//////////////////////////// ////////////////////////////
// PF0 // PF0
xpos = 10; ypos += 2*lineHeight; xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
4*fontWidth, fontHeight,
"PF:", kTextAlignLeft); "PF:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth; xpos += 4*fontWidth;
myPF[0] = new TogglePixelWidget(boss, xpos, ypos+2, 4, 1); myPF[0] = new TogglePixelWidget(boss, font, xpos, ypos+2, 4, 1);
myPF[0]->setTarget(this); myPF[0]->setTarget(this);
myPF[0]->setID(kPF0ID); myPF[0]->setID(kPF0ID);
addFocusWidget(myPF[0]); addFocusWidget(myPF[0]);
// PF1 // PF1
xpos += myPF[0]->getWidth() + 2; xpos += myPF[0]->getWidth() + 2;
myPF[1] = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); myPF[1] = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1);
myPF[1]->setTarget(this); myPF[1]->setTarget(this);
myPF[1]->setID(kPF1ID); myPF[1]->setID(kPF1ID);
addFocusWidget(myPF[1]); addFocusWidget(myPF[1]);
// PF2 // PF2
xpos += myPF[1]->getWidth() + 2; xpos += myPF[1]->getWidth() + 2;
myPF[2] = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); myPF[2] = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1);
myPF[2]->setTarget(this); myPF[2]->setTarget(this);
myPF[2]->setID(kPF2ID); myPF[2]->setID(kPF2ID);
addFocusWidget(myPF[2]); addFocusWidget(myPF[2]);
@ -675,7 +613,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos = 10 + 4*fontWidth; ypos += lineHeight + 2; xpos = 10 + 4*fontWidth; ypos += lineHeight + 2;
myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1, myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd); "Reflect", kCheckActionCmd);
myRefPF->setFont(font);
myRefPF->setTarget(this); myRefPF->setTarget(this);
myRefPF->setID(kRefPFID); myRefPF->setID(kRefPFID);
addFocusWidget(myRefPF); addFocusWidget(myRefPF);
@ -683,7 +620,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefPF->getWidth() + 15; xpos += myRefPF->getWidth() + 15;
myScorePF = new CheckboxWidget(boss, font, xpos, ypos+1, myScorePF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Score", kCheckActionCmd); "Score", kCheckActionCmd);
myScorePF->setFont(font);
myScorePF->setTarget(this); myScorePF->setTarget(this);
myScorePF->setID(kScorePFID); myScorePF->setID(kScorePFID);
addFocusWidget(myScorePF); addFocusWidget(myScorePF);
@ -691,7 +627,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myScorePF->getWidth() + 15; xpos += myScorePF->getWidth() + 15;
myPriorityPF = new CheckboxWidget(boss, font, xpos, ypos+1, myPriorityPF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Priority", kCheckActionCmd); "Priority", kCheckActionCmd);
myPriorityPF->setFont(font);
myPriorityPF->setTarget(this); myPriorityPF->setTarget(this);
myPriorityPF->setID(kPriorityPFID); myPriorityPF->setID(kPriorityPFID);
addFocusWidget(myPriorityPF); addFocusWidget(myPriorityPF);

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: TiaWidget.hxx,v 1.2 2005-10-13 18:53:07 stephena Exp $ // $Id: TiaWidget.hxx,v 1.3 2006-02-22 17:38:04 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
@ -38,7 +38,8 @@ class ColorWidget;
class TiaWidget : public Widget, public CommandSender class TiaWidget : public Widget, public CommandSender
{ {
public: public:
TiaWidget(GuiObject* boss, int x, int y, int w, int h); TiaWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~TiaWidget(); virtual ~TiaWidget();
void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);

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.5 2005-09-23 23:35:02 stephena Exp $ // $Id: TiaZoomWidget.cxx,v 1.6 2006-02-22 17:38:04 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
@ -28,8 +28,9 @@
#include "TiaZoomWidget.hxx" #include "TiaZoomWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaZoomWidget::TiaZoomWidget(GuiObject* boss, int x, int y) TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, 16, 16), int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
myMenu(NULL) myMenu(NULL)
{ {
@ -50,7 +51,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, int x, int y)
myYCenter = myNumRows >> 1; myYCenter = myNumRows >> 1;
// Create context menu for zoom levels // Create context menu for zoom levels
myMenu = new ContextMenu(this, instance()->consoleFont()); myMenu = new ContextMenu(this, font);
StringList l; StringList l;
l.push_back("2x zoom"); l.push_back("2x zoom");

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.hxx,v 1.3 2005-09-01 16:49:52 stephena Exp $ // $Id: TiaZoomWidget.hxx,v 1.4 2006-02-22 17:38:04 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,7 +32,7 @@ class ContextMenu;
class TiaZoomWidget : public Widget, public CommandSender class TiaZoomWidget : public Widget, public CommandSender
{ {
public: public:
TiaZoomWidget(GuiObject *boss, int x, int y); TiaZoomWidget(GuiObject *boss, const GUI::Font& font, int x, int y);
virtual ~TiaZoomWidget(); virtual ~TiaZoomWidget();
void loadConfig(); void loadConfig();

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: ToggleBitWidget.cxx,v 1.2 2006-01-15 20:46:19 stephena Exp $ // $Id: ToggleBitWidget.cxx,v 1.3 2006-02-22 17:38:04 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
@ -30,10 +30,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font, ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars) int x, int y, int cols, int rows, int colchars)
: ToggleWidget(boss, x, y, cols, rows) : ToggleWidget(boss, font, x, y, cols, rows)
{ {
setFont(font);
_rowHeight = font.getLineHeight(); _rowHeight = font.getLineHeight();
_colWidth = colchars * font.getMaxCharWidth() + 8; _colWidth = colchars * font.getMaxCharWidth() + 8;

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: TogglePixelWidget.cxx,v 1.2 2006-01-15 20:46:19 stephena Exp $ // $Id: TogglePixelWidget.cxx,v 1.3 2006-02-22 17:38:04 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,12 +27,12 @@
#include "TogglePixelWidget.hxx" #include "TogglePixelWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, int x, int y, TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
int cols, int rows) int x, int y, int cols, int rows)
: ToggleWidget(boss, x, y, cols, rows), : ToggleWidget(boss, font, x, y, cols, rows),
_pixelColor(kBGColor) _pixelColor(kBGColor)
{ {
_rowHeight = _font->getLineHeight(); _rowHeight = font.getLineHeight();
_colWidth = 15; _colWidth = 15;
// Calculate real dimensions // Calculate real dimensions

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: TogglePixelWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ // $Id: TogglePixelWidget.hxx,v 1.2 2006-02-22 17:38:04 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,8 @@
class TogglePixelWidget : public ToggleWidget class TogglePixelWidget : public ToggleWidget
{ {
public: public:
TogglePixelWidget(GuiObject* boss, int x, int y, int cols, int rows); TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows);
virtual ~TogglePixelWidget(); virtual ~TogglePixelWidget();
void setColor(OverlayColor color) { _pixelColor = color; } void setColor(OverlayColor color) { _pixelColor = color; }

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: ToggleWidget.cxx,v 1.2 2005-09-23 23:35:02 stephena Exp $ // $Id: ToggleWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -24,8 +24,9 @@
#include "ToggleWidget.hxx" #include "ToggleWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleWidget::ToggleWidget(GuiObject* boss, int x, int y, int cols, int rows) ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, 16, 16), int x, int y, int cols, int rows)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
_rows(rows), _rows(rows),
_cols(cols), _cols(cols),

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: ToggleWidget.hxx,v 1.1 2005-08-30 17:51:26 stephena Exp $ // $Id: ToggleWidget.hxx,v 1.2 2006-02-22 17:38:04 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
@ -37,7 +37,8 @@ enum {
class ToggleWidget : public Widget, public CommandSender class ToggleWidget : public Widget, public CommandSender
{ {
public: public:
ToggleWidget(GuiObject* boss, int x, int y, int cols, int rows); ToggleWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows);
virtual ~ToggleWidget(); virtual ~ToggleWidget();
const BoolArray& getState() { return _stateList; } const BoolArray& getState() { return _stateList; }

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: OSystem.cxx,v 1.60 2006-01-31 14:02:08 urchlay Exp $ // $Id: OSystem.cxx,v 1.61 2006-02-22 17:38:04 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -96,6 +96,11 @@ OSystem::~OSystem()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool OSystem::create() bool OSystem::create()
{ {
// Create fonts to draw text
myFont = new GUI::Font(GUI::stellaDesc);
myLauncherFont = new GUI::Font(GUI::stellaDesc); // FIXME
myConsoleFont = new GUI::Font(GUI::consoleDesc);
// Create menu and launcher GUI objects // Create menu and launcher GUI objects
myMenu = new Menu(this); myMenu = new Menu(this);
myCommandMenu = new CommandMenu(this); myCommandMenu = new CommandMenu(this);
@ -107,10 +112,6 @@ bool OSystem::create()
myCheatManager = new CheatManager(this); myCheatManager = new CheatManager(this);
#endif #endif
// Create fonts to draw text
myFont = new GUI::Font(GUI::stellaDesc);
myConsoleFont = new GUI::Font(GUI::consoleDesc);
// Determine which features were conditionally compiled into Stella // Determine which features were conditionally compiled into Stella
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
myFeatures += "OpenGL "; myFeatures += "OpenGL ";

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: OSystem.hxx,v 1.37 2006-01-30 01:01:44 stephena Exp $ // $Id: OSystem.hxx,v 1.38 2006-02-22 17:38:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_HXX #ifndef OSYSTEM_HXX
@ -44,7 +44,7 @@ class CheatManager;
other objects belong. other objects belong.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystem.hxx,v 1.37 2006-01-30 01:01:44 stephena Exp $ @version $Id: OSystem.hxx,v 1.38 2006-02-22 17:38:04 stephena Exp $
*/ */
class OSystem class OSystem
{ {
@ -174,6 +174,13 @@ class OSystem
*/ */
inline const GUI::Font& font() const { return *myFont; } inline const GUI::Font& font() const { return *myFont; }
/**
Get the launcher font object of the system
@return The font reference
*/
inline const GUI::Font& launcherFont() const { return *myLauncherFont; }
/** /**
Get the console font object of the system Get the console font object of the system
@ -430,10 +437,13 @@ class OSystem
string myFeatures; string myFeatures;
// The normal GUI font object to use // The font object to use for the normal in-game GUI
GUI::Font* myFont; GUI::Font* myFont;
// The console font object to use // The font object to use for the ROM launcher
GUI::Font* myLauncherFont;
// The font object to use for the console/debugger
GUI::Font* myConsoleFont; GUI::Font* myConsoleFont;
private: private:

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: AboutDialog.cxx,v 1.9 2005-11-26 21:23:35 stephena Exp $ // $Id: AboutDialog.cxx,v 1.10 2006-02-22 17:38:04 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
@ -31,25 +31,26 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent, AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
myPage(1), myPage(1),
myNumPages(6) myNumPages(6)
{ {
// Add Previous, Next and Close buttons // Add Previous, Next and Close buttons
myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P'); myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton((kButtonWidth + 15), h - 24, myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
"Next", kNextCmd, 'N'); "Next", kNextCmd, 'N');
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C'); addButton(font, w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED); myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 5, 5, w-10, kFontHeight, "", kTextAlignCenter); myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
"", kTextAlignCenter);
myTitle->setColor(kTextColorHi); myTitle->setColor(kTextColorHi);
for(int i = 0; i < LINES_PER_PAGE; i++) for(int i = 0; i < LINES_PER_PAGE; i++)
{ {
myDesc[i] = new StaticTextWidget(this, 10, 18 + (10 * i), w - 20, myDesc[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), w - 20,
kFontHeight, "", kTextAlignLeft); font.getFontHeight(), "", kTextAlignLeft);
} }
} }

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: AboutDialog.hxx,v 1.3 2005-07-05 15:25:44 stephena Exp $ // $Id: AboutDialog.hxx,v 1.4 2006-02-22 17:38:04 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
@ -37,7 +37,7 @@ class AboutDialog : public Dialog
{ {
public: public:
AboutDialog(OSystem* osystem, DialogContainer* parent, AboutDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~AboutDialog(); ~AboutDialog();
protected: protected:

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.17 2005-09-23 23:35:02 stephena Exp $ // $Id: AudioDialog.cxx,v 1.18 2006-02-22 17:38:04 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
@ -34,60 +34,60 @@
#include "bspf.hxx" #include "bspf.hxx"
enum {
kAudioRowHeight = 12,
kAudioWidth = 200,
kAudioHeight = 100
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent, AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h) : Dialog(osystem, parent, x, y, w, h)
{ {
const GUI::Font& font = instance()->font(); const int lineHeight = font.getLineHeight(),
int yoff = 10, fontHeight = font.getFontHeight();
xoff = 30, int xpos, ypos;
woff = _w - 80, int lwidth = font.getStringWidth("Fragment Size: "),
labelWidth = 80; pwidth = font.getStringWidth("4096");
// Volume // Volume
myVolumeSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight, xpos = (w - lwidth - pwidth - 40) / 2; ypos = 10;
"Volume: ", labelWidth, kVolumeChanged);
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Volume: ", lwidth, kVolumeChanged);
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100); myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
myVolumeLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 24, kLineHeight, myVolumeLabel = new StaticTextWidget(this, font,
"", kTextAlignLeft); xpos + myVolumeSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myVolumeLabel->setFlags(WIDGET_CLEARBG); myVolumeLabel->setFlags(WIDGET_CLEARBG);
yoff += kAudioRowHeight + 4; ypos += lineHeight + 4;
// Fragment size // Fragment size
myFragsizePopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, myFragsizePopup = new PopUpWidget(this, font, xpos, ypos,
"Fragment size: ", labelWidth); pwidth + myVolumeLabel->getWidth() - 4, lineHeight,
"Fragment size: ", lwidth);
myFragsizePopup->appendEntry("256", 1); myFragsizePopup->appendEntry("256", 1);
myFragsizePopup->appendEntry("512", 2); myFragsizePopup->appendEntry("512", 2);
myFragsizePopup->appendEntry("1024", 3); myFragsizePopup->appendEntry("1024", 3);
myFragsizePopup->appendEntry("2048", 4); myFragsizePopup->appendEntry("2048", 4);
myFragsizePopup->appendEntry("4096", 5); myFragsizePopup->appendEntry("4096", 5);
yoff += kAudioRowHeight + 4; ypos += lineHeight + 4;
// Stereo sound // Stereo sound
mySoundTypeCheckbox = new CheckboxWidget(this, font, xoff+28, yoff, mySoundTypeCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
"Stereo mode", 0); "Stereo mode", 0);
yoff += kAudioRowHeight + 4; ypos += lineHeight + 4;
// Enable sound // Enable sound
mySoundEnableCheckbox = new CheckboxWidget(this, font, xoff+28, yoff, mySoundEnableCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
"Enable sound", kSoundEnableChanged); "Enable sound", kSoundEnableChanged);
yoff += kAudioRowHeight + 12; ypos += lineHeight + 12;
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0); addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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: AudioDialog.hxx,v 1.6 2005-09-06 19:42:35 stephena Exp $ // $Id: AudioDialog.hxx,v 1.7 2006-02-22 17:38:04 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
@ -42,7 +42,7 @@ class AudioDialog : public Dialog
{ {
public: public:
AudioDialog(OSystem* osystem, DialogContainer* parent, AudioDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~AudioDialog(); ~AudioDialog();
protected: protected:

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: BrowserDialog.cxx,v 1.13 2006-01-16 01:56:18 stephena Exp $ // $Id: BrowserDialog.cxx,v 1.14 2006-02-22 17:38:04 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,34 +43,56 @@ enum {
*/ */
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BrowserDialog::BrowserDialog(GuiObject* boss, int x, int y, int w, int h) BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Dialog(boss->instance(), boss->parent(), x, y, w, h), : Dialog(boss->instance(), boss->parent(), x, y, w, h),
CommandSender(boss), CommandSender(boss),
_fileList(NULL), _fileList(NULL),
_currentPath(NULL) _currentPath(NULL)
{ {
_title = new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, "", kTextAlignCenter); const int lineHeight = font.getLineHeight(),
bwidth = font.getStringWidth("Cancel") + 20,
bheight = font.getLineHeight() + 4;
int xpos, ypos;
xpos = 10; ypos = 4;
_title = new StaticTextWidget(this, font, xpos, ypos,
_w - 2 * xpos, lineHeight,
"", kTextAlignCenter);
// Current path - TODO: handle long paths ? // Current path - TODO: handle long paths ?
_currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight, ypos += lineHeight + 4;
_currentPath = new StaticTextWidget(this, font, xpos, ypos,
_w - 2 * xpos, lineHeight,
"DUMMY", kTextAlignLeft); "DUMMY", kTextAlignLeft);
// Add file list // Add file list
_fileList = new StringListWidget(this, instance()->font(), ypos += lineHeight;
10, 34, _w - 2 * 10, _h - 34 - 24 - 10); _fileList = new StringListWidget(this, font, xpos, ypos,
_w - 2 * xpos, _h - bheight - ypos - 15);
_fileList->setNumberingMode(kListNumberingOff); _fileList->setNumberingMode(kListNumberingOff);
_fileList->setEditable(false); _fileList->setEditable(false);
_fileList->setFlags(WIDGET_NODRAW_FOCUS); _fileList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(_fileList); addFocusWidget(_fileList);
// Buttons // Buttons
addButton(10, _h - 24, "Go up", kGoUpCmd, 0); xpos = 10; ypos = _h - bheight - 8;
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Go up",
kGoUpCmd, 0);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Choose", kChooseCmd, 0); xpos = _w - 2 *(bwidth + 10);
addButton(_w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0); new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
kChooseCmd, 0);
xpos += bwidth + 10;
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0); new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd, 0);
xpos += bwidth + 10;
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
kChooseCmd, 0);
#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: BrowserDialog.hxx,v 1.6 2005-08-22 18:17:10 stephena Exp $ // $Id: BrowserDialog.hxx,v 1.7 2006-02-22 17:38:04 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
@ -34,7 +34,8 @@ class StringListWidget;
class BrowserDialog : public Dialog, public CommandSender class BrowserDialog : public Dialog, public CommandSender
{ {
public: public:
BrowserDialog(GuiObject* boss, int x, int y, int w, int h); BrowserDialog(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
const FilesystemNode& getResult() { return _choice; } const FilesystemNode& getResult() { return _choice; }

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: CheckListWidget.cxx,v 1.9 2005-11-27 22:37:25 stephena Exp $ // $Id: CheckListWidget.cxx,v 1.10 2006-02-22 17:38:04 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
@ -31,8 +31,8 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
// rowheight is determined by largest item on a line, // rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change // possibly meaning that number of rows will change
_rowHeight = MAX(_rowHeight, CheckboxWidget::boxSize()); _fontHeight = MAX(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _rowHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list
CheckboxWidget* t; CheckboxWidget* t;
@ -42,7 +42,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
t->setTarget(this); t->setTarget(this);
t->setID(i); t->setID(i);
t->holdFocus(false); t->holdFocus(false);
ypos += _rowHeight; ypos += _fontHeight;
_checkList.push_back(t); _checkList.push_back(t);
} }
@ -127,8 +127,7 @@ void CheckListWidget::drawWidget(bool hilite)
_checkList[i]->setDirty(); _checkList[i]->setDirty();
_checkList[i]->draw(); _checkList[i]->draw();
// FIXME - properly account for differing font heights const int y = _y + 2 + _fontHeight * i + 2;
const int y = _y + 2 + _rowHeight * i + 2;
GUI::Rect r(getEditRect()); GUI::Rect r(getEditRect());
@ -136,12 +135,12 @@ void CheckListWidget::drawWidget(bool hilite)
if (_selectedItem == pos) if (_selectedItem == pos)
{ {
if (_hasFocus && !_editMode) if (_hasFocus && !_editMode)
fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i, fb.fillRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
_w - r.left, _rowHeight, _w - r.left, _fontHeight,
kTextColorHi); kTextColorHi);
else else
fb.frameRect(_x + r.left - 3, _y + 1 + _rowHeight * i, fb.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
_w - r.left, _rowHeight, _w - r.left, _fontHeight,
kTextColorHi); kTextColorHi);
} }
@ -171,8 +170,8 @@ void CheckListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect CheckListWidget::getEditRect() const GUI::Rect CheckListWidget::getEditRect() const
{ {
GUI::Rect r(2, 1, _w, _rowHeight); GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight, const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10; xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset; r.top += yoffset;
r.bottom += yoffset; r.bottom += yoffset;

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: CommandDialog.cxx,v 1.7 2006-01-08 20:55:53 stephena Exp $ // $Id: CommandDialog.cxx,v 1.8 2006-02-22 17:38:04 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
@ -31,7 +31,8 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
: Dialog(osystem, parent, 0, 0, 16, 16), : Dialog(osystem, parent, 0, 0, 16, 16),
mySelectedItem(0) mySelectedItem(0)
{ {
int lineHeight = osystem->font().getLineHeight(), const GUI::Font& font = osystem->font();
int lineHeight = font.getLineHeight(),
buttonWidth = 60, buttonWidth = 60,
buttonHeight = lineHeight + 2, buttonHeight = lineHeight + 2,
xoffset = 5, xoffset = 5,
@ -47,88 +48,88 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
WidgetArray wid; WidgetArray wid;
ButtonWidget* b; ButtonWidget* b;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Select", kSelectCmd, 0); "Select", kSelectCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Reset", kResetCmd, 0); "Reset", kResetCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Color TV", kColorCmd, 0); "Color TV", kColorCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"B/W TV", kBWCmd, 0); "B/W TV", kBWCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset = 5; yoffset += buttonHeight + 5; xoffset = 5; yoffset += buttonHeight + 5;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Left Diff A", kLeftDiffACmd, 0); "Left Diff A", kLeftDiffACmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Left Diff B", kLeftDiffBCmd, 0); "Left Diff B", kLeftDiffBCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Right Diff A", kRightDiffACmd, 0); "Right Diff A", kRightDiffACmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Right Diff B", kRightDiffBCmd, 0); "Right Diff B", kRightDiffBCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset = 5; yoffset += buttonHeight + 5; xoffset = 5; yoffset += buttonHeight + 5;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Save State", kSaveStateCmd, 0); "Save State", kSaveStateCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"State Slot", kStateSlotCmd, 0); "State Slot", kStateSlotCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Load State", kLoadStateCmd, 0); "Load State", kLoadStateCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Snapshot", kSnapshotCmd, 0); "Snapshot", kSnapshotCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset = 5; yoffset += buttonHeight + 5; xoffset = 5; yoffset += buttonHeight + 5;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"NTSC/PAL", kFormatCmd, 0); "NTSC/PAL", kFormatCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Palette", kPaletteCmd, 0); "Palette", kPaletteCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Reload ROM", kReloadRomCmd, 0); "Reload ROM", kReloadRomCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);
xoffset += lwidth; xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight, b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Exit Game", kExitCmd, 0); "Exit Game", kExitCmd, 0);
b->setEditable(true); b->setEditable(true);
wid.push_back(b); wid.push_back(b);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Dialog.cxx,v 1.41 2006-01-09 16:50:01 stephena Exp $ // $Id: Dialog.cxx,v 1.42 2006-02-22 17:38:04 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
@ -450,8 +450,15 @@ Widget* Dialog::findWidget(int x, int y)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ButtonWidget* Dialog::addButton(int x, int y, const string& label, ButtonWidget* Dialog::addButton(const GUI::Font& font, int x, int y,
int cmd, char hotkey) const string& label, int cmd, char hotkey)
{ {
return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey); #if 0
const int w = 6 * font.getMaxCharWidth(),
h = font.getFontHeight() + 6;
return new ButtonWidget(this, font, x, y, w, h, label, cmd, hotkey);
#else
return new ButtonWidget(this, font, x, y, kButtonWidth, 16, label, cmd, hotkey);
#endif
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Dialog.hxx,v 1.26 2006-01-09 16:50:01 stephena Exp $ // $Id: Dialog.hxx,v 1.27 2006-02-22 17:38:04 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
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes. This is the base class for all dialog boxes.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Dialog.hxx,v 1.26 2006-01-09 16:50:01 stephena Exp $ @version $Id: Dialog.hxx,v 1.27 2006-02-22 17:38:04 stephena Exp $
*/ */
class Dialog : public GuiObject class Dialog : public GuiObject
{ {
@ -94,7 +94,8 @@ class Dialog : public GuiObject
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
ButtonWidget* addButton(int x, int y, const string& label, int cmd, char hotkey); ButtonWidget* addButton(const GUI::Font& font, int x, int y,
const string& label = "", int cmd = 0, char hotkey = 0);
void setResult(int result) { _result = result; } void setResult(int result) { _result = result; }
int getResult() const { return _result; } int getResult() const { return _result; }

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: EditTextWidget.cxx,v 1.13 2006-01-15 20:46:20 stephena Exp $ // $Id: EditTextWidget.cxx,v 1.14 2006-02-22 17:38:04 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
@ -26,9 +26,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditTextWidget::EditTextWidget(GuiObject* boss, int x, int y, int w, int h, EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font,
const string& text) int x, int y, int w, int h, const string& text)
: EditableWidget(boss, x, y - 1, w, h + 2) : EditableWidget(boss, font, x, y - 1, w, h + 2)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kEditTextWidget; _type = kEditTextWidget;

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: EditTextWidget.hxx,v 1.4 2005-06-30 00:08:01 stephena Exp $ // $Id: EditTextWidget.hxx,v 1.5 2006-02-22 17:38:04 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
@ -30,7 +30,8 @@
class EditTextWidget : public EditableWidget class EditTextWidget : public EditableWidget
{ {
public: public:
EditTextWidget(GuiObject* boss, int x, int y, int w, int h, const string& text); EditTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& text);
void setEditString(const string& str); void setEditString(const string& str);

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: EditableWidget.cxx,v 1.15 2006-01-15 20:46:20 stephena Exp $ // $Id: EditableWidget.cxx,v 1.16 2006-02-22 17:38:04 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
@ -23,8 +23,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditableWidget::EditableWidget(GuiObject* boss, int x, int y, int w, int h) EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
_editable(true) _editable(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: EditableWidget.hxx,v 1.8 2005-10-09 20:41:56 stephena Exp $ // $Id: EditableWidget.hxx,v 1.9 2006-02-22 17:38:04 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
@ -38,7 +38,8 @@ enum {
class EditableWidget : public Widget, public CommandSender class EditableWidget : public Widget, public CommandSender
{ {
public: public:
EditableWidget(GuiObject *boss, int x, int y, int w, int h); EditableWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual ~EditableWidget(); virtual ~EditableWidget();
virtual void setEditString(const string& str); virtual void setEditString(const string& str);

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: EventMappingWidget.cxx,v 1.11 2006-01-19 00:45:13 stephena Exp $ // $Id: EventMappingWidget.cxx,v 1.12 2006-02-22 17:38:04 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
@ -30,14 +30,15 @@
#include "bspf.hxx" #include "bspf.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int h) EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
myActionSelected(-1), myActionSelected(-1),
myRemapStatus(false), myRemapStatus(false),
myFirstTime(true) myFirstTime(true)
{ {
const GUI::Font& font = instance()->font(); // FIXME
const int fontHeight = font.getFontHeight(), const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos = 5, ypos = 5; int xpos = 5, ypos = 5;
@ -52,26 +53,26 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int
// Add remap, erase, cancel and default buttons // Add remap, erase, cancel and default buttons
xpos += myActionsList->getWidth() + 15; ypos += 5; xpos += myActionsList->getWidth() + 15; ypos += 5;
myMapButton = new ButtonWidget(boss, xpos, ypos, 50, 16, myMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Map", kStartMapCmd); "Map", kStartMapCmd);
myMapButton->setTarget(this); myMapButton->setTarget(this);
ypos += 20; ypos += 20;
myEraseButton = new ButtonWidget(boss, xpos, ypos, 50, 16, myEraseButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Erase", kEraseCmd); "Erase", kEraseCmd);
myEraseButton->setTarget(this); myEraseButton->setTarget(this);
ypos += 20; ypos += 20;
myCancelMapButton = new ButtonWidget(boss, xpos, ypos, 50, 16, myCancelMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Cancel", kStopMapCmd); "Cancel", kStopMapCmd);
myCancelMapButton->setTarget(this); myCancelMapButton->setTarget(this);
myCancelMapButton->clearFlags(WIDGET_ENABLED); myCancelMapButton->clearFlags(WIDGET_ENABLED);
ypos += 30; ypos += 30;
myDefaultsButton = new ButtonWidget(boss, xpos, ypos, 50, 16, myDefaultsButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Defaults", kDefaultsCmd); "Defaults", kDefaultsCmd);
myDefaultsButton->setTarget(this); myDefaultsButton->setTarget(this);
// Show message for currently selected event // Show message for currently selected event
xpos = 10; ypos = 5 + myActionsList->getHeight() + 3; xpos = 10; ypos = 5 + myActionsList->getHeight() + 3;
myKeyMapping = new StaticTextWidget(boss, xpos, ypos, _w - 20, fontHeight, myKeyMapping = new StaticTextWidget(boss, font, xpos, ypos, _w - 20, fontHeight,
"Action: ", kTextAlignLeft); "Action: ", kTextAlignLeft);
myKeyMapping->setFlags(WIDGET_CLEARBG); myKeyMapping->setFlags(WIDGET_CLEARBG);

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: EventMappingWidget.hxx,v 1.6 2006-01-15 20:46:20 stephena Exp $ // $Id: EventMappingWidget.hxx,v 1.7 2006-02-22 17:38:04 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
@ -41,7 +41,8 @@ class EventMappingWidget : public Widget, public CommandSender
friend class InputDialog; friend class InputDialog;
public: public:
EventMappingWidget(GuiObject* boss, int x, int y, int w, int h); EventMappingWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
~EventMappingWidget(); ~EventMappingWidget();
virtual bool handleKeyDown(int ascii, int keycode, int modifiers); virtual bool handleKeyDown(int ascii, int keycode, int modifiers);

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.22 2006-01-20 15:13:37 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.23 2006-02-22 17:38:04 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
@ -31,23 +31,22 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GameInfoDialog::GameInfoDialog( GameInfoDialog::GameInfoDialog(
OSystem* osystem, DialogContainer* parent, GuiObject* boss, OSystem* osystem, DialogContainer* parent, const GUI::Font& font,
int x, int y, int w, int h) GuiObject* boss, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
CommandSender(boss) CommandSender(boss)
{ {
const GUI::Font& font = instance()->font();
const int fontHeight = font.getFontHeight(), const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
const int vBorder = 4; const int vBorder = 4;
int xpos, ypos, lwidth, fwidth, tabID; int xpos, ypos, lwidth, fwidth, pwidth, tabID;
unsigned int i; unsigned int i;
WidgetArray wid; WidgetArray wid;
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
// 1) Cartridge properties // 1) Cartridge properties
wid.clear(); wid.clear();
@ -56,62 +55,63 @@ GameInfoDialog::GameInfoDialog(
xpos = 10; xpos = 10;
lwidth = font.getStringWidth("Manufacturer: "); lwidth = font.getStringWidth("Manufacturer: ");
fwidth = _w - xpos - lwidth - 10; fwidth = _w - xpos - lwidth - 10;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Name:", kTextAlignLeft); "Name:", kTextAlignLeft);
myName = new EditTextWidget(myTab, xpos+lwidth, ypos, fwidth, fontHeight, ""); myName = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, "");
wid.push_back(myName); wid.push_back(myName);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"MD5:", kTextAlignLeft); "MD5:", kTextAlignLeft);
myMD5 = new StaticTextWidget(myTab, xpos+lwidth, ypos, myMD5 = new StaticTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, fwidth, fontHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Manufacturer:", kTextAlignLeft); "Manufacturer:", kTextAlignLeft);
myManufacturer = new EditTextWidget(myTab, xpos+lwidth, ypos, myManufacturer = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, ""); fwidth, fontHeight, "");
wid.push_back(myManufacturer); wid.push_back(myManufacturer);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Model:", kTextAlignLeft); "Model:", kTextAlignLeft);
myModelNo = new EditTextWidget(myTab, xpos+lwidth, ypos, myModelNo = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, ""); fwidth, fontHeight, "");
wid.push_back(myModelNo); wid.push_back(myModelNo);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Rarity:", kTextAlignLeft); "Rarity:", kTextAlignLeft);
myRarity = new EditTextWidget(myTab, xpos+lwidth, ypos, myRarity = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, ""); fwidth, fontHeight, "");
wid.push_back(myRarity); wid.push_back(myRarity);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Note:", kTextAlignLeft); "Note:", kTextAlignLeft);
myNote = new EditTextWidget(myTab, xpos+lwidth, ypos, myNote = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, ""); fwidth, fontHeight, "");
wid.push_back(myNote); wid.push_back(myNote);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Sound:", kTextAlignLeft); "Sound:", kTextAlignLeft);
mySound = new PopUpWidget(myTab, xpos+lwidth, ypos, pwidth = font.getStringWidth("Stereo");
font.getStringWidth("Stereo") + 15, lineHeight, mySound = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
"", 0, 0); pwidth, lineHeight, "", 0, 0);
mySound->appendEntry("Mono", 1); mySound->appendEntry("Mono", 1);
mySound->appendEntry("Stereo", 2); mySound->appendEntry("Stereo", 2);
wid.push_back(mySound); wid.push_back(mySound);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Type:", kTextAlignLeft); "Type:", kTextAlignLeft);
myType = new PopUpWidget(myTab, xpos+lwidth, ypos, pwidth = font.getStringWidth("CV (Commavid extra ram)");
font.getStringWidth("CV (Commavid extra ram)") + 15, myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
lineHeight, "", 0, 0); pwidth, lineHeight, "", 0, 0);
for(i = 0; i < 21; ++i) for(i = 0; i < 21; ++i)
myType->appendEntry(ourCartridgeList[i].name, i+1); myType->appendEntry(ourCartridgeList[i].name, i+1);
wid.push_back(myType); wid.push_back(myType);
@ -126,41 +126,38 @@ GameInfoDialog::GameInfoDialog(
xpos = 10; ypos = vBorder; xpos = 10; ypos = vBorder;
lwidth = font.getStringWidth("Right Difficulty: "); lwidth = font.getStringWidth("Right Difficulty: ");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, pwidth = font.getStringWidth("B & W");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Left Difficulty:", kTextAlignLeft); "Left Difficulty:", kTextAlignLeft);
myLeftDiff = new PopUpWidget(myTab, xpos+lwidth, ypos, myLeftDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth(" ") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myLeftDiff->appendEntry("B", 1); myLeftDiff->appendEntry("B", 1);
myLeftDiff->appendEntry("A", 2); myLeftDiff->appendEntry("A", 2);
wid.push_back(myLeftDiff); wid.push_back(myLeftDiff);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Right Difficulty:", kTextAlignLeft); "Right Difficulty:", kTextAlignLeft);
myRightDiff = new PopUpWidget(myTab, xpos+lwidth, ypos, myRightDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth(" ") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myRightDiff->appendEntry("B", 1); myRightDiff->appendEntry("B", 1);
myRightDiff->appendEntry("A", 2); myRightDiff->appendEntry("A", 2);
wid.push_back(myRightDiff); wid.push_back(myRightDiff);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"TV Type:", kTextAlignLeft); "TV Type:", kTextAlignLeft);
myTVType = new PopUpWidget(myTab, xpos+lwidth, ypos, myTVType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth("B & W") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myTVType->appendEntry("Color", 1); myTVType->appendEntry("Color", 1);
myTVType->appendEntry("B & W", 2); myTVType->appendEntry("B & W", 2);
wid.push_back(myTVType); wid.push_back(myTVType);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Swap ports:", kTextAlignLeft); "Swap ports:", kTextAlignLeft);
mySwapPorts = new PopUpWidget(myTab, xpos+lwidth, ypos, mySwapPorts = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
mySwapPorts->appendEntry("Yes", 1); mySwapPorts->appendEntry("Yes", 1);
mySwapPorts->appendEntry("No", 2); mySwapPorts->appendEntry("No", 2);
wid.push_back(mySwapPorts); wid.push_back(mySwapPorts);
@ -175,22 +172,20 @@ GameInfoDialog::GameInfoDialog(
xpos = 10; ypos = vBorder; xpos = 10; ypos = vBorder;
lwidth = font.getStringWidth("Right Controller: "); lwidth = font.getStringWidth("Right Controller: ");
fwidth = font.getStringWidth("Booster-Grip"); pwidth = font.getStringWidth("Booster-Grip");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Left Controller:", kTextAlignLeft); "Left Controller:", kTextAlignLeft);
myLeftController = new PopUpWidget(myTab, xpos+lwidth, ypos, myLeftController = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
fwidth + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)
myLeftController->appendEntry(ourControllerList[i].name, i+1); myLeftController->appendEntry(ourControllerList[i].name, i+1);
wid.push_back(myLeftController); wid.push_back(myLeftController);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Right Controller:", kTextAlignLeft); "Right Controller:", kTextAlignLeft);
myRightController = new PopUpWidget(myTab, xpos+lwidth, ypos, myRightController = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
fwidth + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
for(i = 0; i < 5; ++i) for(i = 0; i < 5; ++i)
myRightController->appendEntry(ourControllerList[i].name, i+1); myRightController->appendEntry(ourControllerList[i].name, i+1);
wid.push_back(myRightController); wid.push_back(myRightController);
@ -204,60 +199,59 @@ GameInfoDialog::GameInfoDialog(
tabID = myTab->addTab("Display"); tabID = myTab->addTab("Display");
xpos = 10; ypos = vBorder; xpos = 10; ypos = vBorder;
lwidth = font.getStringWidth("Use HMBlanks: "); lwidth = font.getStringWidth("Use Phosphor: ");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, pwidth = font.getStringWidth("NTSC");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Format:", kTextAlignLeft); "Format:", kTextAlignLeft);
myFormat = new PopUpWidget(myTab, xpos+lwidth, ypos, myFormat = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth("NTSC") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myFormat->appendEntry("NTSC", 1); myFormat->appendEntry("NTSC", 1);
myFormat->appendEntry("PAL", 2); myFormat->appendEntry("PAL", 2);
wid.push_back(myFormat); wid.push_back(myFormat);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"XStart:", kTextAlignLeft); "XStart:", kTextAlignLeft);
myXStart = new EditTextWidget(myTab, xpos+lwidth, ypos, myXStart = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, ""); 25, fontHeight, "");
wid.push_back(myXStart); wid.push_back(myXStart);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Width:", kTextAlignLeft); "Width:", kTextAlignLeft);
myWidth = new EditTextWidget(myTab, xpos+lwidth, ypos, myWidth = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, ""); 25, fontHeight, "");
wid.push_back(myWidth); wid.push_back(myWidth);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"YStart:", kTextAlignLeft); "YStart:", kTextAlignLeft);
myYStart = new EditTextWidget(myTab, xpos+lwidth, ypos, myYStart = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, ""); 25, fontHeight, "");
wid.push_back(myYStart); wid.push_back(myYStart);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Height:", kTextAlignLeft); "Height:", kTextAlignLeft);
myHeight = new EditTextWidget(myTab, xpos+lwidth, ypos, myHeight = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, ""); 25, fontHeight, "");
wid.push_back(myHeight); wid.push_back(myHeight);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, pwidth = font.getStringWidth("Yes");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use Phosphor:", kTextAlignLeft); "Use Phosphor:", kTextAlignLeft);
myPhosphor = new PopUpWidget(myTab, xpos+lwidth, ypos, myPhosphor = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myPhosphor->appendEntry("Yes", 1); myPhosphor->appendEntry("Yes", 1);
myPhosphor->appendEntry("No", 2); myPhosphor->appendEntry("No", 2);
wid.push_back(myPhosphor); wid.push_back(myPhosphor);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use HMBlanks:", kTextAlignLeft); "Use HMBlanks:", kTextAlignLeft);
myHmoveBlanks = new PopUpWidget(myTab, xpos+lwidth, ypos, myHmoveBlanks = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight, pwidth, lineHeight, "", 0, 0);
"", 0, 0);
myHmoveBlanks->appendEntry("Yes", 1); myHmoveBlanks->appendEntry("Yes", 1);
myHmoveBlanks->appendEntry("No", 2); myHmoveBlanks->appendEntry("No", 2);
wid.push_back(myHmoveBlanks); wid.push_back(myHmoveBlanks);
@ -270,16 +264,16 @@ GameInfoDialog::GameInfoDialog(
myTab->setActiveTab(0); myTab->setActiveTab(0);
// Add message concerning usage // Add message concerning usage
new StaticTextWidget(this, 10, _h - 20, 120, fontHeight, new StaticTextWidget(this, font, 10, _h - 20, 120, fontHeight,
"(*) Requires a ROM reload", kTextAlignLeft); "(*) Requires a ROM reload", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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: GameInfoDialog.hxx,v 1.14 2006-01-11 01:17:11 stephena Exp $ // $Id: GameInfoDialog.hxx,v 1.15 2006-02-22 17:38:04 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,8 @@ struct PropType {
class GameInfoDialog : public Dialog, public CommandSender class GameInfoDialog : public Dialog, public CommandSender
{ {
public: public:
GameInfoDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss, GameInfoDialog(OSystem* osystem, DialogContainer* parent,
const GUI::Font& font, GuiObject* boss,
int x, int y, int w, int h); int x, int y, int w, int h);
~GameInfoDialog(); ~GameInfoDialog();

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: GuiObject.hxx,v 1.18 2006-01-15 20:46:20 stephena Exp $ // $Id: GuiObject.hxx,v 1.19 2006-02-22 17:38:04 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
@ -28,7 +28,6 @@ class Widget;
#include "Command.hxx" #include "Command.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Array.hxx" #include "Array.hxx"
#include "Font.hxx"
typedef Common::Array<Widget*> WidgetArray; typedef Common::Array<Widget*> WidgetArray;
@ -47,7 +46,7 @@ enum {
This is the base class for all GUI objects/widgets. This is the base class for all GUI objects/widgets.
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiObject.hxx,v 1.18 2006-01-15 20:46:20 stephena Exp $ @version $Id: GuiObject.hxx,v 1.19 2006-02-22 17:38:04 stephena Exp $
*/ */
class GuiObject : public CommandReceiver class GuiObject : public CommandReceiver
{ {
@ -63,7 +62,6 @@ class GuiObject : public CommandReceiver
_w(w), _w(w),
_h(h), _h(h),
_dirty(false), _dirty(false),
_font((GUI::Font*)&(osystem->font())),
_firstWidget(0) {} _firstWidget(0) {}
virtual ~GuiObject() {} virtual ~GuiObject() {}
@ -84,9 +82,6 @@ class GuiObject : public CommandReceiver
virtual void setDirty() { _dirty = true; } virtual void setDirty() { _dirty = true; }
virtual void setFont(const GUI::Font& font) { _font = (GUI::Font*) &font; }
virtual const GUI::Font* font() { return _font; }
virtual bool isVisible() const = 0; virtual bool isVisible() const = 0;
virtual void draw() = 0; virtual void draw() = 0;
@ -110,8 +105,6 @@ class GuiObject : public CommandReceiver
int _w, _h; int _w, _h;
bool _dirty; bool _dirty;
GUI::Font* _font;
Widget* _firstWidget; Widget* _firstWidget;
WidgetArray _focusList; WidgetArray _focusList;
}; };

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GuiUtils.hxx,v 1.21 2005-10-09 17:31:47 stephena Exp $ // $Id: GuiUtils.hxx,v 1.22 2006-02-22 17:38:04 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,12 +29,9 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.21 2005-10-09 17:31:47 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.22 2006-02-22 17:38:04 stephena Exp $
*/ */
#define kFontHeight 10
#define kLineHeight 12
#define kScrollBarWidth 9 #define kScrollBarWidth 9
// Colors indices to use for the various GUI elements // Colors indices to use for the various GUI elements

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: HelpDialog.cxx,v 1.14 2005-10-24 18:18:30 stephena Exp $ // $Id: HelpDialog.cxx,v 1.15 2006-02-22 17:38:04 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,25 +29,26 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent, HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
myPage(1), myPage(1),
myNumPages(4) myNumPages(4)
{ {
// Add Previous, Next and Close buttons // Add Previous, Next and Close buttons
myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P'); myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton((kButtonWidth + 15), h - 24, myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
"Next", kNextCmd, 'N'); "Next", kNextCmd, 'N');
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C'); addButton(font, w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED); myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 5, 5, w-10, kFontHeight, "", kTextAlignCenter); myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
"", kTextAlignCenter);
for(uInt8 i = 0; i < LINES_PER_PAGE; i++) for(uInt8 i = 0; i < LINES_PER_PAGE; i++)
{ {
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, kFontHeight, myKey[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), 80,
"", kTextAlignLeft); font.getFontHeight(), "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, kFontHeight, myDesc[i] = new StaticTextWidget(this, font, 90, 18 + (10 * i), 160,
"", kTextAlignLeft); font.getFontHeight(), "", kTextAlignLeft);
} }
} }

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: HelpDialog.hxx,v 1.6 2005-07-05 15:25:44 stephena Exp $ // $Id: HelpDialog.hxx,v 1.7 2006-02-22 17:38:04 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
@ -41,7 +41,7 @@ class HelpDialog : public Dialog
{ {
public: public:
HelpDialog(OSystem* osystem, DialogContainer* parent, HelpDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~HelpDialog(); ~HelpDialog();
protected: protected:

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.10 2006-01-15 20:46:20 stephena Exp $ // $Id: InputDialog.cxx,v 1.11 2006-02-22 17:38:04 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -36,7 +36,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent, InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h) : Dialog(osystem, parent, x, y, w, h)
{ {
const int vBorder = 4; const int vBorder = 4;
@ -44,19 +44,19 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
addTabWidget(myTab); addTabWidget(myTab);
// 1) Event mapper // 1) Event mapper
tabID = myTab->addTab("Event Mapping"); tabID = myTab->addTab("Event Mapping");
myEventMapper = new EventMappingWidget(myTab, 2, 2, myEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(), myTab->getWidth(),
myTab->getHeight() - ypos); myTab->getHeight() - ypos);
myTab->setParentWidget(tabID, myEventMapper); myTab->setParentWidget(tabID, myEventMapper);
addToFocusList(myEventMapper->getFocusList(), tabID); addToFocusList(myEventMapper->getFocusList(), tabID);
// 2) Virtual device support // 2) Virtual device support
addVDeviceTab(); addVDeviceTab(font);
// Finalize the tabs, and activate the first tab // Finalize the tabs, and activate the first tab
myTab->activateTabs(); myTab->activateTabs();
@ -64,11 +64,11 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// Add OK and Cancel buttons // Add OK and Cancel buttons
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif #endif
} }
@ -78,14 +78,11 @@ InputDialog::~InputDialog()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::addVDeviceTab() void InputDialog::addVDeviceTab(const GUI::Font& font)
{ {
const GUI::Font& font = instance()->font(); const int lineHeight = font.getLineHeight();
const int fontHeight = font.getFontHeight(), int xpos, ypos, lwidth, pwidth, tabID;
lineHeight = font.getLineHeight();
WidgetArray wid; WidgetArray wid;
int xpos, ypos, lwidth, fwidth, tabID;
// Virtual device/ports // Virtual device/ports
tabID = myTab->addTab("Virtual Devices"); tabID = myTab->addTab("Virtual Devices");
@ -93,20 +90,17 @@ void InputDialog::addVDeviceTab()
// Stelladaptor mappings // Stelladaptor mappings
xpos = 5; ypos = 5; xpos = 5; ypos = 5;
lwidth = font.getStringWidth("Stelladaptor 2 is: "); lwidth = font.getStringWidth("Stelladaptor 2 is: ");
fwidth = _w - xpos - lwidth - 10; pwidth = font.getStringWidth("right virtual port");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
"Stelladaptor 1 is:", kTextAlignLeft); myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
myLeftPort = new PopUpWidget(myTab, xpos+lwidth, ypos, "Stelladaptor 1 is: ", lwidth);
fwidth, lineHeight, "", 0, 0);
myLeftPort->appendEntry("left virtual port", 1); myLeftPort->appendEntry("left virtual port", 1);
myLeftPort->appendEntry("right virtual port", 2); myLeftPort->appendEntry("right virtual port", 2);
wid.push_back(myLeftPort); wid.push_back(myLeftPort);
ypos += lineHeight + 3; ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight, myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Stelladaptor 2 is:", kTextAlignLeft); "Stelladaptor 2 is: ", lwidth);
myRightPort = new PopUpWidget(myTab, xpos+lwidth, ypos,
fwidth, lineHeight, "", 0, 0);
myRightPort->appendEntry("left virtual port", 1); myRightPort->appendEntry("left virtual port", 1);
myRightPort->appendEntry("right virtual port", 2); myRightPort->appendEntry("right virtual port", 2);
wid.push_back(myRightPort); wid.push_back(myRightPort);
@ -114,60 +108,60 @@ void InputDialog::addVDeviceTab()
// Add 'mouse to paddle' mapping // Add 'mouse to paddle' mapping
ypos += 2*lineHeight; ypos += 2*lineHeight;
lwidth = font.getStringWidth("Mouse is paddle: "); lwidth = font.getStringWidth("Mouse is paddle: ");
myPaddleMode = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight, pwidth = font.getMaxCharWidth() * 5;
"Mouse is paddle: ", myPaddleMode = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
lwidth, kPaddleChanged); "Mouse is paddle: ", lwidth, kPaddleChanged);
myPaddleMode->setMinValue(0); myPaddleMode->setMaxValue(3); myPaddleMode->setMinValue(0); myPaddleMode->setMaxValue(3);
xpos += myPaddleMode->getWidth() + 5; xpos += myPaddleMode->getWidth() + 5;
myPaddleModeLabel = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight, myPaddleModeLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
myPaddleModeLabel->setFlags(WIDGET_CLEARBG); myPaddleModeLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleMode); wid.push_back(myPaddleMode);
// Add paddle 0 speed // Add paddle 0 speed
xpos = 5; ypos += lineHeight + 3; xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed[0] = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight, myPaddleSpeed[0] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle 1 speed: ", "Paddle 1 speed: ",
lwidth, kP0SpeedID); lwidth, kP0SpeedID);
myPaddleSpeed[0]->setMinValue(1); myPaddleSpeed[0]->setMaxValue(100); myPaddleSpeed[0]->setMinValue(1); myPaddleSpeed[0]->setMaxValue(100);
xpos += myPaddleSpeed[0]->getWidth() + 5; xpos += myPaddleSpeed[0]->getWidth() + 5;
myPaddleLabel[0] = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight, myPaddleLabel[0] = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
myPaddleLabel[0]->setFlags(WIDGET_CLEARBG); myPaddleLabel[0]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[0]); wid.push_back(myPaddleSpeed[0]);
// Add paddle 1 speed // Add paddle 1 speed
xpos = 5; ypos += lineHeight + 3; xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed[1] = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight, myPaddleSpeed[1] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle 2 speed: ", "Paddle 2 speed: ",
lwidth, kP1SpeedID); lwidth, kP1SpeedID);
myPaddleSpeed[1]->setMinValue(1); myPaddleSpeed[1]->setMaxValue(100); myPaddleSpeed[1]->setMinValue(1); myPaddleSpeed[1]->setMaxValue(100);
xpos += myPaddleSpeed[1]->getWidth() + 5; xpos += myPaddleSpeed[1]->getWidth() + 5;
myPaddleLabel[1] = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight, myPaddleLabel[1] = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
myPaddleLabel[1]->setFlags(WIDGET_CLEARBG); myPaddleLabel[1]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[1]); wid.push_back(myPaddleSpeed[1]);
// Add paddle 2 speed // Add paddle 2 speed
xpos = 5; ypos += lineHeight + 3; xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed[2] = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight, myPaddleSpeed[2] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle 3 speed: ", "Paddle 3 speed: ",
lwidth, kP2SpeedID); lwidth, kP2SpeedID);
myPaddleSpeed[2]->setMinValue(1); myPaddleSpeed[2]->setMaxValue(100); myPaddleSpeed[2]->setMinValue(1); myPaddleSpeed[2]->setMaxValue(100);
xpos += myPaddleSpeed[2]->getWidth() + 5; xpos += myPaddleSpeed[2]->getWidth() + 5;
myPaddleLabel[2] = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight, myPaddleLabel[2] = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
myPaddleLabel[2]->setFlags(WIDGET_CLEARBG); myPaddleLabel[2]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[2]); wid.push_back(myPaddleSpeed[2]);
// Add paddle 3 speed // Add paddle 3 speed
xpos = 5; ypos += lineHeight + 3; xpos = 5; ypos += lineHeight + 3;
myPaddleSpeed[3] = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight, myPaddleSpeed[3] = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Paddle 4 speed: ", "Paddle 4 speed: ",
lwidth, kP3SpeedID); lwidth, kP3SpeedID);
myPaddleSpeed[3]->setMinValue(1); myPaddleSpeed[3]->setMaxValue(100); myPaddleSpeed[3]->setMinValue(1); myPaddleSpeed[3]->setMaxValue(100);
xpos += myPaddleSpeed[3]->getWidth() + 5; xpos += myPaddleSpeed[3]->getWidth() + 5;
myPaddleLabel[3] = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight, myPaddleLabel[3] = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
myPaddleLabel[3]->setFlags(WIDGET_CLEARBG); myPaddleLabel[3]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[3]); wid.push_back(myPaddleSpeed[3]);

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.hxx,v 1.5 2006-01-09 19:30:04 stephena Exp $ // $Id: InputDialog.hxx,v 1.6 2006-02-22 17:38:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef INPUT_DIALOG_HXX #ifndef INPUT_DIALOG_HXX
@ -35,7 +35,7 @@ class InputDialog : public Dialog
{ {
public: public:
InputDialog(OSystem* osystem, DialogContainer* parent, InputDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~InputDialog(); ~InputDialog();
protected: protected:
@ -49,7 +49,7 @@ class InputDialog : public Dialog
void saveConfig(); void saveConfig();
private: private:
void addVDeviceTab(); void addVDeviceTab(const GUI::Font& font);
private: private:
TabWidget* myTab; TabWidget* myTab;

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: InputTextDialog.cxx,v 1.10 2005-12-20 19:05:16 stephena Exp $ // $Id: InputTextDialog.cxx,v 1.11 2006-02-22 17:38:04 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
@ -66,16 +66,13 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
for(i = 0; i < labels.size(); ++i) for(i = 0; i < labels.size(); ++i)
{ {
xpos = 10; xpos = 10;
StaticTextWidget* t = new StaticTextWidget(this, font, xpos, ypos,
new StaticTextWidget(this, xpos, ypos, lwidth, fontHeight,
lwidth, fontHeight, labels[i], kTextAlignLeft);
labels[i], kTextAlignLeft);
t->setFont(font);
xpos += lwidth + fontWidth; xpos += lwidth + fontWidth;
EditTextWidget* w = new EditTextWidget(this, xpos, ypos, EditTextWidget* w = new EditTextWidget(this, font, xpos, ypos,
_w - xpos - 10, lineHeight, ""); _w - xpos - 10, lineHeight, "");
w->setFont(font);
wid.push_back(w); wid.push_back(w);
myInput.push_back(w); myInput.push_back(w);
@ -84,16 +81,16 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
addToFocusList(wid); addToFocusList(wid);
xpos = 10; xpos = 10;
myTitle = new StaticTextWidget(this, xpos, ypos, _w - 2*xpos, fontHeight, myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 2*xpos, fontHeight,
"", kTextAlignCenter); "", kTextAlignCenter);
myTitle->setColor(kTextColorEm); myTitle->setColor(kTextColorEm);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0); addButton(font, _w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0);
#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: Launcher.hxx,v 1.4 2005-06-16 00:55:59 stephena Exp $ // $Id: Launcher.hxx,v 1.5 2006-02-22 17:38:04 stephena Exp $
//============================================================================ //============================================================================
#ifndef LAUNCHER_HXX #ifndef LAUNCHER_HXX
@ -24,15 +24,17 @@ class OSystem;
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
enum { enum {
kLauncherWidth = 320, kLauncherWidth = 320,
kLauncherHeight = 240 kLauncherHeight = 240
// kLauncherWidth = 639,
// kLauncherHeight = 479
}; };
/** /**
The base dialog for the ROM launcher in Stella. The base dialog for the ROM launcher in Stella.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Launcher.hxx,v 1.4 2005-06-16 00:55:59 stephena Exp $ @version $Id: Launcher.hxx,v 1.5 2006-02-22 17:38:04 stephena Exp $
*/ */
class Launcher : public DialogContainer class Launcher : public DialogContainer
{ {

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: LauncherDialog.cxx,v 1.38 2006-01-15 16:31:01 stephena Exp $ // $Id: LauncherDialog.cxx,v 1.39 2006-02-22 17:38:04 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
@ -39,9 +39,6 @@
#include "bspf.hxx" #include "bspf.hxx"
/////////////////////////////////////////
// TODO - make this dialog font sensitive
/////////////////////////////////////////
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent, LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
@ -56,80 +53,98 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myProgressBar(NULL), myProgressBar(NULL),
mySelectedItem(0) mySelectedItem(0)
{ {
const GUI::Font& font = instance()->font(); const GUI::Font& font = instance()->launcherFont();
const int fontHeight = font.getFontHeight(); // const GUI::Font& font = instance()->font();
const int fontHeight = font.getFontHeight();
const int bwidth = (_w - 2 * 10 - 8 * (4 - 1)) / 4;
const int bheight = font.getLineHeight() + 4;
int xpos = 0, ypos = 0, lwidth = 0;
WidgetArray wid; WidgetArray wid;
// Show game name // Show game name
new StaticTextWidget(this, 10, 8, 200, fontHeight, lwidth = font.getStringWidth("Select a game from the list ...");
xpos += 10; ypos += 8;
new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
"Select a game from the list ...", kTextAlignLeft); "Select a game from the list ...", kTextAlignLeft);
myRomCount = new StaticTextWidget(this, _w - 100, 8, 90, fontHeight, lwidth = font.getStringWidth("XXXX files found");
xpos = _w - lwidth - 10;
myRomCount = new StaticTextWidget(this, font, xpos, ypos,
lwidth, fontHeight,
"", kTextAlignRight); "", kTextAlignRight);
// Add four buttons at the bottom
const int border = 10;
const int space = 8;
const int buttons = 4;
const int width = (_w - 2 * border - space * (buttons - 1)) / buttons;
int xpos = border;
#ifndef MAC_OSX
myStartButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Play", kStartCmd, 'S');
myStartButton->setEditable(true);
wid.push_back(myStartButton);
xpos += space + width;
myOptionsButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Options", kOptionsCmd, 'O');
myOptionsButton->setEditable(true);
wid.push_back(myOptionsButton);
xpos += space + width;
myReloadButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Reload", kReloadCmd, 'R');
myReloadButton->setEditable(true);
wid.push_back(myReloadButton);
xpos += space + width;
myQuitButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Quit", kQuitCmd, 'Q');
myQuitButton->setEditable(true);
wid.push_back(myQuitButton);
xpos += space + width;
mySelectedItem = 0; // Highlight 'Play' button
#else
myQuitButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Quit", kQuitCmd, 'Q');
myQuitButton->setEditable(true);
wid.push_back(myQuitButton);
xpos += space + width;
myOptionsButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Options", kOptionsCmd, 'O');
myOptionsButton->setEditable(true);
wid.push_back(myOptionsButton);
xpos += space + width;
myReloadButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Reload", kReloadCmd, 'R');
myReloadButton->setEditable(true);
wid.push_back(myReloadButton);
xpos += space + width;
myStartButton = new ButtonWidget(this, xpos, _h - 24, width, 16, "Start", kStartCmd, 'Q');
myStartButton->setEditable(true);
wid.push_back(myStartButton);
xpos += space + width;
mySelectedItem = 3; // Highlight 'Play' button
#endif
// Add list with game titles // Add list with game titles
// The list isn't added to focus objects, but is instead made 'sticky' // The list isn't added to focus objects, but is instead made 'sticky'
// This means it will act as if it were focused (wrt how it's drawn), but // This means it will act as if it were focused (wrt how it's drawn), but
// won't actually be able to lose focus // won't actually be able to lose focus
myList = new StringListWidget(this, instance()->font(), xpos = 10; ypos += fontHeight + 5;
10, 24, _w - 20, _h - 24 - 26 - 10 - 10); myList = new StringListWidget(this, font, xpos, ypos,
_w - 20, _h - 28 - bheight - 2*fontHeight);
myList->setNumberingMode(kListNumberingOff); myList->setNumberingMode(kListNumberingOff);
myList->setEditable(false); myList->setEditable(false);
myList->setFlags(WIDGET_STICKY_FOCUS); myList->setFlags(WIDGET_STICKY_FOCUS);
// Add note textwidget to show any notes for the currently selected ROM // Add note textwidget to show any notes for the currently selected ROM
new StaticTextWidget(this, 20, _h - 43, 30, fontHeight, "Note:", kTextAlignLeft); xpos += 5; ypos += myList->getHeight() + 4;
myNote = new StaticTextWidget(this, 50, _h - 43, w - 70, fontHeight, lwidth = font.getStringWidth("Note:");
new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
"Note:", kTextAlignLeft);
xpos += lwidth + 5;
myNote = new StaticTextWidget(this, font, xpos, ypos,
_w - xpos - 10, fontHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
// Add four buttons at the bottom
xpos = 10; ypos += myNote->getHeight() + 4;
#ifndef MAC_OSX
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Play", kStartCmd, 'S');
myStartButton->setEditable(true);
wid.push_back(myStartButton);
xpos += bwidth + 8;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Options", kOptionsCmd, 'O');
myOptionsButton->setEditable(true);
wid.push_back(myOptionsButton);
xpos += bwidth + 8;
myReloadButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Reload", kReloadCmd, 'R');
myReloadButton->setEditable(true);
wid.push_back(myReloadButton);
xpos += bwidth + 8;
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Quit", kQuitCmd, 'Q');
myQuitButton->setEditable(true);
wid.push_back(myQuitButton);
xpos += bwidth + 8;
mySelectedItem = 0; // Highlight 'Play' button
#else
myQuitButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Quit", kQuitCmd, 'Q');
myQuitButton->setEditable(true);
wid.push_back(myQuitButton);
xpos += bwidth + 8;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Options", kOptionsCmd, 'O');
myOptionsButton->setEditable(true);
wid.push_back(myOptionsButton);
xpos += bwidth + 8;
myReloadButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Reload", kReloadCmd, 'R');
myReloadButton->setEditable(true);
wid.push_back(myReloadButton);
xpos += bwidth + 8;
myStartButton = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight,
"Start", kStartCmd, 'Q');
myStartButton->setEditable(true);
wid.push_back(myStartButton);
xpos += bwidth + 8;
mySelectedItem = 3; // Highlight 'Play' button
#endif
// Create the launcher options dialog, where you can change ROM // Create the launcher options dialog, where you can change ROM
// and snapshot paths // and snapshot paths
myOptions = new LauncherOptionsDialog(osystem, parent, this, myOptions = new LauncherOptionsDialog(osystem, parent, font, this,
20, 60, _w - 40, _h - 120); 20, 60, _w - 40, _h - 120);
// Create a game list, which contains all the information about a ROM that // Create a game list, which contains all the information about a ROM that
@ -253,7 +268,7 @@ void LauncherDialog::loadListFromDisk()
// Create a progress dialog box to show the progress of processing // Create a progress dialog box to show the progress of processing
// the ROMs, since this is usually a time-consuming operation // the ROMs, since this is usually a time-consuming operation
ProgressDialog progress(this, instance()->font(), ProgressDialog progress(this, instance()->launcherFont(),
"Loading ROM's from disk ..."); "Loading ROM's from disk ...");
progress.setRange(0, files.size() - 1, 10); progress.setRange(0, files.size() - 1, 10);

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: LauncherOptionsDialog.cxx,v 1.13 2005-09-15 19:43:36 stephena Exp $ // $Id: LauncherOptionsDialog.cxx,v 1.14 2006-02-22 17:38:04 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
@ -30,31 +30,33 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherOptionsDialog::LauncherOptionsDialog( LauncherOptionsDialog::LauncherOptionsDialog(
OSystem* osystem, DialogContainer* parent, GuiObject* boss, OSystem* osystem, DialogContainer* parent,
const GUI::Font& font, GuiObject* boss,
int x, int y, int w, int h) int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
CommandSender(boss), CommandSender(boss),
myBrowser(NULL) myBrowser(NULL)
{ {
const GUI::Font& font = instance()->font();
const int vBorder = 4; const int vBorder = 4;
int xpos, ypos; int xpos, ypos, bwidth, bheight;
bwidth = font.getStringWidth("Cancel") + 20;
bheight = font.getLineHeight() + 4;
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos);
// 1) The ROM locations tab // 1) The ROM locations tab
myTab->addTab("ROM Settings"); myTab->addTab("ROM Settings");
// ROM path // ROM path
xpos = 15; xpos = 15; ypos += 5;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
kChooseRomDirCmd, 0); kChooseRomDirCmd, 0);
xpos += kButtonWidth + 30; xpos += bwidth + 20;
myRomPath = new StaticTextWidget(myTab, xpos, ypos + 3, myRomPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, kLineHeight, _w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft); "", kTextAlignLeft);
// 2) The snapshot settings tab // 2) The snapshot settings tab
@ -62,22 +64,25 @@ LauncherOptionsDialog::LauncherOptionsDialog(
// Snapshot path // Snapshot path
xpos = 15; xpos = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
kChooseSnapDirCmd, 0); kChooseSnapDirCmd, 0);
xpos += kButtonWidth + 30; xpos += bwidth + 20;
mySnapPath = new StaticTextWidget(myTab, xpos, ypos + 3, mySnapPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, kLineHeight, _w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft); "", kTextAlignLeft);
// Snapshot save name // Snapshot save name
xpos = 10; ypos += 22; xpos = 10; ypos += mySnapPath->getHeight() + 8;
mySnapTypePopup = new PopUpWidget(myTab, xpos, ypos, 140, kLineHeight, mySnapTypePopup = new PopUpWidget(myTab, font, xpos, ypos,
"Save snapshot as: ", 87, 0); font.getStringWidth("romname"),
font.getLineHeight(),
"Save snapshot as: ",
font.getStringWidth("Save snapshot as: "), 0);
mySnapTypePopup->appendEntry("romname", 1); mySnapTypePopup->appendEntry("romname", 1);
mySnapTypePopup->appendEntry("md5sum", 2); mySnapTypePopup->appendEntry("md5sum", 2);
// Snapshot single or multiple saves // Snapshot single or multiple saves
xpos = 30; ypos += 18; xpos = 30; ypos += mySnapTypePopup->getHeight() + 8;
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Multiple snapshots"); "Multiple snapshots");
@ -86,17 +91,25 @@ LauncherOptionsDialog::LauncherOptionsDialog(
// Add OK & Cancel buttons // Add OK & Cancel buttons
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK",
kOKCmd, 0);
xpos += bwidth + 10;
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd, 0);
#else #else
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd, 0);
xpos += bwidth + 10;
new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK",
kOKCmd, 0);
#endif #endif
// Create file browser dialog // Create file browser dialog
int baseW = instance()->frameBuffer().baseWidth(); int baseW = instance()->frameBuffer().baseWidth();
int baseH = instance()->frameBuffer().baseHeight(); int baseH = instance()->frameBuffer().baseHeight();
myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40); myBrowser = new BrowserDialog(this, font, 60, 20, baseW - 120, baseH - 40);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: LauncherOptionsDialog.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $ // $Id: LauncherOptionsDialog.hxx,v 1.8 2006-02-22 17:38:04 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
@ -38,7 +38,7 @@ class LauncherOptionsDialog : public Dialog, public CommandSender
{ {
public: public:
LauncherOptionsDialog(OSystem* osystem, DialogContainer* parent, LauncherOptionsDialog(OSystem* osystem, DialogContainer* parent,
GuiObject* boss, const GUI::Font& font, GuiObject* boss,
int x, int y, int w, int h); int x, int y, int w, int h);
~LauncherOptionsDialog(); ~LauncherOptionsDialog();

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: ListWidget.cxx,v 1.39 2006-01-15 20:46:20 stephena Exp $ // $Id: ListWidget.cxx,v 1.40 2006-02-22 17:38:04 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
@ -33,7 +33,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) int x, int y, int w, int h)
: EditableWidget(boss, x, y, 16, 16), : EditableWidget(boss, font, x, y, 16, 16),
_rows(0), _rows(0),
_cols(0), _cols(0),
_currentPos(0), _currentPos(0),
@ -47,19 +47,15 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kListWidget; _type = kListWidget;
setFont(font); _cols = w / _fontWidth;
_rows = h / _fontHeight;
_colWidth = font.getMaxCharWidth();
_rowHeight = font.getLineHeight();
_cols = w / _colWidth;
_rows = h / _rowHeight;
// Set real dimensions // Set real dimensions
_w = w - kScrollBarWidth; _w = w - kScrollBarWidth;
_h = h + 2; _h = h + 2;
// Create scrollbar and attach to the list // Create scrollbar and attach to the list
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h); _scrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar->setTarget(this); _scrollBar->setTarget(this);
} }
@ -200,7 +196,7 @@ void ListWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int ListWidget::findItem(int x, int y) const int ListWidget::findItem(int x, int y) const
{ {
return (y - 1) / _rowHeight + _currentPos; return (y - 1) / _fontHeight + _currentPos;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: ListWidget.hxx,v 1.15 2006-01-04 01:24:17 stephena Exp $ // $Id: ListWidget.hxx,v 1.16 2006-02-22 17:38:04 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
@ -95,8 +95,6 @@ class ListWidget : public EditableWidget
protected: protected:
int _rows; int _rows;
int _cols; int _cols;
int _rowHeight;
int _colWidth;
int _currentPos; int _currentPos;
int _selectedItem; int _selectedItem;
int _highlightedItem; int _highlightedItem;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OptionsDialog.cxx,v 1.35 2005-12-18 18:37:03 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.36 2006-02-22 17:38:04 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
@ -57,7 +57,7 @@ enum {
}; };
#define addBigButton(label, cmd, hotkey) \ #define addBigButton(label, cmd, hotkey) \
new ButtonWidget(this, xoffset, yoffset, kBigButtonWidth, 18, label, cmd, hotkey); yoffset += kRowHeight new ButtonWidget(this, font, xoffset, yoffset, kBigButtonWidth, 18, label, cmd, hotkey); yoffset += kRowHeight
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent) OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
@ -76,6 +76,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
int yoffset = 7; int yoffset = 7;
const int xoffset = (_w - kBigButtonWidth) / 2; const int xoffset = (_w - kBigButtonWidth) / 2;
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
ButtonWidget* b = NULL; ButtonWidget* b = NULL;
b = addBigButton("Video Settings", kVidCmd, 0); b = addBigButton("Video Settings", kVidCmd, 0);
@ -105,33 +106,33 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
// Now create all the dialogs attached to each menu button // Now create all the dialogs attached to each menu button
w = 230; h = 130; w = 230; h = 130;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myVideoDialog = new VideoDialog(myOSystem, parent, x, y, w, h); myVideoDialog = new VideoDialog(myOSystem, parent, font, x, y, w, h);
w = 200; h = 110; w = 200; h = 110;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAudioDialog = new AudioDialog(myOSystem, parent, x, y, w, h); myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h);
w = 230; h = 170; w = 230; h = 170;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myInputDialog = new InputDialog(myOSystem, parent, x, y, w, h); myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
w = 255; h = 175; w = 255; h = 175;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, this, x, y, w, h); myGameInfoDialog = new GameInfoDialog(myOSystem, parent, font, this, x, y, w, h);
#ifdef CHEATCODE_SUPPORT #ifdef CHEATCODE_SUPPORT
w = 230; h = 150; w = 230; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myCheatCodeDialog = new CheatCodeDialog(myOSystem, parent, x, y, w, h); myCheatCodeDialog = new CheatCodeDialog(myOSystem, parent, font, x, y, w, h);
#endif #endif
w = 255; h = 150; w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myHelpDialog = new HelpDialog(myOSystem, parent, x, y, w, h); myHelpDialog = new HelpDialog(myOSystem, parent, font, x, y, w, h);
w = 255; h = 150; w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myAboutDialog = new AboutDialog(myOSystem, parent, x, y, w, h); myAboutDialog = new AboutDialog(myOSystem, parent, font, 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: PopUpWidget.cxx,v 1.23 2006-01-15 20:46:20 stephena Exp $ // $Id: PopUpWidget.cxx,v 1.24 2006-02-22 17:38:04 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
@ -53,8 +53,8 @@ PopUpDialog::PopUpDialog(PopUpWidget* boss, int clickX, int clickY)
// Calculate real popup dimensions // Calculate real popup dimensions
_x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth; _x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth;
_y = _popUpBoss->getAbsY() - _popUpBoss->_selectedItem * kLineHeight; _y = _popUpBoss->getAbsY() - _popUpBoss->_selectedItem * _popUpBoss->_fontHeight;
_w = _popUpBoss->_w - kLineHeight + 2 - _popUpBoss->_labelWidth; _w = _popUpBoss->_w - _popUpBoss->_labelWidth - 10;
_h = 2; _h = 2;
} }
@ -86,8 +86,8 @@ void PopUpDialog::drawDialog()
// The last entry may be empty. Fill it with black. // The last entry may be empty. Fill it with black.
if(_twoColumns && (count & 1)) if(_twoColumns && (count & 1))
fb.fillRect(_x + 1 + _w / 2, _y + 1 + kLineHeight * (_entriesPerColumn - 1), fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1),
_w / 2 - 1, kLineHeight, kBGColor); _w / 2 - 1, _popUpBoss->_fontHeight, kBGColor);
_dirty = false; _dirty = false;
fb.addDirtyRect(_x, _y, _w, _h); fb.addDirtyRect(_x, _y, _w, _h);
@ -178,12 +178,12 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
if (entry >= n) if (entry >= n)
{ {
x = _x + 1 + _w / 2; x = _x + 1 + _w / 2;
y = _y + 1 + kLineHeight * (entry - n); y = _y + 1 + _popUpBoss->_fontHeight * (entry - n);
} }
else else
{ {
x = _x + 1; x = _x + 1;
y = _y + 1 + kLineHeight * entry; y = _y + 1 + _popUpBoss->_fontHeight * entry;
} }
w = _w / 2 - 1; w = _w / 2 - 1;
@ -191,18 +191,18 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
else else
{ {
x = _x + 1; x = _x + 1;
y = _y + 1 + kLineHeight * entry; y = _y + 1 + _popUpBoss->_fontHeight * entry;
w = _w - 2; w = _w - 2;
} }
string& name = _popUpBoss->_entries[entry].name; string& name = _popUpBoss->_entries[entry].name;
fb.fillRect(x, y, w, kLineHeight, hilite ? kTextColorHi : kBGColor); fb.fillRect(x, y, w, _popUpBoss->_fontHeight, hilite ? kTextColorHi : kBGColor);
if(name.size() == 0) if(name.size() == 0)
{ {
// Draw a separator // Draw a separator
fb.hLine(x - 1, y + kLineHeight / 2, x + w, kShadowColor); fb.hLine(x - 1, y + _popUpBoss->_fontHeight / 2, x + w, kShadowColor);
fb.hLine(x, y + 1 + kLineHeight / 2, x + w, kColor); fb.hLine(x, y + 1 + _popUpBoss->_fontHeight / 2, x + w, kColor);
} }
else else
fb.drawString(_popUpBoss->font(), name, x + 1, y + 2, w - 2, fb.drawString(_popUpBoss->font(), name, x + 1, y + 2, w - 2,
@ -215,7 +215,7 @@ void PopUpDialog::recalc()
// Perform clipping / switch to scrolling mode if we don't fit on the screen // Perform clipping / switch to scrolling mode if we don't fit on the screen
const int height = instance()->frameBuffer().baseHeight(); const int height = instance()->frameBuffer().baseHeight();
_h = _popUpBoss->_entries.size() * kLineHeight + 2; _h = _popUpBoss->_entries.size() * _popUpBoss->_fontHeight + 2;
// HACK: For now, we do not do scrolling. Instead, we draw the dialog // HACK: For now, we do not do scrolling. Instead, we draw the dialog
// in two columns if it's too tall. // in two columns if it's too tall.
@ -229,13 +229,13 @@ void PopUpDialog::recalc()
if(_popUpBoss->_entries.size() & 1) if(_popUpBoss->_entries.size() & 1)
_entriesPerColumn++; _entriesPerColumn++;
_h = _entriesPerColumn * kLineHeight + 2; _h = _entriesPerColumn * _popUpBoss->_fontHeight + 2;
_w = 0; _w = 0;
// Find width of largest item // Find width of largest item
for(unsigned int i = 0; i < _popUpBoss->_entries.size(); i++) for(unsigned int i = 0; i < _popUpBoss->_entries.size(); i++)
{ {
int width = _font->getStringWidth(_popUpBoss->_entries[i].name); int width = _popUpBoss->_font->getStringWidth(_popUpBoss->_entries[i].name);
if(width > _w) if(width > _w)
_w = width; _w = width;
@ -249,7 +249,8 @@ void PopUpDialog::recalc()
if(_popUpBoss->_selectedItem >= _entriesPerColumn) if(_popUpBoss->_selectedItem >= _entriesPerColumn)
{ {
_x -= _w / 2; _x -= _w / 2;
_y = _popUpBoss->getAbsY() - (_popUpBoss->_selectedItem - _entriesPerColumn) * kLineHeight; _y = _popUpBoss->getAbsY() - (_popUpBoss->_selectedItem - _entriesPerColumn) *
_popUpBoss->_fontHeight;
} }
if(_w >= width) if(_w >= width)
@ -279,7 +280,7 @@ int PopUpDialog::findItem(int x, int y) const
{ {
if(_twoColumns) if(_twoColumns)
{ {
unsigned int entry = (y - 2) / kLineHeight; unsigned int entry = (y - 2) / _popUpBoss->_fontHeight;
if(x > _w / 2) if(x > _w / 2)
{ {
entry += _entriesPerColumn; entry += _entriesPerColumn;
@ -289,7 +290,7 @@ int PopUpDialog::findItem(int x, int y) const
} }
return entry; return entry;
} }
return (y - 2) / kLineHeight; return (y - 2) / _popUpBoss->_fontHeight;
} }
return -1; return -1;
@ -379,9 +380,10 @@ void PopUpDialog::moveDown()
// PopUpWidget // PopUpWidget
// //
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PopUpWidget::PopUpWidget(GuiObject* boss, int x, int y, int w, int h, PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int labelWidth, int cmd) const string& label, int labelWidth, int cmd)
: Widget(boss, x, y - 1, w, h + 2), : Widget(boss, font, x, y - 1, w, h + 2),
CommandSender(boss), CommandSender(boss),
_label(label), _label(label),
_labelWidth(labelWidth), _labelWidth(labelWidth),
@ -396,6 +398,12 @@ PopUpWidget::PopUpWidget(GuiObject* boss, int x, int y, int w, int h,
if(!_label.empty() && _labelWidth == 0) if(!_label.empty() && _labelWidth == 0)
_labelWidth = _font->getStringWidth(_label); _labelWidth = _font->getStringWidth(_label);
_w = w + _labelWidth + 15;
// vertically center the arrows and text
myTextY = (_h - _font->getFontHeight()) / 2;
myArrowsY = (_h - 8) / 2;
myPopUpDialog = new PopUpDialog(this, x + getAbsX(), y + getAbsY()); myPopUpDialog = new PopUpDialog(this, x + getAbsX(), y + getAbsY());
} }
@ -476,7 +484,7 @@ void PopUpWidget::drawWidget(bool hilite)
// Draw the label, if any // Draw the label, if any
if (_labelWidth > 0) if (_labelWidth > 0)
fb.drawString(_font, _label, _x, _y + 3, _labelWidth, fb.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? kTextColor : kColor, kTextAlignRight); isEnabled() ? kTextColor : kColor, kTextAlignRight);
// Draw a thin frame around us. // Draw a thin frame around us.
@ -486,7 +494,7 @@ void PopUpWidget::drawWidget(bool hilite)
fb.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor); fb.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup // Draw an arrow pointing down at the right end to signal this is a dropdown/popup
fb.drawBitmap(up_down_arrows, x+w - 10, _y+2, fb.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY,
!isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor); !isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor);
// Draw the selected entry, if any // Draw the selected entry, if any
@ -494,7 +502,7 @@ void PopUpWidget::drawWidget(bool hilite)
{ {
TextAlignment align = (_font->getStringWidth(_entries[_selectedItem].name) > w-6) ? TextAlignment align = (_font->getStringWidth(_entries[_selectedItem].name) > w-6) ?
kTextAlignRight : kTextAlignLeft; kTextAlignRight : kTextAlignLeft;
fb.drawString(_font, _entries[_selectedItem].name, x+2, _y+3, w-6, fb.drawString(_font, _entries[_selectedItem].name, x+2, _y+myTextY, w-6,
!isEnabled() ? kColor : kTextColor, align); !isEnabled() ? kColor : kTextColor, align);
} }
} }

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.11 2005-12-09 01:16:14 stephena Exp $ // $Id: PopUpWidget.hxx,v 1.12 2006-02-22 17:38:04 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
@ -59,7 +59,8 @@ class PopUpWidget : public Widget, public CommandSender
int _labelWidth; int _labelWidth;
public: public:
PopUpWidget(GuiObject* boss, int x, int y, int w, int h, PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int labelWidth = 0, int cmd = 0); const string& label, int labelWidth = 0, int cmd = 0);
~PopUpWidget(); ~PopUpWidget();
@ -86,6 +87,8 @@ class PopUpWidget : public Widget, public CommandSender
private: private:
PopUpDialog* myPopUpDialog; PopUpDialog* myPopUpDialog;
int myArrowsY;
int myTextY;
}; };
// //

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: ProgressDialog.cxx,v 1.5 2005-08-04 22:59:54 stephena Exp $ // $Id: ProgressDialog.cxx,v 1.6 2006-02-22 17:38:04 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
@ -51,12 +51,12 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
_y = (boss->getHeight() - _h) / 2; _y = (boss->getHeight() - _h) / 2;
xpos = fontWidth; ypos = lineHeight; xpos = fontWidth; ypos = lineHeight;
myMessage = new StaticTextWidget(this, xpos, ypos, lwidth, fontHeight, myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
message, kTextAlignCenter); message, kTextAlignCenter);
myMessage->setColor(kTextColorEm); myMessage->setColor(kTextColorEm);
xpos = fontWidth; ypos += 2 * lineHeight; xpos = fontWidth; ypos += 2 * lineHeight;
mySlider = new SliderWidget(this, xpos, ypos, lwidth, lineHeight, "", 0, 0); mySlider = new SliderWidget(this, font, xpos, ypos, lwidth, lineHeight, "", 0, 0);
mySlider->setMinValue(100); mySlider->setMinValue(100);
mySlider->setMaxValue(200); mySlider->setMaxValue(200);
mySlider->setValue(100); // Prevents the slider from initially drawing mySlider->setValue(100); // Prevents the slider from initially drawing

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: ScrollBarWidget.cxx,v 1.12 2006-01-15 20:46:20 stephena Exp $ // $Id: ScrollBarWidget.cxx,v 1.13 2006-02-22 17:38:04 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
@ -63,8 +63,9 @@ static unsigned int down_arrow[8] = {
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, int x, int y, int w, int h) ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), CommandSender(boss) int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h), CommandSender(boss)
{ {
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
_type = kScrollBarWidget; _type = kScrollBarWidget;

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: ScrollBarWidget.hxx,v 1.5 2005-08-01 22:33:16 stephena Exp $ // $Id: ScrollBarWidget.hxx,v 1.6 2006-02-22 17:38:04 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
@ -41,7 +41,8 @@ class ScrollBarWidget : public Widget, public CommandSender
} Part; } Part;
public: public:
ScrollBarWidget(GuiObject* boss, int x, int y, int w, int h); ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h);
virtual void handleMouseDown(int x, int y, int button, int clickCount); virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleMouseUp(int x, int y, int button, int clickCount); virtual void handleMouseUp(int x, int y, int button, int clickCount);

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: StringListWidget.cxx,v 1.4 2006-01-15 20:46:20 stephena Exp $ // $Id: StringListWidget.cxx,v 1.5 2006-02-22 17:38:04 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
@ -63,15 +63,15 @@ void StringListWidget::drawWidget(bool hilite)
{ {
const OverlayColor textColor = (_selectedItem == pos && _editMode) const OverlayColor textColor = (_selectedItem == pos && _editMode)
? kColor : kTextColor; ? kColor : kTextColor;
const int y = _y + 2 + kLineHeight * i; const int y = _y + 2 + _fontHeight * i;
// Draw the selected item inverted, on a highlighted background. // Draw the selected item inverted, on a highlighted background.
if (_selectedItem == pos) if (_selectedItem == pos)
{ {
if ((_hasFocus && !_editMode) || isSticky()) if ((_hasFocus && !_editMode) || isSticky())
fb.fillRect(_x + 1, _y + 1 + kLineHeight * i, _w - 1, kLineHeight, kTextColorHi); fb.fillRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
else else
fb.frameRect(_x + 1, _y + 1 + kLineHeight * i, _w - 1, kLineHeight, kTextColorHi); fb.frameRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, kTextColorHi);
} }
// If in numbering mode, we first print a number prefix // If in numbering mode, we first print a number prefix
@ -110,8 +110,8 @@ void StringListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect StringListWidget::getEditRect() const GUI::Rect StringListWidget::getEditRect() const
{ {
GUI::Rect r(2, 1, _w - 2 , kLineHeight); GUI::Rect r(2, 1, _w - 2 , _fontHeight);
const int offset = (_selectedItem - _currentPos) * kLineHeight; const int offset = (_selectedItem - _currentPos) * _fontHeight;
r.top += offset; r.top += offset;
r.bottom += offset; r.bottom += offset;

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: TabWidget.cxx,v 1.20 2006-01-15 20:46:20 stephena Exp $ // $Id: TabWidget.cxx,v 1.21 2006-02-22 17:38:04 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
@ -28,15 +28,10 @@
#include "Dialog.hxx" #include "Dialog.hxx"
#include "TabWidget.hxx" #include "TabWidget.hxx"
enum {
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TabWidget::TabWidget(GuiObject* boss, int x, int y, int w, int h) TabWidget::TabWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, x, y, w, h), int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
_tabWidth(40), _tabWidth(40),
_activeTab(-1), _activeTab(-1),
@ -44,6 +39,8 @@ TabWidget::TabWidget(GuiObject* boss, int x, int y, int w, int h)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG; _flags = WIDGET_ENABLED | WIDGET_CLEARBG;
_type = kTabWidget; _type = kTabWidget;
_tabHeight = font.getLineHeight() + 4;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -61,7 +58,7 @@ TabWidget::~TabWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TabWidget::getChildY() const int TabWidget::getChildY() const
{ {
return getAbsY() + kTabHeight; return getAbsY() + _tabHeight;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -170,7 +167,7 @@ void TabWidget::setParentWidget(int tabID, Widget* parent)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
{ {
assert(y < kTabHeight); assert(y < _tabHeight);
// Determine which tab was clicked // Determine which tab was clicked
int tabID = -1; int tabID = -1;
@ -251,8 +248,8 @@ void TabWidget::drawWidget(bool hilite)
const int right2 = _x + _w - 2; const int right2 = _x + _w - 2;
// Draw horizontal line // Draw horizontal line
fb.hLine(left1, _y + kTabHeight - 2, right1, kShadowColor); fb.hLine(left1, _y + _tabHeight - 2, right1, kShadowColor);
fb.hLine(left2, _y + kTabHeight - 2, right2, kShadowColor); fb.hLine(left2, _y + _tabHeight - 2, right2, kShadowColor);
// Iterate over all tabs and draw them // Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset; int i, x = _x + kTabLeftOffset;
@ -260,26 +257,26 @@ void TabWidget::drawWidget(bool hilite)
{ {
OverlayColor color = (i == _activeTab) ? kColor : kShadowColor; OverlayColor color = (i == _activeTab) ? kColor : kShadowColor;
int yOffset = (i == _activeTab) ? 0 : 2; int yOffset = (i == _activeTab) ? 0 : 2;
box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color, (i == _activeTab)); box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, color, color, (i == _activeTab));
fb.drawString(_font, _tabs[i].title, x + kTabPadding, fb.drawString(_font, _tabs[i].title, x + kTabPadding,
_y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _y + yOffset / 2 + (_tabHeight - _fontHeight - 1),
_tabWidth - 2 * kTabPadding, kTextColor, kTextAlignCenter); _tabWidth - 2 * kTabPadding, kTextColor, kTextAlignCenter);
x += _tabWidth + kTabSpacing; x += _tabWidth + kTabSpacing;
} }
// Draw a frame around the widget area (belows the tabs) // Draw a frame around the widget area (belows the tabs)
fb.hLine(left1, _y + kTabHeight - 1, right1, kColor); fb.hLine(left1, _y + _tabHeight - 1, right1, kColor);
fb.hLine(left2, _y + kTabHeight - 1, right2, kColor); fb.hLine(left2, _y + _tabHeight - 1, right2, kColor);
fb.hLine(_x+1, _y + _h - 2, _x + _w - 2, kShadowColor); fb.hLine(_x+1, _y + _h - 2, _x + _w - 2, kShadowColor);
fb.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor); fb.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor);
fb.vLine(_x + _w - 2, _y + kTabHeight - 1, _y + _h - 2, kColor); fb.vLine(_x + _w - 2, _y + _tabHeight - 1, _y + _h - 2, kColor);
fb.vLine(_x + _w - 1, _y + kTabHeight - 1, _y + _h - 2, kShadowColor); fb.vLine(_x + _w - 1, _y + _tabHeight - 1, _y + _h - 2, kShadowColor);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget *TabWidget::findWidget(int x, int y) Widget *TabWidget::findWidget(int x, int y)
{ {
if (y < kTabHeight) if (y < _tabHeight)
{ {
// Click was in the tab area // Click was in the tab area
return this; return this;
@ -287,6 +284,6 @@ Widget *TabWidget::findWidget(int x, int y)
else else
{ {
// Iterate over all child widgets and find the one which was clicked // Iterate over all child widgets and find the one which was clicked
return Widget::findWidgetInChain(_firstWidget, x, y - kTabHeight); return Widget::findWidgetInChain(_firstWidget, x, y - _tabHeight);
} }
} }

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: TabWidget.hxx,v 1.11 2005-12-21 01:50:16 stephena Exp $ // $Id: TabWidget.hxx,v 1.12 2006-02-22 17:38:04 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
@ -28,10 +28,6 @@
#include "Array.hxx" #include "Array.hxx"
#include "bspf.hxx" #include "bspf.hxx"
enum {
kTabHeight = 16
};
class TabWidget : public Widget, public CommandSender class TabWidget : public Widget, public CommandSender
{ {
struct Tab { struct Tab {
@ -42,7 +38,7 @@ class TabWidget : public Widget, public CommandSender
typedef Common::Array<Tab> TabList; typedef Common::Array<Tab> TabList;
public: public:
TabWidget(GuiObject* boss, int x, int y, int w, int h); TabWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h);
~TabWidget(); ~TabWidget();
virtual int getChildY() const; virtual int getChildY() const;
@ -64,6 +60,9 @@ class TabWidget : public Widget, public CommandSender
// will be added to the active tab. // will be added to the active tab.
void setParentWidget(int tabID, Widget* parent); void setParentWidget(int tabID, Widget* parent);
int getTabWidth() { return _tabWidth; }
int getTabHeight() { return _tabHeight; }
virtual void handleMouseDown(int x, int y, int button, int clickCount); virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
@ -76,9 +75,16 @@ class TabWidget : public Widget, public CommandSender
protected: protected:
TabList _tabs; TabList _tabs;
int _tabWidth; int _tabWidth;
int _tabHeight;
int _activeTab; int _activeTab;
bool _firstTime; bool _firstTime;
enum {
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
};
private: private:
void box(int x, int y, int width, int height, void box(int x, int y, int width, int height,
OverlayColor colorA, OverlayColor colorB, bool omitBottom); OverlayColor colorA, OverlayColor colorB, bool omitBottom);

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.26 2005-10-24 18:18:30 stephena Exp $ // $Id: VideoDialog.cxx,v 1.27 2006-02-22 17:38:04 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
@ -33,34 +33,29 @@
#include "bspf.hxx" #include "bspf.hxx"
enum {
kVideoRowHeight = 12,
kVideoWidth = 200,
kVideoHeight = 100
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h) const GUI::Font& font, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h) : Dialog(osystem, parent, x, y, w, h)
{ {
const GUI::Font& font = instance()->font(); const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight();
int yoff = 10, int xpos, ypos;
xoff = 5, int lwidth = font.getStringWidth("Dirty Rects: "),
woff = 110, pwidth = font.getStringWidth("Software");
labelWidth = 55;
// Use dirty rectangle updates // Use dirty rectangle updates
myDirtyPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, xpos = 5; ypos = 10;
"Dirty Rects: ", labelWidth); myDirtyPopup = new PopUpWidget(this, font, xpos, ypos,
pwidth, lineHeight, "Dirty Rects: ", lwidth);
myDirtyPopup->appendEntry("Yes", 1); myDirtyPopup->appendEntry("Yes", 1);
myDirtyPopup->appendEntry("No", 2); myDirtyPopup->appendEntry("No", 2);
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Video renderer // Video renderer
myRendererPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, myRendererPopup = new PopUpWidget(this, font, xpos, ypos,
"Renderer: ", labelWidth, kRendererChanged); pwidth, lineHeight, "Renderer: ", lwidth,
kRendererChanged);
myRendererPopup->appendEntry("Software", 1); myRendererPopup->appendEntry("Software", 1);
#ifdef PSP #ifdef PSP
myRendererPopup->appendEntry("Hardware", 2); myRendererPopup->appendEntry("Hardware", 2);
@ -68,69 +63,75 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
myRendererPopup->appendEntry("OpenGL", 3); myRendererPopup->appendEntry("OpenGL", 3);
#endif #endif
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Video filter // Video filter
myFilterPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, myFilterPopup = new PopUpWidget(this, font, xpos, ypos,
"GL Filter: ", labelWidth); pwidth, lineHeight, "GL Filter: ", lwidth);
myFilterPopup->appendEntry("Linear", 1); myFilterPopup->appendEntry("Linear", 1);
myFilterPopup->appendEntry("Nearest", 2); myFilterPopup->appendEntry("Nearest", 2);
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Aspect ratio // Aspect ratio
myAspectRatioSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight, myAspectRatioSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect: ", labelWidth, kAspectRatioChanged); "GL Aspect: ", lwidth, kAspectRatioChanged);
myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100); myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
myAspectRatioLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 15, kLineHeight, myAspectRatioLabel = new StaticTextWidget(this, font,
"", kTextAlignLeft); xpos + myAspectRatioSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myAspectRatioLabel->setFlags(WIDGET_CLEARBG); myAspectRatioLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Palette // Palette
myPalettePopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight, "Palette: ", labelWidth); myPalettePopup = new PopUpWidget(this, font, xpos, ypos, pwidth,
lineHeight, "Palette: ", lwidth);
myPalettePopup->appendEntry("Standard", 1); myPalettePopup->appendEntry("Standard", 1);
myPalettePopup->appendEntry("Original", 2); myPalettePopup->appendEntry("Original", 2);
myPalettePopup->appendEntry("Z26", 3); myPalettePopup->appendEntry("Z26", 3);
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Move over to the next column // Move over to the next column
yoff = 10; xpos += 115; ypos = 10;
xoff = xoff + 115;
// Framerate // Framerate
myFrameRateSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight, myFrameRateSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Framerate: ", labelWidth, kFrameRateChanged); "Framerate: ", lwidth, kFrameRateChanged);
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300); myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
myFrameRateLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight, myFrameRateLabel = new StaticTextWidget(this, font,
"", kTextAlignLeft); xpos + myFrameRateSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myFrameRateLabel->setFlags(WIDGET_CLEARBG); myFrameRateLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
// Zoom level // Zoom level
myZoomSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight, myZoomSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Zoom: ", labelWidth, kZoomChanged); "Zoom: ", lwidth, kZoomChanged);
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50); myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
myZoomLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight, myZoomLabel = new StaticTextWidget(this, font,
"", kTextAlignLeft); xpos + myZoomSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myZoomLabel->setFlags(WIDGET_CLEARBG); myZoomLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 10; ypos += lineHeight + 10;
myFullscreenCheckbox = new CheckboxWidget(this, font, xoff + 5, yoff, myFullscreenCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
"Fullscreen mode"); "Fullscreen mode");
yoff += kVideoRowHeight + 4; ypos += lineHeight + 4;
myUseDeskResCheckbox = new CheckboxWidget(this, font, xoff + 5, yoff, myUseDeskResCheckbox = new CheckboxWidget(this, font, xpos + 5, ypos,
"Desktop Res in FS"); "Desktop Res in FS");
yoff += kVideoRowHeight + 20; ypos += lineHeight + 20;
// Add Defaults, OK and Cancel buttons // Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0); addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else #else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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: VideoDialog.hxx,v 1.10 2005-10-18 18:49:46 stephena Exp $ // $Id: VideoDialog.hxx,v 1.11 2006-02-22 17:38:04 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,7 +44,7 @@ class VideoDialog : public Dialog
{ {
public: public:
VideoDialog(OSystem* osystem, DialogContainer* parent, VideoDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h); const GUI::Font& font, int x, int y, int w, int h);
~VideoDialog(); ~VideoDialog();
protected: protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Widget.cxx,v 1.41 2006-01-08 20:55:54 stephena Exp $ // $Id: Widget.cxx,v 1.42 2006-02-22 17:38:04 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,12 @@
#include "EditableWidget.hxx" #include "EditableWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget::Widget(GuiObject* boss, int x, int y, int w, int h) Widget::Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: GuiObject(boss->instance(), boss->parent(), x, y, w, h), : GuiObject(boss->instance(), boss->parent(), x, y, w, h),
_type(0), _type(0),
_boss(boss), _boss(boss),
_font((GUI::Font*)&font),
_id(-1), _id(-1),
_flags(0), _flags(0),
_hasFocus(false), _hasFocus(false),
@ -44,6 +46,9 @@ Widget::Widget(GuiObject* boss, int x, int y, int w, int h)
// Insert into the widget list of the boss // Insert into the widget list of the boss
_next = _boss->_firstWidget; _next = _boss->_firstWidget;
_boss->_firstWidget = this; _boss->_firstWidget = this;
_fontWidth = _font->getMaxCharWidth();
_fontHeight = _font->getLineHeight();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -294,9 +299,10 @@ void Widget::setDirtyInChain(Widget* start)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, StaticTextWidget::StaticTextWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& text, TextAlignment align) const string& text, TextAlignment align)
: Widget(boss, x, y, w, h), : Widget(boss, font, x, y, w, h),
_align(align) _align(align)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG; _flags = WIDGET_ENABLED | WIDGET_CLEARBG;
@ -330,9 +336,10 @@ void StaticTextWidget::drawWidget(bool hilite)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int cmd, uInt8 hotkey) const string& label, int cmd, uInt8 hotkey)
: StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter), : StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
CommandSender(boss), CommandSender(boss),
_cmd(cmd), _cmd(cmd),
_editable(false), _editable(false),
@ -411,7 +418,7 @@ void ButtonWidget::setEditable(bool editable)
void ButtonWidget::drawWidget(bool hilite) void ButtonWidget::drawWidget(bool hilite)
{ {
FrameBuffer& fb = _boss->instance()->frameBuffer(); FrameBuffer& fb = _boss->instance()->frameBuffer();
fb.drawString(_font, _label, _x, _y + (_h - kLineHeight)/2 + 1, _w, fb.drawString(_font, _label, _x, _y + (_h - _fontHeight)/2 + 1, _w,
!isEnabled() ? kColor : hilite ? kTextColorHi : _color, _align); !isEnabled() ? kColor : hilite ? kTextColorHi : _color, _align);
} }
@ -433,23 +440,32 @@ static unsigned int checked_img[8] =
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font, CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, const string& label, int x, int y, const string& label,
int cmd) int cmd)
: ButtonWidget(boss, x, y, 16, 16, label, cmd, 0), : ButtonWidget(boss, font, x, y, 16, 16, label, cmd, 0),
_state(false), _state(false),
_editable(true), _editable(true),
_holdFocus(true), _holdFocus(true),
_fillRect(false), _fillRect(false),
_drawBox(true), _drawBox(true),
_fillColor(kColor) _fillColor(kColor),
_boxY(0),
_textY(0)
{ {
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
_type = kCheckboxWidget; _type = kCheckboxWidget;
setFont(font);
if(label == "") if(label == "")
_w = 14; _w = 14;
else else
_w = font.getStringWidth(label) + 20; _w = font.getStringWidth(label) + 20;
_h = font.getFontHeight() < 14 ? 14 : font.getFontHeight(); _h = font.getFontHeight() < 14 ? 14 : font.getFontHeight();
// Depending on font size, either the font or box will need to be
// centered vertically
if(_h > 14) // center box
_boxY = (_h - 14) / 2;
else // center text
_textY = (14 - _font->getFontHeight()) / 2;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -512,40 +528,33 @@ void CheckboxWidget::drawWidget(bool hilite)
{ {
FrameBuffer& fb = _boss->instance()->frameBuffer(); FrameBuffer& fb = _boss->instance()->frameBuffer();
// Depending on font size, either the font or box will need to be
// centered vertically
int box_yoff = 0, text_yoff = 0;
if(_h > 14) // center box
box_yoff = (_h - 14) / 2;
else // center text
text_yoff = (14 - _font->getFontHeight()) / 2;
// Draw the box // Draw the box
if(_drawBox) if(_drawBox)
fb.box(_x, _y + box_yoff, 14, 14, kColor, kShadowColor); fb.box(_x, _y + _boxY, 14, 14, kColor, kShadowColor);
// If checked, draw cross inside the box // If checked, draw cross inside the box
if(_state) if(_state)
{ {
if(_fillRect) if(_fillRect)
fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10, fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10,
isEnabled() ? _color : kColor); isEnabled() ? _color : kColor);
else else
fb.drawBitmap(checked_img, _x + 3, _y + box_yoff + 3, fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3,
isEnabled() ? _color : kColor); isEnabled() ? _color : kColor);
} }
else else
fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10, kBGColor); fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, kBGColor);
// Finally draw the label // Finally draw the label
fb.drawString(_font, _label, _x + 20, _y + text_yoff, _w, fb.drawString(_font, _label, _x + 20, _y + _textY, _w,
isEnabled() ? _color : kColor); isEnabled() ? _color : kColor);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int labelWidth, int cmd, uInt8 hotkey) const string& label, int labelWidth, int cmd, uInt8 hotkey)
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), : ButtonWidget(boss, font, x, y, w, h, label, cmd, hotkey),
_value(0), _value(0),
_oldValue(0), _oldValue(0),
_valueMin(0), _valueMin(0),
@ -555,6 +564,11 @@ SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h,
{ {
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
_type = kSliderWidget; _type = kSliderWidget;
if(!_label.empty() && _labelWidth == 0)
_labelWidth = _font->getStringWidth(_label);
_w = w + _labelWidth;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Widget.hxx,v 1.46 2006-01-09 16:50:01 stephena Exp $ // $Id: Widget.hxx,v 1.47 2006-02-22 17:38:04 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,6 +32,7 @@ class Dialog;
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "Array.hxx" #include "Array.hxx"
#include "Rect.hxx" #include "Rect.hxx"
#include "Font.hxx"
#include "bspf.hxx" #include "bspf.hxx"
enum { enum {
@ -75,14 +76,14 @@ enum {
This is the base class for all widgets. This is the base class for all widgets.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Widget.hxx,v 1.46 2006-01-09 16:50:01 stephena Exp $ @version $Id: Widget.hxx,v 1.47 2006-02-22 17:38:04 stephena Exp $
*/ */
class Widget : public GuiObject class Widget : public GuiObject
{ {
friend class Dialog; friend class Dialog;
public: public:
Widget(GuiObject* boss, int x, int y, int w, int h); Widget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h);
virtual ~Widget(); virtual ~Widget();
virtual int getAbsX() const { return _x + _boss->getChildX(); } virtual int getAbsX() const { return _x + _boss->getChildX(); }
@ -126,6 +127,7 @@ class Widget : public GuiObject
int getID() { return _id; } int getID() { return _id; }
void setColor(OverlayColor color) { _color = color; } void setColor(OverlayColor color) { _color = color; }
virtual const GUI::Font* font() { return _font; }
virtual void loadConfig() {} virtual void loadConfig() {}
@ -146,11 +148,14 @@ class Widget : public GuiObject
protected: protected:
int _type; int _type;
GuiObject* _boss; GuiObject* _boss;
GUI::Font* _font;
Widget* _next; Widget* _next;
int _id; int _id;
int _flags; int _flags;
bool _hasFocus; bool _hasFocus;
OverlayColor _color; OverlayColor _color;
int _fontWidth;
int _fontHeight;
public: public:
static Widget* findWidgetInChain(Widget* start, int x, int y); static Widget* findWidgetInChain(Widget* start, int x, int y);
@ -175,7 +180,7 @@ class Widget : public GuiObject
class StaticTextWidget : public Widget class StaticTextWidget : public Widget
{ {
public: public:
StaticTextWidget(GuiObject* boss, StaticTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& text, TextAlignment align); const string& text, TextAlignment align);
void setValue(int value); void setValue(int value);
@ -198,7 +203,7 @@ class StaticTextWidget : public Widget
class ButtonWidget : public StaticTextWidget, public CommandSender class ButtonWidget : public StaticTextWidget, public CommandSender
{ {
public: public:
ButtonWidget(GuiObject* boss, ButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& label, int cmd = 0, uInt8 hotkey = 0); const string& label, int cmd = 0, uInt8 hotkey = 0);
@ -260,6 +265,10 @@ class CheckboxWidget : public ButtonWidget
bool _drawBox; bool _drawBox;
OverlayColor _fillColor; OverlayColor _fillColor;
private:
int _boxY;
int _textY;
}; };
@ -267,7 +276,8 @@ class CheckboxWidget : public ButtonWidget
class SliderWidget : public ButtonWidget class SliderWidget : public ButtonWidget
{ {
public: public:
SliderWidget(GuiObject *boss, int x, int y, int w, int h, const string& label = "", SliderWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, int w, int h, const string& label = "",
int labelWidth = 0, int cmd = 0, uInt8 hotkey = 0); int labelWidth = 0, int cmd = 0, uInt8 hotkey = 0);
void setValue(int value); void setValue(int value);