Load config info for the dialog boxes. Otherwise, the settings could

get out of sync when the user changed a settings with a hotkey.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@383 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-03-15 22:28:05 +00:00
parent c7383bb103
commit a4376c52cf
4 changed files with 25 additions and 14 deletions

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: Dialog.cxx,v 1.6 2005-03-14 04:08:15 stephena Exp $
// $Id: Dialog.cxx,v 1.7 2005-03-15 22:28:05 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -40,7 +40,8 @@ Dialog::Dialog(OSystem* instance, uInt16 x, uInt16 y, uInt16 w, uInt16 h)
: GuiObject(instance, x, y, w, h),
_mouseWidget(0),
_focusedWidget(0),
_visible(true)
_visible(true),
_openCount(0)
{
}
@ -70,6 +71,12 @@ void Dialog::open()
_result = 0;
_visible = true;
// Keep count of how many times this dialog was opened
// Load the config only on the first open (ie, since close was last called)
if(_openCount++ == 0)
loadConfig();
cerr << "_openCount = " << _openCount << endl;
Widget* w = _firstWidget;
// Search for the first objects that wantsFocus() (if any) and give it the focus
@ -93,6 +100,8 @@ void Dialog::close()
releaseFocus();
instance()->menu().removeDialog();
_openCount = 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: Dialog.hxx,v 1.5 2005-03-14 04:08:15 stephena Exp $
// $Id: Dialog.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -35,7 +35,7 @@ class Menu;
This is the base class for all dialog boxes.
@author Stephen Anthony
@version $Id: Dialog.hxx,v 1.5 2005-03-14 04:08:15 stephena Exp $
@version $Id: Dialog.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $
*/
class Dialog : public GuiObject
{
@ -53,15 +53,16 @@ class Dialog : public GuiObject
virtual void open();
virtual void close();
virtual void drawDialog();
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
virtual void handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
virtual void loadConfig() {}
virtual void saveConfig() {}
protected:
virtual void draw();
void releaseFocus();
virtual void handleTickle(); // Called periodically (in every guiloop() )
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
virtual void handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleMouseUp(int x, int y, int button, int clickCount);
virtual void handleMouseWheel(int x, int y, int direction);
@ -80,6 +81,7 @@ class Dialog : public GuiObject
Widget* _mouseWidget;
Widget* _focusedWidget;
bool _visible;
uInt32 _openCount;
private:
int _result;

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: VideoDialog.cxx,v 1.1 2005-03-14 04:08:15 stephena Exp $
// $Id: VideoDialog.cxx,v 1.2 2005-03-15 22:28:05 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -108,9 +108,6 @@ VideoDialog::VideoDialog(OSystem* osystem, uInt16 x, uInt16 y, uInt16 w, uInt16
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
#endif
// Set the items according to current settings
loadConfig();
// FIXME - get list of video drivers from OSystem
// const Common::LanguageDescription *l = Common::g_languages;
// for (; l->code; ++l) {
@ -126,6 +123,7 @@ VideoDialog::~VideoDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void VideoDialog::loadConfig()
{
cerr << "VideoDialog::loadConfig()\n";
string s;
bool b;
uInt32 i;

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: Widget.hxx,v 1.5 2005-03-14 04:08:15 stephena Exp $
// $Id: Widget.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -24,6 +24,8 @@
class Dialog;
#include <assert.h>
#include "StellaFont.hxx"
#include "FrameBuffer.hxx"
#include "GuiObject.hxx"
@ -42,7 +44,7 @@ enum {
};
enum {
kStaticTextWidget ='TEXT',
kStaticTextWidget = 'TEXT',
kEditTextWidget = 'EDIT',
kButtonWidget = 'BTTN',
kCheckboxWidget = 'CHKB',
@ -62,7 +64,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.5 2005-03-14 04:08:15 stephena Exp $
@version $Id: Widget.hxx,v 1.6 2005-03-15 22:28:05 stephena Exp $
*/
class Widget : public GuiObject
{