From 2bc3a826441c8c9a7192b29b433d21508200edb3 Mon Sep 17 00:00:00 2001 From: knakos Date: Tue, 23 Jan 2007 09:37:39 +0000 Subject: [PATCH] Disable some of the UI controls for the wince port. We don't want the user disoriented with options that are: 1) ignored byt the port, 2) Cannot fit in small screen devices. As far as the #ifdef badness goes this is not too bad. The conditional compiled code blocks are scarce. In my opinion they do not justify an architectural approach, which would mean adding methods for enabling/disabling widgets. Also note in OptionsDialog.cpp we were leaking memory by instantiating twice the InputDialog. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1301 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/gui/OptionsDialog.cxx | 49 +++++++++++++++++++++++--------- stella/src/gui/OptionsDialog.hxx | 7 ++++- stella/src/gui/UIDialog.cxx | 6 +++- stella/src/gui/VideoDialog.cxx | 9 +++++- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index a5be63207..f983945c2 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.cxx @@ -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.50 2007-01-18 16:30:32 knakos Exp $ +// $Id: OptionsDialog.cxx,v 1.51 2007-01-23 09:37:38 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -63,14 +63,14 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, WidgetArray wid; ButtonWidget* b = NULL; - b = addBigButton("Video Settings", kVidCmd); - wid.push_back(b); + myVideoSettingsButton = addBigButton("Video Settings", kVidCmd); + wid.push_back(myVideoSettingsButton); - b = addBigButton("Audio Settings", kAudCmd); + myAudioSettingsButton = addBigButton("Audio Settings", kAudCmd); #ifndef SOUND_SUPPORT b->clearFlags(WIDGET_ENABLED); #endif - wid.push_back(b); + wid.push_back(myAudioSettingsButton); b = addBigButton("Input Settings", kInptCmd); wid.push_back(b); @@ -78,8 +78,8 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, b = addBigButton("UI Settings", kUsrIfaceCmd); wid.push_back(b); - b = addBigButton("Files & Snapshots", kFileSnapCmd); - wid.push_back(b); + myFileSnapButton = addBigButton("Files & Snapshots", kFileSnapCmd); + wid.push_back(myFileSnapButton); // Move to second column xoffset += kBigButtonWidth + 10; yoffset = 10; @@ -93,11 +93,11 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, #endif wid.push_back(myCheatCodeButton); - b = addBigButton("Help", kHelpCmd); - wid.push_back(b); + myHelpButton = addBigButton("Help", kHelpCmd); + wid.push_back(myHelpButton); - b = addBigButton("About", kAboutCmd); - wid.push_back(b); + myAboutButton = addBigButton("About", kAboutCmd); + wid.push_back(myAboutButton); b = addBigButton("Exit Menu", kExitCmd); wid.push_back(b); @@ -113,10 +113,20 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, w = 200; h = 140; myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h); - w = 230; h = 185; - myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h); + // knakos: I think this is wrong: (instantiating twice) + //w = 230; h = 185; + //myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h); +#ifdef _WIN32_WCE + int sx, sy; + myOSystem->getScreenDimensions(sx, sy); + // we scale the input dialog down a bit in low res devices. + // looks only a little ugly, but the functionality is very welcome + if(sx < 320) { w = 220; h = 176; } + else { w = 230; h = 185; } +#else w = 230; h = 185; +#endif myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h); w = 200; h = 90; @@ -148,6 +158,19 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent, myGameInfoButton->clearFlags(WIDGET_ENABLED); myCheatCodeButton->clearFlags(WIDGET_ENABLED); } + +#ifdef _WIN32_WCE + myAudioSettingsButton->clearFlags(WIDGET_ENABLED); // not honored in wince port + if(sx < 320) + { + // these cannot be displayed in low res devices + myVideoSettingsButton->clearFlags(WIDGET_ENABLED); + myFileSnapButton->clearFlags(WIDGET_ENABLED); + myGameInfoButton->clearFlags(WIDGET_ENABLED); + myHelpButton->clearFlags(WIDGET_ENABLED); + myAboutButton->clearFlags(WIDGET_ENABLED); + } +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/OptionsDialog.hxx b/stella/src/gui/OptionsDialog.hxx index 464bdf1f0..d30302f92 100644 --- a/stella/src/gui/OptionsDialog.hxx +++ b/stella/src/gui/OptionsDialog.hxx @@ -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.hxx,v 1.23 2007-01-01 18:04:54 stephena Exp $ +// $Id: OptionsDialog.hxx,v 1.24 2007-01-23 09:37:39 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -61,8 +61,13 @@ class OptionsDialog : public Dialog HelpDialog* myHelpDialog; AboutDialog* myAboutDialog; + ButtonWidget* myVideoSettingsButton; + ButtonWidget* myAudioSettingsButton; + ButtonWidget* myFileSnapButton; ButtonWidget* myGameInfoButton; ButtonWidget* myCheatCodeButton; + ButtonWidget* myHelpButton; + ButtonWidget* myAboutButton; // Indicates if this dialog is used for global (vs. in-game) settings bool myIsGlobal; diff --git a/stella/src/gui/UIDialog.cxx b/stella/src/gui/UIDialog.cxx index 7f21f3ed4..58caa84c4 100644 --- a/stella/src/gui/UIDialog.cxx +++ b/stella/src/gui/UIDialog.cxx @@ -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: UIDialog.cxx,v 1.2 2007-01-01 18:04:54 stephena Exp $ +// $Id: UIDialog.cxx,v 1.3 2007-01-23 09:37:39 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -89,6 +89,10 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent, #endif addToFocusList(wid); + +#ifdef _WIN32_WCE + myLauncherPopup->clearFlags(WIDGET_ENABLED); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/VideoDialog.cxx b/stella/src/gui/VideoDialog.cxx index d37e79753..fe89d4f73 100644 --- a/stella/src/gui/VideoDialog.cxx +++ b/stella/src/gui/VideoDialog.cxx @@ -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.41 2007-01-01 18:04:54 stephena Exp $ +// $Id: VideoDialog.cxx,v 1.42 2007-01-23 09:37:39 knakos Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -176,6 +176,13 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent, #endif addToFocusList(wid); + +#ifdef _WIN32_WCE + myTIAScalerPopup->clearFlags(WIDGET_ENABLED); + myUIScalerPopup->clearFlags(WIDGET_ENABLED); + myFullscreenCheckbox->clearFlags(WIDGET_ENABLED); + myDirtyRectCheckbox->clearFlags(WIDGET_ENABLED); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -