From f49eb18079acbce8fe28feacd73e32593df5387e Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 7 Aug 2007 14:38:52 +0000 Subject: [PATCH] A few more tweaks to the new UI stuff. Removed older browsing mode where the listing is scanned by md5sum, since it wasn't really useful any more. Basically, the default is to now use 'rombrowse' mode, where the listing acts like an actual filesystem. Related to this, removed 'rombrowse', 'modtime' and 'lastrom' settings. Reworked the FileSnapDialog wrt the previous point. The rombrowse toggle button and 'Reload' button were no longer relevant. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1341 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/FSNode.hxx | 7 +- stella/src/emucore/FrameBuffer.cxx | 4 +- stella/src/emucore/OSystem.cxx | 7 +- stella/src/emucore/Settings.cxx | 16 ++--- stella/src/gp2x/FSNodeGP2X.cxx | 15 +--- stella/src/gui/EditableWidget.cxx | 4 +- stella/src/gui/FileSnapDialog.cxx | 111 +++++++---------------------- stella/src/gui/FileSnapDialog.hxx | 14 +--- stella/src/gui/OptionsDialog.cxx | 6 +- stella/src/gui/PopUpWidget.cxx | 4 +- stella/src/gui/ScrollBarWidget.cxx | 17 ++--- stella/src/gui/Widget.cxx | 20 +++++- stella/src/unix/FSNodePOSIX.cxx | 15 +--- stella/src/win32/FSNodeWin32.cxx | 17 +---- 14 files changed, 77 insertions(+), 180 deletions(-) diff --git a/stella/src/emucore/FSNode.hxx b/stella/src/emucore/FSNode.hxx index c57c69e32..bd80bd468 100644 --- a/stella/src/emucore/FSNode.hxx +++ b/stella/src/emucore/FSNode.hxx @@ -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: FSNode.hxx,v 1.11 2007-01-01 18:04:48 stephena Exp $ +// $Id: FSNode.hxx,v 1.12 2007-08-07 14:38:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -140,11 +140,6 @@ class AbstractFilesystemNode */ static bool makeDir(const string& path); - /** - Return a string representing the last modification time of this file/dir. - */ - static string modTime(const string& path); - /* TODO: bool isReadable(); bool isWriteable(); diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index b964b85d8..a6e2d9288 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -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.120 2007-07-31 15:46:20 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.121 2007-08-07 14:38:51 stephena Exp $ //============================================================================ #include @@ -569,7 +569,7 @@ void FrameBuffer::frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, break; case kDashLine: - unsigned int i, skip, lwidth = 0; + unsigned int i, skip, lwidth = 1; for(i = x, skip = 1; i < x+w-1; i=i+lwidth+1, ++skip) { diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 16d9c7007..0e5bcf66f 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.102 2007-08-06 21:32:10 stephena Exp $ +// $Id: OSystem.cxx,v 1.103 2007-08-07 14:38:51 stephena Exp $ //============================================================================ #include @@ -804,7 +804,7 @@ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = { 0x000000, // kTextColor 0x62a108, // kTextColorHi 0xc80000, // kTextColorEm - 0xe69d10, // kDlgColor + 0xc9af7c, // kDlgColor 0xf0f0cf, // kListColor 0xac3410, // kBtnColor 0xd55941, // kBtnColorHi @@ -815,9 +815,6 @@ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = { 0xc80000 // kWidColor }, -/* { 0x686868, 0xffe69c, 0x404040, 0xc8c8ff, 0x000000, 0x62a108, 0xc80000 }, */ - - // GP2X { 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x0000ff, 0xc80000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 8c83d0039..360860393 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -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: Settings.cxx,v 1.120 2007-07-27 13:49:16 stephena Exp $ +// $Id: Settings.cxx,v 1.121 2007-08-07 14:38:51 stephena Exp $ //============================================================================ #include @@ -76,18 +76,15 @@ Settings::Settings(OSystem* osystem) setInternal("sssingle", "false"); setInternal("romdir", ""); - setInternal("rombrowse", "true"); - setInternal("lastrom", ""); - setInternal("modtime", ""); - setInternal("debugheight", "0"); - setInternal("launcherres", "320x240"); - setInternal("uipalette", "0"); - setInternal("autoslot", "false"); - setInternal("statedir", ""); setInternal("cheatfile", ""); setInternal("palettefile", ""); setInternal("propsfile", ""); + + setInternal("debugheight", "0"); + setInternal("launcherres", "400x300"); + setInternal("uipalette", "0"); + setInternal("autoslot", "false"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -302,7 +299,6 @@ void Settings::usage() << " -p2speed Speed of emulated mouse movement for paddle 2 (0-100)\n" << " -p3speed Speed of emulated mouse movement for paddle 3 (0-100)\n" << " -pthresh Set threshold for eliminating paddle jitter\n" - << " -rombrowse <1|0> Use ROM browser mode (shows files and folders)\n" << " -autoslot <1|0> Automatically switch to next save slot when state saving\n" << " -ssdir The directory to save snapshot files to\n" << " -sssingle <1|0> Generate single snapshot instead of many\n" diff --git a/stella/src/gp2x/FSNodeGP2X.cxx b/stella/src/gp2x/FSNodeGP2X.cxx index b5781577d..70d62a179 100644 --- a/stella/src/gp2x/FSNodeGP2X.cxx +++ b/stella/src/gp2x/FSNodeGP2X.cxx @@ -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: FSNodeGP2X.cxx,v 1.4 2007-01-01 18:04:51 stephena Exp $ +// $Id: FSNodeGP2X.cxx,v 1.5 2007-08-07 14:38:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -227,16 +227,3 @@ bool AbstractFilesystemNode::makeDir(const string& path) { return mkdir(path.c_str(), 0777) == 0; } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string AbstractFilesystemNode::modTime(const string& path) -{ - struct stat st; - if(stat(path.c_str(), &st) != 0) - return ""; - - ostringstream buf; - buf << st.st_mtime; - - return buf.str(); -} diff --git a/stella/src/gui/EditableWidget.cxx b/stella/src/gui/EditableWidget.cxx index 39b0625cf..7ad21b094 100644 --- a/stella/src/gui/EditableWidget.cxx +++ b/stella/src/gui/EditableWidget.cxx @@ -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.22 2007-08-06 20:16:51 stephena Exp $ +// $Id: EditableWidget.cxx,v 1.23 2007-08-07 14:38:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -194,7 +194,7 @@ void EditableWidget::drawCaret() y += _y; FrameBuffer& fb = _boss->instance()->frameBuffer(); - fb.vLine(x, y+2, y + editRect.height() - 2, color); + fb.vLine(x, y+2, y + editRect.height() - 3, color); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/FileSnapDialog.cxx b/stella/src/gui/FileSnapDialog.cxx index 63b8725b3..0e0332304 100644 --- a/stella/src/gui/FileSnapDialog.cxx +++ b/stella/src/gui/FileSnapDialog.cxx @@ -13,18 +13,18 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FileSnapDialog.cxx,v 1.9 2007-07-27 13:49:16 stephena Exp $ +// $Id: FileSnapDialog.cxx,v 1.10 2007-08-07 14:38:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project //============================================================================ +#include "bspf.hxx" + #include "FSNode.hxx" #include "DialogContainer.hxx" #include "BrowserDialog.hxx" #include "EditTextWidget.hxx" -#include "TabWidget.hxx" -#include "bspf.hxx" #include "LauncherDialog.hxx" #include "FileSnapDialog.hxx" @@ -38,130 +38,90 @@ FileSnapDialog::FileSnapDialog( myBrowser(NULL), myIsGlobal(boss != 0) { - const int vBorder = 4; + const int vBorder = 8; int xpos, ypos, bwidth, bheight; WidgetArray wid; ButtonWidget* b; - int tabID; - bwidth = font.getStringWidth("Cancel") + 20; + bwidth = font.getStringWidth("Properties file:") + 20; bheight = font.getLineHeight() + 4; - // The tab widget - xpos = 2; ypos = vBorder; - myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos, _h - 2*bheight - ypos); - addTabWidget(myTab); - addFocusWidget(myTab); - - // 1) The browser settings tab - wid.clear(); - tabID = myTab->addTab("Browser Settings"); + xpos = vBorder; ypos = vBorder; // ROM path - xpos = 15; ypos += 5; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Path", + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Rom path:", kChooseRomDirCmd); wid.push_back(b); xpos += bwidth + 10; - myRomPath = new EditTextWidget(myTab, font, xpos, ypos + 2, + myRomPath = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(myRomPath); - // Use ROM browse mode - xpos = 30; ypos += myRomPath->getHeight() + 8; - myBrowseCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, - "Browse folders", kBrowseDirCmd); - wid.push_back(myBrowseCheckbox); - - // Reload current ROM listing - xpos += myBrowseCheckbox->getWidth() + 20; - myReloadButton = new ButtonWidget(myTab, font, xpos, ypos-2, - font.getStringWidth("Reload ROM Listing") + 20, - bheight, - "Reload ROM Listing", kReloadRomDirCmd); -// myReloadButton->setEditable(true); - wid.push_back(myReloadButton); - // ROM settings are disabled while in game mode if(!myIsGlobal) { - myTab->disableTab(0); - // TODO - until I get the above method working, we also need to - // disable the specific widgets ourself - myRomPath->clearFlags(WIDGET_ENABLED); - for(unsigned int i = 0; i < wid.size(); ++i) - wid[i]->clearFlags(WIDGET_ENABLED); + b->clearFlags(WIDGET_ENABLED); + myRomPath->setEditable(false); } - // Add focus widgets for ROM tab - addToFocusList(wid, tabID); - - // 2) The configuration files tab - wid.clear(); - tabID = myTab->addTab(" Config Files "); - - bwidth = font.getStringWidth("Properties file:") + 20; // State directory - xpos = 15; ypos = vBorder + 5; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "State path:", + xpos = vBorder; ypos += b->getHeight() + 3; + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "State path:", kChooseStateDirCmd); wid.push_back(b); xpos += bwidth + 10; - myStatePath = new EditTextWidget(myTab, font, xpos, ypos + 2, + myStatePath = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(myStatePath); // Cheat file - xpos = 15; ypos += b->getHeight() + 3; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Cheat file:", + xpos = vBorder; ypos += b->getHeight() + 3; + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cheat file:", kChooseCheatFileCmd); wid.push_back(b); xpos += bwidth + 10; - myCheatFile = new EditTextWidget(myTab, font, xpos, ypos + 2, + myCheatFile = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(myCheatFile); // Palette file - xpos = 15; ypos += b->getHeight() + 3; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Palette file:", + xpos = vBorder; ypos += b->getHeight() + 3; + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Palette file:", kChoosePaletteFileCmd); wid.push_back(b); xpos += bwidth + 10; - myPaletteFile = new EditTextWidget(myTab, font, xpos, ypos + 2, + myPaletteFile = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(myPaletteFile); // Properties file - xpos = 15; ypos += b->getHeight() + 3; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Properties file:", + xpos = vBorder; ypos += b->getHeight() + 3; + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Properties file:", kChoosePropsFileCmd); wid.push_back(b); xpos += bwidth + 10; - myPropsFile = new EditTextWidget(myTab, font, xpos, ypos + 2, + myPropsFile = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(myPropsFile); // Snapshot path - xpos = 15; ypos += b->getHeight() + 3; - b = new ButtonWidget(myTab, font, xpos, ypos, bwidth, bheight, "Snapshot path:", + xpos = vBorder; ypos += b->getHeight() + 3; + b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Snapshot path:", kChooseSnapDirCmd); wid.push_back(b); xpos += bwidth + 10; - mySnapPath = new EditTextWidget(myTab, font, xpos, ypos + 2, + mySnapPath = new EditTextWidget(this, font, xpos, ypos + 2, _w - xpos - 10, font.getLineHeight(), ""); wid.push_back(mySnapPath); // Snapshot single or multiple saves xpos = 30; ypos += mySnapPath->getHeight() + 8; - mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, + mySnapSingleCheckbox = new CheckboxWidget(this, font, xpos, ypos, "Multiple snapshots"); wid.push_back(mySnapSingleCheckbox); // Add focus widgets for Snapshot tab - addToFocusList(wid, tabID); - - // Activate the first tab - myTab->setActiveTab(0); + addToFocusList(wid); // Add OK & Cancel buttons wid.clear(); @@ -196,10 +156,6 @@ FileSnapDialog::~FileSnapDialog() void FileSnapDialog::loadConfig() { myRomPath->setEditString(instance()->settings().getString("romdir")); - bool b = instance()->settings().getBool("rombrowse"); - myBrowseCheckbox->setState(b); - myReloadButton->setEnabled(myIsGlobal && !b); - myStatePath->setEditString(instance()->stateDir()); myCheatFile->setEditString(instance()->cheatFile()); myPaletteFile->setEditString(instance()->paletteFile()); @@ -207,16 +163,12 @@ void FileSnapDialog::loadConfig() mySnapPath->setEditString(instance()->settings().getString("ssdir")); mySnapSingleCheckbox->setState(!instance()->settings().getBool("sssingle")); - - myTab->loadConfig(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FileSnapDialog::saveConfig() { instance()->settings().setString("romdir", myRomPath->getEditString()); - instance()->settings().setBool("rombrowse", myBrowseCheckbox->getState()); - instance()->settings().setString("statedir", myStatePath->getEditString()); instance()->settings().setString("cheatfile", myCheatFile->getEditString()); instance()->settings().setString("palettefile", myPaletteFile->getEditString()); @@ -251,10 +203,7 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd, saveConfig(); close(); if(myIsGlobal) - { - sendCommand(kBrowseChangedCmd, 0, 0); // Call this before refreshing ROMs sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed - } break; case kChooseRomDirCmd: @@ -329,12 +278,6 @@ void FileSnapDialog::handleCommand(CommandSender* sender, int cmd, break; } - case kReloadRomDirCmd: - { - sendCommand(kReloadRomDirCmd, 0, 0); - break; - } - default: Dialog::handleCommand(sender, cmd, data, 0); break; diff --git a/stella/src/gui/FileSnapDialog.hxx b/stella/src/gui/FileSnapDialog.hxx index aac929742..3e713cd39 100644 --- a/stella/src/gui/FileSnapDialog.hxx +++ b/stella/src/gui/FileSnapDialog.hxx @@ -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: FileSnapDialog.hxx,v 1.5 2007-07-27 13:49:16 stephena Exp $ +// $Id: FileSnapDialog.hxx,v 1.6 2007-08-07 14:38:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,6 @@ class BrowserDialog; class CheckboxWidget; class PopUpWidget; class EditTextWidget; -class TabWidget; #include "Dialog.hxx" #include "Command.hxx" @@ -59,24 +58,17 @@ class FileSnapDialog : public Dialog, public CommandSender kChooseCheatFileCmd = 'LOcf', // cheatfile (stella.cht) kChoosePaletteFileCmd = 'LOpf', // palette file (stella.pal) kChoosePropsFileCmd = 'LOpr', // properties file (stella.pro) - kChooseSnapDirCmd = 'LOsn', // snap select - kBrowseDirCmd = 'LObd', // browse mode + kChooseSnapDirCmd = 'LOsn', // snapshot dir kStateDirChosenCmd = 'LOsc', // state dir changed kCheatFileChosenCmd = 'LOcc', // cheatfile changed kPaletteFileChosenCmd = 'LOpc', // palette file changed kPropsFileChosenCmd = 'LOrc' // properties file changed }; - BrowserDialog* myBrowser; - TabWidget* myTab; - - // Rom path controls - EditTextWidget* myRomPath; - CheckboxWidget* myBrowseCheckbox; - ButtonWidget* myReloadButton; // Config paths + EditTextWidget* myRomPath; EditTextWidget* myStatePath; EditTextWidget* myCheatFile; EditTextWidget* myPaletteFile; diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 9cad07964..926522bbc 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OptionsDialog.cxx,v 1.54 2007-07-19 16:21:39 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.55 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -78,7 +78,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, b = addBigButton("UI Settings", kUsrIfaceCmd); wid.push_back(b); - myFileSnapButton = addBigButton("Files & Snapshots", kFileSnapCmd); + myFileSnapButton = addBigButton("Config Files", kFileSnapCmd); wid.push_back(myFileSnapButton); // Move to second column @@ -127,7 +127,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, w = 200; h = 105; myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h); - w = 280; h = 180; + w = 280; h = 170; myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font, boss, x, y, w, h); diff --git a/stella/src/gui/PopUpWidget.cxx b/stella/src/gui/PopUpWidget.cxx index 7bb9b87c2..de77a01f7 100644 --- a/stella/src/gui/PopUpWidget.cxx +++ b/stella/src/gui/PopUpWidget.cxx @@ -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.35 2007-08-06 21:32:10 stephena Exp $ +// $Id: PopUpWidget.cxx,v 1.36 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -86,7 +86,7 @@ void PopUpDialog::drawDialog() // The last entry may be empty. Fill it with black. if(_twoColumns && (count & 1)) fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1), - _w / 2 - 1, _popUpBoss->_fontHeight, _popUpBoss->_bgcolor); + _w / 2 - 1, _popUpBoss->_fontHeight, kListColor); _dirty = false; fb.addDirtyRect(_x, _y, _w, _h); diff --git a/stella/src/gui/ScrollBarWidget.cxx b/stella/src/gui/ScrollBarWidget.cxx index 22e189496..4678a4d2f 100644 --- a/stella/src/gui/ScrollBarWidget.cxx +++ b/stella/src/gui/ScrollBarWidget.cxx @@ -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.16 2007-01-01 18:04:54 stephena Exp $ +// $Id: ScrollBarWidget.cxx,v 1.17 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -69,6 +69,8 @@ ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; _type = kScrollBarWidget; + _bgcolor = kListColor; + _bgcolorhi = kListColor; _part = kNoPart; _sliderHeight = 0; @@ -262,24 +264,23 @@ void ScrollBarWidget::drawWidget(bool hilite) fb.frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, kColor); fb.drawBitmap(up_arrow, _x, _y, isSinglePage ? kColor : - (hilite && _part == kUpArrowPart) ? kTextColorHi : kTextColor); + (hilite && _part == kUpArrowPart) ? kBtnColorHi : kBtnColor); // Down arrow fb.frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, kColor); fb.drawBitmap(down_arrow, _x, bottomY - UP_DOWN_BOX_HEIGHT, isSinglePage ? kColor : - (hilite && _part == kDownArrowPart) ? kTextColorHi : kTextColor); + (hilite && _part == kDownArrowPart) ? kBtnColorHi : kBtnColor); // Slider if(!isSinglePage) { fb.fillRect(_x, _y + _sliderPos, _w, _sliderHeight, - (hilite && _part == kSliderPart) ? kTextColorHi : kTextColor); + (hilite && _part == kSliderPart) ? kBtnColorHi : kBtnColor); fb.frameRect(_x, _y + _sliderPos, _w, _sliderHeight, kColor); int y = _y + _sliderPos + _sliderHeight / 2; - int color = (hilite && _part == kSliderPart) ? kColor : kShadowColor; - fb.hLine(_x + 2, y - 2, _x + _w - 3, color); - fb.hLine(_x + 2, y, _x + _w - 3, color); - fb.hLine(_x + 2, y + 2, _x + _w - 3, color); + fb.hLine(_x + 2, y - 2, _x + _w - 3, kBtnFntColorHi); + fb.hLine(_x + 2, y, _x + _w - 3, kBtnFntColorHi); + fb.hLine(_x + 2, y + 2, _x + _w - 3, kBtnFntColorHi); } } diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index 50e1e1ce6..7f1a78f6e 100644 --- a/stella/src/gui/Widget.cxx +++ b/stella/src/gui/Widget.cxx @@ -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.51 2007-08-06 20:16:51 stephena Exp $ +// $Id: Widget.cxx,v 1.52 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -82,10 +82,20 @@ void Widget::draw() _x = getAbsX(); _y = getAbsY(); + +// fb.fillRect(_x+1, _y+1, _w-2, _h-2, + + // Clear background (unless alpha blending is enabled) if(_flags & WIDGET_CLEARBG) - fb.fillRect(_x, _y, _w, _h, - (_flags & WIDGET_HILITED) ? _bgcolorhi : _bgcolor); + { + int x = _x, y = _y, w = _w, h = _h; + if(_flags & WIDGET_BORDER) + { + x++; y++; w-=2; h-=2; + } + fb.fillRect(x, y, w, h, (_flags & WIDGET_HILITED) ? _bgcolorhi : _bgcolor); + } // Draw border if(_flags & WIDGET_BORDER) { @@ -644,6 +654,10 @@ void SliderWidget::drawWidget(bool hilite) // Draw the box fb.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor); + // Fill the box + fb.fillRect(_x + _labelWidth + 2, _y + 2, _w - _labelWidth - 4, _h - 4, + !isEnabled() ? kColor : kListColor); + // Draw the 'bar' fb.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, !isEnabled() ? kColor : diff --git a/stella/src/unix/FSNodePOSIX.cxx b/stella/src/unix/FSNodePOSIX.cxx index 075655ad9..803e70219 100644 --- a/stella/src/unix/FSNodePOSIX.cxx +++ b/stella/src/unix/FSNodePOSIX.cxx @@ -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: FSNodePOSIX.cxx,v 1.10 2007-01-01 18:04:55 stephena Exp $ +// $Id: FSNodePOSIX.cxx,v 1.11 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -231,16 +231,3 @@ bool AbstractFilesystemNode::makeDir(const string& path) { return mkdir(path.c_str(), 0777) == 0; } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string AbstractFilesystemNode::modTime(const string& path) -{ - struct stat st; - if(stat(path.c_str(), &st) != 0) - return ""; - - ostringstream buf; - buf << st.st_mtime; - - return buf.str(); -} diff --git a/stella/src/win32/FSNodeWin32.cxx b/stella/src/win32/FSNodeWin32.cxx index 9bf3a1563..a319b08c4 100644 --- a/stella/src/win32/FSNodeWin32.cxx +++ b/stella/src/win32/FSNodeWin32.cxx @@ -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: FSNodeWin32.cxx,v 1.10 2007-08-04 20:32:54 stephena Exp $ +// $Id: FSNodeWin32.cxx,v 1.11 2007-08-07 14:38:52 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -280,18 +280,3 @@ bool AbstractFilesystemNode::makeDir(const string& path) { return CreateDirectory(path.c_str(), NULL) != 0; } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string AbstractFilesystemNode::modTime(const string& path) -{ - WIN32_FILE_ATTRIBUTE_DATA attr; - BOOL b = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attr); - - if(b == 0) - return ""; - - ostringstream buf; - buf << attr.ftLastWriteTime.dwHighDateTime << attr.ftLastWriteTime.dwLowDateTime; - - return buf.str(); -}