Added right mouse button context menu to the ROM launcher. For now, it has

three entries:

1)  Override properties - temporarily override ROM properties, so that
    (for example) the left diff switch can be set to 'A' even if its
    property says to use 'B'.

2)  Filter ROM listing - still TODO.

3)  Reload ROM listing - functionality was already present with Ctrl-r;
    this just adds a UI element for it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1592 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-01-02 01:50:03 +00:00
parent 8f59c4a08e
commit 187bec7873
10 changed files with 389 additions and 21 deletions

View File

@ -25,11 +25,11 @@ X * Make UI 'font-sensitive' and remove all hardcoded dimensions for
* Add option to automatically save snapshots in 1X mode (useful for
RomInfoWidget)
* A way to override (possibly temporarily) all properties for a ROM, and
X * A way to override (possibly temporarily) all properties for a ROM, and
use global ones instead. Tied to the current developer commandline
options, but presented in a GUI (started from ROM launcher).
* Add infrastructure to show all info gathered from a ROM (similar to what
X * Add infrastructure to show all info gathered from a ROM (similar to what
is currently displayed on the commandline). Add a UI part for this, so
users aren't forced to use the commandline to see it.
@ -52,12 +52,10 @@ X * Make UI 'font-sensitive' and remove all hardcoded dimensions for
X (4) Reload current listing (possibly tied to a RMB context menu).
(5) Add commandline argument to toggle launcher use.
* Research lockups in Stay Frosty ROM. Test out sample state file in
AtariAge email.
* Fix issue with paddle support in Activision Bridge ROM.
* Fix issue with paddle support in Activision Casino ROM.
* More support for copy and paste.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: BrowserDialog.cxx,v 1.33 2009-01-01 18:13:38 stephena Exp $
// $Id: BrowserDialog.cxx,v 1.34 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -35,7 +35,6 @@
* - to select the data dir for a game
* - to select the place where save games are stored
* - others???
* TODO - make this dialog font sensitive
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.cxx,v 1.61 2009-01-01 18:13:38 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.62 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -52,6 +52,12 @@ GameInfoDialog::GameInfoDialog(
WidgetArray wid;
StringMap items, ports, ctrls;
////////////////////////////////////////////////////////////////////
// Some of the following items are also present in GlobalPropsDialog
// If any changes are ever made here, GlobalPropsDialog should also
// be updated accordingly
////////////////////////////////////////////////////////////////////
// The tab widget
xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, font, xpos, ypos, _w - 2*xpos,

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GameInfoDialog.hxx,v 1.35 2009-01-01 18:13:38 stephena Exp $
// $Id: GameInfoDialog.hxx,v 1.36 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -34,6 +34,7 @@ class SliderWidget;
#include "Dialog.hxx"
#include "Command.hxx"
#include "Props.hxx"
#include "StringList.hxx"
class GameInfoDialog : public Dialog, public CommandSender
{
@ -94,13 +95,13 @@ class GameInfoDialog : public Dialog, public CommandSender
kPPBlendChanged = 'PBch'
};
/** Game properties for currently loaded ROM */
// Game properties for currently loaded ROM
Properties myGameProperties;
/** Indicates that we've got a valid properties entry */
// Indicates that we've got a valid properties entry
bool myPropertiesLoaded;
/** Indicates that the default properties have been loaded */
// Indicates that the default properties have been loaded
bool myDefaultsSelected;
};

View File

@ -0,0 +1,240 @@
//============================================================================
//
// 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-2009 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalPropsDialog.cxx,v 1.1 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "bspf.hxx"
#include "Control.hxx"
#include "Dialog.hxx"
#include "OSystem.hxx"
#include "PopUpWidget.hxx"
#include "Settings.hxx"
#include "StringList.hxx"
#include "Widget.hxx"
#include "GlobalPropsDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalPropsDialog::
GlobalPropsDialog(GuiObject* boss, const GUI::Font& font, Settings& settings,
int x, int y, int w, int h)
: Dialog(&boss->instance(), &boss->parent(), x, y, w, h),
mySettings(settings)
{
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight(),
buttonWidth = font.getStringWidth("Defaults") + 20,
buttonHeight = font.getLineHeight() + 4;
int xpos, ypos;
int lwidth = font.getStringWidth("Right Difficulty: "),
pwidth = font.getStringWidth("SB (128-256k SUPERbanking)");
WidgetArray wid;
StringMap items;
xpos = 10; ypos = 10;
////////////////////////////////////////////////////////////////////
// The following items are also present in GameInfoDialog
// If any changes are ever made here, GameInfoDialog should also
// be updated accordingly
////////////////////////////////////////////////////////////////////
// Bankswitch type
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,
"Bankswitch type:", kTextAlignLeft);
items.clear();
items.push_back("Default", "DEFAULT");
items.push_back("Auto-detect", "AUTO-DETECT");
items.push_back("0840 (8K ECONObanking)", "0840" );
items.push_back("2K (2K Atari)", "2K" );
items.push_back("3E (32K Tigervision)", "3E" );
items.push_back("3F (512K Tigervision)", "3F" );
items.push_back("4A50 (64K 4A50 + ram)", "4A50" );
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("E0 (8K Parker Bros)", "E0" );
items.push_back("E7 (16K M-network)", "E7" );
items.push_back("F4 (32K Atari)", "F4" );
items.push_back("F4SC (32K Atari + ram)", "F4SC" );
items.push_back("F6 (16K Atari)", "F6" );
items.push_back("F6SC (16K Atari + ram)", "F6SC" );
items.push_back("F8 (8K Atari)", "F8" );
items.push_back("F8SC (8K Atari + ram)", "F8SC" );
items.push_back("FASC (CBS RAM Plus)", "FASC" );
items.push_back("FE (8K Decathlon)", "FE" );
items.push_back("MB (Dynacom Megaboy)", "MB" );
items.push_back("MC (C. Wilkson Megacart)", "MC" );
items.push_back("SB (128-256k SUPERbanking)", "SB" );
items.push_back("UA (8K UA Ltd.)", "UA" );
items.push_back("X07 (64K AtariAge)", "X07" );
myBSType = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myBSType);
ypos += lineHeight + 10;
// Left difficulty
pwidth = font.getStringWidth("Default");
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,
"Left Difficulty:", kTextAlignLeft);
items.clear();
items.push_back("Default", "DEFAULT");
items.push_back("B", "B");
items.push_back("A", "A");
myLeftDiff = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myLeftDiff);
ypos += lineHeight + 5;
// Right difficulty
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,
"Right Difficulty:", kTextAlignLeft);
// ... use same items as above
myRightDiff = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myRightDiff);
ypos += lineHeight + 5;
// TV type
new StaticTextWidget(this, font, xpos, ypos+1, lwidth, fontHeight,
"TV Type:", kTextAlignLeft);
items.clear();
items.push_back("Default", "DEFAULT");
items.push_back("Color", "COLOR");
items.push_back("B & W", "BLACKANDWHITE");
myTVType = new PopUpWidget(this, font, xpos+lwidth, ypos,
pwidth, lineHeight, items, "", 0, 0);
wid.push_back(myTVType);
ypos += lineHeight + 5;
xpos = 30; ypos += 10;
// Start with Select held down
myHoldSelect = new CheckboxWidget(this, font, xpos, ypos,
"Hold Select down");
wid.push_back(myHoldSelect);
ypos += lineHeight + 4;
// Start with Reset held down
myHoldReset = new CheckboxWidget(this, font, xpos, ypos,
"Hold Reset down");
wid.push_back(myHoldReset);
ypos += lineHeight + 4;
// Start with joy button 0 held down
myHoldButton0 = new CheckboxWidget(this, font, xpos, ypos,
"Hold Button 0 down");
wid.push_back(myHoldButton0);
// Add message concerning usage
lwidth = font.getStringWidth("(*) These changes are not saved");
new StaticTextWidget(this, font, 10, _h - 2*buttonHeight - 10, lwidth, fontHeight,
"(*) These changes are not saved", kTextAlignLeft);
// Add Defaults, OK and Cancel buttons
ButtonWidget* b;
b = new ButtonWidget(this, font, 10, _h - buttonHeight - 10,
buttonWidth, buttonHeight, "Defaults", kDefaultsCmd);
wid.push_back(b);
addOKCancelBGroup(wid, font);
addToFocusList(wid);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalPropsDialog::~GlobalPropsDialog()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::loadConfig()
{
myBSType->setSelected(mySettings.getString("bs"), "DEFAULT");
myLeftDiff->setSelected(mySettings.getString("ld"), "DEFAULT");
myRightDiff->setSelected(mySettings.getString("rd"), "DEFAULT");
myTVType->setSelected(mySettings.getString("tv"), "DEFAULT");
myHoldSelect->setState(mySettings.getBool("holdselect"));
myHoldReset->setState(mySettings.getBool("holdreset"));
myHoldButton0->setState(mySettings.getBool("holdbutton0"));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::saveConfig()
{
string s;
s = myBSType->getSelectedTag();
if(s == "DEFAULT") s = "";
mySettings.setString("bs", s);
s = myLeftDiff->getSelectedTag();
if(s == "DEFAULT") s = "";
mySettings.setString("ld", s);
s = myRightDiff->getSelectedTag();
if(s == "DEFAULT") s = "";
mySettings.setString("rd", s);
s = myTVType->getSelectedTag();
if(s == "DEFAULT") s = "";
mySettings.setString("tv", s);
mySettings.setBool("holdselect", myHoldSelect->getState());
mySettings.setBool("holdreset", myHoldReset->getState());
mySettings.setBool("holdbutton0", myHoldButton0->getState());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::setDefaults()
{
myBSType->setSelected("DEFAULT", "");
myLeftDiff->setSelected("DEFAULT", "");
myRightDiff->setSelected("DEFAULT", "");
myTVType->setSelected("DEFAULT", "");
myHoldSelect->setState(false);
myHoldReset->setState(false);
myHoldButton0->setState(false);
_dirty = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id)
{
switch(cmd)
{
case kOKCmd:
saveConfig();
close();
break;
case kDefaultsCmd:
setDefaults();
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
break;
}
}

View File

@ -0,0 +1,62 @@
//============================================================================
//
// 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-2009 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: GlobalPropsDialog.hxx,v 1.1 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#ifndef GLOBAL_PROPS_DIALOG_HXX
#define GLOBAL_PROPS_DIALOG_HXX
class CommandSender;
class DialogContainer;
class CheckboxWidget;
class PopUpWidget;
#include "OSystem.hxx"
#include "Dialog.hxx"
#include "Settings.hxx"
#include "bspf.hxx"
class GlobalPropsDialog : public Dialog
{
public:
GlobalPropsDialog(GuiObject* boss, const GUI::Font& font, Settings& settings,
int x, int y, int w, int h);
~GlobalPropsDialog();
private:
void loadConfig();
void saveConfig();
void setDefaults();
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
PopUpWidget* myBSType;
PopUpWidget* myLeftDiff;
PopUpWidget* myRightDiff;
PopUpWidget* myTVType;
CheckboxWidget* myHoldSelect;
CheckboxWidget* myHoldReset;
CheckboxWidget* myHoldButton0;
Settings& mySettings;
};
#endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherDialog.cxx,v 1.93 2009-01-01 18:13:38 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.94 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -24,12 +24,14 @@
#include "bspf.hxx"
#include "BrowserDialog.hxx"
#include "ContextMenu.hxx"
#include "DialogContainer.hxx"
#include "Dialog.hxx"
#include "FSNode.hxx"
#include "GameList.hxx"
#include "MD5.hxx"
#include "OptionsDialog.hxx"
#include "GlobalPropsDialog.hxx"
#include "OSystem.hxx"
#include "Props.hxx"
#include "PropsSet.hxx"
@ -52,6 +54,8 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myList(NULL),
myGameList(NULL),
myRomInfoWidget(NULL),
myMenu(NULL),
myGlobalProps(NULL),
mySelectedItem(0)
{
const GUI::Font& font = instance().launcherFont();
@ -158,6 +162,19 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
myGameList = new GameList();
addToFocusList(wid);
// Create context menu for ROM list options
StringMap l;
l.push_back("Override properties", "override");
l.push_back("Filter listing", "filter");
l.push_back("Reload listing", "reload");
myMenu = new ContextMenu(this, font, l);
// Create global props dialog, which is uses to to temporarily overrride
// ROM properties
myGlobalProps =
new GlobalPropsDialog(this, osystem->font(), osystem->settings(),
0, 0, 440, 270);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -165,6 +182,7 @@ LauncherDialog::~LauncherDialog()
{
delete myOptions;
delete myGameList;
delete myMenu;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -319,6 +337,25 @@ void LauncherDialog::loadRomInfo()
myRomInfoWidget->clearProperties();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleContextMenu()
{
const string& cmd = myMenu->getSelectedTag();
if(cmd == "override")
{
parent().addDialog(myGlobalProps);
}
else if(cmd == "filter")
{
cerr << "TODO: add dialog for this\n";
}
else if(cmd == "reload")
{
updateListing();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleKeyDown(int ascii, int keycode, int modifiers)
{
@ -330,6 +367,19 @@ void LauncherDialog::handleKeyDown(int ascii, int keycode, int modifiers)
Dialog::handleKeyDown(ascii, keycode, modifiers);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleMouseDown(int x, int y, int button, int clickCount)
{
// Grab right mouse button for context menu, send left to base class
if(button == 2)
{
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY());
}
else
Dialog::handleMouseDown(x, y, button, clickCount);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id)
@ -402,6 +452,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
updateListing();
break;
case kCMenuItemSelectedCmd:
handleContextMenu();
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: LauncherDialog.hxx,v 1.38 2009-01-01 18:13:38 stephena Exp $
// $Id: LauncherDialog.hxx,v 1.39 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -26,9 +26,11 @@
class ButtonWidget;
class CommandSender;
class ContextMenu;
class DialogContainer;
class GameList;
class OptionsDialog;
class GlobalPropsDialog;
class OSystem;
class Properties;
class RomInfoWidget;
@ -62,12 +64,19 @@ class LauncherDialog : public Dialog
protected:
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
void updateListing();
protected:
private:
void enableButtons(bool enable);
void loadDirListing();
void loadRomInfo();
void handleContextMenu();
private:
ButtonWidget* myStartButton;
ButtonWidget* myPrevDirButton;
ButtonWidget* myOptionsButton;
@ -82,12 +91,9 @@ class LauncherDialog : public Dialog
OptionsDialog* myOptions;
RomInfoWidget* myRomInfoWidget;
private:
void enableButtons(bool enable);
void loadDirListing();
void loadRomInfo();
ContextMenu* myMenu;
GlobalPropsDialog* myGlobalProps;
private:
int mySelectedItem;
int myRomInfoSize;
FilesystemNode myCurrentNode;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ListWidget.hxx,v 1.22 2009-01-01 18:13:38 stephena Exp $
// $Id: ListWidget.hxx,v 1.23 2009-01-02 01:50:03 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,6 +36,7 @@ enum {
kListItemDoubleClickedCmd = 'LIdb', // double click on item - 'data' will be item index
kListItemActivatedCmd = 'LIac', // item activated by return/enter - 'data' will be item index
kListItemDataChangedCmd = 'LIch', // item data changed - 'data' will be item index
kListItemRClickedCmd = 'LIrc', // right click on item - 'data' will be item index
kListSelectionChangedCmd = 'Lsch', // selection changed - 'data' will be item index
kListScrolledCmd = 'Lscl' // list scrolled - 'data' will be current position
};

View File

@ -16,6 +16,7 @@ MODULE_OBJS := \
src/gui/Font.o \
src/gui/GameInfoDialog.o \
src/gui/GameList.o \
src/gui/GlobalPropsDialog.o \
src/gui/HelpDialog.o \
src/gui/InputDialog.o \
src/gui/InputTextDialog.o \