Added infrastructure whereby any tab area (in a TabWidget) that doesn't

want to navigate with the TAB key will actually receive the key (ie, it
won't be swallowed).

Updated PromptWidget to use the TAB key for command completion (Escape
is still used as well).

Added 'Alt t' and 'Alt s' for 'Trace' and 'Step' (respectively) to the
debugger area.  These keys are accessible while in any tab, since the
buttons (and associated actions) don't belong to any particular tab.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@554 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-06-24 12:01:27 +00:00
parent c8e4156e4a
commit ff49f7d3b1
4 changed files with 70 additions and 19 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: DebuggerDialog.cxx,v 1.17 2005-06-23 14:33:11 stephena Exp $
// $Id: DebuggerDialog.cxx,v 1.18 2005-06-24 12:01:26 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -106,7 +106,16 @@ void DebuggerDialog::loadConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers)
{
myTab->handleKeyDown(ascii, keycode, 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
myTab->handleKeyDown(ascii, keycode, modifiers);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -117,22 +126,19 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, int data)
switch(cmd)
{
case kDDStepCmd:
instance()->debugger().step();
myTab->loadConfig();
doStep();
break;
case kDDTraceCmd:
instance()->debugger().trace();
myTab->loadConfig();
doTrace();
break;
case kDDAdvCmd:
instance()->debugger().nextFrame(1);
myTab->loadConfig();
doAdvance();
break;
case kDDExitCmd:
instance()->debugger().quit();
doExit();
break;
default:
@ -140,6 +146,33 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, int data)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doStep()
{
instance()->debugger().step();
myTab->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doTrace()
{
instance()->debugger().trace();
myTab->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doAdvance()
{
instance()->debugger().nextFrame(1);
myTab->loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doExit()
{
instance()->debugger().quit();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PromptWidget *DebuggerDialog::prompt()
{

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: DebuggerDialog.hxx,v 1.9 2005-06-17 14:42:49 stephena Exp $
// $Id: DebuggerDialog.hxx,v 1.10 2005-06-24 12:01:27 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -44,6 +44,12 @@ class DebuggerDialog : public Dialog
protected:
TabWidget* myTab;
PromptWidget *myPrompt;
private:
void doStep();
void doTrace();
void doAdvance();
void doExit();
};
#endif

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: PromptWidget.cxx,v 1.14 2005-06-24 00:03:38 urchlay Exp $
// $Id: PromptWidget.cxx,v 1.15 2005-06-24 12:01:27 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -192,7 +192,8 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
break;
}
case 27: // escape
case 27: // escape FIXME - possibly remove this one?
case 9: // tab
{
if(_currentPos <= _promptStartPos)
break;

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: TabWidget.cxx,v 1.10 2005-06-23 14:33:11 stephena Exp $
// $Id: TabWidget.cxx,v 1.11 2005-06-24 12:01:27 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -204,6 +204,12 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
{
// Pass the tab key to the activeWidget if we know that widget
// navigation won't be needed
bool navigateWanted = false;
if(_activeWidget && (_activeWidget->getFlags() & WIDGET_TAB_NAVIGATE))
navigateWanted = true;
// Test for TAB character
// Ctrl-Tab selects next tab
// Shift-Ctrl-Tab selects previous tab
@ -218,14 +224,19 @@ bool TabWidget::handleKeyDown(int ascii, int keycode, int modifiers)
else
cycleTab(+1);
}
else if(_boss->instance()->eventHandler().kbdShift(modifiers))
cycleWidget(-1);
else
cycleWidget(+1);
else if(navigateWanted)
{
if(_boss->instance()->eventHandler().kbdShift(modifiers))
cycleWidget(-1);
else
cycleWidget(+1);
}
return true;
if(navigateWanted)
return true;
}
else if (_activeWidget)
if (_activeWidget && !navigateWanted)
return _activeWidget->handleKeyDown(ascii, keycode, modifiers);
else
return Widget::handleKeyDown(ascii, keycode, modifiers);