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
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 <b>Alt/Shift-Cmd z, x, c, v, b, n</b> keys to enable/disable the
@ -272,7 +281,7 @@
further details.</li>
<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
automatically decide when to use this setting.</li>
@ -823,11 +832,6 @@
<td>Set "Display.Height" property (100 - 256).</td>
</tr>
<tr>
<td><pre>-cpu &lt;High|Low&gt;</pre></td>
<td>Set "Emulation.CPU" property.</td>
</tr>
<tr>
<td><pre>-hmove &lt;Yes|No&gt;</pre></td>
<td>Set "Emulation.HmoveBlanks" property.</td>
@ -1820,12 +1824,6 @@
100 &lt;= <i>n</i> &lt;= 256.</td>
</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>
<td VALIGN="TOP"><i>Emulation.HmoveBlanks:</i></td>
<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
// 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>
@ -711,8 +711,11 @@ void EventHandler::handleKeyEvent(int unicode, SDLKey key, SDLMod mod, uInt8 sta
else if (key >= SDLK_KP0 && key <= SDLK_KP9)
unicode = key - SDLK_KP0 + '0';
else if (key == SDLK_BACKSPACE || key == SDLK_DELETE ||
(key >= SDLK_UP && key <= SDLK_PAGEDOWN) ||
!unicode)
(key >= SDLK_UP && key <= SDLK_PAGEDOWN))
unicode = key;
else if (key >= SDLK_NUMLOCK && key <= SDLK_UNDO)
return;
else
unicode = key;
switch((int)myState)

View File

@ -13,53 +13,138 @@
// 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.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
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "DialogContainer.hxx"
#include "BrowserDialog.hxx"
#include "GuiUtils.hxx"
#include "OSystem.hxx"
#include "Props.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx"
#include "TabWidget.hxx"
#include "FSNode.hxx"
#include "bspf.hxx"
#include "LauncherDialog.hxx"
#include "LauncherOptionsDialog.hxx"
#include "GameInfoDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherOptionsDialog::LauncherOptionsDialog(
GameInfoDialog::GameInfoDialog(
OSystem* osystem, DialogContainer* parent, GuiObject* boss,
int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h),
CommandSender(boss),
myBrowser(NULL)
CommandSender(boss)
{
const GUI::Font& font = instance()->font();
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
const int vBorder = 4;
int xpos, ypos;
int xpos, ypos, lwidth, tabID;
WidgetArray wid;
// The tab widget
xpos = 2; ypos = vBorder;
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
// 1) The ROM locations tab
myTab->addTab("ROM Settings");
// 1) Cartridge properties
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 = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
kChooseRomDirCmd, 0);
xpos += kButtonWidth + 30;
myRomPath = new StaticTextWidget(myTab, xpos, ypos + 3,
_w - xpos - 10, kLineHeight,
"", kTextAlignLeft);
xpos = 10;
lwidth = font.getStringWidth("Manufacturer: ");
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
"Name:", kTextAlignLeft);
myName = new EditTextWidget(myTab, xpos+lwidth, ypos, 100, fontHeight, "");
wid.push_back(myName);
// 2) The snapshot settings tab
myTab->addTab(" Snapshot Settings ");
ypos += lineHeight + 3;
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
xpos = 15;
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
@ -80,6 +165,7 @@ LauncherOptionsDialog::LauncherOptionsDialog(
xpos = 30; ypos += 18;
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Multiple snapshots");
*/
// Activate the first tab
myTab->setActiveTab(0);
@ -92,22 +178,18 @@ LauncherOptionsDialog::LauncherOptionsDialog(
addButton(_w - 2 *(kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
#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;
bool b;
@ -127,13 +209,15 @@ void LauncherOptionsDialog::loadConfig()
b = instance()->settings().getBool("sssingle");
mySnapSingleCheckbox->setState(!b);
*/
myTab->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::saveConfig()
void GameInfoDialog::saveConfig()
{
cerr << "saveConfig()\n";
/*
string s;
bool b;
@ -151,30 +235,11 @@ void LauncherOptionsDialog::saveConfig()
// Flush changes to disk
instance()->settings().saveConfig();
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherOptionsDialog::openRomBrowser()
{
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,
void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id)
{
switch (cmd)
@ -182,31 +247,8 @@ void LauncherOptionsDialog::handleCommand(CommandSender* sender, int cmd,
case kOKCmd:
saveConfig();
close();
sendCommand(kRomDirChosenCmd, 0, 0); // Let the boss know romdir has changed
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:
Dialog::handleCommand(sender, cmd, data, 0);
break;

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.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
// Copyright (C) 2002-2004 The ScummVM project
@ -28,6 +28,7 @@ class EditTextWidget;
class PopUpWidget;
class StaticTextWidget;
class TabWidget;
class Properties;
#include "Dialog.hxx"
#include "Command.hxx"
@ -35,15 +36,15 @@ class TabWidget;
class GameInfoDialog : public Dialog, public CommandSender
{
public:
GameInfoDialog(OSystem* osystem, DialogContainer* parent,
GuiObject* boss,
GameInfoDialog(OSystem* osystem, DialogContainer* parent, GuiObject* boss,
int x, int y, int w, int h);
~GameInfoDialog();
virtual void loadConfig();
virtual void saveConfig();
void setGameProfile(Properties& props) { myGameProperties = &props; }
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:
TabWidget* myTab;
@ -53,24 +54,30 @@ class GameInfoDialog : public Dialog, public CommandSender
StaticTextWidget* myMD5;
EditTextWidget* myManufacturer;
EditTextWidget* myModelNo;
PopUpWidget* myRarity;
EditTextWidget* myNote;
PopupWidget* mySound;
PopupWidget* myType;
PopUpWidget* mySound;
PopUpWidget* myType;
// Console/controller properties
PopupWidget* myLeftDiff;
PopupWidget* myRightDiff;
PopupWidget* myTVType;
PopupWidget* myLeftController;
PopupWidget* myRightController;
PopUpWidget* myLeftDiff;
PopUpWidget* myRightDiff;
PopUpWidget* myTVType;
PopUpWidget* myLeftController;
PopUpWidget* myRightController;
// Display properties
PopupWidget* myFormat;
PopUpWidget* myFormat;
EditTextWidget* myXStart;
EditTextWidget* myWidth;
EditTextWidget* myYStart;
EditTextWidget* myHeight;
PopupWidget* myHmoveBlanks;
PopUpWidget* myHmoveBlanks;
Properties* myGameProperties;
ButtonWidget* myNextButton;
ButtonWidget* myPrevButton;
};
#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: 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
// 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.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
@ -55,6 +55,7 @@ enum {
kCloseCmd = 'CLOS',
kNextCmd = 'NEXT',
kPrevCmd = 'PREV',
kEditCmd = 'EDIT',
kDefaultsCmd = 'DEFA',
kSetPositionCmd = 'SETP',
kTabChangedCmd = 'TBCH',

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: 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
// Copyright (C) 2002-2004 The ScummVM project
@ -106,7 +106,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
w = 255; h = 150;
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;
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);