mirror of https://github.com/stella-emu/stella.git
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:
parent
c7383bb103
commit
a4376c52cf
|
@ -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: 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
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// 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),
|
: GuiObject(instance, x, y, w, h),
|
||||||
_mouseWidget(0),
|
_mouseWidget(0),
|
||||||
_focusedWidget(0),
|
_focusedWidget(0),
|
||||||
_visible(true)
|
_visible(true),
|
||||||
|
_openCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +71,12 @@ void Dialog::open()
|
||||||
_result = 0;
|
_result = 0;
|
||||||
_visible = true;
|
_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;
|
Widget* w = _firstWidget;
|
||||||
|
|
||||||
// Search for the first objects that wantsFocus() (if any) and give it the focus
|
// Search for the first objects that wantsFocus() (if any) and give it the focus
|
||||||
|
@ -93,6 +100,8 @@ void Dialog::close()
|
||||||
|
|
||||||
releaseFocus();
|
releaseFocus();
|
||||||
instance()->menu().removeDialog();
|
instance()->menu().removeDialog();
|
||||||
|
|
||||||
|
_openCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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: 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
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -35,7 +35,7 @@ class Menu;
|
||||||
This is the base class for all dialog boxes.
|
This is the base class for all dialog boxes.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@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
|
class Dialog : public GuiObject
|
||||||
{
|
{
|
||||||
|
@ -53,15 +53,16 @@ class Dialog : public GuiObject
|
||||||
virtual void open();
|
virtual void open();
|
||||||
virtual void close();
|
virtual void close();
|
||||||
virtual void drawDialog();
|
virtual void drawDialog();
|
||||||
|
virtual void loadConfig() {}
|
||||||
virtual void handleKeyDown(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
virtual void saveConfig() {}
|
||||||
virtual void handleKeyUp(uInt16 ascii, Int32 keycode, Int32 modifiers);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void releaseFocus();
|
void releaseFocus();
|
||||||
|
|
||||||
virtual void handleTickle(); // Called periodically (in every guiloop() )
|
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 handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseUp(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);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
|
@ -80,6 +81,7 @@ class Dialog : public GuiObject
|
||||||
Widget* _mouseWidget;
|
Widget* _mouseWidget;
|
||||||
Widget* _focusedWidget;
|
Widget* _focusedWidget;
|
||||||
bool _visible;
|
bool _visible;
|
||||||
|
uInt32 _openCount;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _result;
|
int _result;
|
||||||
|
|
|
@ -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: 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
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// 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);
|
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set the items according to current settings
|
|
||||||
loadConfig();
|
|
||||||
|
|
||||||
// FIXME - get list of video drivers from OSystem
|
// FIXME - get list of video drivers from OSystem
|
||||||
// const Common::LanguageDescription *l = Common::g_languages;
|
// const Common::LanguageDescription *l = Common::g_languages;
|
||||||
// for (; l->code; ++l) {
|
// for (; l->code; ++l) {
|
||||||
|
@ -126,6 +123,7 @@ VideoDialog::~VideoDialog()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void VideoDialog::loadConfig()
|
void VideoDialog::loadConfig()
|
||||||
{
|
{
|
||||||
|
cerr << "VideoDialog::loadConfig()\n";
|
||||||
string s;
|
string s;
|
||||||
bool b;
|
bool b;
|
||||||
uInt32 i;
|
uInt32 i;
|
||||||
|
|
|
@ -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: 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
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
class Dialog;
|
class Dialog;
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "StellaFont.hxx"
|
#include "StellaFont.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "GuiObject.hxx"
|
#include "GuiObject.hxx"
|
||||||
|
@ -42,7 +44,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kStaticTextWidget ='TEXT',
|
kStaticTextWidget = 'TEXT',
|
||||||
kEditTextWidget = 'EDIT',
|
kEditTextWidget = 'EDIT',
|
||||||
kButtonWidget = 'BTTN',
|
kButtonWidget = 'BTTN',
|
||||||
kCheckboxWidget = 'CHKB',
|
kCheckboxWidget = 'CHKB',
|
||||||
|
@ -62,7 +64,7 @@ enum {
|
||||||
This is the base class for all widgets.
|
This is the base class for all widgets.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@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
|
class Widget : public GuiObject
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue