OK, I'm not sitting on this any longer, for fear it'll get too far

out of sync.  Implemented dirty widget support for the GUI.  That
means the widgets will only be drawn when necessary.  There are still
a few gotcha's:

1)  OpenGL mode hasn't been ported to this new scheme.
2)  It's not totally finished, so some artifacts may appear onscreen.
3)  Selecting active widgets with the mouse is borked.
4)  Prompt commands that change the core aren't shown in the other
    tabs/interface.  Fixing this will require some infrastructure work
    in Debugger and DebuggerParser.
5)  A lot of print debug code has been left in; please ignore it for now.

Moved a lot of the debugger widgets to use non-proportional font (still
TODO is get a larger font) and not use 'magic numbers' for the layout.
That means when a new font is added, the layout should re-arrange itself.

Moved various Debugger tab widgets from 'src/gui' to 'src/debugger',
because they shouldn't be compiled when debugger support isn't
included.  So now (for example), RamWidget and RamDebug are both in
the debugger directory.

Probably more stuff I'm forgetting about.  It looks like the ScummVM
code can be made adequately fast, so the jump to Qt won't be necessary.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@705 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-01 22:33:16 +00:00
parent 43653c53af
commit 64c554e8c5
54 changed files with 645 additions and 491 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: FrameBufferGL.cxx,v 1.36 2005-07-20 17:33:02 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.37 2005-08-01 22:33:11 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -255,7 +255,7 @@ void FrameBufferGL::postFrameUpdate()
{
// Do the following twice, since OpenGL mode is double-buffered,
// and we need the contents placed in both buffers
if(theRedrawTIAIndicator || theRedrawOverlayIndicator)
// FIXME if(theRedrawTIAIndicator || theRedrawOverlayIndicator)
{
// Texturemap complete texture to surface so we have free scaling
// and antialiasing
@ -439,6 +439,12 @@ void FrameBufferGL::translateCoords(Int32* x, Int32* y)
*y = (Int32) (((*y - myImageDim.y) / (theZoomLevel * myFSScaleFactor)));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
// FIXME
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::createTextures()
{

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: FrameBufferGL.hxx,v 1.19 2005-07-02 01:28:42 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.20 2005-08-01 22:33:11 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -37,7 +37,7 @@ class GUI::Font;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.19 2005-07-02 01:28:42 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.20 2005-08-01 22:33:11 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -56,18 +56,18 @@ class FrameBufferGL : public FrameBuffer
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called to initialize OpenGL video mode.
This method is called to initialize OpenGL video mode.
Return false if any operation fails, otherwise return true.
*/
virtual bool initSubsystem();
/**
This routine is called to set the aspect ratio of the screen.
This method is called to set the aspect ratio of the screen.
*/
virtual void setAspectRatio();
/**
This routine is called whenever the screen needs to be recreated.
This method is called whenever the screen needs to be recreated.
It updates the global screen variable.
*/
virtual bool createScreen();
@ -79,23 +79,23 @@ class FrameBufferGL : public FrameBuffer
virtual void toggleFilter();
/**
This routine should be called anytime the MediaSource needs to be redrawn
This method should be called anytime the MediaSource needs to be redrawn
to the screen.
*/
virtual void drawMediaSource();
/**
This routine is called before any drawing is done (per-frame).
This method is called before any drawing is done (per-frame).
*/
virtual void preFrameUpdate();
/**
This routine is called after any drawing is done (per-frame).
This method is called after any drawing is done (per-frame).
*/
virtual void postFrameUpdate();
/**
This routine is called to get the specified scanline data.
This method is called to get the specified scanline data.
@param row The row we are looking for
@param data The actual pixel data (in bytes)
@ -103,7 +103,7 @@ class FrameBufferGL : public FrameBuffer
virtual void scanline(uInt32 row, uInt8* data);
/**
This routine is called to map a given r,g,b triple to the screen palette.
This method is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@ -113,7 +113,7 @@ class FrameBufferGL : public FrameBuffer
{ return SDL_MapRGB(myTexture->format, r, g, b); }
/**
This routine is called to draw a horizontal line.
This method is called to draw a horizontal line.
@param x The first x coordinate
@param y The y coordinate
@ -123,7 +123,7 @@ class FrameBufferGL : public FrameBuffer
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color);
/**
This routine is called to draw a vertical line.
This method is called to draw a vertical line.
@param x The x coordinate
@param y The first y coordinate
@ -133,7 +133,7 @@ class FrameBufferGL : public FrameBuffer
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
/**
This routine is called to draw a blended rectangle.
This method is called to draw a blended rectangle.
@param x The x coordinate
@param y The y coordinate
@ -146,7 +146,7 @@ class FrameBufferGL : public FrameBuffer
OverlayColor color, uInt32 level = 3);
/**
This routine is called to draw a filled rectangle.
This method is called to draw a filled rectangle.
@param x The x coordinate
@param y The y coordinate
@ -158,7 +158,7 @@ class FrameBufferGL : public FrameBuffer
OverlayColor color);
/**
This routine is called to draw the specified character.
This method is called to draw the specified character.
@param font The font to use to draw the character
@param c The character to draw
@ -170,7 +170,7 @@ class FrameBufferGL : public FrameBuffer
OverlayColor color);
/**
This routine is called to draw the bitmap image.
This method is called to draw the bitmap image.
@param bitmap The data to draw
@param x The x coordinate
@ -182,7 +182,7 @@ class FrameBufferGL : public FrameBuffer
Int32 h = 8);
/**
This routine translates the given coordinates to their
This method translates the given coordinates to their
unzoomed/unscaled equivalents.
@param x X coordinate to translate
@ -190,6 +190,17 @@ class FrameBufferGL : public FrameBuffer
*/
inline virtual void translateCoords(Int32* x, Int32* y);
/**
This method adds a dirty rectangle
(ie, an area of the screen that has changed)
@param x The x coordinate
@param y The y coordinate
@param w The width of the area
@param h The height of the area
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
private:
bool createTextures();

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: FrameBufferSoft.cxx,v 1.30 2005-07-20 17:33:03 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.31 2005-08-01 22:33:11 stephena Exp $
//============================================================================
#include <SDL.h>
@ -32,7 +32,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferSoft::FrameBufferSoft(OSystem* osystem)
: FrameBuffer(osystem),
myRectList(NULL)
myRectList(NULL),
myOverlayRectList(NULL)
{
}
@ -40,6 +41,7 @@ FrameBufferSoft::FrameBufferSoft(OSystem* osystem)
FrameBufferSoft::~FrameBufferSoft()
{
delete myRectList;
delete myOverlayRectList;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -50,7 +52,10 @@ bool FrameBufferSoft::initSubsystem()
// Set up the rectangle list to be used in the dirty update
delete myRectList;
myRectList = new RectList();
if(!myRectList)
delete myOverlayRectList;
myOverlayRectList = new RectList();
if(!myRectList || !myOverlayRectList)
{
cerr << "ERROR: Unable to get memory for SDL rects" << endl;
return false;
@ -258,6 +263,12 @@ void FrameBufferSoft::preFrameUpdate()
{
// Start a new rectlist on each display update
myRectList->start();
// Add all previous overlay rects, then erase
SDL_Rect* dirtyOverlayRects = myOverlayRectList->rects();
for(unsigned int i = 0; i < myOverlayRectList->numRects(); ++i)
myRectList->add(&dirtyOverlayRects[i]);
myOverlayRectList->start();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -369,7 +380,6 @@ void FrameBufferSoft::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
tmp.y = y * theZoomLevel;
tmp.w = w * theZoomLevel;
tmp.h = h * theZoomLevel;
myRectList->add(&tmp);
SDL_FillRect(myScreen, &tmp, myPalette[color]);
}
@ -378,21 +388,20 @@ void FrameBufferSoft::drawChar(const GUI::Font* FONT, uInt8 chr,
uInt32 xorig, uInt32 yorig, OverlayColor color)
{
GUI::Font* font = (GUI::Font*)FONT;
const FontDesc& desc = font->desc();
// If this character is not included in the font, use the default char.
if(chr < font->desc().firstchar ||
chr >= font->desc().firstchar + font->desc().size)
if(chr < desc.firstchar || chr >= desc.firstchar + desc.size)
{
if (chr == ' ')
return;
chr = font->desc().defaultchar;
chr = desc.defaultchar;
}
const Int32 w = font->getCharWidth(chr);
const Int32 h = font->getFontHeight();
chr -= font->desc().firstchar;
const uInt16* tmp = font->desc().bits + (font->desc().offset ?
font->desc().offset[chr] : (chr * h));
chr -= desc.firstchar;
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * h));
SDL_Rect rect;
for(int y = 0; y < h; y++)
@ -444,6 +453,38 @@ void FrameBufferSoft::translateCoords(Int32* x, Int32* y)
*y /= theZoomLevel;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
x *= theZoomLevel;
y *= theZoomLevel;
w *= theZoomLevel;
h *= theZoomLevel;
// Check if rect is in screen area
// This is probably a bug, since the GUI code shouldn't be setting
// a dirty rect larger than the screen
int x1 = x, y1 = y, x2 = x + w, y2 = y + h;
int sx1 = myScreenDim.x, sy1 = myScreenDim.y,
sx2 = myScreenDim.x + myScreenDim.w, sy2 = myScreenDim.y + myScreenDim.h;
if(x1 < sx1 || y1 < sy1 || x2 > sx2 || y2 > sy2)
return;
// Add a dirty rect to the overlay rectangle list
// They will actually be added to the main rectlist in preFrameUpdate()
// TODO - intelligent merging of rectangles, to avoid overlap
SDL_Rect temp;
temp.x = x;
temp.y = y;
temp.w = w;
temp.h = h;
myOverlayRectList->add(&temp);
// cerr << "addDirtyRect(): "
// << "x=" << temp.x << ", y=" << temp.y << ", w=" << temp.w << ", h=" << temp.h << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RectList::RectList(Uint32 size)
{

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: FrameBufferSoft.hxx,v 1.18 2005-07-02 01:28:42 stephena Exp $
// $Id: FrameBufferSoft.hxx,v 1.19 2005-08-01 22:33:11 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_SOFT_HXX
@ -35,7 +35,7 @@ class RectList;
This class implements an SDL software framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferSoft.hxx,v 1.18 2005-07-02 01:28:42 stephena Exp $
@version $Id: FrameBufferSoft.hxx,v 1.19 2005-08-01 22:33:11 stephena Exp $
*/
class FrameBufferSoft : public FrameBuffer
{
@ -54,18 +54,18 @@ class FrameBufferSoft : public FrameBuffer
// The following methods are derived from FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This routine is called to initialize software video mode.
This method is called to initialize software video mode.
Return false if any operation fails, otherwise return true.
*/
virtual bool initSubsystem();
/**
This routine is called to set the aspect ratio of the screen.
This method is called to set the aspect ratio of the screen.
*/
virtual void setAspectRatio();
/**
This routine is called whenever the screen needs to be recreated.
This method is called whenever the screen needs to be recreated.
It updates the global screen variable.
*/
virtual bool createScreen();
@ -77,23 +77,23 @@ class FrameBufferSoft : public FrameBuffer
virtual void toggleFilter();
/**
This routine should be called anytime the MediaSource needs to be redrawn
This method should be called anytime the MediaSource needs to be redrawn
to the screen.
*/
virtual void drawMediaSource();
/**
This routine is called before any drawing is done (per-frame).
This method is called before any drawing is done (per-frame).
*/
virtual void preFrameUpdate();
/**
This routine is called after any drawing is done (per-frame).
This method is called after any drawing is done (per-frame).
*/
virtual void postFrameUpdate();
/**
This routine is called to get the specified scanline data.
This method is called to get the specified scanline data.
@param row The row we are looking for
@param data The actual pixel data (in bytes)
@ -101,7 +101,7 @@ class FrameBufferSoft : public FrameBuffer
virtual void scanline(uInt32 row, uInt8* data);
/**
This routine is called to map a given r,g,b triple to the screen palette.
This method is called to map a given r,g,b triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@ -111,7 +111,7 @@ class FrameBufferSoft : public FrameBuffer
{ return SDL_MapRGB(myScreen->format, r, g, b); }
/**
This routine is called to draw a horizontal line.
This method is called to draw a horizontal line.
@param x The first x coordinate
@param y The y coordinate
@ -121,7 +121,7 @@ class FrameBufferSoft : public FrameBuffer
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color);
/**
This routine is called to draw a vertical line.
This method is called to draw a vertical line.
@param x The x coordinate
@param y The first y coordinate
@ -131,7 +131,7 @@ class FrameBufferSoft : public FrameBuffer
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
/**
This routine is called to draw a blended rectangle.
This method is called to draw a blended rectangle.
@param x The x coordinate
@param y The y coordinate
@ -144,7 +144,7 @@ class FrameBufferSoft : public FrameBuffer
OverlayColor color, uInt32 level = 3);
/**
This routine is called to draw a filled rectangle.
This method is called to draw a filled rectangle.
@param x The x coordinate
@param y The y coordinate
@ -156,7 +156,7 @@ class FrameBufferSoft : public FrameBuffer
OverlayColor color);
/**
This routine is called to draw the specified character.
This method is called to draw the specified character.
@param font The font to use to draw the character
@param c The character to draw
@ -168,7 +168,7 @@ class FrameBufferSoft : public FrameBuffer
OverlayColor color);
/**
This routine is called to draw the bitmap image.
This method is called to draw the bitmap image.
@param bitmap The data to draw
@param x The x coordinate
@ -180,7 +180,7 @@ class FrameBufferSoft : public FrameBuffer
Int32 h = 8);
/**
This routine translates the given coordinates to their
This method translates the given coordinates to their
unzoomed/unscaled equivalents.
@param x X coordinate to translate
@ -188,9 +188,23 @@ class FrameBufferSoft : public FrameBuffer
*/
inline virtual void translateCoords(Int32* x, Int32* y);
/**
This method adds a dirty rectangle
(ie, an area of the screen that has changed)
@param x The x coordinate
@param y The y coordinate
@param w The width of the area
@param h The height of the area
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
private:
// Used in the dirty update of the SDL surface
RectList* myRectList;
// Used in the dirty update of the overlay surface
RectList* myOverlayRectList;
};
class RectList

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: CheatWidget.cxx,v 1.12 2005-07-08 14:36:18 stephena Exp $
// $Id: CheatWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -91,9 +91,6 @@ CheatWidget::CheatWidget(GuiObject* boss, int x, int y, int w, int h)
myResultsList = new AddrValueWidget(boss, xpos, ypos, 100, 75, 0xff);
myResultsList->setFont(instance()->consoleFont());
myResultsList->setTarget(this);
// Start in a known state
doRestart();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: CheatWidget.hxx,v 1.6 2005-07-05 15:25:44 stephena Exp $
// $Id: CheatWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project

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.15 2005-07-12 02:27:07 urchlay Exp $
// $Id: CpuWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -128,8 +128,6 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
on.push_back(onstr[i]);
}
myPSRegister->setList(off, on);
loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -209,14 +207,12 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
}
}
}
// TODO - dirty rect, or is it necessary here?
instance()->frameBuffer().refreshOverlay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CpuWidget::loadConfig()
{
cerr << "CpuWidget::loadConfig()\n";
fillGrid();
}

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.hxx,v 1.5 2005-07-05 15:25:44 stephena Exp $
// $Id: CpuWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.hxx,v 1.63 2005-07-30 16:25:48 urchlay Exp $
// $Id: Debugger.hxx,v 1.64 2005-08-01 22:33:12 stephena Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -46,11 +46,19 @@ typedef ListFile::const_iterator ListIter;
typedef map<string,Expression*> FunctionMap;
#if 0
enum {
kDebuggerWidth = 1023,
kDebuggerLineHeight = 12, // based on the height of the console font
kDebuggerLines = 35,
};
#else
enum {
kDebuggerWidth = 639,
kDebuggerLineHeight = 12, // based on the height of the console font
kDebuggerLines = 20,
};
#endif
// Constants for RAM area
enum {
@ -74,7 +82,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.63 2005-07-30 16:25:48 urchlay Exp $
@version $Id: Debugger.hxx,v 1.64 2005-08-01 22:33:12 stephena Exp $
*/
class Debugger : 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: PromptWidget.cxx,v 1.28 2005-07-20 15:52:58 stephena Exp $
// $Id: PromptWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -46,7 +46,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w - kScrollBarWidth, h),
CommandSender(boss)
CommandSender(boss),
_makeDirty(false)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kPromptWidget;
@ -104,13 +105,11 @@ PromptWidget::~PromptWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::drawWidget(bool hilite)
{
cerr << "PromptWidget::drawWidget\n";
OverlayColor fgcolor, bgcolor;
FrameBuffer& fb = _boss->instance()->frameBuffer();
// Fill the background
fb.fillRect(_x, _y, _w, _h, kBGColor);
// Draw text
int start = _scrollLine - _linesPerPage + 1;
int y = _y + 2;
@ -156,7 +155,8 @@ void PromptWidget::handleMouseWheel(int x, int y, int direction)
_scrollBar->handleMouseWheel(x, y, direction);
}
void PromptWidget::printPrompt() {
void PromptWidget::printPrompt()
{
print( instance()->debugger().showWatches() );
print( instance()->debugger().cpuState() );
print(PROMPT);
@ -202,7 +202,6 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
}
printPrompt();
dirty = true;
break;
}
@ -290,9 +289,8 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
print(prefix);
_promptEndPos = _currentPos;
}
draw();
instance()->frameBuffer().refreshOverlay();
delete[] str;
dirty = true;
break;
}
@ -433,11 +431,24 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
break;
}
// Take care of changes made above
if(dirty)
{
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
// There are times when we want the prompt and scrollbar to be marked
// as dirty *after* they've been drawn above. One such occurrence is
// when we issue a command that indirectly redraws the entire parent
// dialog (such as 'scanline' or 'frame').
// In those cases, the retunr code of the command must be shown, but the
// entire dialog contents are redrawn at a later time. So the prompt and
// scrollbar won't be redrawn unless they're dirty again.
if(_makeDirty)
{
setDirty();
_scrollBar->setDirty();
_makeDirty = false;
}
return handled;
@ -469,13 +480,19 @@ void PromptWidget::handleCommand(CommandSender* sender, int cmd,
if (newPos != _scrollLine)
{
_scrollLine = newPos;
draw();
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::loadConfig()
{
// See logic at the end of handleKeyDown for an explanation of this
_makeDirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::specialKeys(int keycode)
{
@ -516,8 +533,7 @@ void PromptWidget::specialKeys(int keycode)
if(handled)
{
draw();
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
}
@ -669,9 +685,7 @@ void PromptWidget::historyScroll(int direction)
// Ensure once more the caret is visible (in case of very long history entries)
scrollToCurrent();
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -746,9 +760,7 @@ void PromptWidget::putchar(int c)
{
putcharIntern(c);
draw(); // FIXME - not nice to redraw the full console just for one char!
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw(); // FIXME - not nice to redraw the full console just for one char!
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -781,20 +793,11 @@ void PromptWidget::putcharIntern(int c)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::print(string str) // laziness/convenience method
void PromptWidget::print(const string& str)
{
print(str.c_str());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::print(const char *str)
{
while (*str)
putcharIntern(*str++);
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
const char* c = str.c_str();
while(*c)
putcharIntern(*c++);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.8 2005-07-16 16:09:38 urchlay Exp $
// $Id: PromptWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -49,8 +49,7 @@ class PromptWidget : public Widget, public CommandSender
int vprintf(const char *format, va_list argptr);
#undef putchar
void putchar(int c);
void print(const char *str);
void print(string str);
void print(const string& str);
void printPrompt();
bool saveBuffer(string& filename);
@ -79,6 +78,7 @@ class PromptWidget : public Widget, public CommandSender
void handleMouseWheel(int x, int y, int direction);
bool handleKeyDown(int ascii, int keycode, int modifiers);
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
protected:
int _buffer[kBufferSize];
@ -108,6 +108,7 @@ class PromptWidget : public Widget, public CommandSender
OverlayColor textColor;
OverlayColor bgColor;
bool _inverse;
bool _makeDirty;
int compareHistory(const char *histLine);
};

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.19 2005-07-12 02:27:07 urchlay Exp $
// $Id: RamWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -37,57 +37,64 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
int xpos = 10;
int ypos = 20;
int lwidth = 30;
int xpos = 10, ypos = 20, lwidth = 4 * kCFontWidth;
const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
const GUI::Font& font = instance()->consoleFont();
StaticTextWidget* t;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
myRamGrid = new DataGridWidget(boss, xpos+lwidth + 5, ypos, 16, 8, 2, 8, kBASE_16);
myRamGrid = new DataGridWidget(boss, xpos + lwidth, ypos, 16, 8, 2, 8, kBASE_16);
myRamGrid->setTarget(this);
myRamGrid->clearFlags(WIDGET_TAB_NAVIGATE);
myActiveWidget = myRamGrid;
for(int row = 0; row < 8; ++row)
{
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
lwidth, kLineHeight,
Debugger::to_hex_16(row*16 + kRamStart) + string(":"),
t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
lwidth, kCFontHeight,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft);
t->setFont(font);
}
for(int col = 0; col < 16; ++col)
{
StaticTextWidget* t = new StaticTextWidget(boss,
xpos + col*myRamGrid->colWidth() + lwidth + 12,
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7,
ypos - kLineHeight,
lwidth, kLineHeight,
kCFontWidth, kCFontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = 20; ypos = 11 * kLineHeight;
new StaticTextWidget(boss, xpos, ypos, 30, kLineHeight, "Label: ", kTextAlignLeft);
xpos += 30;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 100, kLineHeight, "");
t = new StaticTextWidget(boss, xpos, ypos,
6*kCFontWidth, kCFontHeight,
"Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*kCFontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*kCFontWidth, kLineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
xpos += 120;
new StaticTextWidget(boss, xpos, ypos, 35, kLineHeight, "Decimal: ", kTextAlignLeft);
xpos += 35;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
xpos += 15*kCFontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*kCFontWidth, kCFontHeight,
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kLineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
xpos += 48;
new StaticTextWidget(boss, xpos, ypos, 35, kLineHeight, "Binary: ", kTextAlignLeft);
xpos += 35;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 60, kLineHeight, "");
xpos += 4*kCFontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*kCFontWidth, kCFontHeight,
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kLineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(false);
@ -135,8 +142,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
ypos += 16 + space;
b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, ">>", kDGShiftRCmd, 0);
b->setTarget(myRamGrid);
loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -193,16 +198,13 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
myUndoButton->setEnabled(false);
fillGrid(false);
break;
}
// TODO - dirty rect, or is it necessary here?
instance()->frameBuffer().refreshOverlay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RamWidget::loadConfig()
{
cerr << "RamWidget::loadConfig()\n";
fillGrid(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: RamWidget.hxx,v 1.8 2005-07-07 15:19:04 stephena Exp $
// $Id: RamWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project

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.2 2005-07-19 18:21:27 stephena Exp $
// $Id: TiaOutputWidget.cxx,v 1.3 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,8 +29,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TiaOutputWidget::TiaOutputWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss),
_dirty(true)
CommandSender(boss)
{
}
@ -47,7 +46,6 @@ void TiaOutputWidget::advanceScanline(int lines)
instance()->console().mediaSource().updateScanline();
--lines;
}
_dirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -58,7 +56,6 @@ void TiaOutputWidget::advance(int frames)
instance()->console().mediaSource().update();
--frames;
}
_dirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -70,10 +67,7 @@ cerr << "TiaOutputWidget button press: x = " << x << ", y = " << y << endl;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::drawWidget(bool hilite)
{
// if(_dirty) // FIXME - only redraw this when necessary??
{
cerr << "TiaOutputWidget::drawWidget\n";
instance()->frameBuffer().refreshTIA();
instance()->frameBuffer().drawMediaSource();
_dirty = 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: TiaOutputWidget.hxx,v 1.2 2005-07-19 18:21:27 stephena Exp $
// $Id: TiaOutputWidget.hxx,v 1.3 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -54,9 +54,6 @@ class TiaOutputWidget : public Widget, public CommandSender
bool wantsFocus() { return false; }
void handleMouseDown(int x, int y, int button, int clickCount);
private:
bool _dirty;
};
#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: TiaWidget.cxx,v 1.12 2005-07-21 19:30:17 stephena Exp $
// $Id: TiaWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -52,9 +52,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
int xpos = 10;
int ypos = 20;
int lwidth = 25;
int xpos = 10, ypos = 20, lwidth = 4 * kCFontWidth;
// const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
const GUI::Font& font = instance()->consoleFont();
@ -66,56 +64,65 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myActiveWidget = myRamGrid;
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + 2,
lwidth, kLineHeight,
lwidth, kCFontHeight,
Debugger::to_hex_8(0) + string(":"),
kTextAlignLeft);
t->setFont(font);
for(int col = 0; col < 16; ++col)
{
StaticTextWidget* t = new StaticTextWidget(boss,
xpos + col*myRamGrid->colWidth() + lwidth + 7,
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7,
ypos - kLineHeight,
lwidth, kLineHeight,
kCFontWidth, kCFontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = 20; ypos = 4 * kLineHeight;
new StaticTextWidget(boss, xpos, ypos, 30, kLineHeight, "Label: ", kTextAlignLeft);
xpos += 30;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 100, kLineHeight, "");
t = new StaticTextWidget(boss, xpos, ypos,
6*kCFontWidth, kCFontHeight,
"Label:", kTextAlignLeft);
t->setFont(font);
xpos += 6*kCFontWidth + 5;
myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*kCFontWidth, kLineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
xpos += 120;
new StaticTextWidget(boss, xpos, ypos, 35, kLineHeight, "Decimal: ", kTextAlignLeft);
xpos += 35;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, "");
xpos += 15*kCFontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*kCFontWidth, kCFontHeight,
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kLineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
xpos += 48;
new StaticTextWidget(boss, xpos, ypos, 35, kLineHeight, "Binary: ", kTextAlignLeft);
xpos += 35;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 60, kLineHeight, "");
xpos += 4*kCFontWidth + 20;
t = new StaticTextWidget(boss, xpos, ypos,
4*kCFontWidth, kCFontHeight,
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kLineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(false);
// Color registers
const char* regNames[] = { "COLUP0", "COLUP1", "COLUPF", "COLUBK" };
const char* regNames[] = { "COLUP0:", "COLUP1:", "COLUPF:", "COLUBK:" };
xpos = 10; ypos += 2* kLineHeight;
for(int row = 0; row < 4; ++row)
{
new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
40, kLineHeight,
regNames[row] + string(":"),
t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
7*kCFontWidth, kCFontHeight,
regNames[row],
kTextAlignLeft);
t->setFont(font);
}
xpos += 40;
xpos += 7*kCFontWidth + 5;
myColorRegs = new DataGridWidget(boss, xpos, ypos, 1, 4, 2, 8, kBASE_16);
myColorRegs->setTarget(this);
myColorRegs->setID(kColorRegsID);
@ -148,7 +155,6 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
// b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "", kRCmd, 0);
// b->setTarget(this);
*/
loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -213,14 +219,12 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
}
break;
}
// TODO - dirty rect, or is it necessary here?
instance()->frameBuffer().refreshOverlay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaWidget::loadConfig()
{
cerr << "TiaWidget::loadConfig()\n";
fillGrid();
}

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.7 2005-07-21 19:30:17 stephena Exp $
// $Id: TiaWidget.hxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project

View File

@ -41,7 +41,12 @@ MODULE_OBJS := \
src/debugger/RamDebug.o \
src/debugger/TIADebug.o \
src/debugger/TiaInfoWidget.o \
src/debugger/TiaOutputWidget.o
src/debugger/TiaOutputWidget.o \
src/debugger/CheatWidget.o \
src/debugger/CpuWidget.o \
src/debugger/PromptWidget.o \
src/debugger/RamWidget.o \
src/debugger/TiaWidget.o
MODULE_DIRS += \
src/debugger

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: EventHandler.cxx,v 1.82 2005-07-27 20:19:26 urchlay Exp $
// $Id: EventHandler.cxx,v 1.83 2005-08-01 22:33:12 stephena Exp $
//============================================================================
#include <algorithm>
@ -463,6 +463,7 @@ void EventHandler::poll(uInt32 time)
break; // SDL_QUIT
case SDL_VIDEOEXPOSE:
cerr << "SDL_VIDEOEXPOSE\n";
myOSystem->frameBuffer().refreshTIA();
myOSystem->frameBuffer().refreshOverlay();
break; // SDL_VIDEOEXPOSE
@ -654,7 +655,7 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
break;
case S_DEBUGGER:
if(myKeyTable[key] == Event::DebuggerMode && mod == 0 && state == 1)
if(myKeyTable[key] == Event::DebuggerMode && mod == 4096 && state == 1)
{
leaveDebugMode();
return;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.cxx,v 1.57 2005-07-20 18:44:38 stephena Exp $
// $Id: FrameBuffer.cxx,v 1.58 2005-08-01 22:33:12 stephena Exp $
//============================================================================
#include <sstream>
@ -44,7 +44,7 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
theAspectRatio(1.0),
myFrameRate(0),
myPauseStatus(false),
myMessageTime(-1),
myMessageTime(0),
myMessageText(""),
myNumRedraws(0)
{
@ -163,10 +163,8 @@ void FrameBuffer::update()
// We always draw the screen, even if the core is paused
drawMediaSource();
if(!myPauseStatus)
{
// Draw any pending messages
if(myMessageTime > 0)
if(myMessageTime > 0 && !myPauseStatus)
{
int w = myOSystem->font().getStringWidth(myMessageText) + 10;
int h = myOSystem->font().getFontHeight() + 8;
@ -174,19 +172,20 @@ void FrameBuffer::update()
int y = myBaseDim.h - h - 10/2;
// Draw the bounded box and text
blendRect(x+1, y+2, w-2, h-4, kBGColor);
fillRect(x+1, y+2, w-2, h-4, kBGColor);
box(x, y+1, w, h-2, kColor, kColor);
drawString(&myOSystem->font(), myMessageText, x+1, y+4, w, kTextColor, kTextAlignCenter);
myMessageTime--;
// Erase this message on next update
// Either erase the entire message (when time is reached),
// or show again this frame
if(myMessageTime == 0)
{
myMessageTime = -1;
theRedrawTIAIndicator = true;
drawMediaSource(); // show the changes right now, not next frame
}
drawMediaSource();
}
else
addDirtyRect(x, y, w, h);
}
break; // S_EMULATE
}
@ -198,17 +197,15 @@ void FrameBuffer::update()
drawMediaSource();
// Only update the overlay if it's changed
if(theRedrawOverlayIndicator)
myOSystem->menu().draw();
myOSystem->menu().draw(theRedrawOverlayIndicator);
break; // S_MENU
}
case EventHandler::S_LAUNCHER:
{
// Only update the screen if it's been invalidated or the overlay have changed
if(theRedrawOverlayIndicator)
myOSystem->launcher().draw();
// Only update the overlay if it's changed
myOSystem->launcher().draw(theRedrawOverlayIndicator);
break; // S_LAUNCHER
}
@ -216,9 +213,7 @@ void FrameBuffer::update()
case EventHandler::S_DEBUGGER:
{
// Only update the overlay if it's changed
// This is a performance hack to only draw the menus when necessary
if(theRedrawOverlayIndicator)
myOSystem->debugger().draw();
myOSystem->debugger().draw(theRedrawOverlayIndicator);
break; // S_DEBUGGER
}
@ -238,7 +233,7 @@ void FrameBuffer::update()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refreshTIA(bool now)
{
// cerr << "refreshTIA() " << myNumRedraws++ << endl;
cerr << "refreshTIA() " << myNumRedraws++ << endl;
theRedrawTIAIndicator = true;
if(now)
{
@ -250,7 +245,7 @@ void FrameBuffer::refreshTIA(bool now)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refreshOverlay(bool now)
{
// cerr << "refreshOverlay()\n";
cerr << "refreshOverlay()\n";
if(myOSystem->eventHandler().state() == EventHandler::S_MENU)
refreshTIA(now);
@ -262,7 +257,7 @@ void FrameBuffer::refreshOverlay(bool now)
void FrameBuffer::showMessage(const string& message)
{
// Erase old messages on the screen
if(myMessageTime != -1)
if(myMessageTime > 0)
{
theRedrawTIAIndicator = true;
drawMediaSource();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBuffer.hxx,v 1.50 2005-07-20 15:52:58 stephena Exp $
// $Id: FrameBuffer.hxx,v 1.51 2005-08-01 22:33:13 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_HXX
@ -52,7 +52,7 @@ enum FrameStyle {
All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.50 2005-07-20 15:52:58 stephena Exp $
@version $Id: FrameBuffer.hxx,v 1.51 2005-08-01 22:33:13 stephena Exp $
*/
class FrameBuffer
{
@ -392,6 +392,17 @@ class FrameBuffer
*/
virtual void translateCoords(Int32* x, Int32* y) = 0;
/**
This method should be called to add a dirty rectangle
(ie, an area of the screen that has changed)
@param x The x coordinate
@param y The y coordinate
@param w The width of the area
@param h The height of the area
*/
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) = 0;
protected:
// The parent system for the framebuffer
OSystem* myOSystem;

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.4 2005-07-05 15:25:44 stephena Exp $
// $Id: AboutDialog.cxx,v 1.5 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -43,13 +43,13 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter);
myTitle = new StaticTextWidget(this, 0, 5, w, kFontHeight, "", kTextAlignCenter);
myTitle->setColor(kTextColorHi);
for(int i = 0; i < LINES_PER_PAGE; i++)
{
myDesc[i] = new StaticTextWidget(this, 10, 18 + (10 * i), w - 20,
kLineHeight, "", kTextAlignLeft);
kFontHeight, "", kTextAlignLeft);
}
}
@ -226,7 +226,8 @@ void AboutDialog::displayInfo()
delete[] dscStr;
instance()->frameBuffer().refreshOverlay();
// Redraw entire dialog
_dirty = 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: AddrValueWidget.cxx,v 1.8 2005-07-05 15:25:44 stephena Exp $
// $Id: AddrValueWidget.cxx,v 1.9 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -94,6 +94,9 @@ void AddrValueWidget::setList(const AddrList& alist, const ValueList& vlist)
_selectedItem = -1;
_editMode = false;
scrollBarRecalc();
// The list should now be redrawn
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -143,14 +146,9 @@ void AddrValueWidget::handleMouseDown(int x, int y, int button, int clickCount)
abortEditMode();
_selectedItem = newSelectedItem;
sendCommand(kAVSelectionChangedCmd, _selectedItem, _id);
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
}
// TODO: Determine where inside the string the user clicked and place the
// caret accordingly. See _editScrollOffset and EditTextWidget::handleMouseDown.
draw();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -196,6 +194,8 @@ bool AddrValueWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
// Class EditableWidget handles all text editing related key presses for us
handled = EditableWidget::handleKeyDown(ascii, keycode, modifiers);
if(handled)
setDirty(); draw();
}
else
{
@ -255,16 +255,12 @@ bool AddrValueWidget::handleKeyDown(int ascii, int keycode, int modifiers)
}
if (dirty || _selectedItem != oldSelectedItem)
draw();
if (_selectedItem != oldSelectedItem)
{
sendCommand(kAVSelectionChangedCmd, _selectedItem, _id);
// also draw scrollbar
_scrollBar->draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
_currentKeyDown = keycode;
@ -283,7 +279,6 @@ bool AddrValueWidget::handleKeyUp(int ascii, int keycode, int modifiers)
void AddrValueWidget::lostFocusWidget()
{
_editMode = false;
draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -296,7 +291,7 @@ void AddrValueWidget::handleCommand(CommandSender* sender, int cmd,
if (_currentPos != (int)data)
{
_currentPos = data;
draw();
setDirty(); draw();
}
break;
}
@ -305,6 +300,7 @@ void AddrValueWidget::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AddrValueWidget::drawWidget(bool hilite)
{
cerr << "AddrValueWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int i, pos, len = _valueList.size();
string buffer;
@ -401,7 +397,6 @@ void AddrValueWidget::startEditMode()
{
_editMode = true;
setEditString(""); // Erase current entry when starting editing
draw();
}
}

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.10 2005-07-05 15:25:44 stephena Exp $
// $Id: AudioDialog.cxx,v 1.11 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -181,7 +181,7 @@ void AudioDialog::setDefaults()
// Make sure that mutually-exclusive items are not enabled at the same time
handleSoundEnableChange(true);
instance()->frameBuffer().refreshOverlay();
_dirty = 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: BrowserDialog.cxx,v 1.7 2005-07-05 15:25:44 stephena Exp $
// $Id: BrowserDialog.cxx,v 1.8 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -149,5 +149,5 @@ void BrowserDialog::updateListing()
_fileList->scrollTo(0);
// Finally, redraw
draw();
setDirty(); draw();
}

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.1 2005-07-14 23:47:17 stephena Exp $
// $Id: ColorWidget.cxx,v 1.2 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -43,6 +43,13 @@ ColorWidget::~ColorWidget()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ColorWidget::setColor(int color)
{
_color = color;
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ColorWidget::handleMouseDown(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: ColorWidget.hxx,v 1.1 2005-07-14 23:47:17 stephena Exp $
// $Id: ColorWidget.hxx,v 1.2 2005-08-01 22:33:14 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -35,7 +35,7 @@ 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-07-14 23:47:17 stephena Exp $
@version $Id: ColorWidget.hxx,v 1.2 2005-08-01 22:33:14 stephena Exp $
*/
class ColorWidget : public Widget, public CommandSender
{
@ -45,7 +45,7 @@ class ColorWidget : public Widget, public CommandSender
ColorWidget(GuiObject* boss, int x, int y, int w, int h, int cmd = 0);
~ColorWidget();
void setColor(int color) { _color = color; }
void setColor(int color);
int getColor() const { return _color; }
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: DataGridWidget.cxx,v 1.14 2005-07-14 18:28:36 stephena Exp $
// $Id: DataGridWidget.cxx,v 1.15 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -95,6 +95,13 @@ cerr << "alist.size() = " << alist.size()
_valueStringList.push_back(temp);
}
/*
cerr << "_addrList.size() = " << _addrList.size()
<< ", _valueList.size() = " << _valueList.size()
<< ", _changedList.size() = " << _changedList.size()
<< ", _valueStringList.size() = " << _valueStringList.size()
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
*/
_editMode = false;
// Send item selected signal for starting with cell 0
@ -140,14 +147,11 @@ void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount)
_currentCol = _selectedItem - (_currentRow * _cols);
sendCommand(kDGSelectionChangedCmd, _selectedItem, _id);
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
}
// TODO: Determine where inside the string the user clicked and place the
// caret accordingly. See _editScrollOffset and EditTextWidget::handleMouseDown.
draw();
// FIXME - this is only here for focus
// it needs to be fixed
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -192,6 +196,8 @@ bool DataGridWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
// Class EditableWidget handles all text editing related key presses for us
handled = EditableWidget::handleKeyDown(ascii, keycode, modifiers);
if(handled)
setDirty(); draw();
}
else
{
@ -365,12 +371,11 @@ bool DataGridWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
int oldItem = _selectedItem;
_selectedItem = _currentRow*_cols + _currentCol;
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
if(_selectedItem != oldItem)
sendCommand(kDGSelectionChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
_currentKeyDown = keycode;
@ -389,7 +394,6 @@ bool DataGridWidget::handleKeyUp(int ascii, int keycode, int modifiers)
void DataGridWidget::lostFocusWidget()
{
_editMode = false;
draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -400,10 +404,7 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
{
case kSetPositionCmd:
if (_selectedItem != (int)data)
{
_selectedItem = data;
draw();
}
break;
case kDGZeroCmd:
@ -439,6 +440,7 @@ void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::drawWidget(bool hilite)
{
cerr << "DataGridWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int row, col, deltax;
string buffer;
@ -520,7 +522,6 @@ void DataGridWidget::startEditMode()
{
_editMode = true;
setEditString(""); // Erase current entry when starting editing
draw();
}
}

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.27 2005-07-21 19:30:16 stephena Exp $
// $Id: DebuggerDialog.cxx,v 1.28 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -61,6 +61,7 @@ DebuggerDialog::~DebuggerDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::loadConfig()
{
cerr << "DebuggerDialog::loadConfig()\n";
myTab->loadConfig();
myTiaInfo->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: Dialog.cxx,v 1.21 2005-07-05 15:25:44 stephena Exp $
// $Id: Dialog.cxx,v 1.22 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -57,11 +57,11 @@ Dialog::~Dialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::open()
{
cerr << " ==> Dialog::open()\n";
_result = 0;
_visible = true;
_dirty = true;
// Keep count of how many times this dialog was opened
// Load the config only on the first open (ie, since close was last called)
if(_openCount++ == 0)
loadConfig();
@ -76,6 +76,10 @@ void Dialog::open()
w->receivedFocus();
_focusedWidget = w;
}
// Make all child widget dirty
w = _firstWidget;
Widget::setDirtyInChain(w);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -119,11 +123,21 @@ void Dialog::drawDialog()
if(!isVisible())
return;
if(_dirty)
{
cerr << "Dialog::drawDialog()\n";
FrameBuffer& fb = instance()->frameBuffer();
fb.blendRect(_x+1, _y+1, _w-2, _h-2, kBGColor);
fb.box(_x, _y, _w, _h, kColor, kShadowColor);
// Make all child widget dirty
Widget* w = _firstWidget;
Widget::setDirtyInChain(w);
_dirty = false;
}
// Draw all children
Widget* w = _firstWidget;
while(w)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DialogContainer.cxx,v 1.12 2005-07-20 15:52:58 stephena Exp $
// $Id: DialogContainer.cxx,v 1.13 2005-08-01 22:33:15 stephena Exp $
//============================================================================
#include "OSystem.hxx"
@ -72,15 +72,22 @@ void DialogContainer::updateTime(uInt32 time)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::draw()
void DialogContainer::draw(bool fullrefresh)
{
// Draw all the dialogs on the stack when we want a full refresh
if(fullrefresh)
{
// Draw all the dialogs on the stack
for(int i = 0; i < myDialogStack.size(); i++)
{
myDialogStack[i]->open();
myDialogStack[i]->drawDialog();
}
}
else if(!myDialogStack.empty())
{
myDialogStack.top()->drawDialog();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::addDialog(Dialog* d)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DialogContainer.hxx,v 1.6 2005-06-16 00:55:59 stephena Exp $
// $Id: DialogContainer.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
//============================================================================
#ifndef DIALOG_CONTAINER_HXX
@ -37,7 +37,7 @@ typedef FixedStack<Dialog *> DialogStack;
a stack, and handles their events.
@author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.6 2005-06-16 00:55:59 stephena Exp $
@version $Id: DialogContainer.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
*/
class DialogContainer
{
@ -102,7 +102,7 @@ class DialogContainer
/**
Draw the stack of menus.
*/
void draw();
void draw(bool fullrefresh = false);
/**
Add a dialog box to the stack

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: EditNumWidget.cxx,v 1.6 2005-06-30 00:08:01 stephena Exp $
// $Id: EditNumWidget.cxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -72,17 +72,14 @@ void EditNumWidget::handleMouseDown(int x, int y, int button, int clickCount)
break;
}
if (setCaretPos(i))
{
draw();
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
setCaretPos(i);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditNumWidget::drawWidget(bool hilite)
{
cerr << "EditNumWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
// Draw a thin frame around us.

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.6 2005-06-30 00:08:01 stephena Exp $
// $Id: EditTextWidget.cxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -63,11 +63,7 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount)
}
if (setCaretPos(i))
{
draw();
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.7 2005-06-23 14:33:11 stephena Exp $
// $Id: EditableWidget.cxx,v 1.8 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -54,8 +54,7 @@ void EditableWidget::setEditString(const string& str)
_editScrollOffset = 0;
// Make sure the new string is seen onscreen
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -141,9 +140,7 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers)
if (dirty)
{
draw();
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
return handled;

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: EventMappingDialog.cxx,v 1.16 2005-07-05 15:25:44 stephena Exp $
// $Id: EventMappingDialog.cxx,v 1.17 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -42,13 +42,13 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
myDefaultsButton = addButton(10, h - 24, "Defaults", kDefaultsCmd, 0);
myOKButton = addButton(w - (kButtonWidth + 10), h - 24, "OK", kOKCmd, 0);
new StaticTextWidget(this, 10, 8, 150, 16, "Select an event to remap:", kTextAlignCenter);
new StaticTextWidget(this, 10, 8, 150, kFontHeight, "Select an event to remap:", kTextAlignCenter);
myActionsList = new ListWidget(this, 10, 20, 150, 100);
myActionsList->setNumberingMode(kListNumberingOff);
myActionsList->setEditable(false);
myActionsList->clearFlags(WIDGET_TAB_NAVIGATE);
myKeyMapping = new StaticTextWidget(this, 10, 125, w - 20, 16,
myKeyMapping = new StaticTextWidget(this, 10, 125, w - 20, kFontHeight,
"Action: ", kTextAlignLeft);
myKeyMapping->setFlags(WIDGET_CLEARBG);
@ -59,7 +59,7 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
myCancelMapButton->setEnabled(false);
// Add 'mouse to paddle' mapping
myPaddleModeText = new StaticTextWidget(this, 168, 93, 50, kLineHeight,
myPaddleModeText = new StaticTextWidget(this, 168, 93, 50, kFontHeight,
"Mouse is", kTextAlignCenter);
myPaddleModePopup = new PopUpWidget(this, 160, 105, 60, kLineHeight,
"paddle: ", 40, 0);

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: Font.hxx,v 1.2 2005-06-16 00:55:59 stephena Exp $
// $Id: Font.hxx,v 1.3 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ typedef struct
int firstchar; /* first character in bitmap */
int size; /* font size in glyphs */
const uInt16* bits; /* 16-bit right-padded bitmap data */
const int* offset; /* offsets into bitmap data */
const uInt16* offset; /* offsets into bitmap data */
const uInt8* width; /* character widths or NULL if fixed */
int defaultchar; /* default char (not glyph index) */
long bits_size; /* # words of bitmap_t bits */

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.8 2005-07-05 15:25:44 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.9 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -43,11 +43,13 @@ GameInfoDialog::GameInfoDialog(OSystem* osystem, DialogContainer* parent,
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter);
myTitle = new StaticTextWidget(this, 0, 5, w, kFontHeight, "", kTextAlignCenter);
for(uInt8 i = 0; i < LINES_PER_PAGE; i++)
{
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, 16, "", kTextAlignLeft);
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, kFontHeight,
"", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, kFontHeight,
"", kTextAlignLeft);
}
}
@ -118,7 +120,7 @@ void GameInfoDialog::displayInfo()
delete[] keyStr;
delete[] dscStr;
instance()->frameBuffer().refreshOverlay();
_dirty = 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: GuiObject.hxx,v 1.12 2005-06-16 00:55:59 stephena Exp $
// $Id: GuiObject.hxx,v 1.13 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -32,7 +32,7 @@ class Widget;
This is the base class for all GUI objects/widgets.
@author Stephen Anthony
@version $Id: GuiObject.hxx,v 1.12 2005-06-16 00:55:59 stephena Exp $
@version $Id: GuiObject.hxx,v 1.13 2005-08-01 22:33:15 stephena Exp $
*/
class GuiObject : public CommandReceiver
{
@ -47,6 +47,7 @@ class GuiObject : public CommandReceiver
_y(y),
_w(w),
_h(h),
_dirty(true),
_firstWidget(0) { }
virtual ~GuiObject() { }
@ -64,6 +65,8 @@ class GuiObject : public CommandReceiver
virtual void setWidth(int w) { _w = w; }
virtual void setHeight(int h) { _h = h; }
virtual void setDirty() { _dirty = true; }
virtual bool isVisible() const = 0;
virtual void draw() = 0;
@ -76,6 +79,8 @@ class GuiObject : public CommandReceiver
int _x, _y;
int _w, _h;
bool _dirty;
Widget* _firstWidget;
static Widget* _activeWidget;

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.13 2005-07-06 19:09:26 stephena Exp $
// $Id: GuiUtils.hxx,v 1.14 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,10 +29,16 @@
Probably not very neat, but at least it works ...
@author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.13 2005-07-06 19:09:26 stephena Exp $
@version $Id: GuiUtils.hxx,v 1.14 2005-08-01 22:33:15 stephena Exp $
*/
#define kFontHeight 10
#define kLineHeight 12
#define kCFontWidth 6
#define kCFontHeight 10
#define kCLineHeight 12
#define kScrollBarWidth 9
// Colors indices to use for the various GUI elements
@ -56,6 +62,7 @@ enum {
kSetPositionCmd = 'SETP',
kActiveWidgetCmd = 'ACTW',
kCheckActionCmd = 'CBAC',
kRefreshAllCmd = 'REFA',
kRendererChanged,
kAspectRatioChanged,
kFrameRateChanged,
@ -71,7 +78,7 @@ enum Size {
NextSize
};
static const string EmptyString("");
static const string& EmptyString("");
template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
template<typename T> inline T ABS (T x) { return (x>=0) ? x : -x; }

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.10 2005-07-05 15:25:44 stephena Exp $
// $Id: HelpDialog.cxx,v 1.11 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -41,11 +41,13 @@ HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
myPrevButton->clearFlags(WIDGET_ENABLED);
myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter);
myTitle = new StaticTextWidget(this, 0, 5, w, kFontHeight, "", kTextAlignCenter);
for(uInt8 i = 0; i < LINES_PER_PAGE; i++)
{
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, 16, "", kTextAlignLeft);
myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, kFontHeight,
"", kTextAlignLeft);
myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 160, kFontHeight,
"", kTextAlignLeft);
}
}
@ -173,7 +175,7 @@ void HelpDialog::displayInfo()
delete[] keyStr;
delete[] dscStr;
instance()->frameBuffer().refreshOverlay();
_dirty = 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: LauncherOptionsDialog.cxx,v 1.7 2005-07-05 15:25:44 stephena Exp $
// $Id: LauncherOptionsDialog.cxx,v 1.8 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -40,42 +40,42 @@ LauncherOptionsDialog::LauncherOptionsDialog(
int yoffset;
// The tab widget
TabWidget* tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
myTab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
// 1) The ROM locations tab
tab->addTab("ROM Settings");
myTab->addTab("ROM Settings");
yoffset = vBorder;
// ROM path
new ButtonWidget(tab, 15, yoffset, kButtonWidth + 14, 16, "Path", kChooseRomDirCmd, 0);
myRomPath = new StaticTextWidget(tab, 5 + kButtonWidth + 30,
new ButtonWidget(myTab, 15, yoffset, kButtonWidth + 14, 16, "Path", kChooseRomDirCmd, 0);
myRomPath = new StaticTextWidget(myTab, 5 + kButtonWidth + 30,
yoffset + 3, _w - (5 + kButtonWidth + 20) - 10,
kLineHeight, "", kTextAlignLeft);
// 2) The snapshot settings tab
tab->addTab(" Snapshot Settings ");
myTab->addTab(" Snapshot Settings ");
yoffset = vBorder;
// Snapshot path
new ButtonWidget(tab, 15, yoffset, kButtonWidth + 14, 16, "Path", kChooseSnapDirCmd, 0);
mySnapPath = new StaticTextWidget(tab, 5 + kButtonWidth + 30,
new ButtonWidget(myTab, 15, yoffset, kButtonWidth + 14, 16, "Path", kChooseSnapDirCmd, 0);
mySnapPath = new StaticTextWidget(myTab, 5 + kButtonWidth + 30,
yoffset + 3, _w - (5 + kButtonWidth + 20) - 10,
kLineHeight, "", kTextAlignLeft);
yoffset += 22;
// Snapshot save name
mySnapTypePopup = new PopUpWidget(tab, 10, yoffset, 140, kLineHeight,
mySnapTypePopup = new PopUpWidget(myTab, 10, yoffset, 140, kLineHeight,
"Save snapshot as: ", 87, 0);
mySnapTypePopup->appendEntry("romname", 1);
mySnapTypePopup->appendEntry("md5sum", 2);
yoffset += 18;
// Snapshot single or multiple saves
mySnapSingleCheckbox = new CheckboxWidget(tab, 30, yoffset, 80, kLineHeight,
mySnapSingleCheckbox = new CheckboxWidget(myTab, 30, yoffset, 80, kLineHeight,
"Multiple snapshots");
// Activate the first tab
tab->setActiveTab(0);
myTab->setActiveTab(0);
// Add OK & Cancel buttons
#ifndef MAC_OSX
@ -90,6 +90,8 @@ LauncherOptionsDialog::LauncherOptionsDialog(
int baseW = instance()->frameBuffer().baseWidth();
int baseH = instance()->frameBuffer().baseHeight();
myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40);
loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,6 +122,8 @@ void LauncherOptionsDialog::loadConfig()
b = instance()->settings().getBool("sssingle");
mySnapSingleCheckbox->setState(!b);
myTab->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: LauncherOptionsDialog.hxx,v 1.6 2005-07-05 15:25:44 stephena Exp $
// $Id: LauncherOptionsDialog.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,6 +29,7 @@ class BrowserDialog;
class CheckboxWidget;
class PopUpWidget;
class StaticTextWidget;
class TabWidget;
#include "Dialog.hxx"
#include "Command.hxx"
@ -48,6 +49,7 @@ class LauncherOptionsDialog : public Dialog, public CommandSender
protected:
BrowserDialog* myBrowser;
TabWidget* myTab;
// Rom path controls
StaticTextWidget* myRomPath;

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.23 2005-07-05 15:25:44 stephena Exp $
// $Id: ListWidget.cxx,v 1.24 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -76,10 +76,7 @@ void ListWidget::setSelected(int item)
_currentPos = _selectedItem - _entriesPerPage / 2;
scrollToCurrent();
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
}
@ -144,14 +141,11 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
abortEditMode();
_selectedItem = newSelectedItem;
sendCommand(kListSelectionChangedCmd, _selectedItem, _id);
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
}
// TODO: Determine where inside the string the user clicked and place the
// caret accordingly. See _editScrollOffset and EditTextWidget::handleMouseDown.
draw();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -173,6 +167,7 @@ void ListWidget::handleMouseUp(int x, int y, int button, int clickCount)
void ListWidget::handleMouseWheel(int x, int y, int direction)
{
_scrollBar->handleMouseWheel(x, y, direction);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -297,17 +292,13 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
scrollToCurrent();
}
if (dirty || _selectedItem != oldSelectedItem)
draw();
if (_selectedItem != oldSelectedItem)
{
sendCommand(kListSelectionChangedCmd, _selectedItem, _id);
// also draw scrollbar
_scrollBar->draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
_currentKeyDown = keycode;
@ -326,7 +317,6 @@ bool ListWidget::handleKeyUp(int ascii, int keycode, int modifiers)
void ListWidget::lostFocusWidget()
{
_editMode = false;
draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -338,7 +328,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
if (_currentPos != (int)data)
{
_currentPos = data;
draw();
setDirty(); draw();
}
break;
}
@ -347,6 +337,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::drawWidget(bool hilite)
{
cerr << "ListWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int i, pos, len = _list.size();
string buffer;
@ -456,7 +447,6 @@ void ListWidget::startEditMode()
{
_editMode = true;
setEditString(_list[_selectedItem]);
draw();
}
}

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.14 2005-07-05 15:25:44 stephena Exp $
// $Id: PopUpWidget.cxx,v 1.15 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -75,6 +75,12 @@ PopUpDialog::PopUpDialog(PopUpWidget* boss, int clickX, int clickY)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpDialog::drawDialog()
{
// Normally we add widgets and let Dialog::draw() take care of this
// logic. But for some reason, this Dialog was written differently
// by the ScummVM guys, so I'm not going to mess with it.
if(_dirty)
{
cerr << "PopUpDialog::drawDialog()\n";
FrameBuffer& fb = _popUpBoss->instance()->frameBuffer();
// Draw the menu border
@ -86,7 +92,28 @@ void PopUpDialog::drawDialog()
// Draw the entries
int count = _popUpBoss->_entries.size();
for(int i = 0; i < count; i++)
drawMenuEntry(i, i == _selection);
{
bool hilite = i == _selection;
int x = _x + 1;
int y = _y + 1 + i * kLineHeight;
int w = _w - 2;
string& name = _popUpBoss->_entries[i].name;
fb.fillRect(x, y, w, kLineHeight, 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);
}
else
fb.drawString(_popUpBoss->font(), name, x + 1, y + 2, w - 2,
hilite ? kBGColor : kTextColor);
}
_dirty = false;
fb.addDirtyRect(_x, _y, _w, _h);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -165,20 +192,11 @@ void PopUpDialog::setSelection(int item)
{
if(item != _selection)
{
// Undraw old selection
if(_selection >= 0)
drawMenuEntry(_selection, false);
// Change selection
_selection = item;
_popUpBoss->_selectedItem = item;
// Draw new selection
if(item >= 0)
drawMenuEntry(item, true);
// TODO - dirty rectangle
_popUpBoss->instance()->frameBuffer().refreshOverlay();
setDirty(); _popUpBoss->setDirty(); _popUpBoss->draw();
}
}
@ -240,29 +258,6 @@ void PopUpDialog::moveDown()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpDialog::drawMenuEntry(int entry, bool hilite)
{
// Draw one entry of the popup menu, including selection
assert(entry >= 0);
int x = _x + 1;
int y = _y + 1 + kLineHeight * entry;
int w = _w - 2;
string& name = _popUpBoss->_entries[entry].name;
FrameBuffer& fb = _popUpBoss->instance()->frameBuffer();
fb.fillRect(x, y, w, kLineHeight, 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);
}
else
fb.drawString(_popUpBoss->font(), name, x + 1, y + 2, w - 2,
hilite ? kBGColor : kTextColor);
}
//
// PopUpWidget
//

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.3 2005-06-23 14:33:11 stephena Exp $
// $Id: ProgressDialog.cxx,v 1.4 2005-08-01 22:33:15 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -47,7 +47,6 @@ ProgressDialog::ProgressDialog(OSystem* osystem, DialogContainer* parent,
// across the entire screen for a split-second
parent->addDialog(this);
instance()->frameBuffer().refreshOverlay(true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -59,7 +58,6 @@ ProgressDialog::~ProgressDialog()
void ProgressDialog::done()
{
parent()->removeDialog();
instance()->frameBuffer().refreshOverlay(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: ScrollBarWidget.cxx,v 1.9 2005-07-05 15:25:44 stephena Exp $
// $Id: ScrollBarWidget.cxx,v 1.10 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -184,11 +184,7 @@ void ScrollBarWidget::handleMouseMoved(int x, int y, int button)
if (old_part != _part)
{
draw();
// Refresh the FB, since the selected part has changed
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
}
}
@ -204,11 +200,26 @@ void ScrollBarWidget::checkBounds(int old_pos)
if (old_pos != _currentPos)
{
recalc(); // This takes care of the required refresh
draw();
setDirty(); draw();
sendCommand(kSetPositionCmd, _currentPos, _id);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseEntered(int button)
{
setFlags(WIDGET_HILITED);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::handleMouseLeft(int button)
{
_part = kNoPart;
clearFlags(WIDGET_HILITED);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::recalc()
{
@ -229,13 +240,13 @@ void ScrollBarWidget::recalc()
_sliderPos = UP_DOWN_BOX_HEIGHT;
}
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ScrollBarWidget::drawWidget(bool hilite)
{
cerr << "ScrollBarWidget::drawWidget\n";
FrameBuffer& fb = _boss->instance()->frameBuffer();
int bottomY = _y + _h;
bool isSinglePage = (_numEntries <= _entriesPerPage);

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.4 2005-06-16 00:56:00 stephena Exp $
// $Id: ScrollBarWidget.hxx,v 1.5 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -47,8 +47,8 @@ class ScrollBarWidget : public Widget, public CommandSender
virtual void handleMouseUp(int x, int y, int button, int clickCount);
virtual void handleMouseWheel(int x, int y, int direction);
virtual void handleMouseMoved(int x, int y, int button);
virtual void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); }
virtual void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); }
virtual void handleMouseEntered(int button);
virtual void handleMouseLeft(int button);
// FIXME - this should be private, but then we also have to add accessors
// for _numEntries, _entriesPerPage and _currentPos. This again leads to the question:

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.13 2005-07-05 15:25:44 stephena Exp $
// $Id: TabWidget.cxx,v 1.14 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -99,6 +99,12 @@ int TabWidget::addTab(const string& title)
void TabWidget::setActiveTab(int tabID)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
// Make sure all child widgets are shown
_boss->setDirty(); _boss->draw();
Widget::setDirtyInChain(_tabs[tabID].firstWidget);
Widget::setDirtyInChain(_tabs[tabID].parentWidget);
if (_activeTab != tabID)
{
// Exchange the widget lists, and switch to the new tab
@ -108,10 +114,6 @@ void TabWidget::setActiveTab(int tabID)
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
// Reload the settings for the parent widget in this tab
if(_tabs[tabID].parentWidget)
_tabs[tabID].parentWidget->loadConfig();
// If a widget has been activated elsewhere and it belongs to the
// current view, use it. Otherwise use the default.
if(_activeWidget && isWidgetInChain(_firstWidget, _activeWidget))
@ -123,11 +125,6 @@ void TabWidget::setActiveTab(int tabID)
// in the tabview lose focus
if(_activeWidget)
_activeWidget->receivedFocus();
_boss->draw();
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
}
@ -170,6 +167,9 @@ void TabWidget::cycleWidget(int direction)
else if(direction == +1)
Widget::setNextInChain(_tabs[_activeTab].firstWidget,
_tabs[_activeTab].activeWidget);
_boss->setDirty();
Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -247,10 +247,6 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
_tabs[_activeTab].activeWidget = _activeWidget;
Widget::setFocusForChain(_firstWidget, _activeWidget);
// Make sure the changes are shown onscreen
// TODO - dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
break;
@ -263,6 +259,8 @@ void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::loadConfig()
{
cerr << "TabWidget::loadConfig()\n";
// (Re)load the contents of all tabs
// It's up to each tab to decide if it wants to do anything on a reload
for (int id = 0; id < (int)_tabs.size(); ++id)
@ -272,8 +270,7 @@ void TabWidget::loadConfig()
}
// Make sure changes are seen onscreen
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setActiveTab(_activeTab);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -299,6 +296,12 @@ void TabWidget::box(int x, int y, int width, int height,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::drawWidget(bool hilite)
{
cerr << "TabWidget::drawWidget\n";
// The tab widget is strange in that it acts as both a widget (obviously)
// and a dialog (it contains other widgets). Because of the latter,
// it must assume responsibility for refreshing all its children.
Widget::setDirtyInChain(_tabs[_activeTab].firstWidget);
FrameBuffer& fb = instance()->frameBuffer();
const int left1 = _x + 1;

View File

@ -13,15 +13,11 @@
// 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.3 2005-07-05 15:25:44 stephena Exp $
// $Id: ToggleBitWidget.cxx,v 1.4 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
/*
#include <cctype>
#include <algorithm>
*/
#include "OSystem.hxx"
#include "Widget.hxx"
@ -95,12 +91,9 @@ void ToggleBitWidget::handleMouseDown(int x, int y, int button, int clickCount)
_selectedItem = newSelectedItem;
_currentRow = _selectedItem / _cols;
_currentCol = _selectedItem - (_currentRow * _cols);
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
}
draw();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -112,6 +105,7 @@ void ToggleBitWidget::handleMouseUp(int x, int y, int button, int clickCount)
{
_stateList[_selectedItem] = !_stateList[_selectedItem];
sendCommand(kTBItemDataChangedCmd, _selectedItem, _id);
setDirty(); draw();
}
}
@ -227,9 +221,7 @@ bool ToggleBitWidget::handleKeyDown(int ascii, int keycode, int modifiers)
sendCommand(kTBItemDataChangedCmd, _selectedItem, _id);
}
draw();
// TODO - dirty rectangle
instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
return handled;
@ -245,7 +237,7 @@ void ToggleBitWidget::handleCommand(CommandSender* sender, int cmd,
if (_selectedItem != (int)data)
{
_selectedItem = data;
draw();
setDirty(); draw();
}
break;
}
@ -254,6 +246,7 @@ void ToggleBitWidget::handleCommand(CommandSender* sender, int cmd,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ToggleBitWidget::drawWidget(bool hilite)
{
cerr << "ToggleBitWidget::drawWidget\n";
FrameBuffer& fb = instance()->frameBuffer();
int row, col;
string buffer;

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.18 2005-07-05 15:25:44 stephena Exp $
// $Id: VideoDialog.cxx,v 1.19 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -335,8 +335,6 @@ void VideoDialog::setDefaults()
// Make sure that mutually-exclusive items are not enabled at the same time
handleRendererChange(0); // 0 indicates software mode
instance()->frameBuffer().refreshOverlay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.25 2005-07-21 19:30:17 stephena Exp $
// $Id: Widget.cxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
#include "GuiUtils.hxx"
#include "Widget.hxx"
//FIXMEstatic int COUNT = 0;
//static int COUNT = 0;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget::Widget(GuiObject* boss, int x, int y, int w, int h)
@ -57,12 +57,17 @@ Widget::~Widget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::draw()
{
if(!_dirty)
return;
_dirty = false;
FrameBuffer& fb = _boss->instance()->frameBuffer();
if(!isVisible() || !_boss->isVisible())
return;
int oldX = _x, oldY = _y;
int oldX = _x, oldY = _y, oldW = _w, oldH = _h;
// Account for our relative position in the dialog
_x = getAbsX();
@ -111,6 +116,9 @@ void Widget::draw()
w->draw();
w = w->_next;
}
// Tell the framebuffer this area is dirty
fb.addDirtyRect(getAbsX(), getAbsY(), oldW, oldH);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -131,6 +139,17 @@ void Widget::receivedFocus()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setEnabled(bool e)
{
if(e)
setFlags(WIDGET_ENABLED);
else
clearFlags(WIDGET_ENABLED);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget* Widget::findWidgetInChain(Widget *w, int x, int y)
{
@ -311,13 +330,23 @@ void Widget::setNextInChain(Widget* start, Widget* hasFocus)
active->receivedFocus();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setDirtyInChain(Widget* start)
{
while(start)
{
start->setDirty();
start = start->_next;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
const string& text, TextAlignment align)
: Widget(boss, x, y, w, h),
_align(align)
{
_flags = WIDGET_ENABLED;
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
_type = kStaticTextWidget;
setLabel(text);
}
@ -329,9 +358,14 @@ void StaticTextWidget::setValue(int value)
sprintf(buf, "%d", value);
_label = buf;
// Refresh the screen when the text has changed
// TODO - create dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StaticTextWidget::setLabel(const string& label)
{
_label = label;
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -354,6 +388,20 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h,
_type = kButtonWidget;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseEntered(int button)
{
setFlags(WIDGET_HILITED);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseLeft(int button)
{
clearFlags(WIDGET_HILITED);
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
{
@ -413,12 +461,8 @@ void CheckboxWidget::setState(bool state)
{
_state = state;
_flags ^= WIDGET_INV_BORDER;
draw();
setDirty(); draw();
}
// Refresh the screen after the checkbox is drawn
// TODO - create dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -455,6 +499,13 @@ SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h,
_type = kSliderWidget;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SliderWidget::setValue(int value)
{
_value = value;
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SliderWidget::handleMouseMoved(int x, int y, int button)
{
@ -472,12 +523,9 @@ void SliderWidget::handleMouseMoved(int x, int y, int button)
if(newValue != _value)
{
_value = newValue;
draw();
setDirty(); draw();
sendCommand(_cmd, _value, _id);
}
// Refresh the screen while the slider is being redrawn
// TODO - create dirty rectangle
_boss->instance()->frameBuffer().refreshOverlay();
}
}

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.25 2005-07-21 19:30:17 stephena Exp $
// $Id: Widget.hxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -69,7 +69,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.25 2005-07-21 19:30:17 stephena Exp $
@version $Id: Widget.hxx,v 1.26 2005-08-01 22:33:16 stephena Exp $
*/
class Widget : public GuiObject
{
@ -99,15 +99,13 @@ class Widget : public GuiObject
virtual bool wantsFocus() { return false; };
void setFlags(int flags) { _flags |= flags;
_boss->instance()->frameBuffer().refreshOverlay();
}
void clearFlags(int flags) { _flags &= ~flags;
_boss->instance()->frameBuffer().refreshOverlay();
}
/** Set/clear WIDGET_ENABLED flag and immediately redraw */
void setEnabled(bool e);
void setFlags(int flags) { _flags |= flags; }
void clearFlags(int flags) { _flags &= ~flags; }
int getFlags() const { return _flags; }
void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); }
bool isEnabled() const { return _flags & WIDGET_ENABLED; }
bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); }
@ -160,6 +158,9 @@ class Widget : public GuiObject
/** Select next widget in chain with WIDGET_TAB_NOTIFY property to have
focus, starting from 'hasFocus' */
static void setNextInChain(Widget* start, Widget* hasFocus);
/** Sets all widgets in this chain to be dirty (must be redrawn) */
static void setDirtyInChain(Widget* start);
};
@ -171,10 +172,8 @@ class StaticTextWidget : public Widget
int x, int y, int w, int h,
const string& text, TextAlignment align);
void setValue(int value);
void setLabel(const string& label);
void setAlign(TextAlignment align) { _align = align; }
void setLabel(const string& label) { _label = label;
_boss->instance()->frameBuffer().refreshOverlay();
}
const string& getLabel() const { return _label; }
protected:
@ -198,8 +197,8 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
int getCmd() const { return _cmd; }
void handleMouseUp(int x, int y, int button, int clickCount);
void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }
void handleMouseEntered(int button);
void handleMouseLeft(int button);
protected:
void drawWidget(bool hilite);
@ -243,7 +242,7 @@ class SliderWidget : public ButtonWidget
SliderWidget(GuiObject *boss, int x, int y, int w, int h, const string& label = "",
int labelWidth = 0, int cmd = 0, uInt8 hotkey = 0);
void setValue(int value) { _value = value; }
void setValue(int value);
int getValue() const { return _value; }
void setMinValue(int value) { _valueMin = value; }

View File

@ -5,9 +5,7 @@ MODULE_OBJS := \
src/gui/AddrValueWidget.o \
src/gui/AudioDialog.o \
src/gui/BrowserDialog.o \
src/gui/CheatWidget.o \
src/gui/ColorWidget.o \
src/gui/CpuWidget.o \
src/gui/DataGridWidget.o \
src/gui/DebuggerDialog.o \
src/gui/DialogContainer.o \
@ -28,11 +26,8 @@ MODULE_OBJS := \
src/gui/OptionsDialog.o \
src/gui/PopUpWidget.o \
src/gui/ProgressDialog.o \
src/gui/PromptWidget.o \
src/gui/RamWidget.o \
src/gui/ScrollBarWidget.o \
src/gui/TabWidget.o \
src/gui/TiaWidget.o \
src/gui/ToggleBitWidget.o \
src/gui/VideoDialog.o \
src/gui/Widget.o \