mirror of https://github.com/stella-emu/stella.git
Added all editable game properties to GameInfoDialog. At this point,
only the 'Cartridge' properties can be saved to user.pro, and only if you manually hit the merge keys (Alt-s). Once this is complete, the properties will be saved automatically when 'OK' is pressed, and a ROM reload will make those new properties take effect. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@801 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
9ba65abb12
commit
c6ac381c01
|
@ -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: SoundSDL.cxx,v 1.25 2005-09-10 16:19:20 bwmott Exp $
|
||||
// $Id: SoundSDL.cxx,v 1.26 2005-09-30 00:40:33 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
@ -103,7 +103,7 @@ void SoundSDL::initialize()
|
|||
desired.format = AUDIO_U16;
|
||||
#endif
|
||||
desired.channels = myNumChannels;
|
||||
desired.samples = fragsize;
|
||||
desired.samples = fragsize;
|
||||
desired.callback = callback;
|
||||
desired.userdata = (void*)this;
|
||||
|
||||
|
|
|
@ -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: DebuggerDialog.cxx,v 1.6 2005-09-20 19:09:10 stephena Exp $
|
||||
// $Id: DebuggerDialog.cxx,v 1.7 2005-09-30 00:40:33 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -192,6 +192,7 @@ void DebuggerDialog::addStatusArea()
|
|||
font.getLineHeight(), "");
|
||||
myMessageBox->setFont(font);
|
||||
myMessageBox->setEditable(false);
|
||||
myMessageBox->setColor(kTextColorEm);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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.72 2005-09-23 23:35:02 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.73 2005-09-30 00:40:33 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -190,17 +190,16 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
// Initialize the sound interface.
|
||||
// The # of channels can be overridden in the AudioDialog box or on
|
||||
// the commandline, but it can't be saved.
|
||||
uInt32 channels = myOSystem->settings().getInt("channels");
|
||||
if(channels == 0)
|
||||
{
|
||||
string s = myProperties.get("Cartridge.Sound", true);
|
||||
if(s == "STEREO")
|
||||
channels = 2;
|
||||
else if(s == "MONO")
|
||||
channels = 1;
|
||||
else
|
||||
channels = 1;
|
||||
}
|
||||
uInt32 channels;
|
||||
string s = myProperties.get("Cartridge.Sound", true);
|
||||
if(s == "STEREO")
|
||||
channels = 2;
|
||||
else if(s == "MONO")
|
||||
channels = 1;
|
||||
else
|
||||
channels = 1;
|
||||
|
||||
myOSystem->sound().close();
|
||||
myOSystem->sound().setChannels(channels);
|
||||
myOSystem->sound().setFrameRate(framerate);
|
||||
myOSystem->sound().initialize();
|
||||
|
|
|
@ -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: CheatCodeDialog.cxx,v 1.6 2005-09-26 19:10:37 stephena Exp $
|
||||
// $Id: CheatCodeDialog.cxx,v 1.7 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -38,7 +38,8 @@ enum {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
myErrorFlag(false)
|
||||
{
|
||||
const GUI::Font& font = instance()->font();
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
|
@ -85,6 +86,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
{
|
||||
// make sure "invalid code" isn't showing any more:
|
||||
myError->setLabel("");
|
||||
myErrorFlag = false;
|
||||
|
||||
// set up the cheat
|
||||
myCheat->enable();
|
||||
|
@ -96,11 +98,11 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
else // parse() returned 0 (null)
|
||||
{
|
||||
// cerr << "bad cheat code" << endl;
|
||||
myInput->setEditString("");
|
||||
|
||||
// show error message "invalid code":
|
||||
myInput->setEditString("");
|
||||
myError->setLabel("Invalid Code");
|
||||
myErrorFlag = true;
|
||||
|
||||
// not sure this does anything useful:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
|
@ -112,6 +114,15 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
instance()->eventHandler().leaveMenuMode();
|
||||
break;
|
||||
|
||||
case kEditChangedCmd:
|
||||
// Erase the invalid message once editing is restarted
|
||||
if(myErrorFlag)
|
||||
{
|
||||
myError->setLabel("");
|
||||
myErrorFlag = false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
|
|
|
@ -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: CheatCodeDialog.hxx,v 1.3 2005-09-26 19:10:37 stephena Exp $
|
||||
// $Id: CheatCodeDialog.hxx,v 1.4 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -54,6 +54,8 @@ class CheatCodeDialog : public Dialog
|
|||
StaticTextWidget* myError;
|
||||
EditTextWidget* myInput;
|
||||
// CheckboxWidget* myEnableCheat;
|
||||
|
||||
bool myErrorFlag;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.30 2005-09-29 18:50:51 stephena Exp $
|
||||
// $Id: Dialog.cxx,v 1.31 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -122,7 +122,7 @@ void Dialog::addToFocusList(WidgetArray& list, int id)
|
|||
|
||||
_ourFocusList[id].focusList.push_back(list);
|
||||
|
||||
if(list.size() > 0)
|
||||
if(list.size() > 0 && !(list[0]->getFlags() & WIDGET_NODRAW_FOCUS))
|
||||
_ourFocusList[id].focusedWidget = list[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -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: EditTextWidget.cxx,v 1.9 2005-08-11 19:12:39 stephena Exp $
|
||||
// $Id: EditTextWidget.cxx,v 1.10 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,6 +33,9 @@ EditTextWidget::EditTextWidget(GuiObject* boss, int x, int y, int w, int h,
|
|||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
||||
_type = kEditTextWidget;
|
||||
|
||||
if(text == "name")
|
||||
cerr << "EditTextWidget(): _x = " << _x << ", _y = " << _y << endl << endl;
|
||||
|
||||
setEditString(text);
|
||||
}
|
||||
|
||||
|
@ -68,6 +71,9 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EditTextWidget::drawWidget(bool hilite)
|
||||
{
|
||||
//cerr << "EditTextWidget::drawWidget(): (" << _editString << ") " << this << endl
|
||||
// << "_x = " << _x << ", _y = " << _y << endl << endl;
|
||||
|
||||
FrameBuffer& fb = _boss->instance()->frameBuffer();
|
||||
|
||||
// Draw a thin frame around us.
|
||||
|
@ -79,7 +85,7 @@ void EditTextWidget::drawWidget(bool hilite)
|
|||
// Draw the text
|
||||
adjustOffset();
|
||||
fb.drawString(_font, _editString, _x + 2, _y + 2, getEditRect().width(),
|
||||
kTextColor, kTextAlignLeft, -_editScrollOffset, false);
|
||||
_color, kTextAlignLeft, -_editScrollOffset, false);
|
||||
|
||||
// Draw the caret
|
||||
drawCaret();
|
||||
|
|
|
@ -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: EditableWidget.cxx,v 1.12 2005-09-29 18:50:51 stephena Exp $
|
||||
// $Id: EditableWidget.cxx,v 1.13 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -135,6 +135,7 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
if (tryInsertChar((char)ascii, _caretPos))
|
||||
{
|
||||
_caretPos++;
|
||||
sendCommand(kEditChangedCmd, ascii, _id);
|
||||
dirty = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -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: EditableWidget.hxx,v 1.6 2005-08-11 19:12:39 stephena Exp $
|
||||
// $Id: EditableWidget.hxx,v 1.7 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -26,8 +26,9 @@
|
|||
#include "Rect.hxx"
|
||||
|
||||
enum {
|
||||
kEditAcceptCmd = 'EDac',
|
||||
kEditCancelCmd = 'EDcl'
|
||||
kEditAcceptCmd = 'EDac',
|
||||
kEditCancelCmd = 'EDcl',
|
||||
kEditChangedCmd = 'EDch'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,12 +13,15 @@
|
|||
// 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.13 2005-09-29 18:50:51 stephena Exp $
|
||||
// $Id: GameInfoDialog.cxx,v 1.14 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
#include "GuiUtils.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Props.hxx"
|
||||
|
@ -42,6 +45,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
|
||||
const int vBorder = 4;
|
||||
int xpos, ypos, lwidth, fwidth, tabID;
|
||||
unsigned int i;
|
||||
WidgetArray wid;
|
||||
|
||||
// The tab widget
|
||||
|
@ -55,69 +59,107 @@ GameInfoDialog::GameInfoDialog(
|
|||
xpos = 10;
|
||||
lwidth = font.getStringWidth("Manufacturer: ");
|
||||
fwidth = _w - xpos - lwidth - 10;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Name:", kTextAlignLeft);
|
||||
myName = new EditTextWidget(myTab, xpos+lwidth, ypos, fwidth, fontHeight, "");
|
||||
wid.push_back(myName);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"MD5:", kTextAlignLeft);
|
||||
myMD5 = new StaticTextWidget(myTab, xpos+lwidth, ypos,
|
||||
fwidth, fontHeight,
|
||||
"", kTextAlignLeft);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, 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,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, 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,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Rarity:", kTextAlignLeft);
|
||||
myRarity = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
100, fontHeight, "");
|
||||
wid.push_back(myRarity);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Note:", kTextAlignLeft);
|
||||
myNote = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
fwidth, fontHeight, "");
|
||||
wid.push_back(myNote);
|
||||
|
||||
/*
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Sound:", kTextAlignLeft);
|
||||
mySound = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
100, fontHeight, "");
|
||||
mySound = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth("Stereo") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
mySound->appendEntry("Mono", 1);
|
||||
mySound->appendEntry("Stereo", 2);
|
||||
wid.push_back(mySound);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos, lwidth, fontHeight,
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Type:", kTextAlignLeft);
|
||||
myType = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
100, fontHeight, "");
|
||||
wid.push_back(myType);
|
||||
*/
|
||||
myType = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth("Auto-detect") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myType->appendEntry("Auto-detect", 1);
|
||||
myType->appendEntry("2K", 2);
|
||||
myType->appendEntry("3E", 3);
|
||||
wid.push_back(myType); // FIXME - add rest of types
|
||||
|
||||
// Add items for tab 0
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
|
||||
// 2) Console/Controller properties
|
||||
wid.clear();
|
||||
tabID = myTab->addTab("Console");
|
||||
|
||||
xpos = 10; ypos = vBorder;
|
||||
lwidth = font.getStringWidth("Right Difficulty: ");
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Left Difficulty:", kTextAlignLeft);
|
||||
myLeftDiff = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth(" ") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myLeftDiff->appendEntry("B", 1);
|
||||
myLeftDiff->appendEntry("A", 2);
|
||||
wid.push_back(myLeftDiff);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Right Difficulty:", kTextAlignLeft);
|
||||
myRightDiff = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth(" ") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myRightDiff->appendEntry("B", 1);
|
||||
myRightDiff->appendEntry("A", 2);
|
||||
wid.push_back(myRightDiff);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"TV Type:", kTextAlignLeft);
|
||||
myTVType = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth("B & W") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myTVType->appendEntry("Color", 1);
|
||||
myTVType->appendEntry("B & W", 2);
|
||||
wid.push_back(myTVType);
|
||||
|
||||
// Add items for tab 1
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
|
||||
|
@ -125,6 +167,29 @@ GameInfoDialog::GameInfoDialog(
|
|||
wid.clear();
|
||||
tabID = myTab->addTab("Controller");
|
||||
|
||||
xpos = 10; ypos = vBorder;
|
||||
lwidth = font.getStringWidth("Right Controller: ");
|
||||
fwidth = font.getStringWidth("Booster-Grip");
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Left Controller:", kTextAlignLeft);
|
||||
myLeftController = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
fwidth + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
for(i = 0; i < 5; ++i)
|
||||
myLeftController->appendEntry(ourControllerList[i].name, i+1);
|
||||
wid.push_back(myLeftController);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Right Controller:", kTextAlignLeft);
|
||||
myRightController = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
fwidth + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
for(i = 0; i < 5; ++i)
|
||||
myRightController->appendEntry(ourControllerList[i].name, i+1);
|
||||
wid.push_back(myRightController);
|
||||
|
||||
// Add items for tab 2
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
|
||||
|
@ -132,30 +197,58 @@ GameInfoDialog::GameInfoDialog(
|
|||
wid.clear();
|
||||
tabID = myTab->addTab("Display");
|
||||
|
||||
xpos = 10; ypos = vBorder;
|
||||
lwidth = font.getStringWidth("Use HMBlanks: ");
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Format:", kTextAlignLeft);
|
||||
myFormat = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth("NTSC") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myFormat->appendEntry("NTSC", 1);
|
||||
myFormat->appendEntry("PAL", 2);
|
||||
wid.push_back(myFormat);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"XStart:", kTextAlignLeft);
|
||||
myXStart = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
25, fontHeight, "");
|
||||
wid.push_back(myXStart);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Width:", kTextAlignLeft);
|
||||
myWidth = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
25, fontHeight, "");
|
||||
wid.push_back(myWidth);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"YStart:", kTextAlignLeft);
|
||||
myYStart = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
25, fontHeight, "");
|
||||
wid.push_back(myYStart);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Height:", kTextAlignLeft);
|
||||
myHeight = new EditTextWidget(myTab, xpos+lwidth, ypos,
|
||||
25, fontHeight, "");
|
||||
wid.push_back(myHeight);
|
||||
|
||||
ypos += lineHeight + 3;
|
||||
new StaticTextWidget(myTab, xpos, ypos+1, lwidth, fontHeight,
|
||||
"Use HMBlanks:", kTextAlignLeft);
|
||||
myHmoveBlanks = new PopUpWidget(myTab, xpos+lwidth, ypos,
|
||||
font.getStringWidth("Yes") + 15, lineHeight,
|
||||
"", 0, 0);
|
||||
myHmoveBlanks->appendEntry("Yes", 1);
|
||||
myHmoveBlanks->appendEntry("No", 2);
|
||||
wid.push_back(myHmoveBlanks);
|
||||
|
||||
// Add items for tab 3
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
/*
|
||||
// Snapshot path
|
||||
xpos = 15;
|
||||
new ButtonWidget(myTab, xpos, ypos, kButtonWidth + 14, 16, "Path",
|
||||
kChooseSnapDirCmd, 0);
|
||||
xpos += kButtonWidth + 30;
|
||||
mySnapPath = new StaticTextWidget(myTab, xpos, ypos + 3,
|
||||
_w - xpos - 10, kLineHeight,
|
||||
"", kTextAlignLeft);
|
||||
|
||||
// Snapshot save name
|
||||
xpos = 10; ypos += 22;
|
||||
mySnapTypePopup = new PopUpWidget(myTab, xpos, ypos, 140, kLineHeight,
|
||||
"Save snapshot as: ", 87, 0);
|
||||
mySnapTypePopup->appendEntry("romname", 1);
|
||||
mySnapTypePopup->appendEntry("md5sum", 2);
|
||||
|
||||
// Snapshot single or multiple saves
|
||||
xpos = 30; ypos += 18;
|
||||
mySnapSingleCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Multiple snapshots");
|
||||
*/
|
||||
|
||||
// Activate the first tab
|
||||
myTab->setActiveTab(0);
|
||||
|
@ -183,7 +276,9 @@ GameInfoDialog::~GameInfoDialog()
|
|||
void GameInfoDialog::loadConfig()
|
||||
{
|
||||
string s;
|
||||
int i;
|
||||
|
||||
// Cartridge properties
|
||||
s = myGameProperties->get("Cartridge.Name");
|
||||
myName->setEditString(s);
|
||||
|
||||
|
@ -202,15 +297,96 @@ void GameInfoDialog::loadConfig()
|
|||
s = myGameProperties->get("Cartridge.Note");
|
||||
myNote->setEditString(s);
|
||||
|
||||
/*
|
||||
s = instance()->settings().getString("ssname");
|
||||
if(s == "romname")
|
||||
mySnapTypePopup->setSelectedTag(1);
|
||||
else if(s == "md5sum")
|
||||
mySnapTypePopup->setSelectedTag(2);
|
||||
s = myGameProperties->get("Cartridge.Sound", true);
|
||||
if(s == "MONO")
|
||||
mySound->setSelectedTag(1);
|
||||
else if(s == "STEREO")
|
||||
mySound->setSelectedTag(2);
|
||||
else
|
||||
mySnapTypePopup->setSelectedTag(0);
|
||||
*/
|
||||
mySound->setSelectedTag(0);
|
||||
|
||||
// FIXME - add type properties
|
||||
|
||||
// Console properties
|
||||
s = myGameProperties->get("Console.LeftDifficulty", true);
|
||||
if(s == "B")
|
||||
myLeftDiff->setSelectedTag(1);
|
||||
else if(s == "A")
|
||||
myLeftDiff->setSelectedTag(2);
|
||||
else
|
||||
myLeftDiff->setSelectedTag(0);
|
||||
|
||||
s = myGameProperties->get("Console.RightDifficulty", true);
|
||||
if(s == "B")
|
||||
myRightDiff->setSelectedTag(1);
|
||||
else if(s == "A")
|
||||
myRightDiff->setSelectedTag(2);
|
||||
else
|
||||
myRightDiff->setSelectedTag(0);
|
||||
|
||||
s = myGameProperties->get("Console.RightDifficulty", true);
|
||||
if(s == "B")
|
||||
myRightDiff->setSelectedTag(1);
|
||||
else if(s == "A")
|
||||
myRightDiff->setSelectedTag(2);
|
||||
else
|
||||
myRightDiff->setSelectedTag(0);
|
||||
|
||||
s = myGameProperties->get("Console.TelevisionType", true);
|
||||
if(s == "COLOR")
|
||||
myTVType->setSelectedTag(1);
|
||||
else if(s == "BLACKANDWHITE")
|
||||
myTVType->setSelectedTag(2);
|
||||
else
|
||||
myTVType->setSelectedTag(0);
|
||||
|
||||
// Controller properties
|
||||
s = myGameProperties->get("Controller.Left", true);
|
||||
for(i = 0; i < 5; ++i)
|
||||
{
|
||||
if(s == ourControllerList[i].comparitor)
|
||||
break;
|
||||
}
|
||||
i = (i == 5) ? 0: i + 1;
|
||||
myLeftController->setSelectedTag(i);
|
||||
|
||||
s = myGameProperties->get("Controller.Right", true);
|
||||
for(i = 0; i < 5; ++i)
|
||||
{
|
||||
if(s == ourControllerList[i].comparitor)
|
||||
break;
|
||||
}
|
||||
i = (i == 5) ? 0: i + 1;
|
||||
myRightController->setSelectedTag(i);
|
||||
|
||||
// Display properties
|
||||
s = myGameProperties->get("Display.Format", true);
|
||||
if(s == "NTSC")
|
||||
myFormat->setSelectedTag(1);
|
||||
else if(s == "PAL")
|
||||
myFormat->setSelectedTag(2);
|
||||
else
|
||||
myFormat->setSelectedTag(0);
|
||||
|
||||
s = myGameProperties->get("Display.XStart");
|
||||
myXStart->setEditString(s);
|
||||
|
||||
s = myGameProperties->get("Display.Width");
|
||||
myWidth->setEditString(s);
|
||||
|
||||
s = myGameProperties->get("Display.YStart");
|
||||
myYStart->setEditString(s);
|
||||
|
||||
s = myGameProperties->get("Display.Height");
|
||||
myHeight->setEditString(s);
|
||||
|
||||
s = myGameProperties->get("Emulation.HmoveBlanks", true);
|
||||
if(s == "YES")
|
||||
myHmoveBlanks->setSelectedTag(1);
|
||||
else if(s == "NO")
|
||||
myHmoveBlanks->setSelectedTag(2);
|
||||
else
|
||||
myHmoveBlanks->setSelectedTag(0);
|
||||
|
||||
myTab->loadConfig();
|
||||
}
|
||||
|
@ -218,26 +394,33 @@ void GameInfoDialog::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void GameInfoDialog::saveConfig()
|
||||
{
|
||||
cerr << "saveConfig()\n";
|
||||
/*
|
||||
string s;
|
||||
bool b;
|
||||
int i;
|
||||
|
||||
s = myRomPath->getLabel();
|
||||
instance()->settings().setString("romdir", s);
|
||||
// Cartridge properties
|
||||
s = myName->getEditString();
|
||||
myGameProperties->set("Cartridge.Name", s);
|
||||
|
||||
s = mySnapPath->getLabel();
|
||||
instance()->settings().setString("ssdir", s);
|
||||
s = myManufacturer->getEditString();
|
||||
myGameProperties->set("Cartridge.Manufacturer", s);
|
||||
|
||||
s = myModelNo->getEditString();
|
||||
myGameProperties->set("Cartridge.ModelNo", s);
|
||||
|
||||
s = myRarity->getEditString();
|
||||
myGameProperties->set("Cartridge.Rarity", s);
|
||||
|
||||
s = myNote->getEditString();
|
||||
myGameProperties->set("Cartridge.Note", s);
|
||||
|
||||
i = mySound->getSelectedTag();
|
||||
s = (i == 1) ? "Mono" : "Stereo";
|
||||
myGameProperties->set("Cartridge.Sound", s);
|
||||
|
||||
// FIXME - type
|
||||
|
||||
s = mySnapTypePopup->getSelectedString();
|
||||
instance()->settings().setString("ssname", s);
|
||||
|
||||
b = mySnapSingleCheckbox->getState();
|
||||
instance()->settings().setBool("sssingle", !b);
|
||||
|
||||
// Flush changes to disk
|
||||
instance()->settings().saveConfig();
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -256,3 +439,12 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const PropType GameInfoDialog::ourControllerList[5] = {
|
||||
{ "Booster-Grip", "BOOSTER-GRIP" },
|
||||
{ "Driving", "DRIVING" },
|
||||
{ "Keyboard", "KEYBOARD" },
|
||||
{ "Paddles", "PADDLES" },
|
||||
{ "Joystick", "JOYSTICK" }
|
||||
};
|
||||
|
|
|
@ -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.10 2005-09-29 18:50:51 stephena Exp $
|
||||
// $Id: GameInfoDialog.hxx,v 1.11 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -30,9 +30,16 @@ class StaticTextWidget;
|
|||
class TabWidget;
|
||||
class Properties;
|
||||
|
||||
#include "Array.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "Command.hxx"
|
||||
|
||||
// Structure used for cartridge and controller types
|
||||
struct PropType {
|
||||
string name;
|
||||
string comparitor;
|
||||
};
|
||||
|
||||
class GameInfoDialog : public Dialog, public CommandSender
|
||||
{
|
||||
public:
|
||||
|
@ -59,10 +66,12 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
PopUpWidget* mySound;
|
||||
PopUpWidget* myType;
|
||||
|
||||
// Console/controller properties
|
||||
// Console properties
|
||||
PopUpWidget* myLeftDiff;
|
||||
PopUpWidget* myRightDiff;
|
||||
PopUpWidget* myTVType;
|
||||
|
||||
// Controller properties
|
||||
PopUpWidget* myLeftController;
|
||||
PopUpWidget* myRightController;
|
||||
|
||||
|
@ -74,10 +83,14 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
EditTextWidget* myHeight;
|
||||
PopUpWidget* myHmoveBlanks;
|
||||
|
||||
/** Game properties for currently loaded ROM */
|
||||
Properties* myGameProperties;
|
||||
|
||||
ButtonWidget* myNextButton;
|
||||
ButtonWidget* myPrevButton;
|
||||
/** Holds static strings for Cartridge type */
|
||||
static const PropType ourCartridgeList[20];
|
||||
|
||||
/** Holds static strings for Controller type */
|
||||
static const PropType ourControllerList[5];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.30 2005-09-28 22:49:06 stephena Exp $
|
||||
// $Id: OptionsDialog.cxx,v 1.31 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -80,7 +80,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
b->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
addBigButton("Event Mapping", kEMapCmd, 0);
|
||||
addBigButton("Game Information", kInfoCmd, 0);
|
||||
addBigButton("Game Properties", kInfoCmd, 0);
|
||||
addBigButton("Cheat Code", kCheatCmd, 0);
|
||||
addBigButton("Help", kHelpCmd, 0);
|
||||
addBigButton("About", kAboutCmd, 0);
|
||||
|
@ -104,7 +104,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myEventMappingDialog = new EventMappingDialog(myOSystem, parent, x, y, w, h);
|
||||
|
||||
w = 255; h = 150;
|
||||
w = 255; h = 175;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, this, x, y, w, h);
|
||||
|
||||
|
|
|
@ -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.19 2005-09-23 23:35:02 stephena Exp $
|
||||
// $Id: PopUpWidget.cxx,v 1.20 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -272,7 +272,8 @@ PopUpWidget::PopUpWidget(GuiObject* boss, int x, int y, int w, int h,
|
|||
_labelWidth(labelWidth),
|
||||
_cmd(cmd)
|
||||
{
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
|
||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||
WIDGET_NODRAW_FOCUS;
|
||||
_type = kPopUpWidget;
|
||||
|
||||
_selectedItem = -1;
|
||||
|
|
|
@ -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.36 2005-09-23 23:35:02 stephena Exp $
|
||||
// $Id: Widget.cxx,v 1.37 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -28,18 +28,20 @@
|
|||
#include "bspf.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "EditableWidget.hxx"
|
||||
|
||||
//static int COUNT = 0;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Widget::Widget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: GuiObject(boss->instance(), boss->parent(), x, y, w, h),
|
||||
_type(0),
|
||||
_boss(boss),
|
||||
_id(-1),
|
||||
_flags(0),
|
||||
_hasFocus(false),
|
||||
_color(kTextColor)
|
||||
: GuiObject(boss->instance(), boss->parent(), x, y, w, h),
|
||||
_type(0),
|
||||
_boss(boss),
|
||||
_id(-1),
|
||||
_flags(0),
|
||||
_hasFocus(false),
|
||||
_drawFocusBorder(false),
|
||||
_color(kTextColor)
|
||||
{
|
||||
// Insert into the widget list of the boss
|
||||
_next = _boss->_firstWidget;
|
||||
|
@ -74,6 +76,16 @@ void Widget::draw()
|
|||
_x = getAbsX();
|
||||
_y = getAbsY();
|
||||
|
||||
if(_type == kEditTextWidget)
|
||||
{
|
||||
EditableWidget* t = (EditableWidget*) this;
|
||||
if(t->getEditString() == "name")
|
||||
{
|
||||
cerr << "oldX = " << oldX << ", oldY = " << oldY << endl
|
||||
<< "_x = " << _x << ", _y = " << _y << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear background (unless alpha blending is enabled)
|
||||
if(_flags & WIDGET_CLEARBG)
|
||||
fb.fillRect(_x, _y, _w, _h, kBGColor);
|
||||
|
@ -94,6 +106,13 @@ void Widget::draw()
|
|||
// Now perform the actual widget draw
|
||||
drawWidget((_flags & WIDGET_HILITED) ? true : false);
|
||||
|
||||
// Draw focus border
|
||||
if(_drawFocusBorder)
|
||||
{
|
||||
|
||||
_drawFocusBorder = false;
|
||||
}
|
||||
|
||||
// Restore x/y
|
||||
if (_flags & WIDGET_BORDER) {
|
||||
_x -= 4;
|
||||
|
@ -235,7 +254,9 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
|||
{
|
||||
tmp->lostFocus();
|
||||
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
|
||||
// tmp->_drawFocusBorder = true;
|
||||
fb.frameRect(x, y, w, h, kBGColor);
|
||||
|
||||
tmp->setDirty(); tmp->draw();
|
||||
fb.addDirtyRect(x, y, w, h);
|
||||
}
|
||||
|
@ -274,6 +295,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
|||
|
||||
tmp->receivedFocus();
|
||||
if(!(tmp->_flags & WIDGET_NODRAW_FOCUS))
|
||||
// tmp->_drawFocusBorder = true;
|
||||
fb.frameRect(x, y, w, h, kTextColorEm, kDashLine);
|
||||
|
||||
tmp->setDirty(); tmp->draw();
|
||||
|
|
|
@ -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.hxx,v 1.37 2005-09-16 18:15:44 stephena Exp $
|
||||
// $Id: Widget.hxx,v 1.38 2005-09-30 00:40:34 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -72,7 +72,7 @@ enum {
|
|||
This is the base class for all widgets.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Widget.hxx,v 1.37 2005-09-16 18:15:44 stephena Exp $
|
||||
@version $Id: Widget.hxx,v 1.38 2005-09-30 00:40:34 stephena Exp $
|
||||
*/
|
||||
class Widget : public GuiObject
|
||||
{
|
||||
|
@ -142,6 +142,7 @@ class Widget : public GuiObject
|
|||
int _id;
|
||||
int _flags;
|
||||
bool _hasFocus;
|
||||
bool _drawFocusBorder;
|
||||
OverlayColor _color;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue