Second pass at editing properties in GameInfoDialog. It still doesn't

work, but at least it compiles.

Fixed bug whereby pressing modifier keys in GUI mode would sometimes
be interpreted (and printed) as regular keys).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@799 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-09-28 22:49:06 +00:00
parent b0c1c04598
commit bf108706ac
6 changed files with 162 additions and 111 deletions

View File

@ -244,6 +244,15 @@
a per-user 'user.pro' properties files. Changes made by the user a per-user 'user.pro' properties files. Changes made by the user
and stored in 'user.pro' are no longer erased when upgrading Stella.</li> and stored in 'user.pro' are no longer erased when upgrading Stella.</li>
<li>Added ability to edit current ROM properties from directly within
Stella, which can then be saved directly into the 'user.pro' file.
So creating a properties entry for a new ROM can be done without
any external tools.</li>
<li>Added cartridge 'frying', thanks to Fred "batari" Quimby. This
emulates the action of turning the power button on and off on a
real Atari, often resulting in some strange effects.</li>
<li>Added support for cartridges with 3E bankswitching format.</li> <li>Added support for cartridges with 3E bankswitching format.</li>
<li>Added <b>Alt/Shift-Cmd z, x, c, v, b, n</b> keys to enable/disable the <li>Added <b>Alt/Shift-Cmd z, x, c, v, b, n</b> keys to enable/disable the
@ -272,7 +281,7 @@
further details.</li> further details.</li>
<li>Removed <b>mergeprops</b> commandline argument, since there are now <li>Removed <b>mergeprops</b> commandline argument, since there are now
dedicated keys to do either save or merge game properties.</li> dedicated keys to either save or merge game properties.</li>
<li>Removed <b>hidecursor</b> commandline argument. Stella will now <li>Removed <b>hidecursor</b> commandline argument. Stella will now
automatically decide when to use this setting.</li> automatically decide when to use this setting.</li>
@ -823,11 +832,6 @@
<td>Set "Display.Height" property (100 - 256).</td> <td>Set "Display.Height" property (100 - 256).</td>
</tr> </tr>
<tr>
<td><pre>-cpu &lt;High|Low&gt;</pre></td>
<td>Set "Emulation.CPU" property.</td>
</tr>
<tr> <tr>
<td><pre>-hmove &lt;Yes|No&gt;</pre></td> <td><pre>-hmove &lt;Yes|No&gt;</pre></td>
<td>Set "Emulation.HmoveBlanks" property.</td> <td>Set "Emulation.HmoveBlanks" property.</td>
@ -1820,12 +1824,6 @@
100 &lt;= <i>n</i> &lt;= 256.</td> 100 &lt;= <i>n</i> &lt;= 256.</td>
</tr> </tr>
<tr>
<td VALIGN="TOP"><i>Emulation.CPU:</i></td>
<td>This property indicates the CPU emulation quality. The value of
this property must be High or Low.</td>
</tr>
<tr> <tr>
<td VALIGN="TOP"><i>Emulation.HmoveBlanks:</i></td> <td VALIGN="TOP"><i>Emulation.HmoveBlanks:</i></td>
<td>This property indicates whether the TIA HMOVE blank bug should be <td>This property indicates whether the TIA HMOVE blank bug should be

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.99 2005-09-25 23:14:00 urchlay Exp $ // $Id: EventHandler.cxx,v 1.100 2005-09-28 22:49:06 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -711,8 +711,11 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
else if (key >= SDLK_KP0 && key <= SDLK_KP9) else if (key >= SDLK_KP0 && key <= SDLK_KP9)
unicode = key - SDLK_KP0 + '0'; unicode = key - SDLK_KP0 + '0';
else if (key == SDLK_BACKSPACE || key == SDLK_DELETE || else if (key == SDLK_BACKSPACE || key == SDLK_DELETE ||
(key >= SDLK_UP && key <= SDLK_PAGEDOWN) || (key >= SDLK_UP && key <= SDLK_PAGEDOWN))
!unicode) unicode = key;
else if (key >= SDLK_NUMLOCK && key <= SDLK_UNDO)
return;
else
unicode = key; unicode = key;
switch((int)myState) switch((int)myState)

View File

@ -13,53 +13,138 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GameInfoDialog.cxx,v 1.11 2005-09-28 19:59:24 stephena Exp $ // $Id: GameInfoDialog.cxx,v 1.12 2005-09-28 22:49:06 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#include "DialogContainer.hxx" #include "GuiUtils.hxx"
#include "BrowserDialog.hxx" #include "OSystem.hxx"
#include "Props.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "TabWidget.hxx" #include "TabWidget.hxx"
#include "FSNode.hxx" #include "GameInfoDialog.hxx"
#include "bspf.hxx"
#include "LauncherDialog.hxx"
#include "LauncherOptionsDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherOptionsDialog::LauncherOptionsDialog( GameInfoDialog::GameInfoDialog(
OSystem* osystem, DialogContainer* parent, GuiObject* boss, OSystem* osystem, DialogContainer* parent, GuiObject* boss,
int x, int y, int w, int h) int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
CommandSender(boss), CommandSender(boss)
myBrowser(NULL)
{ {
const GUI::Font& font = instance()->font(); const GUI::Font& font = instance()->font();
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
const int vBorder = 4; const int vBorder = 4;
int xpos, ypos; int xpos, ypos, lwidth, tabID;
WidgetArray wid;
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos); myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
// 1) The ROM locations tab // 1) Cartridge properties
myTab->addTab("ROM Settings"); wid.clear();
tabID = myTab->addTab("Cartridge");
// myPrompt = new PromptWidget(myTab, 2, 2, widWidth, widHeight);
// myTab->setParentWidget(tabID, myPrompt);
// addToFocusList(myPrompt->getFocusList(), tabID);
// ROM path xpos = 10;
xpos = 15; lwidth = font.getStringWidth("Manufacturer: ");
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
kChooseRomDirCmd, 0); "Name:", kTextAlignLeft);
xpos += kButtonWidth + 30; myName = new EditTextWidget(myTab, xpos+lwidth, ypos, 100, fontHeight, "");
myRomPath = new StaticTextWidget(myTab, xpos, ypos + 3, wid.push_back(myName);
_w - xpos - 10, kLineHeight,
"", kTextAlignLeft);
// 2) The snapshot settings tab ypos += lineHeight + 3;
myTab->addTab(" Snapshot Settings "); new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"MD5:", kTextAlignLeft);
/*
myMD5 = new StaticTextWidget(myTab, xpos, ypos,
xpos+lwidth, fontHeight,
"HAHA!", kTextAlignLeft);
myMD5->setLabel("GAGA!");
*/
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Manufacturer:", kTextAlignLeft);
myManufacturer = new EditTextWidget(myTab, xpos+lwidth, ypos,
100, fontHeight, "");
wid.push_back(myManufacturer);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Model:", kTextAlignLeft);
myModelNo = new EditTextWidget(myTab, xpos+lwidth, ypos,
100, fontHeight, "");
wid.push_back(myModelNo);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Rarity:", kTextAlignLeft);
myRarity = new PopUpWidget(myTab, xpos+lwidth, ypos, 100, lineHeight,
"", 0, 0);
myRarity->appendEntry("(1) Common", 1);
myRarity->appendEntry("(2) Common+", 2);
myRarity->appendEntry("(3) Scarce", 3);
myRarity->appendEntry("(4) Scarce+", 4);
myRarity->appendEntry("(5) Rare", 5);
/*
myRarity->appendEntry("(6) Rare+", 6);
myRarity->appendEntry("(7) Very Rare", 7);
myRarity->appendEntry("(8) Very Rare+", 8);
myRarity->appendEntry("(9) Extremely Rare", 9);
myRarity->appendEntry("(10) Unbelievably Rare", 10);
myRarity->appendEntry("(H) Homebrew", 11);
myRarity->appendEntry("(R) Reproduction", 12);
myRarity->appendEntry("(P) Prototype", 13);
*/
wid.push_back(myRarity);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Note:", kTextAlignLeft);
myNote = new EditTextWidget(myTab, xpos+lwidth, ypos,
100, fontHeight, "");
wid.push_back(myNote);
/*
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Sound:", kTextAlignLeft);
mySound = new EditTextWidget(myTab, xpos+lwidth, ypos,
100, fontHeight, "");
wid.push_back(mySound);
ypos += lineHeight + 3;
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Type:", kTextAlignLeft);
myType = new EditTextWidget(myTab, xpos+lwidth, ypos,
100, fontHeight, "");
wid.push_back(myType);
*/
// Add items for tab 0
addToFocusList(wid, tabID);
// 2) Console/Controller properties
// myTab->addTab("Console");
// 3) Controller properties
// myTab->addTab("Controller");
// 4) Display properties
// myTab->addTab("Display");
/*
// Snapshot path // Snapshot path
xpos = 15; xpos = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path", new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
@ -80,6 +165,7 @@ LauncherOptionsDialog::LauncherOptionsDialog(
xpos = 30; ypos += 18; xpos = 30; ypos += 18;
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos, mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Multiple snapshots"); "Multiple snapshots");
*/
// Activate the first tab // Activate the first tab
myTab->setActiveTab(0); myTab->setActiveTab(0);
@ -92,22 +178,18 @@ LauncherOptionsDialog::LauncherOptionsDialog(
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#endif #endif
// Create file browser dialog
int baseW = instance()->frameBuffer().baseWidth();
int baseH = instance()->frameBuffer().baseHeight();
myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherOptionsDialog::~LauncherOptionsDialog() GameInfoDialog::~GameInfoDialog()
{ {
delete myBrowser;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::loadConfig() void GameInfoDialog::loadConfig()
{ {
cerr << "loadConfig()\n";
/*
string s; string s;
bool b; bool b;
@ -127,13 +209,15 @@ void LauncherOptionsDialog::loadConfig()
b = instance()->settings().getBool("sssingle"); b = instance()->settings().getBool("sssingle");
mySnapSingleCheckbox->setState(!b); mySnapSingleCheckbox->setState(!b);
*/
myTab->loadConfig(); myTab->loadConfig();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::saveConfig() void GameInfoDialog::saveConfig()
{ {
cerr << "saveConfig()\n";
/*
string s; string s;
bool b; bool b;
@ -151,30 +235,11 @@ void LauncherOptionsDialog::saveConfig()
// Flush changes to disk // Flush changes to disk
instance()->settings().saveConfig(); instance()->settings().saveConfig();
*/
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::openRomBrowser() void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
{
myBrowser->setTitle("Select ROM directory:");
myBrowser->setEmitSignal(kRomDirChosenCmd);
myBrowser->setStartPath(myRomPath->getLabel());
parent()->addDialog(myBrowser);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::openSnapBrowser()
{
myBrowser->setTitle("Select snapshot directory:");
myBrowser->setEmitSignal(kSnapDirChosenCmd);
myBrowser->setStartPath(mySnapPath->getLabel());
parent()->addDialog(myBrowser);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id) int data, int id)
{ {
switch (cmd) switch (cmd)
@ -182,31 +247,8 @@ void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd,
case kOKCmd: case kOKCmd:
saveConfig(); saveConfig();
close(); close();
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
break; break;
case kChooseRomDirCmd:
openRomBrowser();
break;
case kChooseSnapDirCmd:
openSnapBrowser();
break;
case kRomDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myRomPath->setLabel(dir.path());
break;
}
case kSnapDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
mySnapPath->setLabel(dir.path());
break;
}
default: default:
Dialog::handleCommand(sender, cmd, data, 0); Dialog::handleCommand(sender, cmd, data, 0);
break; break;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GameInfoDialog.hxx,v 1.8 2005-09-28 19:59:24 stephena Exp $ // $Id: GameInfoDialog.hxx,v 1.9 2005-09-28 22:49:06 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -28,6 +28,7 @@ class EditTextWidget;
class PopUpWidget; class PopUpWidget;
class StaticTextWidget; class StaticTextWidget;
class TabWidget; class TabWidget;
class Properties;
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Command.hxx" #include "Command.hxx"
@ -35,15 +36,15 @@ class TabWidget;
class GameInfoDialog : public Dialog, public CommandSender class GameInfoDialog : public Dialog, public CommandSender
{ {
public: public:
GameInfoDialog(OSystem* osystem, DialogContainer* parent, GameInfoDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss,
GuiObject* boss,
int x, int y, int w, int h); int x, int y, int w, int h);
~GameInfoDialog(); ~GameInfoDialog();
virtual void loadConfig(); void setGameProfile(Properties& props) { myGameProperties = &props; }
virtual void saveConfig();
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); void loadConfig();
void saveConfig();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private: private:
TabWidget* myTab; TabWidget* myTab;
@ -53,24 +54,30 @@ class GameInfoDialog : public Dialog, public CommandSender
StaticTextWidget* myMD5; StaticTextWidget* myMD5;
EditTextWidget* myManufacturer; EditTextWidget* myManufacturer;
EditTextWidget* myModelNo; EditTextWidget* myModelNo;
PopUpWidget* myRarity;
EditTextWidget* myNote; EditTextWidget* myNote;
PopupWidget* mySound; PopUpWidget* mySound;
PopupWidget* myType; PopUpWidget* myType;
// Console/controller properties // Console/controller properties
PopupWidget* myLeftDiff; PopUpWidget* myLeftDiff;
PopupWidget* myRightDiff; PopUpWidget* myRightDiff;
PopupWidget* myTVType; PopUpWidget* myTVType;
PopupWidget* myLeftController; PopUpWidget* myLeftController;
PopupWidget* myRightController; PopUpWidget* myRightController;
// Display properties // Display properties
PopupWidget* myFormat; PopUpWidget* myFormat;
EditTextWidget* myXStart; EditTextWidget* myXStart;
EditTextWidget* myWidth; EditTextWidget* myWidth;
EditTextWidget* myYStart; EditTextWidget* myYStart;
EditTextWidget* myHeight; EditTextWidget* myHeight;
PopupWidget* myHmoveBlanks; PopUpWidget* myHmoveBlanks;
Properties* myGameProperties;
ButtonWidget* myNextButton;
ButtonWidget* myPrevButton;
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $ // $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.19 2005-09-06 19:42:35 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.20 2005-09-28 22:49:06 stephena Exp $
*/ */
#define kFontHeight 10 #define kFontHeight 10
@ -55,6 +55,7 @@ enum {
kCloseCmd = 'CLOS', kCloseCmd = 'CLOS',
kNextCmd = 'NEXT', kNextCmd = 'NEXT',
kPrevCmd = 'PREV', kPrevCmd = 'PREV',
kEditCmd = 'EDIT',
kDefaultsCmd = 'DEFA', kDefaultsCmd = 'DEFA',
kSetPositionCmd = 'SETP', kSetPositionCmd = 'SETP',
kTabChangedCmd = 'TBCH', kTabChangedCmd = 'TBCH',

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: OptionsDialog.cxx,v 1.29 2005-09-26 19:10:37 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.30 2005-09-28 22:49:06 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -106,7 +106,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
w = 255; h = 150; w = 255; h = 150;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, x, y, w, h); myGameInfoDialog = new GameInfoDialog(myOSystem, parent, this, x, y, w, h);
w = 140; h = 40; w = 140; h = 40;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h); checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);