Some more optimizations for dirty widgets. The progress dialog now

only redraws itself when updating, instead of requiring the dialog
below it to redraw as well.  Related to this, adding a dialog
box on top of another no longer requires a restack and redraw
of other dialog boxes beneath it.

Fixed some dirty update problems with dialog boxes; they weren't
setting dirty rects, hence in some cases weren't being redrawn.

Updated debugger to be 1024x7xx pixels, and partitions the debugger
into separate 'areas'.  The next step is to fill these areas,
starting with moving the CpuWidget and RamWidget onto the main
area (so they're always visible).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@711 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-04 22:59:54 +00:00
parent a18ea23d86
commit 9f58ffb471
11 changed files with 135 additions and 87 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSoft.cxx,v 1.32 2005-08-03 13:26:01 stephena Exp $ // $Id: FrameBufferSoft.cxx,v 1.33 2005-08-04 22:59:38 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
@ -276,6 +276,7 @@ void FrameBufferSoft::postFrameUpdate()
{ {
// Now update all the rectangles at once // Now update all the rectangles at once
SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects()); SDL_UpdateRects(myScreen, myRectList->numRects(), myRectList->rects());
// SDL_UpdateRect(myScreen, 0, 0, 0, 0);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.cxx,v 1.79 2005-07-30 22:08:24 urchlay Exp $ // $Id: Debugger.cxx,v 1.80 2005-08-04 22:59:38 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -893,10 +893,6 @@ void Debugger::setStartState()
{ {
// Lock the bus each time the debugger is entered, so we don't disturb anything // Lock the bus each time the debugger is entered, so we don't disturb anything
mySystem->lockDataBus(); mySystem->lockDataBus();
// FIXME - do we want this to print each time?
// I think it was needed before because of some bugs I've fixed
// myPrompt->printPrompt();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -909,7 +905,7 @@ void Debugger::setQuitState()
// sitting at a breakpoint/trap, this will get us past it. // sitting at a breakpoint/trap, this will get us past it.
// Somehow this feels like a hack to me, but I don't know why // Somehow this feels like a hack to me, but I don't know why
// if(breakPoints->isSet(myCpuDebug->pc())) // if(breakPoints->isSet(myCpuDebug->pc()))
mySystem->m6502().execute(1); mySystem->m6502().execute(1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -936,16 +932,35 @@ GUI::Rect Debugger::getTiaBounds() const
return r; return r;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getRomBounds() const
{
// The ROM area is the full area to the right of the tabs
GUI::Rect dialog = getDialogBounds();
int x1 = dialog.right - myOSystem->consoleFont().getMaxCharWidth() * 60;
int y1 = 0;
int x2 = dialog.right;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getStatusBounds() const GUI::Rect Debugger::getStatusBounds() const
{ {
// The status area is the full area to the right of the TIA image // The status area is the full area to the right of the TIA image
GUI::Rect dialog = getDialogBounds(); // and left of the ROM area
GUI::Rect tia = getTiaBounds(); GUI::Rect tia = getTiaBounds();
GUI::Rect rom = getRomBounds();
int x1 = tia.right + 1;
int y1 = 0;
int x2 = rom.left - 1;
int y2 = tia.bottom;
GUI::Rect r(x1, y1, x2, y2);
GUI::Rect r(tia.width() + 1, 0,
dialog.width(),
tia.height());
return r; return r;
} }
@ -955,10 +970,14 @@ GUI::Rect Debugger::getTabBounds() const
// The tab area is the full area below the TIA image // The tab area is the full area below the TIA image
GUI::Rect dialog = getDialogBounds(); GUI::Rect dialog = getDialogBounds();
GUI::Rect tia = getTiaBounds(); GUI::Rect tia = getTiaBounds();
GUI::Rect rom = getRomBounds();
int x1 = 0;
int y1 = tia.bottom + 1;
int x2 = rom.left - 1;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
GUI::Rect r(0, tia.height() + 1,
dialog.width(),
dialog.height());
return r; return r;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.hxx,v 1.64 2005-08-01 22:33:12 stephena Exp $ // $Id: Debugger.hxx,v 1.65 2005-08-04 22:59:38 stephena Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -46,16 +46,16 @@ typedef ListFile::const_iterator ListIter;
typedef map<string,Expression*> FunctionMap; typedef map<string,Expression*> FunctionMap;
#if 0 #if 1
enum { enum {
kDebuggerWidth = 1023, kDebuggerWidth = 1023,
kDebuggerLineHeight = 12, // based on the height of the console font kDebuggerLineHeight = 15, // based on the height of the console font
kDebuggerLines = 35, kDebuggerLines = 35,
}; };
#else #else
enum { enum {
kDebuggerWidth = 639, kDebuggerWidth = 639,
kDebuggerLineHeight = 12, // based on the height of the console font kDebuggerLineHeight = 15, // based on the height of the console font
kDebuggerLines = 20, kDebuggerLines = 20,
}; };
#endif #endif
@ -82,7 +82,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
for all debugging operations in Stella (parser, 6502 debugger, etc). for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony @author Stephen Anthony
@version $Id: Debugger.hxx,v 1.64 2005-08-01 22:33:12 stephena Exp $ @version $Id: Debugger.hxx,v 1.65 2005-08-04 22:59:38 stephena Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {
@ -286,8 +286,9 @@ class Debugger : public DialogContainer
(takes mediasource into account) (takes mediasource into account)
*/ */
GUI::Rect getDialogBounds() const; GUI::Rect getDialogBounds() const;
GUI::Rect getStatusBounds() const;
GUI::Rect getTiaBounds() const; GUI::Rect getTiaBounds() const;
GUI::Rect getRomBounds() const;
GUI::Rect getStatusBounds() const;
GUI::Rect getTabBounds() const; GUI::Rect getTabBounds() const;
/** /**
@ -359,7 +360,7 @@ class Debugger : public DialogContainer
static Debugger* myStaticDebugger; static Debugger* myStaticDebugger;
FunctionMap functions; FunctionMap functions;
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerDialog.cxx,v 1.29 2005-08-03 13:26:02 stephena Exp $ // $Id: DebuggerDialog.cxx,v 1.30 2005-08-04 22:59:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -51,6 +51,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
addTiaArea(); addTiaArea();
addTabArea(); addTabArea();
addStatusArea(); addStatusArea();
addRomArea();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -61,7 +62,6 @@ DebuggerDialog::~DebuggerDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::loadConfig() void DebuggerDialog::loadConfig()
{ {
cerr << "DebuggerDialog::loadConfig()\n";
myTab->loadConfig(); myTab->loadConfig();
myTiaInfo->loadConfig(); myTiaInfo->loadConfig();
myTiaOutput->loadConfig(); myTiaOutput->loadConfig();
@ -130,31 +130,29 @@ void DebuggerDialog::addTiaArea()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::addTabArea() void DebuggerDialog::addTabArea()
{ {
const int vBorder = 4;
const int vWidth = _w - kButtonWidth - 20;
GUI::Rect r = instance()->debugger().getTabBounds(); 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
// The tab widget // The tab widget
myTab = new TabWidget(this, r.left, r.top + vBorder, vWidth, myTab = new TabWidget(this, r.left, r.top + vBorder,
r.height() - vBorder); r.width(), r.height() - vBorder);
// 1) The Prompt/console tab // 1) The Prompt/console tab
myTab->addTab("Prompt"); myTab->addTab("Prompt");
myPrompt = new PromptWidget(myTab, 2, 2, vWidth - vBorder, myPrompt = new PromptWidget(myTab, 2, 2, widWidth, widHeight);
r.height() - 25);
myTab->setParentWidget(0, myPrompt, myPrompt); myTab->setParentWidget(0, myPrompt, myPrompt);
// 2) The CPU tab // 2) The CPU tab
myTab->addTab("CPU"); myTab->addTab("CPU");
CpuWidget* cpu = new CpuWidget(myTab, 2, 2, vWidth - vBorder, CpuWidget* cpu = new CpuWidget(myTab, 2, 2, widWidth, widHeight);
r.height() - 25);
myTab->setParentWidget(1, cpu, cpu->activeWidget()); myTab->setParentWidget(1, cpu, cpu->activeWidget());
// 3) The RAM tab (part of RIOT) // 3) The RAM tab (part of RIOT)
myTab->addTab("RAM"); myTab->addTab("RAM");
RamWidget* ram = new RamWidget(myTab, 2, 2, vWidth - vBorder, RamWidget* ram = new RamWidget(myTab, 2, 2, widWidth, widHeight);
r.height() - 25);
myTab->setParentWidget(2, ram, ram->activeWidget()); myTab->setParentWidget(2, ram, ram->activeWidget());
// 4) The input/output tab (part of RIOT) // 4) The input/output tab (part of RIOT)
@ -163,8 +161,7 @@ void DebuggerDialog::addTabArea()
// 5) The TIA tab // 5) The TIA tab
myTab->addTab("TIA"); myTab->addTab("TIA");
TiaWidget* tia = new TiaWidget(myTab, 2, 2, vWidth - vBorder, TiaWidget* tia = new TiaWidget(myTab, 2, 2, widWidth, widHeight);
r.height() - 25);
myTab->setParentWidget(4, tia, tia->activeWidget()); myTab->setParentWidget(4, tia, tia->activeWidget());
@ -174,24 +171,11 @@ void DebuggerDialog::addTabArea()
// 7) The Cheat tab // 7) The Cheat tab
myTab->addTab("Cheat"); myTab->addTab("Cheat");
CheatWidget* cheat = new CheatWidget(myTab, 2, 2, CheatWidget* cheat = new CheatWidget(myTab, 2, 2, widWidth, widHeight);
vWidth - vBorder, r.height() - 25);
myTab->setParentWidget(6, cheat, cheat->activeWidget()); myTab->setParentWidget(6, cheat, cheat->activeWidget());
// Set active tab to prompt // Set active tab to prompt
myTab->setActiveTab(0); myTab->setActiveTab(0);
// Add some buttons that are always shown, no matter which tab we're in
int yoff = r.top + vBorder + kTabHeight + 5;
addButton(vWidth + 10, yoff, "Step", kDDStepCmd, 0);
yoff += 22;
addButton(vWidth + 10, yoff, "Trace", kDDTraceCmd, 0);
yoff += 22;
addButton(vWidth + 10, yoff, "Scan +1", kDDSAdvCmd, 0);
yoff += 22;
addButton(vWidth + 10, yoff, "Frame +1", kDDAdvCmd, 0);
addButton(vWidth + 10, r.bottom - 22 - 10, "Exit", kDDExitCmd, 0);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -201,6 +185,26 @@ void DebuggerDialog::addStatusArea()
myTiaInfo = new TiaInfoWidget(this, r.left, r.top, r.width(), r.height()); myTiaInfo = new TiaInfoWidget(this, r.left, r.top, r.width(), r.height());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::addRomArea()
{
GUI::Rect r = instance()->debugger().getRomBounds();
// Add some buttons that are always shown, no matter which tab we're in
// FIXME - these positions will definitely change
int xoff = r.right - 100;
int yoff = r.bottom - 150;
addButton(xoff, yoff, "Step", kDDStepCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Trace", kDDTraceCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Scan +1", kDDSAdvCmd, 0);
yoff += 22;
addButton(xoff, yoff, "Frame +1", kDDAdvCmd, 0);
addButton(xoff, r.bottom - 22 - 10, "Exit", kDDExitCmd, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doStep() void DebuggerDialog::doStep()
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerDialog.hxx,v 1.14 2005-07-21 19:30:16 stephena Exp $ // $Id: DebuggerDialog.hxx,v 1.15 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -58,6 +58,7 @@ class DebuggerDialog : public Dialog
void addTiaArea(); void addTiaArea();
void addTabArea(); void addTabArea();
void addStatusArea(); void addStatusArea();
void addRomArea();
void doStep(); void doStep();
void doTrace(); void doTrace();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Dialog.cxx,v 1.23 2005-08-03 13:26:02 stephena Exp $ // $Id: Dialog.cxx,v 1.24 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -135,6 +135,9 @@ void Dialog::drawDialog()
Widget* w = _firstWidget; Widget* w = _firstWidget;
Widget::setDirtyInChain(w); Widget::setDirtyInChain(w);
// Tell the framebuffer this area is dirty
fb.addDirtyRect(_x, _y, _w, _h);
_dirty = false; _dirty = false;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DialogContainer.cxx,v 1.13 2005-08-01 22:33:15 stephena Exp $ // $Id: DialogContainer.cxx,v 1.14 2005-08-04 22:59:54 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -93,8 +93,8 @@ void DialogContainer::draw(bool fullrefresh)
void DialogContainer::addDialog(Dialog* d) void DialogContainer::addDialog(Dialog* d)
{ {
myDialogStack.push(d); myDialogStack.push(d);
myOSystem->frameBuffer().refreshTIA(); d->open();
myOSystem->frameBuffer().refreshOverlay(); d->setDirty(); // Next update() will take care of drawing
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -103,6 +103,9 @@ void DialogContainer::removeDialog()
if(!myDialogStack.empty()) if(!myDialogStack.empty())
{ {
myDialogStack.pop(); myDialogStack.pop();
// We need to redraw all underlying dialogs, since we don't know
// which ones were obscured
myOSystem->frameBuffer().refreshTIA(); myOSystem->frameBuffer().refreshTIA();
myOSystem->frameBuffer().refreshOverlay(); myOSystem->frameBuffer().refreshOverlay();
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: InputTextDialog.cxx,v 1.1 2005-08-04 16:31:24 stephena Exp $ // $Id: InputTextDialog.cxx,v 1.2 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -46,9 +46,8 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font)
// Calculate real dimensions // Calculate real dimensions
_w = fontWidth * 30; _w = fontWidth * 30;
_h = lineHeight * 6; _h = lineHeight * 6;
// FIXME _x = (boss->getWidth() - _w) / 2;
_x = 100;//(boss->getAbsX() - _w) / 2; _y = (boss->getHeight() - _h) / 2;
_y = 400;//(boss->getAbsY() - _h) / 2;
xpos = 10; ypos = lineHeight; xpos = 10; ypos = lineHeight;
int lwidth = font.getStringWidth("Enter Data:"); int lwidth = font.getStringWidth("Enter Data:");
@ -63,6 +62,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font)
_w - xpos - 10, lineHeight, ""); _w - xpos - 10, lineHeight, "");
_input->setFont(font); _input->setFont(font);
_input->clearFlags(WIDGET_TAB_NAVIGATE); _input->clearFlags(WIDGET_TAB_NAVIGATE);
_input->receivedFocus();
xpos = 10; ypos = 2*lineHeight; xpos = 10; ypos = 2*lineHeight;
_title = new StaticTextWidget(this, xpos, ypos, _w - 2*xpos, fontHeight, _title = new StaticTextWidget(this, xpos, ypos, _w - 2*xpos, fontHeight,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: LauncherDialog.cxx,v 1.25 2005-07-05 15:25:44 stephena Exp $ // $Id: LauncherDialog.cxx,v 1.26 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -52,11 +52,16 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myGameList(NULL), myGameList(NULL),
myProgressBar(NULL) myProgressBar(NULL)
{ {
const GUI::Font& font = instance()->font();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
// Show game name // Show game name
new StaticTextWidget(this, 10, 8, 200, kLineHeight, new StaticTextWidget(this, 10, 8, 200, fontHeight,
"Select a game from the list ...", kTextAlignLeft); "Select a game from the list ...", kTextAlignLeft);
myRomCount = new StaticTextWidget(this, _w - 100, 8, 90, kLineHeight, myRomCount = new StaticTextWidget(this, _w - 100, 8, 90, fontHeight,
"", kTextAlignRight); "", kTextAlignRight);
// Add four buttons at the bottom // Add four buttons at the bottom
@ -93,9 +98,9 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myList->clearFlags(WIDGET_TAB_NAVIGATE); myList->clearFlags(WIDGET_TAB_NAVIGATE);
// Add note textwidget to show any notes for the currently selected ROM // Add note textwidget to show any notes for the currently selected ROM
new StaticTextWidget(this, 20, _h - 43, 30, 16, "Note:", kTextAlignLeft); new StaticTextWidget(this, 20, _h - 43, 30, fontHeight, "Note:", kTextAlignLeft);
myNote = new StaticTextWidget(this, 50, _h - 43, w - 70, 16, myNote = new StaticTextWidget(this, 50, _h - 43, w - 70, fontHeight,
"", kTextAlignLeft); "", kTextAlignLeft);
// Create the launcher options dialog, where you can change ROM // Create the launcher options dialog, where you can change ROM
// and snapshot paths // and snapshot paths
@ -224,13 +229,8 @@ void LauncherDialog::loadListFromDisk()
// Create a progress dialog box to show the progress of processing // Create a progress dialog box to show the progress of processing
// the ROMs, since this is usually a time-consuming operation // the ROMs, since this is usually a time-consuming operation
string message = "Loading ROM's from disk ..."; ProgressDialog progress(this, instance()->font(),
int w = instance()->font().getStringWidth(message) + 20, "Loading ROM's from disk ...");
h = kLineHeight * 4;
int x = (_w - w) / 2,
y = (_h - h) / 2;
ProgressDialog progress(instance(), parent(), x, y, w, h);
progress.setMessage(message);
progress.setRange(0, files.size() - 1, 10); progress.setRange(0, files.size() - 1, 10);
// Create a entry for the GameList for each file // Create a entry for the GameList for each file

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ProgressDialog.cxx,v 1.4 2005-08-01 22:33:15 stephena Exp $ // $Id: ProgressDialog.cxx,v 1.5 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,24 +29,41 @@
#include "bspf.hxx" #include "bspf.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProgressDialog::ProgressDialog(OSystem* osystem, DialogContainer* parent, ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) const string& message)
: Dialog(osystem, parent, x, y, w, h), : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16),
myMessage(NULL), myMessage(NULL),
mySlider(NULL), mySlider(NULL),
myStart(0), myStart(0),
myFinish(0), myFinish(0),
myStep(0) myStep(0)
{ {
myMessage = new StaticTextWidget(this, 0, 10, w, kLineHeight, "", kTextAlignCenter); const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos, ypos, lwidth;
// Calculate real dimensions
lwidth = font.getStringWidth(message);
_w = lwidth + 2 * fontWidth;
_h = lineHeight * 5;
_x = (boss->getWidth() - _w) / 2;
_y = (boss->getHeight() - _h) / 2;
xpos = fontWidth; ypos = lineHeight;
myMessage = new StaticTextWidget(this, xpos, ypos, lwidth, fontHeight,
message, kTextAlignCenter);
myMessage->setColor(kTextColorEm); myMessage->setColor(kTextColorEm);
mySlider = new SliderWidget(this, 10, 15 + kLineHeight, w - 20, kLineHeight, "", 0, 0);
xpos = fontWidth; ypos += 2 * lineHeight;
mySlider = new SliderWidget(this, xpos, ypos, lwidth, lineHeight, "", 0, 0);
mySlider->setMinValue(100); mySlider->setMinValue(100);
mySlider->setMaxValue(200); mySlider->setMaxValue(200);
mySlider->setValue(100); // Prevents the slider from initially drawing mySlider->setValue(100); // Prevents the slider from initially drawing
// across the entire screen for a split-second // across the entire screen for a split-second
parent->addDialog(this); parent()->addDialog(this);
instance()->frameBuffer().update();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -85,6 +102,6 @@ void ProgressDialog::setProgress(int progress)
{ {
myCurrentStep += myStep; myCurrentStep += myStep;
mySlider->setValue(p); mySlider->setValue(p);
instance()->frameBuffer().refreshOverlay(true); instance()->frameBuffer().update();
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ProgressDialog.hxx,v 1.1 2005-05-17 18:42:23 stephena Exp $ // $Id: ProgressDialog.hxx,v 1.2 2005-08-04 22:59:54 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -22,19 +22,18 @@
#ifndef PROGRESS_DIALOG_HXX #ifndef PROGRESS_DIALOG_HXX
#define PROGRESS_DIALOG_HXX #define PROGRESS_DIALOG_HXX
class DialogContainer;
class StaticTextWidget; class StaticTextWidget;
class SliderWidget; class SliderWidget;
#include "OSystem.hxx" #include "GuiObject.hxx"
#include "bspf.hxx" #include "bspf.hxx"
class ProgressDialog : public Dialog class ProgressDialog : public Dialog
{ {
public: public:
ProgressDialog(OSystem* osystem, DialogContainer* parent, ProgressDialog(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h); const string& message);
~ProgressDialog(); virtual ~ProgressDialog();
void setMessage(const string& message); void setMessage(const string& message);
void setRange(int begin, int end, int step); void setRange(int begin, int end, int step);