diff --git a/stella/src/build/makefile b/stella/src/build/makefile index 4374650ae..678975bb0 100644 --- a/stella/src/build/makefile +++ b/stella/src/build/makefile @@ -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: makefile,v 1.76 2005-05-09 18:58:17 stephena Exp $ +## $Id: makefile,v 1.77 2005-05-10 19:20:38 stephena Exp $ ##============================================================================ ##============================================================================ @@ -159,7 +159,7 @@ GUI_OBJS = StellaFont.o Menu.o Launcher.o \ Widget.o PopUpWidget.o ScrollBarWidget.o ListWidget.o \ Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \ EventMappingDialog.o GameInfoDialog.o HelpDialog.o \ - LauncherDialog.o BrowserDialog.o + LauncherDialog.o BrowserDialog.o GameList.o CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \ CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \ @@ -426,3 +426,6 @@ LauncherDialog.o: $(GUI)/LauncherDialog.cxx $(GUI)/LauncherDialog.hxx BrowserDialog.o: $(GUI)/BrowserDialog.cxx $(GUI)/BrowserDialog.hxx $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/BrowserDialog.cxx + +GameList.o: $(GUI)/GameList.cxx $(GUI)/GameList.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/GameList.cxx diff --git a/stella/src/emucore/FSNode.cxx b/stella/src/emucore/FSNode.cxx index fa6895fcf..446be8700 100644 --- a/stella/src/emucore/FSNode.cxx +++ b/stella/src/emucore/FSNode.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: FSNode.cxx,v 1.1 2005-05-09 18:58:18 stephena Exp $ +// $Id: FSNode.cxx,v 1.2 2005-05-10 19:20:40 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -64,13 +64,11 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#ifdef MACOSX FilesystemNode::FilesystemNode(const string& p) { _realNode = getNodeForPath(p); _refCount = new int(1); } -#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNode::~FilesystemNode() diff --git a/stella/src/emucore/FSNode.hxx b/stella/src/emucore/FSNode.hxx index 98b43a7b8..7d4064554 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.1 2005-05-09 18:58:18 stephena Exp $ +// $Id: FSNode.hxx,v 1.2 2005-05-10 19:20:40 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -161,9 +161,7 @@ class FilesystemNode : public AbstractFilesystemNode public: FilesystemNode(); FilesystemNode(const FilesystemNode& node); -#ifdef MACOSX FilesystemNode(const string& path); -#endif ~FilesystemNode(); FilesystemNode &operator =(const FilesystemNode &node); @@ -195,7 +193,6 @@ class FilesystemNode : public AbstractFilesystemNode */ static AbstractFilesystemNode* getRoot(); -#ifdef MACOSX /* * Construct a node based on a path; the path is in the same format as it * would be for calls to fopen(). @@ -203,7 +200,6 @@ class FilesystemNode : public AbstractFilesystemNode * I.e. getNodeForPath(oldNode.path()) should create a new node identical to oldNode. */ static AbstractFilesystemNode* getNodeForPath(const string& path); -#endif }; #endif diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index a1e6261cb..5ef7087cb 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.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: FrameBuffer.hxx,v 1.30 2005-05-08 17:38:23 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.31 2005-05-10 19:20:40 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -41,7 +41,7 @@ class OSystem; All GUI elements (ala ScummVM) are drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.30 2005-05-08 17:38:23 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.31 2005-05-10 19:20:40 stephena Exp $ */ class FrameBuffer { @@ -135,7 +135,7 @@ class FrameBuffer */ void refresh(bool now = false) { - //cerr << "refresh() " << myNumRedraws++ << endl; +// cerr << "refresh() " << myNumRedraws++ << endl; theRedrawEntireFrameIndicator = true; myMenuRedraws = 2; if(now) drawMediaSource(); diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 27b872746..2feb50047 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.38 2005-05-06 18:38:59 stephena Exp $ +// $Id: Settings.cxx,v 1.39 2005-05-10 19:20:41 stephena Exp $ //============================================================================ #include @@ -59,6 +59,7 @@ Settings::Settings(OSystem* osystem) set("ssdir", "."); set("ssname", "romname"); set("sssingle", "false"); + set("romdir", ""); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/AudioDialog.cxx b/stella/src/gui/AudioDialog.cxx index 1dbcc5078..c434ef712 100644 --- a/stella/src/gui/AudioDialog.cxx +++ b/stella/src/gui/AudioDialog.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: AudioDialog.cxx,v 1.3 2005-04-28 19:28:33 stephena Exp $ +// $Id: AudioDialog.cxx,v 1.4 2005-05-10 19:20:42 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -41,8 +41,9 @@ enum { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -AudioDialog::AudioDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h) +AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h) { int yoff = 10, xoff = 30, diff --git a/stella/src/gui/AudioDialog.hxx b/stella/src/gui/AudioDialog.hxx index 453706aef..ce634fc48 100644 --- a/stella/src/gui/AudioDialog.hxx +++ b/stella/src/gui/AudioDialog.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: AudioDialog.hxx,v 1.1 2005-03-26 19:26:47 stephena Exp $ +// $Id: AudioDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -24,6 +24,7 @@ class CommandSender; class Dialog; +class DialogContainer; class PopUpWidget; class SliderWidget; class StaticTextWidget; @@ -35,7 +36,8 @@ class CheckboxWidget; class AudioDialog : public Dialog { public: - AudioDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + AudioDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~AudioDialog(); protected: diff --git a/stella/src/gui/BrowserDialog.cxx b/stella/src/gui/BrowserDialog.cxx index 43a48e200..c51da34c6 100644 --- a/stella/src/gui/BrowserDialog.cxx +++ b/stella/src/gui/BrowserDialog.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: BrowserDialog.cxx,v 1.1 2005-05-06 18:39:00 stephena Exp $ +// $Id: BrowserDialog.cxx,v 1.2 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -23,31 +23,125 @@ #include "Widget.hxx" #include "ListWidget.hxx" #include "Dialog.hxx" +#include "FSNode.hxx" #include "GuiUtils.hxx" -#include "Event.hxx" -#include "EventHandler.hxx" #include "BrowserDialog.hxx" #include "bspf.hxx" +enum { + kChooseCmd = 'CHOS', + kGoUpCmd = 'GOUP' +}; + +/* We want to use this as a general directory selector at some point... possible uses + * - to select the data dir for a game + * - to select the place where save games are stored + * - others??? + */ + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BrowserDialog::BrowserDialog(OSystem* osystem, uInt16 x, uInt16 y, - uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h) +BrowserDialog::BrowserDialog(OSystem* osystem, DialogContainer* parent, + const string& title, const string& startpath, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h), + _fileList(NULL), + _currentPath(NULL), + _startPath(startpath) { + // Headline - TODO: should be customizable during creation time + new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); + + // Current path - TODO: handle long paths ? + _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight, + "DUMMY", kTextAlignLeft); + + // Add file list + _fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10); + _fileList->setNumberingMode(kListNumberingOff); + _fileList->setEditable(false); + + // Buttons + addButton(10, _h - 24, "Go up", kGoUpCmd, 0); + addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); + addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0); + + // If no node has been set, or the last used one is now invalid, + // go back to the root/default dir. + if (_startPath != "") + _choice = FilesystemNode(_startPath); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BrowserDialog::~BrowserDialog() +void BrowserDialog::loadConfig() { -} + // If no node has been set, or the last used one is now invalid, + // go back to the root/default dir. + if (_choice.isValid()) + _node = _choice; + else if (!_node.isValid()) + _node = FilesystemNode(); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void BrowserDialog::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers) -{ + // Alway refresh file list + updateListing(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void BrowserDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data) { + switch (cmd) + { + case kChooseCmd: + { + // If nothing is selected in the list widget, choose the current dir. + // Else, choose the dir that is selected. + Int32 selection = _fileList->getSelected(); + if (selection >= 0) + _choice = _nodeContent[selection]; + else + _choice = _node; + + setResult(1); + close(); + break; + } + + case kGoUpCmd: + _node = _node.getParent(); + updateListing(); + break; + + case kListItemActivatedCmd: + case kListItemDoubleClickedCmd: + _node = _nodeContent[data]; + updateListing(); + break; + + default: + Dialog::handleCommand(sender, cmd, data); + break; + } +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void BrowserDialog::updateListing() +{ + // Update the path display + _currentPath->setLabel(_node.path()); + + // Read in the data from the file system + _nodeContent = _node.listDir(); + _nodeContent.sort(); + + // Populate the ListWidget + StringList list; + Int32 size = _nodeContent.size(); + for (Int32 i = 0; i < size; i++) + list.push_back(_nodeContent[i].displayName()); + + _fileList->setList(list); + _fileList->scrollTo(0); + + // Finally, redraw + draw(); } diff --git a/stella/src/gui/BrowserDialog.hxx b/stella/src/gui/BrowserDialog.hxx index 000ffc91c..2a73c6a18 100644 --- a/stella/src/gui/BrowserDialog.hxx +++ b/stella/src/gui/BrowserDialog.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: BrowserDialog.hxx,v 1.1 2005-05-06 18:39:00 stephena Exp $ +// $Id: BrowserDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,6 +22,7 @@ #ifndef BROWSER_DIALOG_HXX #define BROWSER_DIALOG_HXX +class DialogContainer; class CommandSender; class ButtonWidget; class StaticTextWidget; @@ -29,28 +30,30 @@ class ListWidget; #include "Dialog.hxx" #include "OSystem.hxx" +#include "FSNode.hxx" #include "bspf.hxx" class BrowserDialog : public Dialog { public: - BrowserDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); - ~BrowserDialog(); - - virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers); - - protected: - - private: - enum { - kStartMapCmd = 'map ', - kEraseCmd = 'eras', - kStopMapCmd = 'smap' - }; + BrowserDialog(OSystem* osystem, DialogContainer* parent, + const string& title, const string& startpath, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); + virtual void loadConfig(); virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); - private: + const FilesystemNode& getResult() { return _choice; } + + protected: + ListWidget* _fileList; + StaticTextWidget* _currentPath; + FilesystemNode _node; + FSList _nodeContent; + FilesystemNode _choice; + string _startPath; + + void updateListing(); }; #endif diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index 22a1bc8dd..babf487c8 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.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: Dialog.cxx,v 1.11 2005-04-24 20:36:36 stephena Exp $ +// $Id: Dialog.cxx,v 1.12 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -36,8 +36,9 @@ * ... */ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Dialog::Dialog(OSystem* instance, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : GuiObject(instance, x, y, w, h), +Dialog::Dialog(OSystem* instance, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : GuiObject(instance, parent, x, y, w, h), _mouseWidget(0), _focusedWidget(0), _dragWidget(0), @@ -99,7 +100,7 @@ void Dialog::close() } releaseFocus(); - instance()->menu().removeDialog(); + parent()->removeDialog(); _openCount = 0; } diff --git a/stella/src/gui/Dialog.hxx b/stella/src/gui/Dialog.hxx index 870714bfe..68d6d64e8 100644 --- a/stella/src/gui/Dialog.hxx +++ b/stella/src/gui/Dialog.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: Dialog.hxx,v 1.9 2005-05-04 19:04:46 stephena Exp $ +// $Id: Dialog.hxx,v 1.10 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -35,14 +35,15 @@ class DialogContainer; This is the base class for all dialog boxes. @author Stephen Anthony - @version $Id: Dialog.hxx,v 1.9 2005-05-04 19:04:46 stephena Exp $ + @version $Id: Dialog.hxx,v 1.10 2005-05-10 19:20:43 stephena Exp $ */ class Dialog : public GuiObject { friend class DialogContainer; public: - Dialog(OSystem* instance, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + Dialog(OSystem* instance, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); virtual ~Dialog(); diff --git a/stella/src/gui/EventMappingDialog.cxx b/stella/src/gui/EventMappingDialog.cxx index a2d6eb9eb..0880a89ff 100644 --- a/stella/src/gui/EventMappingDialog.cxx +++ b/stella/src/gui/EventMappingDialog.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: EventMappingDialog.cxx,v 1.7 2005-05-06 22:50:15 stephena Exp $ +// $Id: EventMappingDialog.cxx,v 1.8 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -31,9 +31,9 @@ #include "bspf.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EventMappingDialog::EventMappingDialog(OSystem* osystem, uInt16 x, uInt16 y, - uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h), +EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h), myActionSelected(-1), myRemapStatus(false) { diff --git a/stella/src/gui/EventMappingDialog.hxx b/stella/src/gui/EventMappingDialog.hxx index 2691541c8..24dcea76f 100644 --- a/stella/src/gui/EventMappingDialog.hxx +++ b/stella/src/gui/EventMappingDialog.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: EventMappingDialog.hxx,v 1.4 2005-04-06 23:47:08 stephena Exp $ +// $Id: EventMappingDialog.hxx,v 1.5 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,6 +22,7 @@ #ifndef EVENT_MAPPING_DIALOG_HXX #define EVENT_MAPPING_DIALOG_HXX +class DialogContainer; class CommandSender; class ButtonWidget; class StaticTextWidget; @@ -33,7 +34,8 @@ class ListWidget; class EventMappingDialog : public Dialog { public: - EventMappingDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + EventMappingDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~EventMappingDialog(); virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers); diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx index c2ea40a7b..42b54347b 100644 --- a/stella/src/gui/GameInfoDialog.cxx +++ b/stella/src/gui/GameInfoDialog.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: GameInfoDialog.cxx,v 1.3 2005-05-02 22:18:13 stephena Exp $ +// $Id: GameInfoDialog.cxx,v 1.4 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,8 +29,9 @@ #include "bspf.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GameInfoDialog::GameInfoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h), +GameInfoDialog::GameInfoDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h), myPage(1), myNumPages(2), myGameProperties(NULL) diff --git a/stella/src/gui/GameInfoDialog.hxx b/stella/src/gui/GameInfoDialog.hxx index d07c25140..f49f9f5e6 100644 --- a/stella/src/gui/GameInfoDialog.hxx +++ b/stella/src/gui/GameInfoDialog.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: GameInfoDialog.hxx,v 1.2 2005-05-02 19:36:05 stephena Exp $ +// $Id: GameInfoDialog.hxx,v 1.3 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,6 +22,7 @@ #ifndef GAME_INFO_DIALOG_HXX #define GAME_INFO_DIALOG_HXX +class DialogContainer; class CommandSender; class ButtonWidget; class StaticTextWidget; @@ -39,7 +40,8 @@ class StaticTextWidget; class GameInfoDialog : public Dialog { public: - GameInfoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + GameInfoDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~GameInfoDialog(); void setGameProfile(Properties& props) { myGameProperties = &props; } diff --git a/stella/src/gui/GameList.cxx b/stella/src/gui/GameList.cxx new file mode 100644 index 000000000..4c391969c --- /dev/null +++ b/stella/src/gui/GameList.cxx @@ -0,0 +1,41 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: GameList.cxx,v 1.1 2005-05-10 19:20:43 stephena Exp $ +// +// Copyright (C) 2005 by Stephen Anthony +// @author Stephen Anthony +//============================================================================ + +#include "GameList.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GameList::GameList() +{ +cerr << "GameList::GameList()\n"; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GameList::~GameList() +{ +cerr << "GameList::~GameList()\n"; + myArray.clear(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void GameList::sortByName() +{ +cerr << "GameList::sortByName()\n"; +} diff --git a/stella/src/gui/GameList.hxx b/stella/src/gui/GameList.hxx new file mode 100644 index 000000000..60bcfd749 --- /dev/null +++ b/stella/src/gui/GameList.hxx @@ -0,0 +1,53 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: GameList.hxx,v 1.1 2005-05-10 19:20:43 stephena Exp $ +// +// Based on code from KStella - Stella frontend +// Copyright (C) 2003-2005 Stephen Anthony +//============================================================================ + +#ifndef GAME_LIST_HXX +#define GAME_LIST_HXX + +#include "Array.hxx" +#include "bspf.hxx" + +/** + Holds the list of game info for the ROM launcher. +*/ +class GameList +{ + struct Entry { + string _rom; + string _md5; + string _name; + string _note; + }; + + typedef Array GameArray; + + public: + GameList(); + ~GameList(); + + void sortByName(); + GameArray& getList() { return myArray; } + + private: + GameArray myArray; +}; + +#endif diff --git a/stella/src/gui/GuiObject.hxx b/stella/src/gui/GuiObject.hxx index ba02f48f1..fa5820c37 100644 --- a/stella/src/gui/GuiObject.hxx +++ b/stella/src/gui/GuiObject.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: GuiObject.hxx,v 1.4 2005-03-14 04:08:15 stephena Exp $ +// $Id: GuiObject.hxx,v 1.5 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -23,6 +23,7 @@ #define GUI_OBJECT_HXX class OSystem; +class DialogContainer; class Widget; class Menu; @@ -33,7 +34,7 @@ class Menu; This is the base class for all GUI objects/widgets. @author Stephen Anthony - @version $Id: GuiObject.hxx,v 1.4 2005-03-14 04:08:15 stephena Exp $ + @version $Id: GuiObject.hxx,v 1.5 2005-05-10 19:20:43 stephena Exp $ */ class GuiObject : public CommandReceiver { @@ -41,8 +42,9 @@ class GuiObject : public CommandReceiver friend class Menu; public: - GuiObject(OSystem* osystem, int x, int y, int w, int h) + GuiObject(OSystem* osystem, DialogContainer* parent, int x, int y, int w, int h) : myOSystem(osystem), + myParent(parent), _x(x), _y(y), _w(w), @@ -50,6 +52,7 @@ class GuiObject : public CommandReceiver _firstWidget(0) { } OSystem* instance() { return myOSystem; } + DialogContainer* parent() { return myParent; } virtual Int16 getAbsX() const { return _x; } virtual Int16 getAbsY() const { return _y; } @@ -62,7 +65,8 @@ class GuiObject : public CommandReceiver virtual void draw() = 0; protected: - OSystem* myOSystem; + OSystem* myOSystem; + DialogContainer* myParent; Int16 _x, _y; uInt16 _w, _h; diff --git a/stella/src/gui/HelpDialog.cxx b/stella/src/gui/HelpDialog.cxx index 38398aa1e..a85afd935 100644 --- a/stella/src/gui/HelpDialog.cxx +++ b/stella/src/gui/HelpDialog.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: HelpDialog.cxx,v 1.3 2005-05-02 22:18:14 stephena Exp $ +// $Id: HelpDialog.cxx,v 1.4 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -28,8 +28,9 @@ #include "bspf.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -HelpDialog::HelpDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h), +HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h), myPage(1), myNumPages(4) { diff --git a/stella/src/gui/HelpDialog.hxx b/stella/src/gui/HelpDialog.hxx index fa7c4679f..6dde3fc95 100644 --- a/stella/src/gui/HelpDialog.hxx +++ b/stella/src/gui/HelpDialog.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: HelpDialog.hxx,v 1.1 2005-03-27 03:07:34 stephena Exp $ +// $Id: HelpDialog.hxx,v 1.2 2005-05-10 19:20:43 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,6 +22,7 @@ #ifndef HELP_DIALOG_HXX #define HELP_DIALOG_HXX +class DialogContainer; class CommandSender; class ButtonWidget; class StaticTextWidget; @@ -39,7 +40,8 @@ class StaticTextWidget; class HelpDialog : public Dialog { public: - HelpDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + HelpDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~HelpDialog(); protected: diff --git a/stella/src/gui/Launcher.cxx b/stella/src/gui/Launcher.cxx index b7ded5d40..5f60cbdbf 100644 --- a/stella/src/gui/Launcher.cxx +++ b/stella/src/gui/Launcher.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: Launcher.cxx,v 1.3 2005-05-09 18:58:19 stephena Exp $ +// $Id: Launcher.cxx,v 1.4 2005-05-10 19:20:43 stephena Exp $ //============================================================================ #include "OSystem.hxx" @@ -39,7 +39,8 @@ void Launcher::initialize() // We only create one instance of this dialog, since each time we do so, // the ROM listing is read from disk. This can be very expensive. if(myBaseDialog == NULL) - myBaseDialog = new LauncherDialog(myOSystem, 0, 0, kLauncherWidth, kLauncherHeight); + myBaseDialog = new LauncherDialog(myOSystem, this, + 0, 0, kLauncherWidth, kLauncherHeight); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/LauncherDialog.cxx b/stella/src/gui/LauncherDialog.cxx index 6de160876..27adadbeb 100644 --- a/stella/src/gui/LauncherDialog.cxx +++ b/stella/src/gui/LauncherDialog.cxx @@ -13,20 +13,20 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: LauncherDialog.cxx,v 1.5 2005-05-10 01:12:59 stephena Exp $ +// $Id: LauncherDialog.cxx,v 1.6 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project //============================================================================ #include "OSystem.hxx" +#include "Settings.hxx" #include "FSNode.hxx" #include "Widget.hxx" #include "ListWidget.hxx" #include "Dialog.hxx" +#include "DialogContainer.hxx" #include "GuiUtils.hxx" -#include "Event.hxx" -#include "EventHandler.hxx" #include "BrowserDialog.hxx" #include "LauncherDialog.hxx" @@ -48,11 +48,12 @@ enum { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, - uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h), +LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h), myList(NULL), - myBrowser(NULL) + myBrowser(NULL), + myGameList(NULL) { // Show game name new StaticTextWidget(this, 10, 8, _w - 20, kLineHeight, @@ -100,17 +101,22 @@ LauncherDialog::LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, } } */ - // En-/Disable the buttons depending on the list selection - updateButtons(); // Create file browser dialog -//FIXME myBrowser = new BrowserDialog("Select directory with game data"); + string romdir = instance()->settings().getString("romdir"); + myBrowser = new BrowserDialog(osystem, parent, "Select ROM directory", romdir, + 20, 20, _w - 40, _h - 40); + + // Create a game list, which contains all the information about a ROM that + // the launcher needs + myGameList = new GameList(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LauncherDialog::~LauncherDialog() { delete myBrowser; + delete myGameList; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -125,6 +131,9 @@ void LauncherDialog::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::close() { + // Save romdir specified by the browser + FilesystemNode dir(myBrowser->getResult()); + instance()->settings().setString("romdir", dir.path()); /* // Save last selection const int sel = _list->getSelected(); @@ -139,7 +148,7 @@ void LauncherDialog::close() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::updateListing() +void LauncherDialog::updateListing(bool full_reload) { cerr << "LauncherDialog::updateListing()\n"; @@ -147,19 +156,18 @@ cerr << "LauncherDialog::updateListing()\n"; // If so, we do a full reload from disk (takes quite some time). // Otherwise, we can use the cache file (which is much faster). // FIXME - actually implement the following code -/* - if(... ROM_DIR_CHANGED ...) +bool ROM_DIR_CHANGED = true; + + if(ROM_DIR_CHANGED) loadListFromDisk(); - else if( ... CACHE_FILE_EXISTS) - loadListFromCache(); +// else if( ... CACHE_FILE_EXISTS) +// loadListFromCache(); else // we have no other choice loadListFromDisk(); -*/ StringList l; - FilesystemNode t; - FilesystemNode dir(t);//"/local/emulators/atari/roms"); // FIXME + FilesystemNode dir(myBrowser->getResult()); FSList files = dir.listDir(FilesystemNode::kListAll); files.sort(); @@ -199,14 +207,6 @@ cerr << "LauncherDialog::updateListing()\n"; } */ myList->setList(l); - updateButtons(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::reloadListing() -{ -// FIXME - add bulk of KStella code here wrt loading from disk -cerr << "LauncherDialog::reloadListing()\n"; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -331,7 +331,6 @@ void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 dat if(myList->getSelected() >= 0) { string item = myList->getSelectedString(); - cerr << "Game selected: " << item << endl; instance()->createConsole(item); close(); } @@ -339,16 +338,15 @@ void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 dat } case kLocationCmd: - cerr << "kLocationCmd from LauncherDialog\n"; -// instance()->launcher().addDialog(myLocationDialog); + parent()->addDialog(myBrowser); break; case kReloadCmd: - reloadListing(); + updateListing(true); // force a reload from disk break; case kListSelectionChangedCmd: - cerr << "change note\n"; +// cerr << "change note\n"; break; case kQuitCmd: @@ -362,13 +360,11 @@ void LauncherDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 dat } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::updateButtons() +void LauncherDialog::loadListFromDisk() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::loadListFromCache() { -/* - bool enable = (myList->getSelected() >= 0); - if (enable != _startButton->isEnabled()) { - _startButton->setEnabled(enable); - _startButton->draw(); - } -*/ } diff --git a/stella/src/gui/LauncherDialog.hxx b/stella/src/gui/LauncherDialog.hxx index 41c78de8c..6c4fc48f1 100644 --- a/stella/src/gui/LauncherDialog.hxx +++ b/stella/src/gui/LauncherDialog.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: LauncherDialog.hxx,v 1.2 2005-05-10 01:12:59 stephena Exp $ +// $Id: LauncherDialog.hxx,v 1.3 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,12 +22,14 @@ #ifndef LAUNCHER_DIALOG_HXX #define LAUNCHER_DIALOG_HXX +class DialogContainer; class CommandSender; class ButtonWidget; class StaticTextWidget; class ListWidget; class BrowserDialog; +#include "GameList.hxx" #include "Dialog.hxx" #include "Launcher.hxx" #include "OSystem.hxx" @@ -36,15 +38,14 @@ class BrowserDialog; class LauncherDialog : public Dialog { public: - LauncherDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + LauncherDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~LauncherDialog(); virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); protected: - void updateListing(); - void reloadListing(); - void updateButtons(); + void updateListing(bool full_reload = false); void close(); virtual void addGame(); @@ -56,6 +57,11 @@ class LauncherDialog : public Dialog ListWidget* myList; BrowserDialog* myBrowser; StaticTextWidget* myNote; + GameList* myGameList; + + private: + void loadListFromDisk(); + void loadListFromCache(); }; #endif diff --git a/stella/src/gui/ListWidget.cxx b/stella/src/gui/ListWidget.cxx index 1fc33f7c1..949f6dfe8 100644 --- a/stella/src/gui/ListWidget.cxx +++ b/stella/src/gui/ListWidget.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: ListWidget.cxx,v 1.5 2005-05-04 19:04:46 stephena Exp $ +// $Id: ListWidget.cxx,v 1.6 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -165,9 +165,9 @@ void ListWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCoun drawCaret(true); } sendCommand(kListSelectionChangedCmd, _selectedItem); + _boss->instance()->frameBuffer().refresh(); } draw(); - _boss->instance()->frameBuffer().refresh(); } } @@ -184,7 +184,6 @@ void ListWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount) void ListWidget::handleMouseWheel(Int32 x, Int32 y, Int32 direction) { _scrollBar->handleMouseWheel(x, y, direction); - _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -336,6 +335,8 @@ bool ListWidget::handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers) sendCommand(kListSelectionChangedCmd, _selectedItem); // also draw scrollbar _scrollBar->draw(); + + _boss->instance()->frameBuffer().refresh(); } return handled; diff --git a/stella/src/gui/ListWidget.hxx b/stella/src/gui/ListWidget.hxx index 8b8386cd5..fb495ad9f 100644 --- a/stella/src/gui/ListWidget.hxx +++ b/stella/src/gui/ListWidget.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: ListWidget.hxx,v 1.1 2005-04-04 02:19:22 stephena Exp $ +// $Id: ListWidget.hxx,v 1.2 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -64,8 +64,8 @@ class ListWidget : public Widget, public CommandSender virtual void handleMouseDown(Int32 x, Int32 y, Int32 button, Int32 clickCount); virtual void handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount); virtual void handleMouseWheel(Int32 x, Int32 y, Int32 direction); - virtual void handleMouseEntered(Int32 button) { _scrollBar->handleMouseLeft(button); } - virtual void handleMouseLeft(Int32 button) { _scrollBar->handleMouseLeft(button); } + virtual void handleMouseEntered(Int32 button) {}; + virtual void handleMouseLeft(Int32 button) {}; virtual bool handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers); virtual bool handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers); virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); diff --git a/stella/src/gui/Menu.cxx b/stella/src/gui/Menu.cxx index d2b6fcefb..705bb2261 100644 --- a/stella/src/gui/Menu.cxx +++ b/stella/src/gui/Menu.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: Menu.cxx,v 1.8 2005-05-04 21:32:25 stephena Exp $ +// $Id: Menu.cxx,v 1.9 2005-05-10 19:20:44 stephena Exp $ //============================================================================ #include "Dialog.hxx" @@ -38,7 +38,7 @@ Menu::~Menu() void Menu::initialize() { delete myBaseDialog; - myBaseDialog = new OptionsDialog(myOSystem); + myBaseDialog = new OptionsDialog(myOSystem, this); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 4a434a9e4..d20c16f5e 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.cxx @@ -13,15 +13,15 @@ // 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.13 2005-05-01 18:57:21 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.14 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project //============================================================================ #include "OSystem.hxx" -#include "Menu.hxx" #include "Dialog.hxx" +#include "DialogContainer.hxx" #include "Widget.hxx" #include "Control.hxx" #include "VideoDialog.hxx" @@ -53,13 +53,14 @@ enum { new ButtonWidget(this, xoffset, yoffset, kBigButtonWidth, 18, label, cmd, hotkey); yoffset += kRowHeight // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -OptionsDialog::OptionsDialog(OSystem* osystem) +OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent) // FIXME - we have to initialize the video system at least once *before* // creating a new console. For now, just use predefined values. // Eventually, this subsystem will have to take into account screen size changes - : Dialog(osystem, (osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2, - (osystem->frameBuffer().baseHeight() - kMainMenuHeight)/2, - kMainMenuWidth, kMainMenuHeight), + : Dialog(osystem, parent, + (osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2, + (osystem->frameBuffer().baseHeight() - kMainMenuHeight)/2, + kMainMenuWidth, kMainMenuHeight), myVideoDialog(NULL) { int yoffset = 7; @@ -85,27 +86,27 @@ OptionsDialog::OptionsDialog(OSystem* osystem) // Now create all the dialogs attached to each menu button w = 230; h = 130; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myVideoDialog = new VideoDialog(myOSystem, x, y, w, h); + myVideoDialog = new VideoDialog(myOSystem, parent, x, y, w, h); w = 200; h = 100; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myAudioDialog = new AudioDialog(myOSystem, x, y, w, h); + myAudioDialog = new AudioDialog(myOSystem, parent, x, y, w, h); w = 280; h = 170; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myEventMappingDialog = new EventMappingDialog(myOSystem, x, y, w, h); + myEventMappingDialog = new EventMappingDialog(myOSystem, parent, x, y, w, h); // w = 250; h = 150; // checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); -// myMiscDialog = new MiscDialog(myOSystem, x, y, w, h); +// myMiscDialog = new MiscDialog(myOSystem, parent, x, y, w, h); w = 255; h = 150; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myGameInfoDialog = new GameInfoDialog(myOSystem, x, y, w, h); + myGameInfoDialog = new GameInfoDialog(myOSystem, parent, x, y, w, h); w = 255; h = 150; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myHelpDialog = new HelpDialog(myOSystem, x, y, w, h); + myHelpDialog = new HelpDialog(myOSystem, parent, x, y, w, h); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -135,28 +136,28 @@ void OptionsDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data switch(cmd) { case kVidCmd: - instance()->menu().addDialog(myVideoDialog); + parent()->addDialog(myVideoDialog); break; case kAudCmd: - instance()->menu().addDialog(myAudioDialog); + parent()->addDialog(myAudioDialog); break; case kEMapCmd: - instance()->menu().addDialog(myEventMappingDialog); + parent()->addDialog(myEventMappingDialog); break; case kMiscCmd: -// instance()->menu().addDialog(myMiscDialog); +// parent()->addDialog(myMiscDialog); cerr << "push MiscDialog to top of stack\n"; break; case kInfoCmd: - instance()->menu().addDialog(myGameInfoDialog); + parent()->addDialog(myGameInfoDialog); break; case kHelpCmd: - instance()->menu().addDialog(myHelpDialog); + parent()->addDialog(myHelpDialog); break; default: diff --git a/stella/src/gui/OptionsDialog.hxx b/stella/src/gui/OptionsDialog.hxx index 7350258fc..460352a03 100644 --- a/stella/src/gui/OptionsDialog.hxx +++ b/stella/src/gui/OptionsDialog.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: OptionsDialog.hxx,v 1.4 2005-03-28 00:04:54 stephena Exp $ +// $Id: OptionsDialog.hxx,v 1.5 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -25,6 +25,7 @@ class Properties; class CommandSender; class Dialog; +class DialogContainer; class VideoDialog; class AudioDialog; class EventMappingDialog; @@ -38,7 +39,7 @@ class HelpDialog; class OptionsDialog : public Dialog { public: - OptionsDialog(OSystem* osystem); + OptionsDialog(OSystem* osystem, DialogContainer* parent); ~OptionsDialog(); virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); diff --git a/stella/src/gui/PopUpWidget.cxx b/stella/src/gui/PopUpWidget.cxx index 24e3d8700..9dfa9ad69 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.4 2005-04-04 02:19:22 stephena Exp $ +// $Id: PopUpWidget.cxx,v 1.5 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -44,7 +44,7 @@ static uInt32 up_down_arrows[8] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PopUpDialog::PopUpDialog(PopUpWidget* boss, Int32 clickX, Int32 clickY) - : Dialog(boss->instance(), 0, 0, 16, 16), + : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), _popUpBoss(boss) { // Copy the selection index diff --git a/stella/src/gui/ScrollBarWidget.cxx b/stella/src/gui/ScrollBarWidget.cxx index 6c7763949..4b802aae0 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.2 2005-04-24 20:36:36 stephena Exp $ +// $Id: ScrollBarWidget.cxx,v 1.3 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -118,8 +118,6 @@ void ScrollBarWidget::handleMouseDown(Int32 x, Int32 y, Int32 button, // Make sure that _currentPos is still inside the bounds checkBounds(old_pos); - - _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -127,7 +125,6 @@ void ScrollBarWidget::handleMouseUp(Int32 x, Int32 y, Int32 button, Int32 clickCount) { _draggingPart = kNoPart; - _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -145,7 +142,6 @@ void ScrollBarWidget::handleMouseWheel(Int32 x, Int32 y, Int32 direction) // Make sure that _currentPos is still inside the bounds checkBounds(old_pos); - _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -186,9 +182,13 @@ void ScrollBarWidget::handleMouseMoved(Int32 x, Int32 y, Int32 button) _part = kSliderPart; if (old_part != _part) + { draw(); + + // Refresh the FB, since the selected part has changed + _boss->instance()->frameBuffer().refresh(); + } } - _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -222,7 +222,7 @@ void ScrollBarWidget::checkBounds(Int32 old_pos) if (old_pos != _currentPos) { - recalc(); + recalc(); // This takes care of the required refresh draw(); sendCommand(kSetPositionCmd, _currentPos); } @@ -247,6 +247,8 @@ void ScrollBarWidget::recalc() _sliderHeight = _h - 2 * UP_DOWN_BOX_HEIGHT; _sliderPos = UP_DOWN_BOX_HEIGHT; } + + _boss->instance()->frameBuffer().refresh(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index 2902e2f97..f4dd1180d 100644 --- a/stella/src/gui/VideoDialog.cxx +++ b/stella/src/gui/VideoDialog.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: VideoDialog.cxx,v 1.9 2005-05-05 00:10:49 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.10 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -40,8 +40,9 @@ enum { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) - : Dialog(osystem, x, y, w, h) +VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, parent, x, y, w, h) { int yoff = 10, xoff = 2, diff --git a/stella/src/gui/VideoDialog.hxx b/stella/src/gui/VideoDialog.hxx index fc640b8c1..c843dbd96 100644 --- a/stella/src/gui/VideoDialog.hxx +++ b/stella/src/gui/VideoDialog.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: VideoDialog.hxx,v 1.3 2005-03-26 19:26:48 stephena Exp $ +// $Id: VideoDialog.hxx,v 1.4 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -24,6 +24,7 @@ class CommandSender; class Dialog; +class DialogContainer; class PopUpWidget; class SliderWidget; class StaticTextWidget; @@ -35,7 +36,8 @@ class CheckboxWidget; class VideoDialog : public Dialog { public: - VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + VideoDialog(OSystem* osystem, DialogContainer* parent, + uInt16 x, uInt16 y, uInt16 w, uInt16 h); ~VideoDialog(); protected: diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index e067df2ed..4d13b035c 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.7 2005-04-04 02:19:22 stephena Exp $ +// $Id: Widget.cxx,v 1.8 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -31,7 +31,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Widget::Widget(GuiObject* boss, Int32 x, Int32 y, Int32 w, Int32 h) - : GuiObject(boss->instance(), x, y, w, h), + : GuiObject(boss->instance(), boss->parent(), x, y, w, h), _type(0), _boss(boss), _id(0), diff --git a/stella/src/unix/FSNodePOSIX.cxx b/stella/src/unix/FSNodePOSIX.cxx index 354d6e193..68307bd14 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.1 2005-05-09 18:58:19 stephena Exp $ +// $Id: FSNodePOSIX.cxx,v 1.2 2005-05-10 19:20:44 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -78,12 +78,10 @@ AbstractFilesystemNode* FilesystemNode::getRoot() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#ifdef MACOSX AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path) { return new POSIXFilesystemNode(path); } -#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POSIXFilesystemNode::POSIXFilesystemNode() diff --git a/stella/src/unix/SettingsUNIX.cxx b/stella/src/unix/SettingsUNIX.cxx index 5dac66e18..f965cb43d 100644 --- a/stella/src/unix/SettingsUNIX.cxx +++ b/stella/src/unix/SettingsUNIX.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: SettingsUNIX.cxx,v 1.11 2005-05-02 19:36:05 stephena Exp $ +// $Id: SettingsUNIX.cxx,v 1.12 2005-05-10 19:20:45 stephena Exp $ //============================================================================ #include @@ -48,8 +48,7 @@ SettingsUNIX::SettingsUNIX(OSystem* osystem) string systemConfigFile = "/etc/stellarc"; myOSystem->setConfigFiles(userConfigFile, systemConfigFile); - // This argument is only valid for Linux/UNIX, and will eventually - // be removed + // This argument is only valid for Linux/UNIX, and will eventually be removed set("accurate", "false"); }