From b5fb1d277d4d5dccdc2a5f8819627083fc4a70db Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 27 Mar 2005 03:07:34 +0000 Subject: [PATCH] Added Game Info Dialog. It basically lists all the relevant information in the stella.pro file for the particular game. Added Help Dialog, which gives a description of the most commonly used non-remappable commands. This still has to be adapted for OSX shortcuts. Finished the Sound Dialog. Still TODO is remove the requirement for restarting Stella before sound can be disabled. All that's left now are the Miscellaneous and Event Remapping Dialogs. The later will be the hardest, but it will also work a lot better than in previous versions of Stella. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@386 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/build/makefile | 11 +- stella/src/emucore/Console.cxx | 3 +- stella/src/gui/AudioDialog.cxx | 6 +- stella/src/gui/GameInfoDialog.cxx | 149 ++++++++++++++++++++++++++ stella/src/gui/GameInfoDialog.hxx | 69 ++++++++++++ stella/src/gui/GuiUtils.hxx | 12 ++- stella/src/gui/HelpDialog.cxx | 169 ++++++++++++++++++++++++++++++ stella/src/gui/HelpDialog.hxx | 64 +++++++++++ stella/src/gui/Menu.hxx | 16 ++- stella/src/gui/OptionsDialog.cxx | 27 ++--- stella/src/gui/OptionsDialog.hxx | 7 +- stella/src/gui/VideoDialog.cxx | 6 +- 12 files changed, 507 insertions(+), 32 deletions(-) create mode 100644 stella/src/gui/GameInfoDialog.cxx create mode 100644 stella/src/gui/GameInfoDialog.hxx create mode 100644 stella/src/gui/HelpDialog.cxx create mode 100644 stella/src/gui/HelpDialog.hxx diff --git a/stella/src/build/makefile b/stella/src/build/makefile index 3e87411c5..d71bbc39d 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.67 2005-03-26 19:26:47 stephena Exp $ +## $Id: makefile,v 1.68 2005-03-27 03:07:33 stephena Exp $ ##============================================================================ ##============================================================================ @@ -147,7 +147,8 @@ win32-gl: M6502_OBJS = D6502.o Device.o M6502.o M6502Low.o M6502Hi.o NullDev.o System.o GUI_OBJS = StellaFont.o Menu.o Widget.o PopUpWidget.o Dialog.o \ - OptionsDialog.o VideoDialog.o AudioDialog.o + OptionsDialog.o VideoDialog.o AudioDialog.o \ + GameInfoDialog.o HelpDialog.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 \ @@ -378,3 +379,9 @@ VideoDialog.o: $(GUI)/VideoDialog.cxx $(GUI)/VideoDialog.hxx AudioDialog.o: $(GUI)/AudioDialog.cxx $(GUI)/AudioDialog.hxx $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/AudioDialog.cxx + +GameInfoDialog.o: $(GUI)/GameInfoDialog.cxx $(GUI)/GameInfoDialog.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/GameInfoDialog.cxx + +HelpDialog.o: $(GUI)/HelpDialog.cxx $(GUI)/HelpDialog.hxx + $(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/HelpDialog.cxx diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index a152849b0..ef802ab39 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.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: Console.cxx,v 1.44 2005-03-26 19:26:47 stephena Exp $ +// $Id: Console.cxx,v 1.45 2005-03-27 03:07:33 stephena Exp $ //============================================================================ #include @@ -187,6 +187,7 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem) // Initialize the menuing system with updated values from the framebuffer myOSystem->menu().initialize(); + myOSystem->menu().setGameProfile(myProperties); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/AudioDialog.cxx b/stella/src/gui/AudioDialog.cxx index a952a5341..93b8561b9 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.1 2005-03-26 19:26:47 stephena Exp $ +// $Id: AudioDialog.cxx,v 1.2 2005-03-27 03:07:34 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -85,10 +85,10 @@ AudioDialog::AudioDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 // Add Defaults, OK and Cancel buttons addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0); #ifndef MAC_OSX - addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); + addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); #else - addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); + addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); #endif diff --git a/stella/src/gui/GameInfoDialog.cxx b/stella/src/gui/GameInfoDialog.cxx new file mode 100644 index 000000000..522e7b021 --- /dev/null +++ b/stella/src/gui/GameInfoDialog.cxx @@ -0,0 +1,149 @@ +//============================================================================ +// +// 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: GameInfoDialog.cxx,v 1.1 2005-03-27 03:07:34 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#include "OSystem.hxx" +#include "Props.hxx" +#include "Widget.hxx" +#include "Dialog.hxx" +#include "GameInfoDialog.hxx" +#include "GuiUtils.hxx" + +#include "bspf.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GameInfoDialog::GameInfoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, x, y, w, h), + myPage(1), + myNumPages(2) +{ + // Add Previous, Next and Close buttons + myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P'); + myNextButton = addButton((kButtonWidth + 15), h - 24, + "Next", kNextCmd, 'N'); + addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C'); + myPrevButton->clearFlags(WIDGET_ENABLED); + + myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter); + for(uInt8 i = 0; i < LINES_PER_PAGE; i++) + { + myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft); + myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 210, 16, "", kTextAlignLeft); + } + + displayInfo(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GameInfoDialog::~GameInfoDialog() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void GameInfoDialog::updateStrings(uInt8 page, uInt8 lines, + string& title, string*& key, string* &dsc) +{ + key = new string[lines]; + dsc = new string[lines]; + + uInt8 i = 0; + switch(page) + { + case 1: + title = "Common game properties"; + ADD_BIND("Name:", myGameProperties.get("Cartridge.Name")); + ADD_LINE; + ADD_BIND("Manufacturer:", myGameProperties.get("Cartridge.Manufacturer")); + ADD_BIND("Model:", myGameProperties.get("Cartridge.ModelNo")); + ADD_BIND("Rarity:", myGameProperties.get("Cartridge.Rarity")); + ADD_BIND("Note:", myGameProperties.get("Cartridge.Note")); + ADD_BIND("Type:", myGameProperties.get("Cartridge.Type")); + ADD_LINE; + ADD_BIND("MD5sum:", myGameProperties.get("Cartridge.MD5")); + break; + + case 2: + title = "Other game properties"; + ADD_BIND("TV Type:", myGameProperties.get("Console.TelevisionType")); + ADD_BIND("Left Controller:", myGameProperties.get("Controller.Left")); + ADD_BIND("Right Controller:", myGameProperties.get("Controller.Left")); + ADD_BIND("Format:", myGameProperties.get("Display.Format")); + ADD_BIND("XStart:", myGameProperties.get("Display.XStart")); + ADD_BIND("Width:", myGameProperties.get("Display.Width")); + ADD_BIND("YStart:", myGameProperties.get("Display.YStart")); + ADD_BIND("Height:", myGameProperties.get("Display.Height")); + ADD_BIND("CPU Type:", myGameProperties.get("Emulation.CPU")); + ADD_BIND("Use HMoveBlanks:", myGameProperties.get("Emulation.HmoveBlanks")); + break; + } + + while(i < lines) + ADD_LINE; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void GameInfoDialog::displayInfo() +{ + string titleStr, *keyStr, *dscStr; + + updateStrings(myPage, LINES_PER_PAGE, titleStr, keyStr, dscStr); + + myTitle->setLabel(titleStr); + for(uInt8 i = 0; i < LINES_PER_PAGE; i++) + { + myKey[i]->setLabel(keyStr[i]); + myDesc[i]->setLabel(dscStr[i]); + } + + delete[] keyStr; + delete[] dscStr; + + instance()->frameBuffer().refresh(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void GameInfoDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data) +{ + switch(cmd) + { + case kNextCmd: + myPage++; + if(myPage >= myNumPages) + myNextButton->clearFlags(WIDGET_ENABLED); + if(myPage >= 2) + myPrevButton->setFlags(WIDGET_ENABLED); + + displayInfo(); + break; + + case kPrevCmd: + myPage--; + if(myPage <= myNumPages) + myNextButton->setFlags(WIDGET_ENABLED); + if(myPage <= 1) + myPrevButton->clearFlags(WIDGET_ENABLED); + + displayInfo(); + break; + + default: + Dialog::handleCommand(sender, cmd, data); + } +} diff --git a/stella/src/gui/GameInfoDialog.hxx b/stella/src/gui/GameInfoDialog.hxx new file mode 100644 index 000000000..30925ec31 --- /dev/null +++ b/stella/src/gui/GameInfoDialog.hxx @@ -0,0 +1,69 @@ +//============================================================================ +// +// 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: GameInfoDialog.hxx,v 1.1 2005-03-27 03:07:34 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#ifndef GAME_INFO_DIALOG_HXX +#define GAME_INFO_DIALOG_HXX + +class CommandSender; +class ButtonWidget; +class StaticTextWidget; + +#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while(0) +#define ADD_TEXT(d) ADD_BIND("",d) +#define ADD_LINE ADD_BIND("","") + +#define LINES_PER_PAGE 10 + +#include "OSystem.hxx" +#include "Props.hxx" +#include "bspf.hxx" + +class GameInfoDialog : public Dialog +{ + public: + GameInfoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + ~GameInfoDialog(); + + void setGameProfile(Properties& props) { myGameProperties = props; } + + protected: + ButtonWidget* myNextButton; + ButtonWidget* myPrevButton; + + StaticTextWidget* myTitle; + StaticTextWidget* myKey[LINES_PER_PAGE]; + StaticTextWidget* myDesc[LINES_PER_PAGE]; + + uInt8 myPage; + uInt8 myNumPages; + + private: + virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); + virtual void updateStrings(uInt8 page, uInt8 lines, + string& title, string*& key, string* &dsc); + void displayInfo(); + void loadConfig() { displayInfo(); } + + private: + Properties myGameProperties; +}; + +#endif diff --git a/stella/src/gui/GuiUtils.hxx b/stella/src/gui/GuiUtils.hxx index 6d026f590..89c2d3550 100644 --- a/stella/src/gui/GuiUtils.hxx +++ b/stella/src/gui/GuiUtils.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: GuiUtils.hxx,v 1.4 2005-03-26 19:26:47 stephena Exp $ +// $Id: GuiUtils.hxx,v 1.5 2005-03-27 03:07:34 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,7 @@ Probably not very neat, but at least it works ... @author Stephen Anthony - @version $Id: GuiUtils.hxx,v 1.4 2005-03-26 19:26:47 stephena Exp $ + @version $Id: GuiUtils.hxx,v 1.5 2005-03-27 03:07:34 stephena Exp $ */ #define kLineHeight 12 @@ -45,9 +45,11 @@ enum OverlayColor { // The commands generated by various widgets enum { - kOKCmd = 'ok ', - kCloseCmd = 'clos', - kDefaultsCmd, + kOKCmd = 'OK ', + kCloseCmd = 'CLOS', + kNextCmd = 'NEXT', + kPrevCmd = 'PREV', + kDefaultsCmd = 'DEFA', kRendererChanged, kAspectRatioChanged, kFrameRateChanged, diff --git a/stella/src/gui/HelpDialog.cxx b/stella/src/gui/HelpDialog.cxx new file mode 100644 index 000000000..8916884a5 --- /dev/null +++ b/stella/src/gui/HelpDialog.cxx @@ -0,0 +1,169 @@ +//============================================================================ +// +// 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: HelpDialog.cxx,v 1.1 2005-03-27 03:07:34 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#include "OSystem.hxx" +#include "Widget.hxx" +#include "Dialog.hxx" +#include "HelpDialog.hxx" +#include "GuiUtils.hxx" + +#include "bspf.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +HelpDialog::HelpDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h) + : Dialog(osystem, x, y, w, h), + myPage(1), + myNumPages(4) +{ + // Add Previous, Next and Close buttons + myPrevButton = addButton(10, h - 24, "Previous", kPrevCmd, 'P'); + myNextButton = addButton((kButtonWidth + 15), h - 24, + "Next", kNextCmd, 'N'); + addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C'); + myPrevButton->clearFlags(WIDGET_ENABLED); + + myTitle = new StaticTextWidget(this, 0, 5, w, 16, "", kTextAlignCenter); + for(uInt8 i = 0; i < LINES_PER_PAGE; i++) + { + myKey[i] = new StaticTextWidget(this, 10, 18 + (10 * i), 80, 16, "", kTextAlignLeft); + myDesc[i] = new StaticTextWidget(this, 90, 18 + (10 * i), 210, 16, "", kTextAlignLeft); + } + + displayInfo(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +HelpDialog::~HelpDialog() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void HelpDialog::updateStrings(uInt8 page, uInt8 lines, + string& title, string*& key, string* &dsc) +{ + key = new string[lines]; + dsc = new string[lines]; + + uInt8 i = 0; + switch(page) // FIXME - change for OSX + { + case 1: + title = "Common commands:"; + ADD_BIND("Ctrl Q", "Quit emulation"); + ADD_BIND("Escape", "Exit current game"); + ADD_BIND("Tab", "Enter/exit configuration menu"); + ADD_LINE; + ADD_BIND("Alt =", "Increase window size"); + ADD_BIND("Alt -", "Decrease window size"); + ADD_BIND("Alt Enter", "Toggle fullscreen/windowed mode"); + ADD_LINE; + ADD_BIND("Alt ]", "Increase volume by 2%"); + ADD_BIND("Alt [", "Decrease volume by 2%"); + break; + + case 2: + title = "Special commands:"; + ADD_BIND("Ctrl g", "Grab mouse (keep in window)"); + ADD_BIND("Ctrl f", "Switch between NTSC and PAL"); + ADD_BIND("Ctrl s", "Save (or merge) game properties"); + ADD_LINE; + ADD_BIND("Ctrl 0", "Mouse emulates paddle 0"); + ADD_BIND("Ctrl 1", "Mouse emulates paddle 1"); + ADD_BIND("Ctrl 2", "Mouse emulates paddle 2"); + ADD_BIND("Ctrl 3", "Mouse emulates paddle 3"); + break; + + case 3: + title = "Developer commands:"; + ADD_BIND("Alt PageUp", "Increase Display.YStart"); + ADD_BIND("Alt PageDown", "Decrease Display.YStart"); + ADD_BIND("Ctrl PageUp", "Increase Display.Height"); + ADD_BIND("Ctrl PageDown", "Decrease Display.Height"); + ADD_BIND("Alt End", "Increase Display.XStart"); + ADD_BIND("Alt Home", "Decrease Display.XStart"); + ADD_BIND("Ctrl End", "Increase Display.Width"); + ADD_BIND("Ctrl Home", "Decrease Display.Width"); + break; + + case 4: + title = "All other commands:"; + ADD_LINE; + ADD_BIND("Remapped Events", ""); + ADD_TEXT("Most other commands can be"); + ADD_TEXT("remapped. Please consult the"); + ADD_TEXT("'Event Remapping' section"); + ADD_TEXT("for more information."); + break; + } + + while(i < lines) + ADD_LINE; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void HelpDialog::displayInfo() +{ + string titleStr, *keyStr, *dscStr; + + updateStrings(myPage, LINES_PER_PAGE, titleStr, keyStr, dscStr); + + myTitle->setLabel(titleStr); + for(uInt8 i = 0; i < LINES_PER_PAGE; i++) + { + myKey[i]->setLabel(keyStr[i]); + myDesc[i]->setLabel(dscStr[i]); + } + + delete[] keyStr; + delete[] dscStr; + + instance()->frameBuffer().refresh(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void HelpDialog::handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data) +{ + switch(cmd) + { + case kNextCmd: + myPage++; + if(myPage >= myNumPages) + myNextButton->clearFlags(WIDGET_ENABLED); + if(myPage >= 2) + myPrevButton->setFlags(WIDGET_ENABLED); + + displayInfo(); + break; + + case kPrevCmd: + myPage--; + if(myPage <= myNumPages) + myNextButton->setFlags(WIDGET_ENABLED); + if(myPage <= 1) + myPrevButton->clearFlags(WIDGET_ENABLED); + + displayInfo(); + break; + + default: + Dialog::handleCommand(sender, cmd, data); + } +} diff --git a/stella/src/gui/HelpDialog.hxx b/stella/src/gui/HelpDialog.hxx new file mode 100644 index 000000000..fa7c4679f --- /dev/null +++ b/stella/src/gui/HelpDialog.hxx @@ -0,0 +1,64 @@ +//============================================================================ +// +// 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: HelpDialog.hxx,v 1.1 2005-03-27 03:07:34 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#ifndef HELP_DIALOG_HXX +#define HELP_DIALOG_HXX + +class CommandSender; +class ButtonWidget; +class StaticTextWidget; + +#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while(0) +#define ADD_TEXT(d) ADD_BIND("",d) +#define ADD_LINE ADD_BIND("","") + +#define LINES_PER_PAGE 10 + +#include "OSystem.hxx" +#include "Props.hxx" +#include "bspf.hxx" + +class HelpDialog : public Dialog +{ + public: + HelpDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 h); + ~HelpDialog(); + + protected: + ButtonWidget* myNextButton; + ButtonWidget* myPrevButton; + + StaticTextWidget* myTitle; + StaticTextWidget* myKey[LINES_PER_PAGE]; + StaticTextWidget* myDesc[LINES_PER_PAGE]; + + uInt8 myPage; + uInt8 myNumPages; + + private: + virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); + virtual void updateStrings(uInt8 page, uInt8 lines, + string& title, string*& key, string* &dsc); + void displayInfo(); + void loadConfig() { displayInfo(); } +}; + +#endif diff --git a/stella/src/gui/Menu.hxx b/stella/src/gui/Menu.hxx index 3b9c15261..20ee03b48 100644 --- a/stella/src/gui/Menu.hxx +++ b/stella/src/gui/Menu.hxx @@ -13,20 +13,21 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Menu.hxx,v 1.4 2005-03-14 04:08:15 stephena Exp $ +// $Id: Menu.hxx,v 1.5 2005-03-27 03:07:34 stephena Exp $ //============================================================================ #ifndef MENU_HXX #define MENU_HXX -class Dialog; +class Properties; class OSystem; -class OptionsDialog; #include #include "Stack.hxx" #include "EventHandler.hxx" +#include "Dialog.hxx" +#include "OptionsDialog.hxx" #include "bspf.hxx" typedef FixedStack DialogStack; @@ -38,7 +39,7 @@ typedef FixedStack DialogStack; a stack, and handles their events. @author Stephen Anthony - @version $Id: Menu.hxx,v 1.4 2005-03-14 04:08:15 stephena Exp $ + @version $Id: Menu.hxx,v 1.5 2005-03-27 03:07:34 stephena Exp $ */ class Menu { @@ -110,6 +111,13 @@ class Menu */ void reStack(); + /** + Adds the specified game info to the appropriate menu item + + @param props The properties of the current game + */ + void setGameProfile(Properties& props) { myOptionsDialog->setGameProfile(props); } + private: OSystem* myOSystem; OptionsDialog* myOptionsDialog; diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 31e3b6eeb..f06e4d924 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.6 2005-03-26 19:26:47 stephena Exp $ +// $Id: OptionsDialog.cxx,v 1.7 2005-03-27 03:07:34 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -26,6 +26,8 @@ #include "Control.hxx" #include "VideoDialog.hxx" #include "AudioDialog.hxx" +#include "GameInfoDialog.hxx" +#include "HelpDialog.hxx" #include "OptionsDialog.hxx" #include "bspf.hxx" @@ -78,14 +80,19 @@ OptionsDialog::OptionsDialog(OSystem* osystem) w = 220; h = 120; checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); - myAudioDialog = new AudioDialog(myOSystem, x, y, w, h); + myAudioDialog = new AudioDialog(myOSystem, x, y, w, h); /* myEventMappingDialog = new EventMappingDialog(myOSystem); myMiscDialog = new MiscDialog(myOSystem); - myGameInfoDialog = new GameInfoDialog(myOSystem); - myHelpDialog = new HelpDialog(myOSystem); */ + w = 255; h = 150; + checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); + myGameInfoDialog = new GameInfoDialog(myOSystem, x, y, w, h); + + w = 255; h = 150; + checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); + myHelpDialog = new HelpDialog(myOSystem, x, y, w, h); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -93,12 +100,10 @@ OptionsDialog::~OptionsDialog() { delete myVideoDialog; delete myAudioDialog; -/* FIXME - delete myEventMappingDialog; - delete myMiscDialog; +// delete myEventMappingDialog; +// delete myMiscDialog; delete myGameInfoDialog; delete myHelpDialog; -*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -135,13 +140,11 @@ cerr << "push MiscDialog to top of stack\n"; break; case kInfoCmd: -// instance()->menu().addDialog(myGameInfoDialog); -cerr << "push GameInfoDialog to top of stack\n"; + instance()->menu().addDialog(myGameInfoDialog); break; case kHelpCmd: -// instance()->menu().addDialog(myHelpDialog); -cerr << "push HelpDialog to top of stack\n"; + instance()->menu().addDialog(myHelpDialog); break; default: diff --git a/stella/src/gui/OptionsDialog.hxx b/stella/src/gui/OptionsDialog.hxx index 4e31b3b06..b0aa1c9b9 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.2 2005-03-26 19:26:47 stephena Exp $ +// $Id: OptionsDialog.hxx,v 1.3 2005-03-27 03:07:34 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,16 +22,17 @@ #ifndef OPTIONS_DIALOG_HXX #define OPTIONS_DIALOG_HXX +class Properties; class CommandSender; class Dialog; class VideoDialog; class AudioDialog; class EventMappingDialog; class MiscDialog; -class GameInfoDialog; class HelpDialog; #include "OSystem.hxx" +#include "GameInfoDialog.hxx" #include "bspf.hxx" class OptionsDialog : public Dialog @@ -42,6 +43,8 @@ class OptionsDialog : public Dialog virtual void handleCommand(CommandSender* sender, uInt32 cmd, uInt32 data); + void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); } + protected: VideoDialog* myVideoDialog; AudioDialog* myAudioDialog; diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index 55745aca4..9d50975eb 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.4 2005-03-26 19:26:48 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.5 2005-03-27 03:07:34 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -131,10 +131,10 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16 // Add Defaults, OK and Cancel buttons addButton( 10, _h - 24, "Defaults", kDefaultsCmd, 0); #ifndef MAC_OSX - addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); + addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); #else - addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); + addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); #endif