More UI cleanups for the recent palette changes.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1343 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-08-12 23:05:12 +00:00
parent afc12e4977
commit 3993576dfc
13 changed files with 94 additions and 118 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.cxx,v 1.111 2007-08-10 18:27:10 stephena Exp $ // $Id: Debugger.cxx,v 1.112 2007-08-12 23:05:12 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -969,6 +969,7 @@ void Debugger::setQuitState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getDialogBounds() const GUI::Rect Debugger::getDialogBounds() const
{ {
// The dialog bounds are the actual size of the entire dialog container
GUI::Rect r(0, 0, myWidth, myHeight); GUI::Rect r(0, 0, myWidth, myHeight);
return r; return r;
} }
@ -976,6 +977,7 @@ GUI::Rect Debugger::getDialogBounds() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getTiaBounds() const GUI::Rect Debugger::getTiaBounds() const
{ {
// The area showing the TIA image (NTSC and PAL supported, up to 260 lines)
GUI::Rect r(0, 0, 320, 260); GUI::Rect r(0, 0, 320, 260);
return r; return r;
} }
@ -985,8 +987,9 @@ GUI::Rect Debugger::getRomBounds() const
{ {
// The ROM area is the full area to the right of the tabs // The ROM area is the full area to the right of the tabs
GUI::Rect dialog = getDialogBounds(); GUI::Rect dialog = getDialogBounds();
GUI::Rect status = getStatusBounds();
int x1 = dialog.right - myOSystem->consoleFont().getMaxCharWidth() * 60; int x1 = status.right + 1;
int y1 = 0; int y1 = 0;
int x2 = dialog.right; int x2 = dialog.right;
int y2 = dialog.bottom; int y2 = dialog.bottom;
@ -999,13 +1002,14 @@ GUI::Rect Debugger::getRomBounds() const
GUI::Rect Debugger::getStatusBounds() const GUI::Rect Debugger::getStatusBounds() const
{ {
// The status area is the full area to the right of the TIA image // The status area is the full area to the right of the TIA image
// and left of the ROM area // extending as far as necessary
GUI::Rect dlg = getDialogBounds();
GUI::Rect tia = getTiaBounds(); GUI::Rect tia = getTiaBounds();
GUI::Rect rom = getRomBounds();
int x1 = tia.right + 1; int x1 = tia.right + 1;
int y1 = 0; int y1 = 0;
int x2 = rom.left - 1; int x2 = tia.right + 225 + (dlg.width() > 1030 ?
(int) (0.2 * (dlg.width() - 1030)) : 0);
int y2 = tia.bottom; int y2 = tia.bottom;
GUI::Rect r(x1, y1, x2, y2); GUI::Rect r(x1, y1, x2, y2);
@ -1018,11 +1022,11 @@ GUI::Rect Debugger::getTabBounds() const
// The tab area is the full area below the TIA image // The tab area is the full area below the TIA image
GUI::Rect dialog = getDialogBounds(); GUI::Rect dialog = getDialogBounds();
GUI::Rect tia = getTiaBounds(); GUI::Rect tia = getTiaBounds();
GUI::Rect rom = getRomBounds(); GUI::Rect status = getStatusBounds();
int x1 = 0; int x1 = 0;
int y1 = tia.bottom + 1; int y1 = tia.bottom + 1;
int x2 = rom.left - 1; int x2 = status.right + 1;
int y2 = dialog.bottom; int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2); GUI::Rect r(x1, y1, x2, y2);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ContextMenu.cxx,v 1.9 2007-01-01 18:04:43 stephena Exp $ // $Id: ContextMenu.cxx,v 1.10 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -191,7 +191,7 @@ void ContextMenu::drawDialog()
{ {
FrameBuffer& fb = instance()->frameBuffer(); FrameBuffer& fb = instance()->frameBuffer();
fb.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor); fb.fillRect(_x+1, _y+1, _w-2, _h-2, kWidColor);
fb.box(_x, _y, _w, _h, kColor, kShadowColor); fb.box(_x, _y, _w, _h, kColor, kShadowColor);
// Draw the entries // Draw the entries
@ -204,10 +204,10 @@ void ContextMenu::drawDialog()
int w = _w - 4; int w = _w - 4;
string& name = _entries[i]; string& name = _entries[i];
fb.fillRect(x, y, w, _rowHeight, hilite ? kTextColorHi : kBGColor); fb.fillRect(x, y, w, _rowHeight, hilite ? kTextColorHi : kWidColor);
fb.drawString(_font, name, x + 1, y + 2, w - 2, fb.drawString(_font, name, x + 1, y + 2, w - 2,
hilite ? kBGColor : kTextColor); hilite ? kWidColor : kTextColor);
} }
_dirty = false; _dirty = false;
fb.addDirtyRect(_x, _y, _w, _h); fb.addDirtyRect(_x, _y, _w, _h);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PromptWidget.cxx,v 1.17 2007-07-31 15:46:20 stephena Exp $ // $Id: PromptWidget.cxx,v 1.18 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -54,6 +54,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_WANTS_TAB | WIDGET_WANTS_RAWDATA; WIDGET_WANTS_TAB | WIDGET_WANTS_RAWDATA;
_type = kPromptWidget; _type = kPromptWidget;
_bgcolor = kWidColor;
_kConsoleCharWidth = font.getMaxCharWidth(); _kConsoleCharWidth = font.getMaxCharWidth();
_kConsoleCharHeight = font.getFontHeight(); _kConsoleCharHeight = font.getFontHeight();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: RomWidget.cxx,v 1.20 2007-01-01 18:04:44 stephena Exp $ // $Id: RomWidget.cxx,v 1.21 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -47,8 +47,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
{ {
_type = kRomWidget; _type = kRomWidget;
int w = 58 * font.getMaxCharWidth(), int xpos, ypos;
h = 0, xpos, ypos;
StaticTextWidget* t; StaticTextWidget* t;
// Create bank editable area // Create bank editable area
@ -60,7 +59,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
xpos += t->getWidth() + 10; xpos += t->getWidth() + 10;
myBank = new DataGridWidget(boss, font, xpos, ypos-2, myBank = new DataGridWidget(boss, font, xpos, ypos-2,
1, 1, 1, 2, kBASE_16_4); 1, 1, 2, 2, kBASE_16_4);
myBank->setTarget(this); myBank->setTarget(this);
myBank->setRange(0, instance()->debugger().bankCount()); myBank->setRange(0, instance()->debugger().bankCount());
if(instance()->debugger().bankCount() <= 1) if(instance()->debugger().bankCount() <= 1)
@ -81,11 +80,8 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// Create rom listing // Create rom listing
xpos = x; ypos += myBank->getHeight() + 4; xpos = x; ypos += myBank->getHeight() + 4;
// Update height of widget to use all remaining vertical space
GUI::Rect dialog = instance()->debugger().getDialogBounds(); GUI::Rect dialog = instance()->debugger().getDialogBounds();
int rows = ((dialog.height() - ypos) / font.getLineHeight()) - 1; int w = dialog.width() - x - 5, h = dialog.height() - ypos - 3;
h = rows * font.getLineHeight();
myRomList = new RomListWidget(boss, font, xpos, ypos, w, h); myRomList = new RomListWidget(boss, font, xpos, ypos, w, h);
myRomList->setTarget(this); myRomList->setTarget(this);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBuffer.hxx,v 1.88 2007-08-06 20:16:51 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.89 2007-08-12 23:05:12 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -75,14 +75,17 @@ enum {
kTextColorHi, kTextColorHi,
kTextColorEm, kTextColorEm,
kDlgColor, kDlgColor,
kListColor, kWidColor,
kBtnColor, kBtnColor,
kBtnColorHi, kBtnColorHi,
kBtnFntColor, kBtnTextColor,
kBtnFntColorHi, kBtnTextColorHi,
kCheckColor,
kScrollColor, kScrollColor,
kScrollColorHi, kScrollColorHi,
kWidColor, kSliderColor,
kSliderColorHi,
kWidFrameColor,
kNumColors kNumColors
}; };
@ -95,7 +98,7 @@ enum {
All GUI elements (ala ScummVM) are drawn here as well. All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.88 2007-08-06 20:16:51 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.89 2007-08-12 23:05:12 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OSystem.cxx,v 1.104 2007-08-10 18:27:11 stephena Exp $ // $Id: OSystem.cxx,v 1.105 2007-08-12 23:05:12 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -768,15 +768,6 @@ void OSystem::queryVideoHardware()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* /*
kColor
kBGColor
kShadowColor
kHiliteColor
kTextColor
kTextColorHi
kTextColorEm
Palette is defined as follows: Palette is defined as follows:
kColor TODO kColor TODO
kBGColor TODO kBGColor TODO
@ -787,20 +778,20 @@ void OSystem::queryVideoHardware()
kTextColorEm TODO kTextColorEm TODO
kDlgColor Dialog background kDlgColor Dialog background
kListColor File list background kWidColor Widget background
kBtnColor Normal button background kBtnColor Normal button background
kBtnColorHi Highlighted button background kBtnColorHi Highlighted button background
kBtnFntColor Normal button font color kBtnTextColor Normal button font color
kBtnFntColorHi Highlighted button font color kBtnTextColorHi Highlighted button font color
kScrollColor Normal scrollbar color kScrollColor Normal scrollbar color
kScrollColorHi Highlighted scrollbar color kScrollColorHi Highlighted scrollbar color
kWidColor Border for currently selected widget kWidFrameColor Border for currently selected widget
*/ */
uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = { uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
// Normal mode // Standard
{ 0x686868, // kColor { 0x686868, // kColor
0x000000, // kBGColor 0x000000, // kBGColor
0x404040, // kShadowColor 0x404040, // kShadowColor
@ -809,20 +800,23 @@ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = {
0x62a108, // kTextColorHi 0x62a108, // kTextColorHi
0xc80000, // kTextColorEm 0xc80000, // kTextColorEm
0xc9af7c, // kDlgColor 0xc9af7c, // kDlgColor
0xf0f0cf, // kListColor 0xf0f0cf, // kWidColor
0xac3410, // kBtnColor 0xac3410, // kBtnColor
0xd55941, // kBtnColorHi 0xd55941, // kBtnColorHi
0xffffff, // kBtnFntColor 0xffffff, // kBtnTextColor
0xffd652, // kBtnFntColorHi 0xffd652, // kBtnTextColorHi
0x000000, // kScrollColor 0xac3410, // kCheckColor
0x000000, // kScrollColorHi 0xac3410, // kScrollColor
0xc80000 // kWidColor 0xd55941, // kScrollColorHi
0xac3410, // kSliderColor
0xd55941, // kSliderColorHi
0xc80000 // kWidFrameColor
}, },
// GP2X // Classic
{ 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x00ff00, 0xc80000, { 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x00ff00, 0xc80000,
0x000000, 0x000000, 0x000000, 0x000000, 0x20a020, 0x00ff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x20a020, 0x00ff00, 0x20a020,
0x000000, 0xc80000 } 0x20a020, 0x00ff00, 0x20a020, 0x00ff00, 0xc80000 }
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OSystem.hxx,v 1.54 2007-08-10 18:27:11 stephena Exp $ // $Id: OSystem.hxx,v 1.55 2007-08-12 23:05:12 stephena Exp $
//============================================================================ //============================================================================
#ifndef OSYSTEM_HXX #ifndef OSYSTEM_HXX
@ -51,7 +51,7 @@ typedef Common::Array<Resolution> ResolutionList;
other objects belong. other objects belong.
@author Stephen Anthony @author Stephen Anthony
@version $Id: OSystem.hxx,v 1.54 2007-08-10 18:27:11 stephena Exp $ @version $Id: OSystem.hxx,v 1.55 2007-08-12 23:05:12 stephena Exp $
*/ */
class OSystem class OSystem
{ {
@ -499,9 +499,6 @@ class OSystem
}; };
TimingInfo myTimingInfo; TimingInfo myTimingInfo;
// Capabilities for this OSystem
uInt32 myCapabilities;
// Table of RGB values for GUI elements // Table of RGB values for GUI elements
static uInt32 ourGUIColors[kNumUIPalettes][kNumColors-256]; static uInt32 ourGUIColors[kNumUIPalettes][kNumColors-256];

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EditableWidget.cxx,v 1.23 2007-08-07 14:38:51 stephena Exp $ // $Id: EditableWidget.cxx,v 1.24 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -37,8 +37,8 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
_editScrollOffset = 0; _editScrollOffset = 0;
_bgcolor = kListColor; _bgcolor = kWidColor;
_bgcolorhi = kListColor; _bgcolorhi = kWidColor;
_textcolor = kTextColor; _textcolor = kTextColor;
_textcolorhi = kTextColor; _textcolorhi = kTextColor;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ListWidget.cxx,v 1.48 2007-08-06 20:16:51 stephena Exp $ // $Id: ListWidget.cxx,v 1.49 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -46,8 +46,8 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kListWidget; _type = kListWidget;
_bgcolor = kListColor; _bgcolor = kWidColor;
_bgcolorhi = kListColor; _bgcolorhi = kWidColor;
_textcolor = kTextColor; _textcolor = kTextColor;
_textcolorhi = kTextColor; _textcolorhi = kTextColor;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PopUpWidget.cxx,v 1.36 2007-08-07 14:38:52 stephena Exp $ // $Id: PopUpWidget.cxx,v 1.37 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -86,7 +86,7 @@ void PopUpDialog::drawDialog()
// The last entry may be empty. Fill it with black. // The last entry may be empty. Fill it with black.
if(_twoColumns && (count & 1)) if(_twoColumns && (count & 1))
fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1), fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1),
_w / 2 - 1, _popUpBoss->_fontHeight, kListColor); _w / 2 - 1, _popUpBoss->_fontHeight, kWidColor);
_dirty = false; _dirty = false;
fb.addDirtyRect(_x, _y, _w, _h); fb.addDirtyRect(_x, _y, _w, _h);
@ -232,7 +232,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite)
} }
string& name = _popUpBoss->_entries[entry].name; string& name = _popUpBoss->_entries[entry].name;
fb.fillRect(x, y, w, _popUpBoss->_fontHeight, hilite ? kTextColorHi : kListColor); fb.fillRect(x, y, w, _popUpBoss->_fontHeight, hilite ? kTextColorHi : kWidColor);
if(name.size() == 0) if(name.size() == 0)
{ {
@ -431,7 +431,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
_type = kPopUpWidget; _type = kPopUpWidget;
_bgcolor = kDlgColor; _bgcolor = kDlgColor;
_bgcolorhi = kListColor; _bgcolorhi = kWidColor;
_textcolor = kTextColor; _textcolor = kTextColor;
_textcolorhi = kTextColor; _textcolorhi = kTextColor;
@ -566,7 +566,7 @@ void PopUpWidget::drawWidget(bool hilite)
fb.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor); fb.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor);
// Fill the background // Fill the background
fb.fillRect(x + 1, _y + 1, w - 2, _h - 2, kListColor); fb.fillRect(x + 1, _y + 1, w - 2, _h - 2, kWidColor);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup // Draw an arrow pointing down at the right end to signal this is a dropdown/popup
fb.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY, fb.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: ScrollBarWidget.cxx,v 1.17 2007-08-07 14:38:52 stephena Exp $ // $Id: ScrollBarWidget.cxx,v 1.18 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -69,8 +69,8 @@ ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
{ {
_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
_type = kScrollBarWidget; _type = kScrollBarWidget;
_bgcolor = kListColor; _bgcolor = kWidColor;
_bgcolorhi = kListColor; _bgcolorhi = kWidColor;
_part = kNoPart; _part = kNoPart;
_sliderHeight = 0; _sliderHeight = 0;
@ -264,23 +264,23 @@ void ScrollBarWidget::drawWidget(bool hilite)
fb.frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, kColor); fb.frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, kColor);
fb.drawBitmap(up_arrow, _x, _y, fb.drawBitmap(up_arrow, _x, _y,
isSinglePage ? kColor : isSinglePage ? kColor :
(hilite && _part == kUpArrowPart) ? kBtnColorHi : kBtnColor); (hilite && _part == kUpArrowPart) ? kScrollColorHi : kScrollColor);
// Down arrow // Down arrow
fb.frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, kColor); fb.frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, kColor);
fb.drawBitmap(down_arrow, _x, bottomY - UP_DOWN_BOX_HEIGHT, fb.drawBitmap(down_arrow, _x, bottomY - UP_DOWN_BOX_HEIGHT,
isSinglePage ? kColor : isSinglePage ? kColor :
(hilite && _part == kDownArrowPart) ? kBtnColorHi : kBtnColor); (hilite && _part == kDownArrowPart) ? kScrollColorHi : kScrollColor);
// Slider // Slider
if(!isSinglePage) if(!isSinglePage)
{ {
fb.fillRect(_x, _y + _sliderPos, _w, _sliderHeight, fb.fillRect(_x, _y + _sliderPos, _w, _sliderHeight,
(hilite && _part == kSliderPart) ? kBtnColorHi : kBtnColor); (hilite && _part == kSliderPart) ? kScrollColorHi : kScrollColor);
fb.frameRect(_x, _y + _sliderPos, _w, _sliderHeight, kColor); fb.frameRect(_x, _y + _sliderPos, _w, _sliderHeight, kColor);
int y = _y + _sliderPos + _sliderHeight / 2; int y = _y + _sliderPos + _sliderHeight / 2;
fb.hLine(_x + 2, y - 2, _x + _w - 3, kBtnFntColorHi); fb.hLine(_x + 2, y - 2, _x + _w - 3, kWidColor);
fb.hLine(_x + 2, y, _x + _w - 3, kBtnFntColorHi); fb.hLine(_x + 2, y, _x + _w - 3, kWidColor);
fb.hLine(_x + 2, y + 2, _x + _w - 3, kBtnFntColorHi); fb.hLine(_x + 2, y + 2, _x + _w - 3, kWidColor);
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Widget.cxx,v 1.53 2007-08-10 18:27:12 stephena Exp $ // $Id: Widget.cxx,v 1.54 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -41,8 +41,8 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font,
_id(-1), _id(-1),
_flags(0), _flags(0),
_hasFocus(false), _hasFocus(false),
_bgcolor(kBGColor), _bgcolor(kWidColor),
_bgcolorhi(kBGColor), _bgcolorhi(kWidColor),
_textcolor(kTextColor), _textcolor(kTextColor),
_textcolorhi(kTextColorHi) _textcolorhi(kTextColorHi)
{ {
@ -285,7 +285,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
w = rect.width(), h = rect.height(); w = rect.width(), h = rect.height();
tmp->receivedFocus(); tmp->receivedFocus();
fb.frameRect(x, y, w, h, kWidColor, kDashLine); fb.frameRect(x, y, w, h, kWidFrameColor, kDashLine);
tmp->setDirty(); tmp->draw(); tmp->setDirty(); tmp->draw();
fb.addDirtyRect(x, y, w, h); fb.addDirtyRect(x, y, w, h);
@ -357,8 +357,8 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font,
_type = kButtonWidget; _type = kButtonWidget;
_bgcolor = kBtnColor; _bgcolor = kBtnColor;
_bgcolorhi = kBtnColorHi; _bgcolorhi = kBtnColorHi;
_textcolor = kBtnFntColor; _textcolor = kBtnTextColor;
_textcolorhi = kBtnFntColorHi; _textcolorhi = kBtnTextColorHi;
_editable = false; _editable = false;
} }
@ -428,14 +428,14 @@ static unsigned int checked_img_x[8] =
static unsigned int checked_img_o[8] = static unsigned int checked_img_o[8] =
{ {
0x00000000,
0x01000010,
0x00100100,
0x00011000, 0x00011000,
0x00111100,
0x01111110,
0x11111111,
0x11111111,
0x01111110,
0x00111100,
0x00011000, 0x00011000,
0x00000000,
0x00000000,
0x00000000,
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -453,10 +453,7 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font,
{ {
_flags = WIDGET_ENABLED; _flags = WIDGET_ENABLED;
_type = kCheckboxWidget; _type = kCheckboxWidget;
_bgcolor = kListColor; _bgcolor = _bgcolorhi = kWidColor;
_bgcolorhi = kBtnColorHi;
_textcolor = kBtnFntColor;
_textcolorhi = kBtnFntColorHi;
_editable = true; _editable = true;
@ -499,7 +496,6 @@ void CheckboxWidget::setState(bool state)
if(_state != state) if(_state != state)
{ {
_state = state; _state = state;
_flags ^= WIDGET_INV_BORDER;
setDirty(); draw(); setDirty(); draw();
} }
} }
@ -520,20 +516,12 @@ void CheckboxWidget::drawWidget(bool hilite)
if(_state) if(_state)
{ {
unsigned int* img = _fillRect ? checked_img_o : checked_img_x; unsigned int* img = _fillRect ? checked_img_o : checked_img_x;
fb.drawBitmap(img, _x + 3, _y + _boxY + 3, kBtnColor); int color = _fillRect ? kWidFrameColor : kCheckColor;
fb.drawBitmap(img, _x + 3, _y + _boxY + 3, color);
} }
} }
else else
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, kColor); fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, kColor);
/*
int checked = !isEnabled() ? kColor : _state ? _bgcolorhi : _bgcolor;
fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, checked);
if(!_fillRect && isEnabled() && _state) // draw a cross
fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3, _textcolor);
*/
// Finally draw the label // Finally draw the label
fb.drawString(_font, _label, _x + 20, _y + _textY, _w, fb.drawString(_font, _label, _x + 20, _y + _textY, _w,
@ -556,8 +544,6 @@ SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
_type = kSliderWidget; _type = kSliderWidget;
_bgcolor = kDlgColor; _bgcolor = kDlgColor;
_bgcolorhi = kDlgColor; _bgcolorhi = kDlgColor;
_textcolor = kBtnColor;
_textcolorhi = kBtnColorHi;
if(!_label.empty() && _labelWidth == 0) if(!_label.empty() && _labelWidth == 0)
_labelWidth = _font->getStringWidth(_label); _labelWidth = _font->getStringWidth(_label);
@ -568,10 +554,6 @@ SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SliderWidget::setValue(int value) void SliderWidget::setValue(int value)
{ {
/*cerr << "SliderWidget::setValue: " << value
<< ", max = " << _valueMax
<< ", min = " << _valueMin
<< endl;*/
if(value < _valueMin) value = _valueMin; if(value < _valueMin) value = _valueMin;
else if(value > _valueMax) value = _valueMax; else if(value > _valueMax) value = _valueMax;
@ -679,12 +661,12 @@ void SliderWidget::drawWidget(bool hilite)
// Fill the box // Fill the box
fb.fillRect(_x + _labelWidth + 2, _y + 2, _w - _labelWidth - 4, _h - 4, fb.fillRect(_x + _labelWidth + 2, _y + 2, _w - _labelWidth - 4, _h - 4,
!isEnabled() ? kColor : kListColor); !isEnabled() ? kColor : kWidColor);
// Draw the 'bar' // Draw the 'bar'
fb.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, fb.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4,
!isEnabled() ? kColor : !isEnabled() ? kColor :
hilite ? _textcolorhi : _textcolor); hilite ? kSliderColorHi : kSliderColor);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Widget.hxx,v 1.56 2007-08-10 18:27:12 stephena Exp $ // $Id: Widget.hxx,v 1.57 2007-08-12 23:05:12 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -41,12 +41,11 @@ enum {
WIDGET_INVISIBLE = 1 << 1, WIDGET_INVISIBLE = 1 << 1,
WIDGET_HILITED = 1 << 2, WIDGET_HILITED = 1 << 2,
WIDGET_BORDER = 1 << 3, WIDGET_BORDER = 1 << 3,
WIDGET_INV_BORDER = 1 << 4, WIDGET_CLEARBG = 1 << 4,
WIDGET_CLEARBG = 1 << 5, WIDGET_TRACK_MOUSE = 1 << 5,
WIDGET_TRACK_MOUSE = 1 << 6, WIDGET_RETAIN_FOCUS = 1 << 6,
WIDGET_RETAIN_FOCUS = 1 << 7, WIDGET_WANTS_TAB = 1 << 7,
WIDGET_WANTS_TAB = 1 << 8, WIDGET_WANTS_RAWDATA = 1 << 8
WIDGET_WANTS_RAWDATA = 1 << 9
}; };
enum { enum {
@ -88,7 +87,7 @@ enum {
This is the base class for all widgets. This is the base class for all widgets.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Widget.hxx,v 1.56 2007-08-10 18:27:12 stephena Exp $ @version $Id: Widget.hxx,v 1.57 2007-08-12 23:05:12 stephena Exp $
*/ */
class Widget : public GuiObject class Widget : public GuiObject
{ {