Some more cleanups for 'magic numbers' in the debugger GUI layout.

Eventually, the debugger GUI will support multiple fonts, and the
layout will automatically resize itself.

(Hopefully) fixed bug whereby pressing '~' would not exit the debugger.

Small performance improvement to OpenGL GUI mode.  No redraws will be
done if no widget has been changed, but if any changes must be made,
the whole screen is redrawn.  So it's partial support for dirty updates.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@707 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-02 15:59:45 +00:00
parent d81a1caad5
commit 10bec1607c
10 changed files with 96 additions and 87 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.37 2005-08-01 22:33:11 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.38 2005-08-02 15:59:43 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -40,7 +40,8 @@ FrameBufferGL::FrameBufferGL(OSystem* osystem)
myTextureID(0),
myFilterParam(GL_NEAREST),
myFilterParamName("GL_NEAREST"),
myFSScaleFactor(1.0)
myFSScaleFactor(1.0),
myDirtyFlag(true)
{
}
@ -255,7 +256,7 @@ void FrameBufferGL::postFrameUpdate()
{
// Do the following twice, since OpenGL mode is double-buffered,
// and we need the contents placed in both buffers
// FIXME if(theRedrawTIAIndicator || theRedrawOverlayIndicator)
if(theRedrawTIAIndicator || theRedrawOverlayIndicator || myDirtyFlag)
{
// Texturemap complete texture to surface so we have free scaling
// and antialiasing
@ -280,6 +281,8 @@ void FrameBufferGL::postFrameUpdate()
glTexCoord2f(myTexCoord[2], myTexCoord[3]); glVertex2i(w, h);
glTexCoord2f(myTexCoord[0], myTexCoord[3]); glVertex2i(0, h);
glEnd();
myDirtyFlag = false;
}
}
@ -443,6 +446,7 @@ void FrameBufferGL::translateCoords(Int32* x, Int32* y)
void FrameBufferGL::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
{
// FIXME
myDirtyFlag = 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: FrameBufferGL.hxx,v 1.20 2005-08-01 22:33:11 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.21 2005-08-02 15:59:43 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.20 2005-08-01 22:33:11 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.21 2005-08-02 15:59:43 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -245,6 +245,9 @@ class FrameBufferGL : public FrameBuffer
// The scaling to use in fullscreen mode
// This is separate from both zoomlevel and aspect ratio
float myFSScaleFactor;
// FIXME - will probably be removed
bool myDirtyFlag;
};
#endif // DISPLAY_OPENGL

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CpuWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: CpuWidget.cxx,v 1.2 2005-08-02 15:59:43 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -57,43 +57,45 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
int xpos = 10;
int ypos = 10;
int lwidth = 20;
int xpos = 10, ypos = 20, lwidth = 4 * kCFontWidth;
StaticTextWidget* t;
const GUI::Font& font = instance()->consoleFont();
// Create a 1x5 grid with labels for the CPU registers
myCpuGrid = new DataGridWidget(boss, xpos+lwidth + 5, ypos, 1, 5, 8, 16);
myCpuGrid = new DataGridWidget(boss, xpos + lwidth, ypos, 1, 5, 8, 16);
myCpuGrid->setTarget(this);
myActiveWidget = myCpuGrid;
string labels[5] = { "PC", "SP", "A", "X", "Y" };
string labels[5] = { "PC:", "SP:", "A:", "X:", "Y:" };
for(int row = 0; row < 5; ++row)
{
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
lwidth, kLineHeight,
labels[row] + string(":"),
kTextAlignLeft);
t = new StaticTextWidget(boss, xpos, ypos + row*kCLineHeight + 2,
lwidth, kCFontHeight,
labels[row], kTextAlignLeft);
t->setFont(font);
}
// Create a read-only textbox containing the current PC label
xpos += lwidth + myCpuGrid->colWidth() + 10; ypos = 10;
myPCLabel = new EditTextWidget(boss, xpos, ypos, 100, kLineHeight, "");
xpos += lwidth + myCpuGrid->colWidth() + 10;
myPCLabel = new EditTextWidget(boss, xpos, ypos, 100, kCLineHeight, "");
myPCLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myPCLabel->setFont(font);
myPCLabel->setEditable(false);
// Create a bitfield widget for changing the processor status
xpos = 10; ypos = 2 + 6*kLineHeight;
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight,
"PS:", kTextAlignLeft);
xpos = 10; ypos += 5*kCLineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos, lwidth-2, kCFontHeight,
"PS:", kTextAlignLeft);
t->setFont(font);
myPSRegister = new ToggleBitWidget(boss, xpos+lwidth + 5, ypos-2, 8, 1);
myPSRegister = new ToggleBitWidget(boss, xpos+lwidth, ypos-2, 8, 1);
myPSRegister->setTarget(this);
// FIXME --------------------------
// The following will be moved to another part of the debugger dialog,
// so I won't bother fixing it here.
// And some status fields
xpos = 10; ypos = 10 + 8*kLineHeight;
xpos = 10; ypos += 2*kCLineHeight;
new StaticTextWidget(boss, xpos, ypos, 55, kLineHeight, "Current Ins:", kTextAlignLeft);
xpos += 60;
myCurrentIns = new EditTextWidget(boss, xpos, ypos-2, 300, kLineHeight, "");
@ -116,6 +118,7 @@ CpuWidget::CpuWidget(GuiObject* boss, int x, int y, int w, int h)
myStatus->clearFlags(WIDGET_TAB_NAVIGATE);
myStatus->setFont(font);
myStatus->setEditable(false);
// FIXME --------------------------
// Set the strings to be used in the PSRegister
// We only do this once because it's the state that changes, not the strings

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.1 2005-08-01 22:33:12 stephena Exp $
// $Id: RamWidget.cxx,v 1.2 2005-08-02 15:59:43 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -37,7 +37,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
int xpos = 10, ypos = 20, lwidth = 4 * kCFontWidth;
int xpos = 10, ypos = 25, lwidth = 4 * kCFontWidth;
const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
const GUI::Font& font = instance()->consoleFont();
StaticTextWidget* t;
@ -50,7 +50,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
for(int row = 0; row < 8; ++row)
{
t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
t = new StaticTextWidget(boss, xpos, ypos + row*kCLineHeight + 2,
lwidth, kCFontHeight,
Debugger::to_hex_8(row*16 + kRamStart) + string(":"),
kTextAlignLeft);
@ -59,20 +59,20 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
for(int col = 0; col < 16; ++col)
{
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7,
ypos - kLineHeight,
ypos - kCLineHeight,
kCFontWidth, kCFontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = 20; ypos = 11 * kLineHeight;
xpos = 20; ypos += 9 * kCLineHeight;
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 = new EditTextWidget(boss, xpos, ypos-2, 15*kCFontWidth, kCLineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
@ -83,7 +83,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kLineHeight, "");
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kCLineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
@ -94,7 +94,7 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kLineHeight, "");
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kCLineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(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: TiaWidget.cxx,v 1.1 2005-08-01 22:33:12 stephena Exp $
// $Id: TiaWidget.cxx,v 1.2 2005-08-02 15:59:43 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -52,8 +52,9 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
int xpos = 10, ypos = 20, lwidth = 4 * kCFontWidth;
int xpos = 10, ypos = 25, lwidth = 4 * kCFontWidth;
// const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
StaticTextWidget* t;
const GUI::Font& font = instance()->consoleFont();
// Create a 16x1 grid holding byte values with labels
@ -63,28 +64,28 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myRamGrid->setID(kRamID);
myActiveWidget = myRamGrid;
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + 2,
lwidth, kCFontHeight,
Debugger::to_hex_8(0) + string(":"),
kTextAlignLeft);
t = new StaticTextWidget(boss, xpos, ypos + 2,
lwidth, kCFontHeight,
Debugger::to_hex_8(0) + string(":"),
kTextAlignLeft);
t->setFont(font);
for(int col = 0; col < 16; ++col)
{
t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7,
ypos - kLineHeight,
ypos - kCLineHeight,
kCFontWidth, kCFontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
xpos = 20; ypos = 4 * kLineHeight;
xpos = 20; ypos += 2 * kCLineHeight;
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 = new EditTextWidget(boss, xpos, ypos-2, 15*kCFontWidth, kCLineHeight, "");
myLabel->clearFlags(WIDGET_TAB_NAVIGATE);
myLabel->setFont(font);
myLabel->setEditable(false);
@ -95,7 +96,7 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
"Dec:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kLineHeight, "");
myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*kCFontWidth, kCLineHeight, "");
myDecValue->clearFlags(WIDGET_TAB_NAVIGATE);
myDecValue->setFont(font);
myDecValue->setEditable(false);
@ -106,17 +107,17 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
"Bin:", kTextAlignLeft);
t->setFont(font);
xpos += 4*kCFontWidth + 5;
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kLineHeight, "");
myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*kCFontWidth, kCLineHeight, "");
myBinValue->clearFlags(WIDGET_TAB_NAVIGATE);
myBinValue->setFont(font);
myBinValue->setEditable(false);
// Color registers
const char* regNames[] = { "COLUP0:", "COLUP1:", "COLUPF:", "COLUBK:" };
xpos = 10; ypos += 2* kLineHeight;
xpos = 10; ypos += 2* kCLineHeight;
for(int row = 0; row < 4; ++row)
{
t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
t = new StaticTextWidget(boss, xpos, ypos + row*kCLineHeight + 2,
7*kCFontWidth, kCFontHeight,
regNames[row],
kTextAlignLeft);
@ -128,19 +129,19 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h)
myColorRegs->setID(kColorRegsID);
xpos += myColorRegs->colWidth() + 5;
myCOLUP0Color = new ColorWidget(boss, xpos, ypos+2, 20, kLineHeight - 4);
myCOLUP0Color = new ColorWidget(boss, xpos, ypos+2, 20, kCLineHeight - 4);
myCOLUP0Color->setTarget(this);
ypos += kLineHeight;
myCOLUP1Color = new ColorWidget(boss, xpos, ypos+2, 20, kLineHeight - 4);
ypos += kCLineHeight;
myCOLUP1Color = new ColorWidget(boss, xpos, ypos+2, 20, kCLineHeight - 4);
myCOLUP1Color->setTarget(this);
ypos += kLineHeight;
myCOLUPFColor = new ColorWidget(boss, xpos, ypos+2, 20, kLineHeight - 4);
ypos += kCLineHeight;
myCOLUPFColor = new ColorWidget(boss, xpos, ypos+2, 20, kCLineHeight - 4);
myCOLUPFColor->setTarget(this);
ypos += kLineHeight;
myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, kLineHeight - 4);
ypos += kCLineHeight;
myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, kCLineHeight - 4);
myCOLUBKColor->setTarget(this);
/*

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.83 2005-08-01 22:33:12 stephena Exp $
// $Id: EventHandler.cxx,v 1.84 2005-08-02 15:59:44 stephena Exp $
//============================================================================
#include <algorithm>
@ -655,7 +655,8 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
break;
case S_DEBUGGER:
if(myKeyTable[key] == Event::DebuggerMode && mod == 4096 && state == 1)
if(myKeyTable[key] == Event::DebuggerMode && state == 1 &&
!(kbdAlt(mod) || kbdControl(mod) || kbdShift(mod)))
{
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: DataGridWidget.cxx,v 1.15 2005-08-01 22:33:15 stephena Exp $
// $Id: DataGridWidget.cxx,v 1.16 2005-08-02 15:59:45 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -33,13 +33,13 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DataGridWidget::DataGridWidget(GuiObject* boss, int x, int y, int cols, int rows,
int colchars, int bits, BaseFormat base)
: EditableWidget(boss, x, y, cols*(colchars * 6 + 8) + 1, kLineHeight*rows + 1),
: EditableWidget(boss, x, y, cols*(colchars * kCFontWidth + 8) + 1, kCLineHeight*rows + 1),
CommandSender(boss),
_rows(rows),
_cols(cols),
_currentRow(0),
_currentCol(0),
_colWidth(colchars * 6 + 8),
_colWidth(colchars * kCFontWidth + 8),
_bits(bits),
_base(base),
_selectedItem(0)
@ -172,7 +172,7 @@ void DataGridWidget::handleMouseUp(int x, int y, int button, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int DataGridWidget::findItem(int x, int y)
{
int row = (y - 1) / kLineHeight;
int row = (y - 1) / kCLineHeight;
if(row >= _rows) row = _rows - 1;
int col = x / _colWidth;
@ -448,8 +448,8 @@ cerr << "DataGridWidget::drawWidget\n";
// Draw the internal grid and labels
int linewidth = _cols * _colWidth;
for (row = 0; row <= _rows; row++)
fb.hLine(_x, _y + (row * kLineHeight), _x + linewidth, kColor);
int lineheight = _rows * kLineHeight;
fb.hLine(_x, _y + (row * kCLineHeight), _x + linewidth, kColor);
int lineheight = _rows * kCLineHeight;
for (col = 0; col <= _cols; col++)
fb.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor);
@ -459,16 +459,16 @@ cerr << "DataGridWidget::drawWidget\n";
for (col = 0; col < _cols; col++)
{
int x = _x + 4 + (col * _colWidth);
int y = _y + 2 + (row * kLineHeight);
int y = _y + 2 + (row * kCLineHeight);
int pos = row*_cols + col;
// Draw the selected item inverted, on a highlighted background.
if (_currentRow == row && _currentCol == col)
{
if (_hasFocus && !_editMode)
fb.fillRect(x - 4, y - 2, _colWidth+1, kLineHeight+1, kTextColorHi);
fb.fillRect(x - 4, y - 2, _colWidth+1, kCLineHeight+1, kTextColorHi);
else
fb.frameRect(x - 4, y - 2, _colWidth+1, kLineHeight+1, kTextColorHi);
fb.frameRect(x - 4, y - 2, _colWidth+1, kCLineHeight+1, kTextColorHi);
}
if (_selectedItem == pos && _editMode)
@ -487,7 +487,7 @@ cerr << "DataGridWidget::drawWidget\n";
if(_changedList[pos])
{
fb.fillRect(x - 3, y - 1, _colWidth-1, kLineHeight-1, kTextColorEm);
fb.fillRect(x - 3, y - 1, _colWidth-1, kCLineHeight-1, kTextColorEm);
fb.drawString(_font, buffer, x, y, _colWidth, kTextColorHi);
}
else
@ -504,8 +504,8 @@ cerr << "DataGridWidget::drawWidget\n";
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DataGridWidget::getEditRect() const
{
GUI::Rect r(1, 0, _colWidth, kLineHeight);
const int rowoffset = _currentRow * kLineHeight;
GUI::Rect r(1, 0, _colWidth, kCLineHeight);
const int rowoffset = _currentRow * kCLineHeight;
const int coloffset = _currentCol * _colWidth + 4;
r.top += rowoffset;
r.bottom += rowoffset;

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.14 2005-08-01 22:33:15 stephena Exp $
// $Id: GuiUtils.hxx,v 1.15 2005-08-02 15:59:45 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,15 +29,15 @@
Probably not very neat, but at least it works ...
@author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.14 2005-08-01 22:33:15 stephena Exp $
@version $Id: GuiUtils.hxx,v 1.15 2005-08-02 15:59:45 stephena Exp $
*/
#define kFontHeight 10
#define kLineHeight 12
#define kCFontWidth 6
#define kCFontHeight 10
#define kCLineHeight 12
#define kCFontWidth 9
#define kCFontHeight 15
#define kCLineHeight 17
#define kScrollBarWidth 9

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.14 2005-08-01 22:33:16 stephena Exp $
// $Id: TabWidget.cxx,v 1.15 2005-08-02 15:59:45 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -105,6 +105,9 @@ void TabWidget::setActiveTab(int tabID)
Widget::setDirtyInChain(_tabs[tabID].firstWidget);
Widget::setDirtyInChain(_tabs[tabID].parentWidget);
if(_tabs[tabID].parentWidget)
_tabs[tabID].parentWidget->loadConfig();
if (_activeTab != tabID)
{
// Exchange the widget lists, and switch to the new tab
@ -261,15 +264,9 @@ 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)
{
if(_tabs[id].parentWidget)
_tabs[id].parentWidget->loadConfig();
}
// Make sure changes are seen onscreen
// For efficiency reasons, only update the tab which is visible
// Others will be updated when they're selected
setActiveTab(_activeTab);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ToggleBitWidget.cxx,v 1.4 2005-08-01 22:33:16 stephena Exp $
// $Id: ToggleBitWidget.cxx,v 1.5 2005-08-02 15:59:45 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,13 +29,13 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, int x, int y,
int cols, int rows, int colchars)
: Widget(boss, x, y, cols*(colchars * 6 + 8) + 1, kLineHeight*rows + 1),
: Widget(boss, x, y, cols*(colchars * kCFontWidth + 8) + 1, kCLineHeight*rows + 1),
CommandSender(boss),
_rows(rows),
_cols(cols),
_currentRow(0),
_currentCol(0),
_colWidth(colchars * 6 + 8),
_colWidth(colchars * kCFontWidth + 8),
_selectedItem(0)
{
// This widget always uses a monospace font
@ -112,7 +112,7 @@ void ToggleBitWidget::handleMouseUp(int x, int y, int button, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int ToggleBitWidget::findItem(int x, int y)
{
int row = (y - 1) / kLineHeight;
int row = (y - 1) / kCLineHeight;
if(row >= _rows) row = _rows - 1;
int col = x / _colWidth;
@ -254,8 +254,8 @@ cerr << "ToggleBitWidget::drawWidget\n";
// Draw the internal grid and labels
int linewidth = _cols * _colWidth;
for (row = 0; row <= _rows; row++)
fb.hLine(_x, _y + (row * kLineHeight), _x + linewidth, kColor);
int lineheight = _rows * kLineHeight;
fb.hLine(_x, _y + (row * kCLineHeight), _x + linewidth, kColor);
int lineheight = _rows * kCLineHeight;
for (col = 0; col <= _cols; col++)
fb.vLine(_x + (col * _colWidth), _y, _y + lineheight, kColor);
@ -265,16 +265,16 @@ cerr << "ToggleBitWidget::drawWidget\n";
for (col = 0; col < _cols; col++)
{
int x = _x + 4 + (col * _colWidth);
int y = _y + 2 + (row * kLineHeight);
int y = _y + 2 + (row * kCLineHeight);
int pos = row*_cols + col;
// Draw the selected item inverted, on a highlighted background.
if (_currentRow == row && _currentCol == col)
{
if (_hasFocus)
fb.fillRect(x - 4, y - 2, _colWidth+1, kLineHeight+1, kTextColorHi);
fb.fillRect(x - 4, y - 2, _colWidth+1, kCLineHeight+1, kTextColorHi);
else
fb.frameRect(x - 4, y - 2, _colWidth+1, kLineHeight+1, kTextColorHi);
fb.frameRect(x - 4, y - 2, _colWidth+1, kCLineHeight+1, kTextColorHi);
}
if(_stateList[pos])