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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -47,10 +47,9 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
const GUI::Font& font = instance()->font();
int xpos, ypos;
// List of cheats, with checkboxes to enable/disable
@ -63,10 +62,10 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
addFocusWidget(myCheatList);
xpos += myCheatList->getWidth() + 15; ypos = 15;
addButton(xpos, ypos, "Add", kAddCheatCmd, 0);
myEditButton = addButton(xpos, ypos+=20, "Edit", kEditCheatCmd, 0);
myRemoveButton = addButton(xpos, ypos+=20, "Remove", kRemCheatCmd, 0);
addButton(xpos, ypos+=30, "One shot", kAddOneShotCmd, 0);
addButton(font, xpos, ypos, "Add", kAddCheatCmd, 0);
myEditButton = addButton(font, xpos, ypos+=20, "Edit", kEditCheatCmd, 0);
myRemoveButton = addButton(font, xpos, ypos+=20, "Remove", kRemCheatCmd, 0);
addButton(font, xpos, ypos+=30, "One shot", kAddOneShotCmd, 0);
// Inputbox which will pop up when adding/editing a cheat
StringList labels;
@ -75,15 +74,15 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
myCheatInput = new InputTextDialog(this, font, labels, _x+20, _y+20);
myCheatInput->setTarget(this);
// Add OK and Cancel buttons
// Add OK and Cancel buttons **** FIXME - coordinates
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
myCancelButton = addButton(_w - (kButtonWidth + 10), _h - 24,
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
myCancelButton = addButton(font, _w - (kButtonWidth + 10), _h - 24,
"Cancel", kCloseCmd, 0);
#else
myCancelButton = addButton(_w - 2 * (kButtonWidth + 7), _h - 24,
myCancelButton = 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
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -42,7 +42,7 @@ class CheatCodeDialog : public Dialog
{
public:
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();
protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -37,22 +37,20 @@ enum {
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss)
{
const GUI::Font& font = instance()->consoleFont();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = font.getStringWidth("AUDW: ");
StaticTextWidget* t;
// AudF registers
t = new StaticTextWidget(boss, xpos, ypos+2,
new StaticTextWidget(boss, font, xpos, ypos+2,
lwidth, fontHeight,
"AUDF:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudF = new DataGridWidget(boss, font, xpos, ypos,
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)
{
t = new StaticTextWidget(boss, xpos + col*myAudF->colWidth() + 7,
ypos - lineHeight,
fontWidth, fontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
new StaticTextWidget(boss, font, xpos + col*myAudF->colWidth() + 7,
ypos - lineHeight, fontWidth, fontHeight,
Debugger::to_hex_4(col), kTextAlignLeft);
}
// AudC registers
xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2,
lwidth, fontHeight,
new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight,
"AUDC:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudC = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16);
@ -87,10 +80,8 @@ AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h)
// AudV registers
xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2,
lwidth, fontHeight,
new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight,
"AUDV:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudV = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -32,7 +32,8 @@ class DataGridWidget;
class AudioWidget : public Widget, public CommandSender
{
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();
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,8 +28,9 @@
#include "ColorWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ColorWidget::ColorWidget(GuiObject* boss, int x, int y, int w, int h, int cmd)
: Widget(boss, x, y, w, h),
ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int cmd)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_color(0),
_cmd(cmd)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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.
@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
{
friend class ColorDialog;
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();
void setColor(int color);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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),
CommandSender(boss),
_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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -76,6 +76,9 @@ class ContextMenu : public Dialog, public CommandSender
int _selectedItem;
int _rowHeight;
private:
const GUI::Font* _font;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -60,20 +60,18 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos, ypos, lwidth;
StaticTextWidget* t;
// Create a 1x1 grid with label for the PC register
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);
t->setFont(font);
myPCGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 16, 16);
myPCGrid->setTarget(this);
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
xpos += lwidth + myPCGrid->getWidth() + 10;
myPCLabel = new EditTextWidget(boss, xpos, ypos, fontWidth*15, lineHeight, "");
myPCLabel->setFont(font);
myPCLabel = new EditTextWidget(boss, font, xpos, ypos, fontWidth*15,
lineHeight, "");
myPCLabel->setEditable(false);
// 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:" };
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,
labels[row], kTextAlignLeft);
t->setFont(font);
}
// Create a bitfield widget for changing the processor status
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);
t->setFont(font);
myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos, 8, 1);
myPSRegister->setTarget(this);
addFocusWidget(myPSRegister);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -22,8 +22,9 @@
#include "DataGridOpsWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, int x, int y)
: Widget(boss, x, y, 16, 16),
DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
_zeroButton(NULL),
_invButton(NULL),
@ -34,38 +35,38 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, int x, int y)
_shiftRightButton(NULL)
{
const int bwidth = _font->getMaxCharWidth() * 3,
bheight = 16, // FIXME - magic number
bheight = _font->getFontHeight() + 2,
space = 6;
int xpos, ypos;
// Create operations buttons
xpos = x; ypos = y;
_zeroButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_zeroButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"0", kDGZeroCmd, 0);
ypos += bheight + space;
_invButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_invButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Inv", kDGInvertCmd, 0);
ypos += bheight + space;
_incButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_incButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"++", kDGIncCmd, 0);
ypos += bheight + space;
_shiftLeftButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_shiftLeftButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"<<", kDGShiftLCmd, 0);
// Move to next column, skip a row
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);
ypos += bheight + space;
_decButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_decButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"--", kDGDecCmd, 0);
ypos += bheight + space;
_shiftRightButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
_shiftRightButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
">>", kDGShiftRCmd, 0);
// Calculate real dimensions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -40,7 +40,7 @@ enum {
class DataGridOpsWidget : public Widget, public CommandSender
{
public:
DataGridOpsWidget(GuiObject* boss, int x, int y);
DataGridOpsWidget(GuiObject* boss, const GUI::Font& font, int x, int y);
virtual ~DataGridOpsWidget() {}
void setTarget(CommandReceiver* target);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -31,7 +31,8 @@
DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows,
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),
_rows(rows),
_cols(cols),
@ -44,8 +45,6 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
_selectedItem(0),
_opsWidget(NULL)
{
setFont(font);
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kDataGridWidget;
_editMode = false;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -145,7 +145,8 @@ void DebuggerDialog::addTiaArea()
{
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();
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
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);
addTabWidget(myTab);
const int widWidth = r.width() - vBorder;
const int widHeight = r.height() - myTab->getTabHeight() - vBorder - 4;
int tabID;
// The Prompt/console tab
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);
addToFocusList(myPrompt->getFocusList(), tabID);
// The TIA tab
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);
addToFocusList(tia->getFocusList(), tabID);
// The Audio tab
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);
addToFocusList(aud->getFocusList(), tabID);
@ -195,16 +200,16 @@ void DebuggerDialog::addStatusArea()
int xpos, ypos;
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;
myTiaZoom = new TiaZoomWidget(this, xpos+10, ypos);
myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos);
addToFocusList(myTiaZoom->getFocusList());
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(), "");
myMessageBox->setFont(font);
myMessageBox->setEditable(false);
myMessageBox->setColor(kTextColorEm);
}
@ -224,18 +229,19 @@ void DebuggerDialog::addRomArea()
addToFocusList(myRam->getFocusList());
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;
addButton(buttonX, buttonY, "Step", kDDStepCmd, 0);
addButton(instance()->consoleFont(), buttonX, buttonY, "Step", kDDStepCmd, 0);
buttonY += 22;
addButton(buttonX, buttonY, "Trace", kDDTraceCmd, 0);
addButton(instance()->consoleFont(), buttonX, buttonY, "Trace", kDDTraceCmd, 0);
buttonY += 22;
addButton(buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0);
addButton(instance()->consoleFont(), buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0);
buttonY += 22;
addButton(buttonX, buttonY, "Frame +1", kDDAdvCmd, 0);
addButton(instance()->consoleFont(), buttonX, buttonY, "Frame +1", kDDAdvCmd, 0);
buttonY += 22;
addButton(buttonX, buttonY, "Exit", kDDExitCmd, 0);
addButton(instance()->consoleFont(), buttonX, buttonY, "Exit", kDDExitCmd, 0);
xpos = r.left + 10; ypos += myRam->getHeight() + 5;
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -44,8 +44,9 @@
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w - kScrollBarWidth, h),
PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w - kScrollBarWidth, h),
CommandSender(boss),
_makeDirty(false),
_firstTime(true)
@ -54,8 +55,8 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
WIDGET_WANTS_TAB;
_type = kPromptWidget;
_kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth();
_kConsoleCharHeight = instance()->consoleFont().getFontHeight();
_kConsoleCharWidth = font.getMaxCharWidth();
_kConsoleCharHeight = font.getFontHeight();
_kConsoleLineHeight = _kConsoleCharHeight + 2;
// Calculate depending values
@ -70,7 +71,7 @@ PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
_firstLineInBuffer = 0;
// Add scrollbar
_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, kScrollBarWidth, _h);
_scrollBar->setTarget(this);
// Init colors

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,8 @@ enum {
class PromptWidget : public Widget, public CommandSender
{
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();
public:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -44,7 +44,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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),
myUndoAddress(-1),
myUndoValue(-1)
@ -55,7 +55,6 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
bwidth = 44,
bheight = 16;
int xpos, ypos, lwidth;
StaticTextWidget* t;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
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
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);
myUndoButton->setTarget(this);
ypos += bheight + bheight/2;
myRevertButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Revert", kRevertCmd, 0);
myRevertButton->setTarget(this);
ypos += 2 * bheight + 2;
mySearchButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Search", kSearchCmd, 0);
mySearchButton->setTarget(this);
ypos += bheight + bheight/2;
myCompareButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Compare", kCmpCmd, 0);
myCompareButton->setTarget(this);
ypos += bheight + bheight/2;
myRestartButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Reset", kRestartCmd, 0);
myRestartButton->setTarget(this);
@ -94,50 +93,43 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
xpos = x; ypos = y + lineHeight;
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,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft);
t->setFont(font);
}
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,
fontWidth, fontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = x + 10; ypos += 9 * lineHeight;
t = new StaticTextWidget(boss, xpos, ypos,
new StaticTextWidget(boss, font, xpos, ypos,
6*fontWidth, fontHeight,
"Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 17*fontWidth, lineHeight, "");
myLabel->setFont(font);
myLabel = new EditTextWidget(boss, font, xpos, ypos-2, 17*fontWidth,
lineHeight, "");
myLabel->setEditable(false);
xpos += 17*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*fontWidth, fontHeight,
new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, "");
myDecValue->setFont(font);
myDecValue = new EditTextWidget(boss, font, xpos, ypos-2, 4*fontWidth,
lineHeight, "");
myDecValue->setEditable(false);
xpos += 4*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*fontWidth, fontHeight,
new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, "");
myBinValue->setFont(font);
myBinValue = new EditTextWidget(boss, font, xpos, ypos-2, 9*fontWidth,
lineHeight, "");
myBinValue->setEditable(false);
// Calculate real dimensions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
myMenu(NULL),
myHighlightedItem(-1)
{
setFont(font);
myMenu = new ContextMenu(this, font);
StringList l;
@ -96,7 +95,7 @@ void RomListWidget::drawWidget(bool hilite)
_checkList[i]->setDirty();
_checkList[i]->draw();
const int y = _y + 2 + _rowHeight * i;
const int y = _y + 2 + _fontHeight * i;
GUI::Rect l = getLineRect();
GUI::Rect r = getEditRect();
@ -104,8 +103,8 @@ void RomListWidget::drawWidget(bool hilite)
// Draw highlighted item in a frame
if (_highlightedItem == pos)
{
fb.frameRect(_x + l.left - 3, _y + 1 + _rowHeight * i,
_w - l.left, _rowHeight,
fb.frameRect(_x + l.left - 3, _y + 1 + _fontHeight * i,
_w - l.left, _fontHeight,
kHiliteColor);
}
@ -113,12 +112,12 @@ void RomListWidget::drawWidget(bool hilite)
if (_selectedItem == pos && _hasFocus)
{
if (!_editMode)
fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i,
r.width(), _rowHeight,
fb.fillRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
r.width(), _fontHeight,
kTextColorHi);
else
fb.frameRect(_x + r.left - 3, _y + 1 + _rowHeight * i,
r.width(), _rowHeight,
fb.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
r.width(), _fontHeight,
kTextColorHi);
}
@ -156,8 +155,8 @@ void RomListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect RomListWidget::getLineRect() const
{
GUI::Rect r(2, 1, _w, _rowHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight,
GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset;
r.bottom += yoffset;
@ -170,8 +169,8 @@ GUI::Rect RomListWidget::getLineRect() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect RomListWidget::getEditRect() const
{
GUI::Rect r(2, 1, _w, _rowHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight,
GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset;
r.bottom += yoffset;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -39,7 +39,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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),
myListIsDirty(true),
mySourceAvailable(false),
@ -51,11 +51,10 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Create bank editable area
xpos = x + 40; ypos = y + 7;
t = new StaticTextWidget(boss, xpos, ypos,
t = new StaticTextWidget(boss, font, xpos, ypos,
font.getStringWidth("Current bank: "),
font.getFontHeight(),
"Current bank:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10;
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
xpos += myBank->getWidth() + 45;
t = new StaticTextWidget(boss, xpos, ypos,
t = new StaticTextWidget(boss, font, xpos, ypos,
font.getStringWidth("Total banks: "),
font.getFontHeight(),
"Total banks:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10;
myBankCount = new EditTextWidget(boss, xpos, ypos-2,
myBankCount = new EditTextWidget(boss, font, xpos, ypos-2,
20, font.getLineHeight(), "");
myBankCount->setFont(font);
myBankCount->setEditable(false);
// Create rom listing

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -30,63 +30,63 @@
#include "TiaInfoWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y)
: Widget(boss, x, y, 16, 16),
TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss)
{
const GUI::Font& font = instance()->consoleFont();
const int lineHeight = font.getLineHeight();
int xpos = x, ypos = y, lwidth = 45;
// Add frame info
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;
myFrameCount = new EditTextWidget(boss, xpos, ypos-2, 45, lineHeight, "");
myFrameCount->setFont(font);
myFrameCount = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
myFrameCount->setEditable(false);
xpos = x; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "F. Cycles:", kTextAlignLeft);
xpos = x; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"F. Cycles:", kTextAlignLeft);
xpos += lwidth;
myFrameCycles = new EditTextWidget(boss, xpos, ypos-2, 45, lineHeight, "");
myFrameCycles->setFont(font);
myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
myFrameCycles->setEditable(false);
xpos = x + 10; ypos += kLineHeight + 5;
myVSync = new CheckboxWidget(boss, instance()->font(), xpos, ypos-3, "VSync", 0);
xpos = x + 10; ypos += lineHeight + 5;
myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0);
myVSync->setEditable(false);
xpos = x + 10; ypos += kLineHeight + 5;
myVBlank = new CheckboxWidget(boss, instance()->font(), xpos, ypos-3, "VBlank", 0);
xpos = x + 10; ypos += lineHeight + 5;
myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0);
myVBlank->setEditable(false);
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;
myScanlineCount = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, "");
myScanlineCount->setFont(font);
myScanlineCount = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myScanlineCount->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "S. Cycles:", kTextAlignLeft);
xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"S. Cycles:", kTextAlignLeft);
xpos += lwidth;
myScanlineCycles = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, "");
myScanlineCycles->setFont(font);
myScanlineCycles = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myScanlineCycles->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Pixel Pos:", kTextAlignLeft);
xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Pixel Pos:", kTextAlignLeft);
xpos += lwidth;
myPixelPosition = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, "");
myPixelPosition->setFont(font);
myPixelPosition = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myPixelPosition->setEditable(false);
xpos = x + 100; ypos += kLineHeight + 5;
new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Color Clk:", kTextAlignLeft);
xpos = x + 100; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Color Clk:", kTextAlignLeft);
xpos += lwidth;
myColorClocks = new EditTextWidget(boss, xpos, ypos-2, 30, lineHeight, "");
myColorClocks->setFont(font);
myColorClocks = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, "");
myColorClocks->setEditable(false);
// Calculate actual dimensions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -32,7 +32,7 @@ class EditTextWidget;
class TiaInfoWidget : public Widget, public CommandSender
{
public:
TiaInfoWidget(GuiObject *boss, int x, int y);
TiaInfoWidget(GuiObject *boss, const GUI::Font& font, int x, int y);
virtual ~TiaInfoWidget();
void loadConfig();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -34,14 +34,15 @@
#include "TiaOutputWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaOutputWidget::TiaOutputWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
myMenu(NULL),
myZoom(NULL)
{
// Create context menu for commands
myMenu = new ContextMenu(this, instance()->consoleFont());
myMenu = new ContextMenu(this, font);
StringList l;
l.push_back("Fill to scanline");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -33,7 +33,8 @@ class TiaZoomWidget;
class TiaOutputWidget : public Widget, public CommandSender
{
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();
void loadConfig();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -81,11 +81,11 @@ enum {
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss)
{
const GUI::Font& font = instance()->consoleFont();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
@ -100,48 +100,40 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myRamGrid->setID(kRamID);
addFocusWidget(myRamGrid);
t = new StaticTextWidget(boss, xpos, ypos + 2,
t = new StaticTextWidget(boss, font, xpos, ypos + 2,
lwidth-2, fontHeight,
"00:", kTextAlignLeft);
t->setFont(font);
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,
fontWidth, fontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = 20; ypos += 2 * lineHeight;
t = new StaticTextWidget(boss, xpos, ypos,
6*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos, 6*fontWidth, fontHeight,
"Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*fontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*fontWidth, lineHeight, "");
myLabel->setFont(font);
myLabel = new EditTextWidget(boss, font, xpos, ypos-2, 15*fontWidth,
lineHeight, "");
myLabel->setEditable(false);
xpos += 15*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, "");
myDecValue->setFont(font);
myDecValue = new EditTextWidget(boss, font, xpos, ypos-2, 4*fontWidth,
lineHeight, "");
myDecValue->setEditable(false);
xpos += 4*fontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight,
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, "");
myBinValue->setFont(font);
myBinValue = new EditTextWidget(boss, font, xpos, ypos-2, 9*fontWidth,
lineHeight, "");
myBinValue->setEditable(false);
// Color registers
@ -149,11 +141,10 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos = 10; ypos += 3*lineHeight;
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,
regNames[row],
kTextAlignLeft);
t->setFont(font);
}
xpos += 7*fontWidth + 5;
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);
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);
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);
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);
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);
////////////////////////////
@ -183,26 +174,22 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// Add horizontal labels
xpos += myCOLUBKColor->getWidth() + 2*fontWidth + 30; ypos -= 4*lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos,
14*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos, 14*fontWidth, fontHeight,
"PF BL M1 M0 P1", kTextAlignLeft);
t->setFont(font);
// 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,
"Strobes:", kTextAlignLeft);
t->setFont(font);
// Add vertical labels
xpos -= 2*fontWidth + 5; ypos += lineHeight;
const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" };
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,
collLabel[row], kTextAlignLeft);
t->setFont(font);
}
// 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,
"", kCheckActionCmd);
myCollision[idx]->setFont(font);
myCollision[idx]->setTarget(this);
myCollision[idx]->setID(idx);
// TODO - make collisions editable in TIA //
@ -235,52 +221,52 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
ButtonWidget* b;
unsigned int buttonX, buttonY;
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);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResP0", kResP0Cmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResM0", kResM0Cmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResBL", kResBLCmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"HmClr", kHmclrCmd);
b->setTarget(this);
buttonX += 50 + 10; buttonY = ypos;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"RSync", kRsyncCmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResP1", kResP1Cmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"ResM1", kResM1Cmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"HMove", kHmoveCmd);
b->setTarget(this);
buttonY += lineHeight + 3;
b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight,
b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight,
"CxClr", kCxclrCmd);
b->setTarget(this);
@ -300,22 +286,20 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// grP0
xpos = 10; ypos = 13*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
t = new StaticTextWidget(boss, font, xpos, ypos+2,
7*fontWidth, fontHeight,
"P0: GR:", kTextAlignLeft);
t->setFont(font);
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->setID(kGRP0ID);
addFocusWidget(myGRP0);
// posP0
xpos += myGRP0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
t = new StaticTextWidget(boss, font, xpos, ypos+2,
4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
@ -325,10 +309,9 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmP0
xpos += myPosP0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
t = new StaticTextWidget(boss, font, xpos, ypos+2,
3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMP0 = new DataGridWidget(boss, font, xpos, ypos,
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;
myRefP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd);
myRefP0->setFont(font);
myRefP0->setTarget(this);
myRefP0->setID(kRefP0ID);
addFocusWidget(myRefP0);
@ -348,17 +330,15 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefP0->getWidth() + 15;
myDelP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd);
myDelP0->setFont(font);
myDelP0->setTarget(this);
myDelP0->setID(kDelP0ID);
addFocusWidget(myDelP0);
// NUSIZ0 (player portion)
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,
"NusizP0:", kTextAlignLeft);
t->setFont(font);
xpos += 8*fontWidth + 5;
myNusizP0 = new DataGridWidget(boss, font, xpos, ypos,
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);
xpos += myNusizP0->getWidth() + 5;
myNusizP0Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusizP0Text->setFont(font);
myNusizP0Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth,
lineHeight, "");
myNusizP0Text->setEditable(false);
////////////////////////////
@ -376,22 +356,18 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// grP1
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
7*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 7*fontWidth, fontHeight,
"P1: GR:", kTextAlignLeft);
t->setFont(font);
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->setID(kGRP1ID);
addFocusWidget(myGRP1);
// posP1
xpos += myGRP1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
@ -401,10 +377,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmP1
xpos += myPosP1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMP1 = new DataGridWidget(boss, font, xpos, ypos,
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;
myRefP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd);
myRefP1->setFont(font);
myRefP1->setTarget(this);
myRefP1->setID(kRefP1ID);
addFocusWidget(myRefP1);
@ -424,17 +397,14 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefP1->getWidth() + 15;
myDelP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd);
myDelP1->setFont(font);
myDelP1->setTarget(this);
myDelP1->setID(kDelP1ID);
addFocusWidget(myDelP1);
// NUSIZ1 (player portion)
xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 5;
t = new StaticTextWidget(boss, xpos, ypos+2,
8*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 8*fontWidth, fontHeight,
"NusizP1:", kTextAlignLeft);
t->setFont(font);
xpos += 8*fontWidth + 5;
myNusizP1 = new DataGridWidget(boss, font, xpos, ypos,
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);
xpos += myNusizP1->getWidth() + 5;
myNusizP1Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, "");
myNusizP1Text->setFont(font);
myNusizP1Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth,
lineHeight, "");
myNusizP1Text->setEditable(false);
////////////////////////////
@ -452,24 +422,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// enaM0
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"M0:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaM0 = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd);
myEnaM0->setFont(font);
myEnaM0->setTarget(this);
myEnaM0->setID(kEnaM0ID);
addFocusWidget(myEnaM0);
// posM0
xpos += myEnaM0->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
@ -479,10 +444,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmM0
xpos += myPosM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMM0 = new DataGridWidget(boss, font, xpos, ypos,
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)
xpos += myHMM0->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
myNusizM0 = new DataGridWidget(boss, font, xpos, ypos,
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;
myResMP0 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reset", kCheckActionCmd);
myResMP0->setFont(font);
myResMP0->setTarget(this);
myResMP0->setID(kResMP0ID);
addFocusWidget(myResMP0);
@ -517,24 +477,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// enaM1
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"M1:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaM1 = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd);
myEnaM1->setFont(font);
myEnaM1->setTarget(this);
myEnaM1->setID(kEnaM1ID);
addFocusWidget(myEnaM1);
// posM0
xpos += myEnaM1->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
@ -544,10 +499,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmM0
xpos += myPosM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMM1 = new DataGridWidget(boss, font, xpos, ypos,
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)
xpos += myHMM1->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
myNusizM1 = new DataGridWidget(boss, font, xpos, ypos,
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;
myResMP1 = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reset", kCheckActionCmd);
myResMP1->setFont(font);
myResMP1->setTarget(this);
myResMP1->setID(kResMP1ID);
addFocusWidget(myResMP1);
@ -582,24 +532,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// enaBL
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"BL:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 8;
myEnaBL = new CheckboxWidget(boss, font, xpos, ypos+2,
"Enable", kCheckActionCmd);
myEnaBL->setFont(font);
myEnaBL->setTarget(this);
myEnaBL->setID(kEnaBLID);
addFocusWidget(myEnaBL);
// posBL
xpos += myEnaBL->getWidth() + 12;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"Pos:", kTextAlignLeft);
t->setFont(font);
xpos += 4*fontWidth + 5;
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
1, 1, 2, 8, kBASE_16);
@ -609,10 +554,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// hmBL
xpos += myPosBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
3*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 3*fontWidth, fontHeight,
"HM:", kTextAlignLeft);
t->setFont(font);
xpos += 3*fontWidth + 5;
myHMBL = new DataGridWidget(boss, font, xpos, ypos,
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)
xpos += myHMBL->getWidth() + 8;
t = new StaticTextWidget(boss, xpos, ypos+2,
5*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 5*fontWidth, fontHeight,
"Size:", kTextAlignLeft);
t->setFont(font);
xpos += 5*fontWidth + 5;
mySizeBL = new DataGridWidget(boss, font, xpos, ypos,
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;
myDelBL = new CheckboxWidget(boss, font, xpos, ypos+1,
"Delay", kCheckActionCmd);
myDelBL->setFont(font);
myDelBL->setTarget(this);
myDelBL->setID(kDelBLID);
addFocusWidget(myDelBL);
@ -647,26 +587,24 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
////////////////////////////
// PF0
xpos = 10; ypos += 2*lineHeight;
t = new StaticTextWidget(boss, xpos, ypos+2,
4*fontWidth, fontHeight,
t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight,
"PF:", kTextAlignLeft);
t->setFont(font);
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]->setID(kPF0ID);
addFocusWidget(myPF[0]);
// PF1
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]->setID(kPF1ID);
addFocusWidget(myPF[1]);
// PF2
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]->setID(kPF2ID);
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;
myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Reflect", kCheckActionCmd);
myRefPF->setFont(font);
myRefPF->setTarget(this);
myRefPF->setID(kRefPFID);
addFocusWidget(myRefPF);
@ -683,7 +620,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myRefPF->getWidth() + 15;
myScorePF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Score", kCheckActionCmd);
myScorePF->setFont(font);
myScorePF->setTarget(this);
myScorePF->setID(kScorePFID);
addFocusWidget(myScorePF);
@ -691,7 +627,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
xpos += myScorePF->getWidth() + 15;
myPriorityPF = new CheckboxWidget(boss, font, xpos, ypos+1,
"Priority", kCheckActionCmd);
myPriorityPF->setFont(font);
myPriorityPF->setTarget(this);
myPriorityPF->setID(kPriorityPFID);
addFocusWidget(myPriorityPF);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -38,7 +38,8 @@ class ColorWidget;
class TiaWidget : public Widget, public CommandSender
{
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();
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,8 +28,9 @@
#include "TiaZoomWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaZoomWidget::TiaZoomWidget(GuiObject* boss, int x, int y)
: Widget(boss, x, y, 16, 16),
TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
myMenu(NULL)
{
@ -50,7 +51,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, int x, int y)
myYCenter = myNumRows >> 1;
// Create context menu for zoom levels
myMenu = new ContextMenu(this, instance()->consoleFont());
myMenu = new ContextMenu(this, font);
StringList l;
l.push_back("2x zoom");

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -32,7 +32,7 @@ class ContextMenu;
class TiaZoomWidget : public Widget, public CommandSender
{
public:
TiaZoomWidget(GuiObject *boss, int x, int y);
TiaZoomWidget(GuiObject *boss, const GUI::Font& font, int x, int y);
virtual ~TiaZoomWidget();
void loadConfig();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -30,10 +30,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
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();
_colWidth = colchars * font.getMaxCharWidth() + 8;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -27,12 +27,12 @@
#include "TogglePixelWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, int x, int y,
int cols, int rows)
: ToggleWidget(boss, x, y, cols, rows),
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows)
: ToggleWidget(boss, font, x, y, cols, rows),
_pixelColor(kBGColor)
{
_rowHeight = _font->getLineHeight();
_rowHeight = font.getLineHeight();
_colWidth = 15;
// Calculate real dimensions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,8 @@
class TogglePixelWidget : public ToggleWidget
{
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();
void setColor(OverlayColor color) { _pixelColor = color; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -24,8 +24,9 @@
#include "ToggleWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleWidget::ToggleWidget(GuiObject* boss, int x, int y, int cols, int rows)
: Widget(boss, x, y, 16, 16),
ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
_rows(rows),
_cols(cols),

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -37,7 +37,8 @@ enum {
class ToggleWidget : public Widget, public CommandSender
{
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();
const BoolArray& getState() { return _stateList; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.cxx,v 1.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>
@ -96,6 +96,11 @@ OSystem::~OSystem()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
myMenu = new Menu(this);
myCommandMenu = new CommandMenu(this);
@ -107,10 +112,6 @@ bool OSystem::create()
myCheatManager = new CheatManager(this);
#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
#ifdef DISPLAY_OPENGL
myFeatures += "OpenGL ";

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OSystem.hxx,v 1.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
@ -44,7 +44,7 @@ class CheatManager;
other objects belong.
@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
{
@ -174,6 +174,13 @@ class OSystem
*/
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
@ -430,10 +437,13 @@ class OSystem
string myFeatures;
// The normal GUI font object to use
// The font object to use for the normal in-game GUI
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;
private:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -31,25 +31,26 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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),
myPage(1),
myNumPages(6)
{
// Add Previous, Next and Close buttons
myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton((kButtonWidth + 15), h - 24,
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
"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);
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);
for(int i = 0; i < LINES_PER_PAGE; i++)
{
myDesc[i] = new StaticTextWidget(this, 10, 18 + (10 * i), w - 20,
kFontHeight, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), w - 20,
font.getFontHeight(), "", kTextAlignLeft);
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -37,7 +37,7 @@ class AboutDialog : public Dialog
{
public:
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();
protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -34,60 +34,60 @@
#include "bspf.hxx"
enum {
kAudioRowHeight = 12,
kAudioWidth = 200,
kAudioHeight = 100
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
const GUI::Font& font = instance()->font();
int yoff = 10,
xoff = 30,
woff = _w - 80,
labelWidth = 80;
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight();
int xpos, ypos;
int lwidth = font.getStringWidth("Fragment Size: "),
pwidth = font.getStringWidth("4096");
// Volume
myVolumeSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
"Volume: ", labelWidth, kVolumeChanged);
xpos = (w - lwidth - pwidth - 40) / 2; ypos = 10;
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Volume: ", lwidth, kVolumeChanged);
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
myVolumeLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 24, kLineHeight,
"", kTextAlignLeft);
myVolumeLabel = new StaticTextWidget(this, font,
xpos + myVolumeSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myVolumeLabel->setFlags(WIDGET_CLEARBG);
yoff += kAudioRowHeight + 4;
ypos += lineHeight + 4;
// Fragment size
myFragsizePopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
"Fragment size: ", labelWidth);
myFragsizePopup = new PopUpWidget(this, font, xpos, ypos,
pwidth + myVolumeLabel->getWidth() - 4, lineHeight,
"Fragment size: ", lwidth);
myFragsizePopup->appendEntry("256", 1);
myFragsizePopup->appendEntry("512", 2);
myFragsizePopup->appendEntry("1024", 3);
myFragsizePopup->appendEntry("2048", 4);
myFragsizePopup->appendEntry("4096", 5);
yoff += kAudioRowHeight + 4;
ypos += lineHeight + 4;
// Stereo sound
mySoundTypeCheckbox = new CheckboxWidget(this, font, xoff+28, yoff,
mySoundTypeCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
"Stereo mode", 0);
yoff += kAudioRowHeight + 4;
ypos += lineHeight + 4;
// Enable sound
mySoundEnableCheckbox = new CheckboxWidget(this, font, xoff+28, yoff,
mySoundEnableCheckbox = new CheckboxWidget(this, font, xpos+28, ypos,
"Enable sound", kSoundEnableChanged);
yoff += kAudioRowHeight + 12;
ypos += lineHeight + 12;
// Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -42,7 +42,7 @@ class AudioDialog : public Dialog
{
public:
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();
protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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),
CommandSender(boss),
_fileList(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 ?
_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);
// Add file list
_fileList = new StringListWidget(this, instance()->font(),
10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
ypos += lineHeight;
_fileList = new StringListWidget(this, font, xpos, ypos,
_w - 2 * xpos, _h - bheight - ypos - 15);
_fileList->setNumberingMode(kListNumberingOff);
_fileList->setEditable(false);
_fileList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(_fileList);
// 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
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Choose", kChooseCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0);
xpos = _w - 2 *(bwidth + 10);
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
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
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
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -34,7 +34,8 @@ class StringListWidget;
class BrowserDialog : public Dialog, public CommandSender
{
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; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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,
// possibly meaning that number of rows will change
_rowHeight = MAX(_rowHeight, CheckboxWidget::boxSize());
_rows = h / _rowHeight;
_fontHeight = MAX(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list
CheckboxWidget* t;
@ -42,7 +42,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
t->setTarget(this);
t->setID(i);
t->holdFocus(false);
ypos += _rowHeight;
ypos += _fontHeight;
_checkList.push_back(t);
}
@ -127,8 +127,7 @@ void CheckListWidget::drawWidget(bool hilite)
_checkList[i]->setDirty();
_checkList[i]->draw();
// FIXME - properly account for differing font heights
const int y = _y + 2 + _rowHeight * i + 2;
const int y = _y + 2 + _fontHeight * i + 2;
GUI::Rect r(getEditRect());
@ -136,12 +135,12 @@ void CheckListWidget::drawWidget(bool hilite)
if (_selectedItem == pos)
{
if (_hasFocus && !_editMode)
fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i,
_w - r.left, _rowHeight,
fb.fillRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
_w - r.left, _fontHeight,
kTextColorHi);
else
fb.frameRect(_x + r.left - 3, _y + 1 + _rowHeight * i,
_w - r.left, _rowHeight,
fb.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
_w - r.left, _fontHeight,
kTextColorHi);
}
@ -171,8 +170,8 @@ void CheckListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect CheckListWidget::getEditRect() const
{
GUI::Rect r(2, 1, _w, _rowHeight);
const int yoffset = (_selectedItem - _currentPos) * _rowHeight,
GUI::Rect r(2, 1, _w, _fontHeight);
const int yoffset = (_selectedItem - _currentPos) * _fontHeight,
xoffset = CheckboxWidget::boxSize() + 10;
r.top += yoffset;
r.bottom += yoffset;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -31,7 +31,8 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
: Dialog(osystem, parent, 0, 0, 16, 16),
mySelectedItem(0)
{
int lineHeight = osystem->font().getLineHeight(),
const GUI::Font& font = osystem->font();
int lineHeight = font.getLineHeight(),
buttonWidth = 60,
buttonHeight = lineHeight + 2,
xoffset = 5,
@ -47,88 +48,88 @@ CommandDialog::CommandDialog(OSystem* osystem, DialogContainer* parent)
WidgetArray wid;
ButtonWidget* b;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Select", kSelectCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Reset", kResetCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Color TV", kColorCmd, 0);
b->setEditable(true);
wid.push_back(b);
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->setEditable(true);
wid.push_back(b);
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);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Left Diff B", kLeftDiffBCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Right Diff A", kRightDiffACmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Right Diff B", kRightDiffBCmd, 0);
b->setEditable(true);
wid.push_back(b);
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);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"State Slot", kStateSlotCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Load State", kLoadStateCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Snapshot", kSnapshotCmd, 0);
b->setEditable(true);
wid.push_back(b);
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);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Palette", kPaletteCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Reload ROM", kReloadRomCmd, 0);
b->setEditable(true);
wid.push_back(b);
xoffset += lwidth;
b = new ButtonWidget(this, xoffset, yoffset, buttonWidth, buttonHeight,
b = new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight,
"Exit Game", kExitCmd, 0);
b->setEditable(true);
wid.push_back(b);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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,
int cmd, char hotkey)
ButtonWidget* Dialog::addButton(const GUI::Font& font, int x, int y,
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes.
@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
{
@ -94,7 +94,8 @@ class Dialog : public GuiObject
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; }
int getResult() const { return _result; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -26,9 +26,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditTextWidget::EditTextWidget(GuiObject* boss, int x, int y, int w, int h,
const string& text)
: EditableWidget(boss, x, y - 1, w, h + 2)
EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& text)
: EditableWidget(boss, font, x, y - 1, w, h + 2)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kEditTextWidget;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -30,7 +30,8 @@
class EditTextWidget : public EditableWidget
{
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);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -23,8 +23,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditableWidget::EditableWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_editable(true)
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -38,7 +38,8 @@ enum {
class EditableWidget : public Widget, public CommandSender
{
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 void setEditString(const string& str);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -30,14 +30,15 @@
#include "bspf.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
myActionSelected(-1),
myRemapStatus(false),
myFirstTime(true)
{
const GUI::Font& font = instance()->font();
// FIXME
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
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
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);
myMapButton->setTarget(this);
ypos += 20;
myEraseButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
myEraseButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Erase", kEraseCmd);
myEraseButton->setTarget(this);
ypos += 20;
myCancelMapButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
myCancelMapButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Cancel", kStopMapCmd);
myCancelMapButton->setTarget(this);
myCancelMapButton->clearFlags(WIDGET_ENABLED);
ypos += 30;
myDefaultsButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
myDefaultsButton = new ButtonWidget(boss, font, xpos, ypos, 50, 16,
"Defaults", kDefaultsCmd);
myDefaultsButton->setTarget(this);
// Show message for currently selected event
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);
myKeyMapping->setFlags(WIDGET_CLEARBG);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,8 @@ class EventMappingWidget : public Widget, public CommandSender
friend class InputDialog;
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();
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -31,23 +31,22 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GameInfoDialog::GameInfoDialog(
OSystem* osystem, DialogContainer* parent, GuiObject* boss,
int x, int y, int w, int h)
OSystem* osystem, DialogContainer* parent, const GUI::Font& font,
GuiObject* boss, int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h),
CommandSender(boss)
{
const GUI::Font& font = instance()->font();
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
const int vBorder = 4;
int xpos, ypos, lwidth, fwidth, tabID;
int xpos, ypos, lwidth, fwidth, pwidth, tabID;
unsigned int i;
WidgetArray wid;
// The tab widget
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
wid.clear();
@ -56,62 +55,63 @@ GameInfoDialog::GameInfoDialog(
xpos = 10;
lwidth = font.getStringWidth("Manufacturer: ");
fwidth = _w - xpos - lwidth - 10;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"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);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"MD5:", kTextAlignLeft);
myMD5 = new StaticTextWidget(myTab, xpos+lwidth, ypos,
myMD5 = new StaticTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight,
"", kTextAlignLeft);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Manufacturer:", kTextAlignLeft);
myManufacturer = new EditTextWidget(myTab, xpos+lwidth, ypos,
myManufacturer = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, "");
wid.push_back(myManufacturer);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Model:", kTextAlignLeft);
myModelNo = new EditTextWidget(myTab, xpos+lwidth, ypos,
myModelNo = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, "");
wid.push_back(myModelNo);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Rarity:", kTextAlignLeft);
myRarity = new EditTextWidget(myTab, xpos+lwidth, ypos,
myRarity = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, "");
wid.push_back(myRarity);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Note:", kTextAlignLeft);
myNote = new EditTextWidget(myTab, xpos+lwidth, ypos,
myNote = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
fwidth, fontHeight, "");
wid.push_back(myNote);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Sound:", kTextAlignLeft);
mySound = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("Stereo") + 15, lineHeight,
"", 0, 0);
pwidth = font.getStringWidth("Stereo");
mySound = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
mySound->appendEntry("Mono", 1);
mySound->appendEntry("Stereo", 2);
wid.push_back(mySound);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Type:", kTextAlignLeft);
myType = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("CV (Commavid extra ram)") + 15,
lineHeight, "", 0, 0);
pwidth = font.getStringWidth("CV (Commavid extra ram)");
myType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
for(i = 0; i < 21; ++i)
myType->appendEntry(ourCartridgeList[i].name, i+1);
wid.push_back(myType);
@ -126,41 +126,38 @@ GameInfoDialog::GameInfoDialog(
xpos = 10; ypos = vBorder;
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);
myLeftDiff = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth(" ") + 15, lineHeight,
"", 0, 0);
myLeftDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myLeftDiff->appendEntry("B", 1);
myLeftDiff->appendEntry("A", 2);
wid.push_back(myLeftDiff);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Right Difficulty:", kTextAlignLeft);
myRightDiff = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth(" ") + 15, lineHeight,
"", 0, 0);
myRightDiff = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myRightDiff->appendEntry("B", 1);
myRightDiff->appendEntry("A", 2);
wid.push_back(myRightDiff);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"TV Type:", kTextAlignLeft);
myTVType = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("B & W") + 15, lineHeight,
"", 0, 0);
myTVType = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myTVType->appendEntry("Color", 1);
myTVType->appendEntry("B & W", 2);
wid.push_back(myTVType);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Swap ports:", kTextAlignLeft);
mySwapPorts = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight,
"", 0, 0);
mySwapPorts = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
mySwapPorts->appendEntry("Yes", 1);
mySwapPorts->appendEntry("No", 2);
wid.push_back(mySwapPorts);
@ -175,22 +172,20 @@ GameInfoDialog::GameInfoDialog(
xpos = 10; ypos = vBorder;
lwidth = font.getStringWidth("Right Controller: ");
fwidth = font.getStringWidth("Booster-Grip");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
pwidth = font.getStringWidth("Booster-Grip");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Left Controller:", kTextAlignLeft);
myLeftController = new PopUpWidget(myTab, xpos+lwidth, ypos,
fwidth + 15, lineHeight,
"", 0, 0);
myLeftController = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
for(i = 0; i < 5; ++i)
myLeftController->appendEntry(ourControllerList[i].name, i+1);
wid.push_back(myLeftController);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Right Controller:", kTextAlignLeft);
myRightController = new PopUpWidget(myTab, xpos+lwidth, ypos,
fwidth + 15, lineHeight,
"", 0, 0);
myRightController = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
for(i = 0; i < 5; ++i)
myRightController->appendEntry(ourControllerList[i].name, i+1);
wid.push_back(myRightController);
@ -204,60 +199,59 @@ GameInfoDialog::GameInfoDialog(
tabID = myTab->addTab("Display");
xpos = 10; ypos = vBorder;
lwidth = font.getStringWidth("Use HMBlanks: ");
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
lwidth = font.getStringWidth("Use Phosphor: ");
pwidth = font.getStringWidth("NTSC");
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Format:", kTextAlignLeft);
myFormat = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("NTSC") + 15, lineHeight,
"", 0, 0);
myFormat = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myFormat->appendEntry("NTSC", 1);
myFormat->appendEntry("PAL", 2);
wid.push_back(myFormat);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"XStart:", kTextAlignLeft);
myXStart = new EditTextWidget(myTab, xpos+lwidth, ypos,
myXStart = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, "");
wid.push_back(myXStart);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Width:", kTextAlignLeft);
myWidth = new EditTextWidget(myTab, xpos+lwidth, ypos,
myWidth = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, "");
wid.push_back(myWidth);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"YStart:", kTextAlignLeft);
myYStart = new EditTextWidget(myTab, xpos+lwidth, ypos,
myYStart = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, "");
wid.push_back(myYStart);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Height:", kTextAlignLeft);
myHeight = new EditTextWidget(myTab, xpos+lwidth, ypos,
myHeight = new EditTextWidget(myTab, font, xpos+lwidth, ypos,
25, fontHeight, "");
wid.push_back(myHeight);
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);
myPhosphor = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight,
"", 0, 0);
myPhosphor = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myPhosphor->appendEntry("Yes", 1);
myPhosphor->appendEntry("No", 2);
wid.push_back(myPhosphor);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Use HMBlanks:", kTextAlignLeft);
myHmoveBlanks = new PopUpWidget(myTab, xpos+lwidth, ypos,
font.getStringWidth("Yes") + 15, lineHeight,
"", 0, 0);
myHmoveBlanks = new PopUpWidget(myTab, font, xpos+lwidth, ypos,
pwidth, lineHeight, "", 0, 0);
myHmoveBlanks->appendEntry("Yes", 1);
myHmoveBlanks->appendEntry("No", 2);
wid.push_back(myHmoveBlanks);
@ -270,16 +264,16 @@ GameInfoDialog::GameInfoDialog(
myTab->setActiveTab(0);
// 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);
// Add Defaults, OK and Cancel buttons
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -43,7 +43,8 @@ struct PropType {
class GameInfoDialog : public Dialog, public CommandSender
{
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);
~GameInfoDialog();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,7 +28,6 @@ class Widget;
#include "Command.hxx"
#include "OSystem.hxx"
#include "Array.hxx"
#include "Font.hxx"
typedef Common::Array<Widget*> WidgetArray;
@ -47,7 +46,7 @@ enum {
This is the base class for all GUI objects/widgets.
@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
{
@ -63,7 +62,6 @@ class GuiObject : public CommandReceiver
_w(w),
_h(h),
_dirty(false),
_font((GUI::Font*)&(osystem->font())),
_firstWidget(0) {}
virtual ~GuiObject() {}
@ -84,9 +82,6 @@ class GuiObject : public CommandReceiver
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 void draw() = 0;
@ -110,8 +105,6 @@ class GuiObject : public CommandReceiver
int _w, _h;
bool _dirty;
GUI::Font* _font;
Widget* _firstWidget;
WidgetArray _focusList;
};

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -29,12 +29,9 @@
Probably not very neat, but at least it works ...
@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
// 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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -29,25 +29,26 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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),
myPage(1),
myNumPages(4)
{
// Add Previous, Next and Close buttons
myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton((kButtonWidth + 15), h - 24,
myPrevButton = addButton(font, 10, h - 24, "Previous", kPrevCmd, 'P');
myNextButton = addButton(font, (kButtonWidth + 15), h - 24,
"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);
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++)
{
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, kFontHeight,
"", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, kFontHeight,
"", kTextAlignLeft);
myKey[i] = new StaticTextWidget(this, font, 10, 18 + (10 * i), 80,
font.getFontHeight(), "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, font, 90, 18 + (10 * i), 160,
font.getFontHeight(), "", kTextAlignLeft);
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,7 @@ class HelpDialog : public Dialog
{
public:
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();
protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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"
@ -36,7 +36,7 @@ enum {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
const int vBorder = 4;
@ -44,19 +44,19 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// The tab widget
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);
// 1) Event mapper
tabID = myTab->addTab("Event Mapping");
myEventMapper = new EventMappingWidget(myTab, 2, 2,
myEventMapper = new EventMappingWidget(myTab, font, 2, 2,
myTab->getWidth(),
myTab->getHeight() - ypos);
myTab->setParentWidget(tabID, myEventMapper);
addToFocusList(myEventMapper->getFocusList(), tabID);
// 2) Virtual device support
addVDeviceTab();
addVDeviceTab(font);
// Finalize the tabs, and activate the first tab
myTab->activateTabs();
@ -64,11 +64,11 @@ InputDialog::InputDialog(OSystem* osystem, DialogContainer* parent,
// Add OK and Cancel buttons
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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 fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
const int lineHeight = font.getLineHeight();
int xpos, ypos, lwidth, pwidth, tabID;
WidgetArray wid;
int xpos, ypos, lwidth, fwidth, tabID;
// Virtual device/ports
tabID = myTab->addTab("Virtual Devices");
@ -93,20 +90,17 @@ void InputDialog::addVDeviceTab()
// Stelladaptor mappings
xpos = 5; ypos = 5;
lwidth = font.getStringWidth("Stelladaptor 2 is: ");
fwidth = _w - xpos - lwidth - 10;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
"Stelladaptor 1 is:", kTextAlignLeft);
myLeftPort = new PopUpWidget(myTab, xpos+lwidth, ypos,
fwidth, lineHeight, "", 0, 0);
pwidth = font.getStringWidth("right virtual port");
myLeftPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Stelladaptor 1 is: ", lwidth);
myLeftPort->appendEntry("left virtual port", 1);
myLeftPort->appendEntry("right virtual port", 2);
wid.push_back(myLeftPort);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
"Stelladaptor 2 is:", kTextAlignLeft);
myRightPort = new PopUpWidget(myTab, xpos+lwidth, ypos,
fwidth, lineHeight, "", 0, 0);
myRightPort = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Stelladaptor 2 is: ", lwidth);
myRightPort->appendEntry("left virtual port", 1);
myRightPort->appendEntry("right virtual port", 2);
wid.push_back(myRightPort);
@ -114,60 +108,60 @@ void InputDialog::addVDeviceTab()
// Add 'mouse to paddle' mapping
ypos += 2*lineHeight;
lwidth = font.getStringWidth("Mouse is paddle: ");
myPaddleMode = new SliderWidget(myTab, xpos, ypos, lwidth + 30, lineHeight,
"Mouse is paddle: ",
lwidth, kPaddleChanged);
pwidth = font.getMaxCharWidth() * 5;
myPaddleMode = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
"Mouse is paddle: ", lwidth, kPaddleChanged);
myPaddleMode->setMinValue(0); myPaddleMode->setMaxValue(3);
xpos += myPaddleMode->getWidth() + 5;
myPaddleModeLabel = new StaticTextWidget(myTab, xpos, ypos+1, 24, lineHeight,
myPaddleModeLabel = new StaticTextWidget(myTab, font, xpos, ypos+1, 24, lineHeight,
"", kTextAlignLeft);
myPaddleModeLabel->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleMode);
// Add paddle 0 speed
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: ",
lwidth, kP0SpeedID);
myPaddleSpeed[0]->setMinValue(1); myPaddleSpeed[0]->setMaxValue(100);
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);
myPaddleLabel[0]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[0]);
// Add paddle 1 speed
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: ",
lwidth, kP1SpeedID);
myPaddleSpeed[1]->setMinValue(1); myPaddleSpeed[1]->setMaxValue(100);
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);
myPaddleLabel[1]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[1]);
// Add paddle 2 speed
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: ",
lwidth, kP2SpeedID);
myPaddleSpeed[2]->setMinValue(1); myPaddleSpeed[2]->setMaxValue(100);
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);
myPaddleLabel[2]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[2]);
// Add paddle 3 speed
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: ",
lwidth, kP3SpeedID);
myPaddleSpeed[3]->setMinValue(1); myPaddleSpeed[3]->setMaxValue(100);
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);
myPaddleLabel[3]->setFlags(WIDGET_CLEARBG);
wid.push_back(myPaddleSpeed[3]);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
@ -35,7 +35,7 @@ class InputDialog : public Dialog
{
public:
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();
protected:
@ -49,7 +49,7 @@ class InputDialog : public Dialog
void saveConfig();
private:
void addVDeviceTab();
void addVDeviceTab(const GUI::Font& font);
private:
TabWidget* myTab;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// 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)
{
xpos = 10;
StaticTextWidget* t =
new StaticTextWidget(this, xpos, ypos,
new StaticTextWidget(this, font, xpos, ypos,
lwidth, fontHeight,
labels[i], kTextAlignLeft);
t->setFont(font);
xpos += lwidth + fontWidth;
EditTextWidget* w = new EditTextWidget(this, xpos, ypos,
EditTextWidget* w = new EditTextWidget(this, font, xpos, ypos,
_w - xpos - 10, lineHeight, "");
w->setFont(font);
wid.push_back(w);
myInput.push_back(w);
@ -84,16 +81,16 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
addToFocusList(wid);
xpos = 10;
myTitle = new StaticTextWidget(this, xpos, ypos, _w - 2*xpos, fontHeight,
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 2*xpos, fontHeight,
"", kTextAlignCenter);
myTitle->setColor(kTextColorEm);
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0);
addButton(font, _w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0);
#else
addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0);
#endif
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
@ -26,13 +26,15 @@ class OSystem;
enum {
kLauncherWidth = 320,
kLauncherHeight = 240
// kLauncherWidth = 639,
// kLauncherHeight = 479
};
/**
The base dialog for the ROM launcher in Stella.
@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
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -39,9 +39,6 @@
#include "bspf.hxx"
/////////////////////////////////////////
// TODO - make this dialog font sensitive
/////////////////////////////////////////
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
@ -56,80 +53,98 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myProgressBar(NULL),
mySelectedItem(0)
{
const GUI::Font& font = instance()->font();
const GUI::Font& font = instance()->launcherFont();
// 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;
// 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);
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);
// 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
// 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
// won't actually be able to lose focus
myList = new StringListWidget(this, instance()->font(),
10, 24, _w - 20, _h - 24 - 26 - 10 - 10);
xpos = 10; ypos += fontHeight + 5;
myList = new StringListWidget(this, font, xpos, ypos,
_w - 20, _h - 28 - bheight - 2*fontHeight);
myList->setNumberingMode(kListNumberingOff);
myList->setEditable(false);
myList->setFlags(WIDGET_STICKY_FOCUS);
// Add note textwidget to show any notes for the currently selected ROM
new StaticTextWidget(this, 20, _h - 43, 30, fontHeight, "Note:", kTextAlignLeft);
myNote = new StaticTextWidget(this, 50, _h - 43, w - 70, fontHeight,
xpos += 5; ypos += myList->getHeight() + 4;
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);
// 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
// and snapshot paths
myOptions = new LauncherOptionsDialog(osystem, parent, this,
myOptions = new LauncherOptionsDialog(osystem, parent, font, this,
20, 60, _w - 40, _h - 120);
// 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
// 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 ...");
progress.setRange(0, files.size() - 1, 10);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -30,31 +30,33 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
: Dialog(osystem, parent, x, y, w, h),
CommandSender(boss),
myBrowser(NULL)
{
const GUI::Font& font = instance()->font();
const int vBorder = 4;
int xpos, ypos;
int xpos, ypos, bwidth, bheight;
bwidth = font.getStringWidth("Cancel") + 20;
bheight = font.getLineHeight() + 4;
// The tab widget
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
myTab->addTab("ROM Settings");
// ROM path
xpos = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
xpos = 15; ypos += 5;
new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
kChooseRomDirCmd, 0);
xpos += kButtonWidth + 30;
myRomPath = new StaticTextWidget(myTab, xpos, ypos + 3,
_w - xpos - 10, kLineHeight,
xpos += bwidth + 20;
myRomPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// 2) The snapshot settings tab
@ -62,22 +64,25 @@ LauncherOptionsDialog::LauncherOptionsDialog(
// Snapshot path
xpos = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path",
kChooseSnapDirCmd, 0);
xpos += kButtonWidth + 30;
mySnapPath = new StaticTextWidget(myTab, xpos, ypos + 3,
_w - xpos - 10, kLineHeight,
xpos += bwidth + 20;
mySnapPath = new StaticTextWidget(myTab, font, xpos, ypos + 3,
_w - xpos - 10, font.getLineHeight(),
"", kTextAlignLeft);
// Snapshot save name
xpos = 10; ypos += 22;
mySnapTypePopup = new PopUpWidget(myTab, xpos, ypos, 140, kLineHeight,
"Save snapshot as: ", 87, 0);
xpos = 10; ypos += mySnapPath->getHeight() + 8;
mySnapTypePopup = new PopUpWidget(myTab, font, xpos, ypos,
font.getStringWidth("romname"),
font.getLineHeight(),
"Save snapshot as: ",
font.getStringWidth("Save snapshot as: "), 0);
mySnapTypePopup->appendEntry("romname", 1);
mySnapTypePopup->appendEntry("md5sum", 2);
// Snapshot single or multiple saves
xpos = 30; ypos += 18;
xpos = 30; ypos += mySnapTypePopup->getHeight() + 8;
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Multiple snapshots");
@ -86,17 +91,25 @@ LauncherOptionsDialog::LauncherOptionsDialog(
// Add OK & Cancel buttons
#ifndef MAC_OSX
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
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
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
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
// Create file browser dialog
int baseW = instance()->frameBuffer().baseWidth();
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -38,7 +38,7 @@ class LauncherOptionsDialog : public Dialog, public CommandSender
{
public:
LauncherOptionsDialog(OSystem* osystem, DialogContainer* parent,
GuiObject* boss,
const GUI::Font& font, GuiObject* boss,
int x, int y, int w, int h);
~LauncherOptionsDialog();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -33,7 +33,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: EditableWidget(boss, x, y, 16, 16),
: EditableWidget(boss, font, x, y, 16, 16),
_rows(0),
_cols(0),
_currentPos(0),
@ -47,19 +47,15 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kListWidget;
setFont(font);
_colWidth = font.getMaxCharWidth();
_rowHeight = font.getLineHeight();
_cols = w / _colWidth;
_rows = h / _rowHeight;
_cols = w / _fontWidth;
_rows = h / _fontHeight;
// Set real dimensions
_w = w - kScrollBarWidth;
_h = h + 2;
// 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);
}
@ -200,7 +196,7 @@ void ListWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -95,8 +95,6 @@ class ListWidget : public EditableWidget
protected:
int _rows;
int _cols;
int _rowHeight;
int _colWidth;
int _currentPos;
int _selectedItem;
int _highlightedItem;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: OptionsDialog.cxx,v 1.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
// Copyright (C) 2002-2004 The ScummVM project
@ -57,7 +57,7 @@ enum {
};
#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)
@ -76,6 +76,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
int yoffset = 7;
const int xoffset = (_w - kBigButtonWidth) / 2;
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
ButtonWidget* b = NULL;
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
w = 230; h = 130;
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;
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;
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;
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
w = 230; h = 150;
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
w = 255; h = 150;
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;
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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -53,8 +53,8 @@ PopUpDialog::PopUpDialog(PopUpWidget* boss, int clickX, int clickY)
// Calculate real popup dimensions
_x = _popUpBoss->getAbsX() + _popUpBoss->_labelWidth;
_y = _popUpBoss->getAbsY() - _popUpBoss->_selectedItem * kLineHeight;
_w = _popUpBoss->_w - kLineHeight + 2 - _popUpBoss->_labelWidth;
_y = _popUpBoss->getAbsY() - _popUpBoss->_selectedItem * _popUpBoss->_fontHeight;
_w = _popUpBoss->_w - _popUpBoss->_labelWidth - 10;
_h = 2;
}
@ -86,8 +86,8 @@ void PopUpDialog::drawDialog()
// The last entry may be empty. Fill it with black.
if(_twoColumns && (count & 1))
fb.fillRect(_x + 1 + _w / 2, _y + 1 + kLineHeight * (_entriesPerColumn - 1),
_w / 2 - 1, kLineHeight, kBGColor);
fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1),
_w / 2 - 1, _popUpBoss->_fontHeight, kBGColor);
_dirty = false;
fb.addDirtyRect(_x, _y, _w, _h);
@ -178,12 +178,12 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
if (entry >= n)
{
x = _x + 1 + _w / 2;
y = _y + 1 + kLineHeight * (entry - n);
y = _y + 1 + _popUpBoss->_fontHeight * (entry - n);
}
else
{
x = _x + 1;
y = _y + 1 + kLineHeight * entry;
y = _y + 1 + _popUpBoss->_fontHeight * entry;
}
w = _w / 2 - 1;
@ -191,18 +191,18 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
else
{
x = _x + 1;
y = _y + 1 + kLineHeight * entry;
y = _y + 1 + _popUpBoss->_fontHeight * entry;
w = _w - 2;
}
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)
{
// Draw a separator
fb.hLine(x - 1, y + kLineHeight / 2, x + w, kShadowColor);
fb.hLine(x, y + 1 + kLineHeight / 2, x + w, kColor);
fb.hLine(x - 1, y + _popUpBoss->_fontHeight / 2, x + w, kShadowColor);
fb.hLine(x, y + 1 + _popUpBoss->_fontHeight / 2, x + w, kColor);
}
else
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
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
// in two columns if it's too tall.
@ -229,13 +229,13 @@ void PopUpDialog::recalc()
if(_popUpBoss->_entries.size() & 1)
_entriesPerColumn++;
_h = _entriesPerColumn * kLineHeight + 2;
_h = _entriesPerColumn * _popUpBoss->_fontHeight + 2;
_w = 0;
// Find width of largest item
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)
_w = width;
@ -249,7 +249,8 @@ void PopUpDialog::recalc()
if(_popUpBoss->_selectedItem >= _entriesPerColumn)
{
_x -= _w / 2;
_y = _popUpBoss->getAbsY() - (_popUpBoss->_selectedItem - _entriesPerColumn) * kLineHeight;
_y = _popUpBoss->getAbsY() - (_popUpBoss->_selectedItem - _entriesPerColumn) *
_popUpBoss->_fontHeight;
}
if(_w >= width)
@ -279,7 +280,7 @@ int PopUpDialog::findItem(int x, int y) const
{
if(_twoColumns)
{
unsigned int entry = (y - 2) / kLineHeight;
unsigned int entry = (y - 2) / _popUpBoss->_fontHeight;
if(x > _w / 2)
{
entry += _entriesPerColumn;
@ -289,7 +290,7 @@ int PopUpDialog::findItem(int x, int y) const
}
return entry;
}
return (y - 2) / kLineHeight;
return (y - 2) / _popUpBoss->_fontHeight;
}
return -1;
@ -379,9 +380,10 @@ void PopUpDialog::moveDown()
// 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)
: Widget(boss, x, y - 1, w, h + 2),
: Widget(boss, font, x, y - 1, w, h + 2),
CommandSender(boss),
_label(label),
_labelWidth(labelWidth),
@ -396,6 +398,12 @@ PopUpWidget::PopUpWidget(GuiObject* boss, int x, int y, int w, int h,
if(!_label.empty() && _labelWidth == 0)
_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());
}
@ -476,7 +484,7 @@ void PopUpWidget::drawWidget(bool hilite)
// Draw the label, if any
if (_labelWidth > 0)
fb.drawString(_font, _label, _x, _y + 3, _labelWidth,
fb.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? kTextColor : kColor, kTextAlignRight);
// 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);
// 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);
// Draw the selected entry, if any
@ -494,7 +502,7 @@ void PopUpWidget::drawWidget(bool hilite)
{
TextAlignment align = (_font->getStringWidth(_entries[_selectedItem].name) > w-6) ?
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);
}
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -59,7 +59,8 @@ class PopUpWidget : public Widget, public CommandSender
int _labelWidth;
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);
~PopUpWidget();
@ -86,6 +87,8 @@ class PopUpWidget : public Widget, public CommandSender
private:
PopUpDialog* myPopUpDialog;
int myArrowsY;
int myTextY;
};
//

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -51,12 +51,12 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
_y = (boss->getHeight() - _h) / 2;
xpos = fontWidth; ypos = lineHeight;
myMessage = new StaticTextWidget(this, xpos, ypos, lwidth, fontHeight,
myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
message, kTextAlignCenter);
myMessage->setColor(kTextColorEm);
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->setMaxValue(200);
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
// 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
// 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)
: Widget(boss, x, y, w, h), CommandSender(boss)
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
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;
_type = kScrollBarWidget;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,8 @@ class ScrollBarWidget : public Widget, public CommandSender
} Part;
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 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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -63,15 +63,15 @@ void StringListWidget::drawWidget(bool hilite)
{
const OverlayColor textColor = (_selectedItem == pos && _editMode)
? 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.
if (_selectedItem == pos)
{
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
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
@ -110,8 +110,8 @@ void StringListWidget::drawWidget(bool hilite)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect StringListWidget::getEditRect() const
{
GUI::Rect r(2, 1, _w - 2 , kLineHeight);
const int offset = (_selectedItem - _currentPos) * kLineHeight;
GUI::Rect r(2, 1, _w - 2 , _fontHeight);
const int offset = (_selectedItem - _currentPos) * _fontHeight;
r.top += offset;
r.bottom += offset;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,15 +28,10 @@
#include "Dialog.hxx"
#include "TabWidget.hxx"
enum {
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TabWidget::TabWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
TabWidget::TabWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_tabWidth(40),
_activeTab(-1),
@ -44,6 +39,8 @@ TabWidget::TabWidget(GuiObject* boss, int x, int y, int w, int h)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
_type = kTabWidget;
_tabHeight = font.getLineHeight() + 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -61,7 +58,7 @@ TabWidget::~TabWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
assert(y < kTabHeight);
assert(y < _tabHeight);
// Determine which tab was clicked
int tabID = -1;
@ -251,8 +248,8 @@ void TabWidget::drawWidget(bool hilite)
const int right2 = _x + _w - 2;
// Draw horizontal line
fb.hLine(left1, _y + kTabHeight - 2, right1, kShadowColor);
fb.hLine(left2, _y + kTabHeight - 2, right2, kShadowColor);
fb.hLine(left1, _y + _tabHeight - 2, right1, kShadowColor);
fb.hLine(left2, _y + _tabHeight - 2, right2, kShadowColor);
// Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset;
@ -260,26 +257,26 @@ void TabWidget::drawWidget(bool hilite)
{
OverlayColor color = (i == _activeTab) ? kColor : kShadowColor;
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,
_y + yOffset / 2 + (kTabHeight - kLineHeight - 1),
_y + yOffset / 2 + (_tabHeight - _fontHeight - 1),
_tabWidth - 2 * kTabPadding, kTextColor, kTextAlignCenter);
x += _tabWidth + kTabSpacing;
}
// Draw a frame around the widget area (belows the tabs)
fb.hLine(left1, _y + kTabHeight - 1, right1, kColor);
fb.hLine(left2, _y + kTabHeight - 1, right2, kColor);
fb.hLine(left1, _y + _tabHeight - 1, right1, 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 - 1, _x + _w - 2, kColor);
fb.vLine(_x + _w - 2, _y + kTabHeight - 1, _y + _h - 2, kColor);
fb.vLine(_x + _w - 1, _y + kTabHeight - 1, _y + _h - 2, kShadowColor);
fb.vLine(_x + _w - 2, _y + _tabHeight - 1, _y + _h - 2, kColor);
fb.vLine(_x + _w - 1, _y + _tabHeight - 1, _y + _h - 2, kShadowColor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget *TabWidget::findWidget(int x, int y)
{
if (y < kTabHeight)
if (y < _tabHeight)
{
// Click was in the tab area
return this;
@ -287,6 +284,6 @@ Widget *TabWidget::findWidget(int x, int y)
else
{
// 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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,10 +28,6 @@
#include "Array.hxx"
#include "bspf.hxx"
enum {
kTabHeight = 16
};
class TabWidget : public Widget, public CommandSender
{
struct Tab {
@ -42,7 +38,7 @@ class TabWidget : public Widget, public CommandSender
typedef Common::Array<Tab> TabList;
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();
virtual int getChildY() const;
@ -64,6 +60,9 @@ class TabWidget : public Widget, public CommandSender
// will be added to the active tab.
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 handleCommand(CommandSender* sender, int cmd, int data, int id);
@ -76,9 +75,16 @@ class TabWidget : public Widget, public CommandSender
protected:
TabList _tabs;
int _tabWidth;
int _tabHeight;
int _activeTab;
bool _firstTime;
enum {
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
};
private:
void box(int x, int y, int width, int height,
OverlayColor colorA, OverlayColor colorB, bool omitBottom);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -33,34 +33,29 @@
#include "bspf.hxx"
enum {
kVideoRowHeight = 12,
kVideoWidth = 200,
kVideoHeight = 100
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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)
{
const GUI::Font& font = instance()->font();
int yoff = 10,
xoff = 5,
woff = 110,
labelWidth = 55;
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight();
int xpos, ypos;
int lwidth = font.getStringWidth("Dirty Rects: "),
pwidth = font.getStringWidth("Software");
// Use dirty rectangle updates
myDirtyPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
"Dirty Rects: ", labelWidth);
xpos = 5; ypos = 10;
myDirtyPopup = new PopUpWidget(this, font, xpos, ypos,
pwidth, lineHeight, "Dirty Rects: ", lwidth);
myDirtyPopup->appendEntry("Yes", 1);
myDirtyPopup->appendEntry("No", 2);
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// Video renderer
myRendererPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
"Renderer: ", labelWidth, kRendererChanged);
myRendererPopup = new PopUpWidget(this, font, xpos, ypos,
pwidth, lineHeight, "Renderer: ", lwidth,
kRendererChanged);
myRendererPopup->appendEntry("Software", 1);
#ifdef PSP
myRendererPopup->appendEntry("Hardware", 2);
@ -68,69 +63,75 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
#ifdef DISPLAY_OPENGL
myRendererPopup->appendEntry("OpenGL", 3);
#endif
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// Video filter
myFilterPopup = new PopUpWidget(this, xoff, yoff, woff, kLineHeight,
"GL Filter: ", labelWidth);
myFilterPopup = new PopUpWidget(this, font, xpos, ypos,
pwidth, lineHeight, "GL Filter: ", lwidth);
myFilterPopup->appendEntry("Linear", 1);
myFilterPopup->appendEntry("Nearest", 2);
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// Aspect ratio
myAspectRatioSlider = new SliderWidget(this, xoff, yoff, woff - 14, kLineHeight,
"GL Aspect: ", labelWidth, kAspectRatioChanged);
myAspectRatioSlider = new SliderWidget(this, font, xpos, ypos, pwidth, lineHeight,
"GL Aspect: ", lwidth, kAspectRatioChanged);
myAspectRatioSlider->setMinValue(1); myAspectRatioSlider->setMaxValue(100);
myAspectRatioLabel = new StaticTextWidget(this, xoff + woff - 11, yoff, 15, kLineHeight,
"", kTextAlignLeft);
myAspectRatioLabel = new StaticTextWidget(this, font,
xpos + myAspectRatioSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myAspectRatioLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// 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("Original", 2);
myPalettePopup->appendEntry("Z26", 3);
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// Move over to the next column
yoff = 10;
xoff = xoff + 115;
xpos += 115; ypos = 10;
// Framerate
myFrameRateSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight,
"Framerate: ", labelWidth, kFrameRateChanged);
myFrameRateSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Framerate: ", lwidth, kFrameRateChanged);
myFrameRateSlider->setMinValue(1); myFrameRateSlider->setMaxValue(300);
myFrameRateLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myFrameRateLabel = new StaticTextWidget(this, font,
xpos + myFrameRateSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
myFrameRateLabel->setFlags(WIDGET_CLEARBG);
yoff += kVideoRowHeight + 4;
ypos += lineHeight + 4;
// Zoom level
myZoomSlider = new SliderWidget(this, xoff, yoff, woff - 25, kLineHeight,
"Zoom: ", labelWidth, kZoomChanged);
myZoomSlider = new SliderWidget(this, font, xpos, ypos, 30, lineHeight,
"Zoom: ", lwidth, kZoomChanged);
myZoomSlider->setMinValue(0); myZoomSlider->setMaxValue(50);
myZoomLabel = new StaticTextWidget(this, xoff + woff - 22, yoff, 20, kLineHeight,
"", kTextAlignLeft);
myZoomLabel = new StaticTextWidget(this, font,
xpos + myZoomSlider->getWidth() + 4,
ypos + 1,
15, fontHeight, "", kTextAlignLeft);
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");
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");
yoff += kVideoRowHeight + 20;
ypos += lineHeight + 20;
// Add Defaults, OK and Cancel buttons
addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0);
addButton(font, 10, _h - 24, "Defaults", kDefaultsCmd, 0);
#ifndef MAC_OSX
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#else
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -44,7 +44,7 @@ class VideoDialog : public Dialog
{
public:
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();
protected:

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Widget.cxx,v 1.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
// Copyright (C) 2002-2004 The ScummVM project
@ -32,10 +32,12 @@
#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),
_type(0),
_boss(boss),
_font((GUI::Font*)&font),
_id(-1),
_flags(0),
_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
_next = _boss->_firstWidget;
_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)
: Widget(boss, x, y, w, h),
: Widget(boss, font, x, y, w, h),
_align(align)
{
_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)
: StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter),
: StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
CommandSender(boss),
_cmd(cmd),
_editable(false),
@ -411,7 +418,7 @@ void ButtonWidget::setEditable(bool editable)
void ButtonWidget::drawWidget(bool hilite)
{
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);
}
@ -433,23 +440,32 @@ static unsigned int checked_img[8] =
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
int x, int y, const string& label,
int cmd)
: ButtonWidget(boss, x, y, 16, 16, label, cmd, 0),
: ButtonWidget(boss, font, x, y, 16, 16, label, cmd, 0),
_state(false),
_editable(true),
_holdFocus(true),
_fillRect(false),
_drawBox(true),
_fillColor(kColor)
_fillColor(kColor),
_boxY(0),
_textY(0)
{
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
_type = kCheckboxWidget;
setFont(font);
if(label == "")
_w = 14;
else
_w = font.getStringWidth(label) + 20;
_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();
// 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
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(_state)
{
if(_fillRect)
fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10,
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10,
isEnabled() ? _color : kColor);
else
fb.drawBitmap(checked_img, _x + 3, _y + box_yoff + 3,
fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3,
isEnabled() ? _color : kColor);
}
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
fb.drawString(_font, _label, _x + 20, _y + text_yoff, _w,
fb.drawString(_font, _label, _x + 20, _y + _textY, _w,
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)
: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey),
: ButtonWidget(boss, font, x, y, w, h, label, cmd, hotkey),
_value(0),
_oldValue(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;
_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
// 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
// Copyright (C) 2002-2004 The ScummVM project
@ -32,6 +32,7 @@ class Dialog;
#include "GuiUtils.hxx"
#include "Array.hxx"
#include "Rect.hxx"
#include "Font.hxx"
#include "bspf.hxx"
enum {
@ -75,14 +76,14 @@ enum {
This is the base class for all widgets.
@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
{
friend class Dialog;
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 int getAbsX() const { return _x + _boss->getChildX(); }
@ -126,6 +127,7 @@ class Widget : public GuiObject
int getID() { return _id; }
void setColor(OverlayColor color) { _color = color; }
virtual const GUI::Font* font() { return _font; }
virtual void loadConfig() {}
@ -146,11 +148,14 @@ class Widget : public GuiObject
protected:
int _type;
GuiObject* _boss;
GUI::Font* _font;
Widget* _next;
int _id;
int _flags;
bool _hasFocus;
OverlayColor _color;
int _fontWidth;
int _fontHeight;
public:
static Widget* findWidgetInChain(Widget* start, int x, int y);
@ -175,7 +180,7 @@ class Widget : public GuiObject
class StaticTextWidget : public Widget
{
public:
StaticTextWidget(GuiObject* boss,
StaticTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& text, TextAlignment align);
void setValue(int value);
@ -198,7 +203,7 @@ class StaticTextWidget : public Widget
class ButtonWidget : public StaticTextWidget, public CommandSender
{
public:
ButtonWidget(GuiObject* boss,
ButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, int cmd = 0, uInt8 hotkey = 0);
@ -260,6 +265,10 @@ class CheckboxWidget : public ButtonWidget
bool _drawBox;
OverlayColor _fillColor;
private:
int _boxY;
int _textY;
};
@ -267,7 +276,8 @@ class CheckboxWidget : public ButtonWidget
class SliderWidget : public ButtonWidget
{
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);
void setValue(int value);