From 34284d0af9ec86629b094b3454e68c6df950b2d8 Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 20 Dec 2005 19:05:16 +0000 Subject: [PATCH] More fixes for the Dialog focus issues. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@920 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/gui/DebuggerDialog.cxx | 25 ++++++++++++++-------- stella/src/gui/Dialog.cxx | 6 +++++- stella/src/gui/EventMappingWidget.cxx | 6 ++++-- stella/src/gui/EventMappingWidget.hxx | 5 ++++- stella/src/gui/InputDialog.cxx | 7 +++++- stella/src/gui/InputTextDialog.cxx | 7 +----- 6 files changed, 36 insertions(+), 20 deletions(-) diff --git a/stella/src/debugger/gui/DebuggerDialog.cxx b/stella/src/debugger/gui/DebuggerDialog.cxx index e5812fb68..e922565c1 100644 --- a/stella/src/debugger/gui/DebuggerDialog.cxx +++ b/stella/src/debugger/gui/DebuggerDialog.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: DebuggerDialog.cxx,v 1.9 2005-10-14 13:50:00 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.10 2005-12-20 19:05:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -87,14 +87,21 @@ void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers) // Doing this means we disallow 'Alt xxx' events to any widget in the tabset if(instance()->eventHandler().kbdAlt(modifiers)) { - if(ascii == 's') - doStep(); - else if(ascii == 't') - doTrace(); - else if(ascii == 'f') - doAdvance(); - else if(ascii == 'l') - doScanlineAdvance(); + switch(ascii) + { + case 's': + doStep(); + break; + case 't': + doTrace(); + break; + case 'f': + doAdvance(); + break; + case 'l': + doScanlineAdvance(); + break; + } } else Dialog::handleKeyDown(ascii, keycode, modifiers); diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index 47a38568a..6a7e2f5e8 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.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: Dialog.cxx,v 1.35 2005-12-19 02:19:49 stephena Exp $ +// $Id: Dialog.cxx,v 1.36 2005-12-20 19:05:16 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -121,6 +121,8 @@ void Dialog::addToFocusList(WidgetArray& list, int id) } _ourFocusList[id].focusList.push_back(list); + if(id == 0) + _focusList = _ourFocusList[id].focusList; if(list.size() > 0 && !(list[0]->getFlags() & WIDGET_NODRAW_FOCUS)) _ourFocusList[id].focusedWidget = list[0]; @@ -263,6 +265,8 @@ void Dialog::handleMouseUp(int x, int y, int button, int clickCount) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::handleMouseWheel(int x, int y, int direction) { +cerr << "_focusedWidget = " << _focusedWidget << endl; + Widget* w; // This may look a bit backwards, but I think it makes more sense for diff --git a/stella/src/gui/EventMappingWidget.cxx b/stella/src/gui/EventMappingWidget.cxx index 2694e86d5..c9b2ddecb 100644 --- a/stella/src/gui/EventMappingWidget.cxx +++ b/stella/src/gui/EventMappingWidget.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: EventMappingWidget.cxx,v 1.2 2005-12-07 20:46:49 stephena Exp $ +// $Id: EventMappingWidget.cxx,v 1.3 2005-12-20 19:05:16 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -46,7 +46,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int myActionsList->setTarget(this); myActionsList->setNumberingMode(kListNumberingOff); myActionsList->setEditable(false); -// myActionsList->setFlags(WIDGET_NODRAW_FOCUS); + myActionsList->setFlags(WIDGET_NODRAW_FOCUS); addFocusWidget(myActionsList); // Add remap, erase, cancel and default buttons @@ -81,6 +81,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int l.push_back(EventHandler::ourActionList[i].action); myActionsList->setList(l); + myActionSelected = myActionsList->getSelected(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -151,6 +152,7 @@ void EventMappingWidget::stopRemapping() myCancelMapButton->setEnabled(false); // Make sure the list widget is in a known state +cerr << "myActionSelected = " << myActionSelected << endl; if(myActionSelected >= 0) { drawKeyMapping(); diff --git a/stella/src/gui/EventMappingWidget.hxx b/stella/src/gui/EventMappingWidget.hxx index 80cd1deb3..36c9dcfbc 100644 --- a/stella/src/gui/EventMappingWidget.hxx +++ b/stella/src/gui/EventMappingWidget.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: EventMappingWidget.hxx,v 1.2 2005-12-07 20:46:49 stephena Exp $ +// $Id: EventMappingWidget.hxx,v 1.3 2005-12-20 19:05:16 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,6 +29,7 @@ class StaticTextWidget; class StringListWidget; class PopUpWidget; class GuiObject; +class InputDialog; #include "Widget.hxx" #include "Command.hxx" @@ -37,6 +38,8 @@ class GuiObject; class EventMappingWidget : public Widget, public CommandSender { + friend class InputDialog; + public: EventMappingWidget(GuiObject* boss, int x, int y, int w, int h); ~EventMappingWidget(); diff --git a/stella/src/gui/InputDialog.cxx b/stella/src/gui/InputDialog.cxx index 0c8723166..c1f584b2a 100644 --- a/stella/src/gui/InputDialog.cxx +++ b/stella/src/gui/InputDialog.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: InputDialog.cxx,v 1.6 2005-12-16 14:41:15 stephena Exp $ +// $Id: InputDialog.cxx,v 1.7 2005-12-20 19:05:16 stephena Exp $ //============================================================================ #include "OSystem.hxx" @@ -56,6 +56,9 @@ InputDialog::InputDialog( myTab->setParentWidget(tabID, myEventMapper); addToFocusList(myEventMapper->getFocusList(), tabID); +cerr << "size = " << myEventMapper->getFocusList().size() + << ", tabid = " << tabID << endl; + // 2) Virtual device support addVDeviceTab(); @@ -179,6 +182,8 @@ void InputDialog::addVDeviceTab() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputDialog::loadConfig() { + myEventMapper->loadConfig(); + // Left & right ports const string& sa1 = instance()->settings().getString("sa1"); int lport = sa1 == "right" ? 2 : 1; diff --git a/stella/src/gui/InputTextDialog.cxx b/stella/src/gui/InputTextDialog.cxx index 2344a85bd..2ab4d3983 100644 --- a/stella/src/gui/InputTextDialog.cxx +++ b/stella/src/gui/InputTextDialog.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: InputTextDialog.cxx,v 1.9 2005-12-20 00:56:31 stephena Exp $ +// $Id: InputTextDialog.cxx,v 1.10 2005-12-20 19:05:16 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -129,13 +129,8 @@ void InputTextDialog::setEditString(const string& str, int idx) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputTextDialog::setFocus(int idx) { -cerr << "size = " << getFocusList().size() << endl; -/* FIXME - a related problem in InputDialog EventMappingWidget list - is occurring, whereby the focuslist isn't being filled - right away if((unsigned int)idx < myInput.size()) Dialog::setFocus(getFocusList()[idx]); -*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -