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
This commit is contained in:
stephena 2005-12-20 19:05:16 +00:00
parent b1439714dc
commit 34284d0af9
6 changed files with 36 additions and 20 deletions

View File

@ -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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // 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 // Doing this means we disallow 'Alt xxx' events to any widget in the tabset
if(instance()->eventHandler().kbdAlt(modifiers)) if(instance()->eventHandler().kbdAlt(modifiers))
{ {
if(ascii == 's') switch(ascii)
doStep(); {
else if(ascii == 't') case 's':
doTrace(); doStep();
else if(ascii == 'f') break;
doAdvance(); case 't':
else if(ascii == 'l') doTrace();
doScanlineAdvance(); break;
case 'f':
doAdvance();
break;
case 'l':
doScanlineAdvance();
break;
}
} }
else else
Dialog::handleKeyDown(ascii, keycode, modifiers); Dialog::handleKeyDown(ascii, keycode, modifiers);

View File

@ -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.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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -121,6 +121,8 @@ void Dialog::addToFocusList(WidgetArray& list, int id)
} }
_ourFocusList[id].focusList.push_back(list); _ourFocusList[id].focusList.push_back(list);
if(id == 0)
_focusList = _ourFocusList[id].focusList;
if(list.size() > 0 && !(list[0]->getFlags() & WIDGET_NODRAW_FOCUS)) if(list.size() > 0 && !(list[0]->getFlags() & WIDGET_NODRAW_FOCUS))
_ourFocusList[id].focusedWidget = list[0]; _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) void Dialog::handleMouseWheel(int x, int y, int direction)
{ {
cerr << "_focusedWidget = " << _focusedWidget << endl;
Widget* w; Widget* w;
// This may look a bit backwards, but I think it makes more sense for // This may look a bit backwards, but I think it makes more sense for

View File

@ -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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // 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->setTarget(this);
myActionsList->setNumberingMode(kListNumberingOff); myActionsList->setNumberingMode(kListNumberingOff);
myActionsList->setEditable(false); myActionsList->setEditable(false);
// myActionsList->setFlags(WIDGET_NODRAW_FOCUS); myActionsList->setFlags(WIDGET_NODRAW_FOCUS);
addFocusWidget(myActionsList); addFocusWidget(myActionsList);
// Add remap, erase, cancel and default buttons // 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); l.push_back(EventHandler::ourActionList[i].action);
myActionsList->setList(l); myActionsList->setList(l);
myActionSelected = myActionsList->getSelected();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -151,6 +152,7 @@ void EventMappingWidget::stopRemapping()
myCancelMapButton->setEnabled(false); myCancelMapButton->setEnabled(false);
// Make sure the list widget is in a known state // Make sure the list widget is in a known state
cerr << "myActionSelected = " << myActionSelected << endl;
if(myActionSelected >= 0) if(myActionSelected >= 0)
{ {
drawKeyMapping(); drawKeyMapping();

View File

@ -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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,6 +29,7 @@ class StaticTextWidget;
class StringListWidget; class StringListWidget;
class PopUpWidget; class PopUpWidget;
class GuiObject; class GuiObject;
class InputDialog;
#include "Widget.hxx" #include "Widget.hxx"
#include "Command.hxx" #include "Command.hxx"
@ -37,6 +38,8 @@ class GuiObject;
class EventMappingWidget : public Widget, public CommandSender class EventMappingWidget : public Widget, public CommandSender
{ {
friend class InputDialog;
public: public:
EventMappingWidget(GuiObject* boss, int x, int y, int w, int h); EventMappingWidget(GuiObject* boss, int x, int y, int w, int h);
~EventMappingWidget(); ~EventMappingWidget();

View File

@ -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: 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" #include "OSystem.hxx"
@ -56,6 +56,9 @@ InputDialog::InputDialog(
myTab->setParentWidget(tabID, myEventMapper); myTab->setParentWidget(tabID, myEventMapper);
addToFocusList(myEventMapper->getFocusList(), tabID); addToFocusList(myEventMapper->getFocusList(), tabID);
cerr << "size = " << myEventMapper->getFocusList().size()
<< ", tabid = " << tabID << endl;
// 2) Virtual device support // 2) Virtual device support
addVDeviceTab(); addVDeviceTab();
@ -179,6 +182,8 @@ void InputDialog::addVDeviceTab()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputDialog::loadConfig() void InputDialog::loadConfig()
{ {
myEventMapper->loadConfig();
// Left & right ports // Left & right ports
const string& sa1 = instance()->settings().getString("sa1"); const string& sa1 = instance()->settings().getString("sa1");
int lport = sa1 == "right" ? 2 : 1; int lport = sa1 == "right" ? 2 : 1;

View File

@ -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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -129,13 +129,8 @@ void InputTextDialog::setEditString(const string& str, int idx)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setFocus(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()) if((unsigned int)idx < myInput.size())
Dialog::setFocus(getFocusList()[idx]); Dialog::setFocus(getFocusList()[idx]);
*/
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -