Made the delay between registering consecutive keypresses as one string

be configurable for ListWidgets.  Added UI item for this to UIDialog
(Misc tab), and added the '-listdelay' commandline argument for it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1600 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-01-05 22:05:35 +00:00
parent 555d9c8273
commit 7f727528b8
8 changed files with 65 additions and 9 deletions

View File

@ -48,7 +48,7 @@ X (1) Only show files with certain extensions (including a UI part to
directory named that way. Basically the same as is currently directory named that way. Basically the same as is currently
done for ROMs. done for ROMs.
(3) Have time between keypresses be configurable when jumping to files. X (3) Have time between keypresses be configurable when jumping to files.
X (4) Reload current listing (possibly tied to a RMB context menu). X (4) Reload current listing (possibly tied to a RMB context menu).

View File

@ -818,6 +818,12 @@
complete.</td> complete.</td>
</tr> </tr>
<tr>
<td><pre>-listdelay &lt;delay&gt;</pre></td>
<td>Set the amount of time to wait between successive keypresses in
list widgets (value can range from 300-1000).</td>
</tr>
<tr> <tr>
<td><pre>-mwheel &lt;lines&gt;</pre></td> <td><pre>-mwheel &lt;lines&gt;</pre></td>
<td>Set the number of lines a mousewheel will scroll in the UI.</td> <td>Set the number of lines a mousewheel will scroll in the UI.</td>

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: EventHandler.cxx,v 1.235 2009-01-03 22:57:12 stephena Exp $ // $Id: EventHandler.cxx,v 1.236 2009-01-05 22:05:35 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -33,6 +33,7 @@
#include "Joystick.hxx" #include "Joystick.hxx"
#include "Paddles.hxx" #include "Paddles.hxx"
#include "PropsSet.hxx" #include "PropsSet.hxx"
#include "ListWidget.hxx"
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "Snapshot.hxx" #include "Snapshot.hxx"
@ -145,6 +146,9 @@ void EventHandler::initialize()
Joystick::setDeadZone(myOSystem->settings().getInt("joydeadzone")); Joystick::setDeadZone(myOSystem->settings().getInt("joydeadzone"));
Paddles::setDigitalSpeed(myOSystem->settings().getInt("pspeed")); Paddles::setDigitalSpeed(myOSystem->settings().getInt("pspeed"));
// Set quick select delay when typing characters in listwidgets
ListWidget::setQuickSelectDelay(myOSystem->settings().getInt("listdelay"));
// Set number of lines a mousewheel will scroll // Set number of lines a mousewheel will scroll
ScrollBarWidget::setWheelLines(myOSystem->settings().getInt("mwheel")); ScrollBarWidget::setWheelLines(myOSystem->settings().getInt("mwheel"));
} }

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: Settings.cxx,v 1.155 2009-01-05 19:44:29 stephena Exp $ // $Id: Settings.cxx,v 1.156 2009-01-05 22:05:35 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -96,6 +96,7 @@ Settings::Settings(OSystem* osystem)
// UI-related options // UI-related options
setInternal("debuggerres", "1030x690"); setInternal("debuggerres", "1030x690");
setInternal("uipalette", "0"); setInternal("uipalette", "0");
setInternal("listdelay", "300");
setInternal("mwheel", "4"); setInternal("mwheel", "4");
// Misc options // Misc options
@ -339,6 +340,7 @@ void Settings::usage()
<< " allroms| (exts is a ':' separated list of extensions\n" << " allroms| (exts is a ':' separated list of extensions\n"
<< " exts\n" << " exts\n"
<< " -uipalette <1|2> Used the specified palette for UI elements\n" << " -uipalette <1|2> Used the specified palette for UI elements\n"
<< " -listdelay <delay> Time to wait between keypresses in list widgets (300-1000)\n"
<< " -mwheel <lines> Number of lines the mouse wheel will scroll in UI\n" << " -mwheel <lines> Number of lines the mouse wheel will scroll in UI\n"
<< " -statedir <dir> Directory in which to save state files\n" << " -statedir <dir> Directory in which to save state files\n"
<< " -cheatfile <file> Full pathname of cheatfile database\n" << " -cheatfile <file> Full pathname of cheatfile database\n"

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: ListWidget.cxx,v 1.53 2009-01-04 02:28:12 stephena Exp $ // $Id: ListWidget.cxx,v 1.54 2009-01-05 22:05:35 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
@ -241,7 +241,7 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
_quickSelectStr = (char)ascii; _quickSelectStr = (char)ascii;
else else
_quickSelectStr += (char)ascii; _quickSelectStr += (char)ascii;
_quickSelectTime = time + 300; _quickSelectTime = time + _QUICK_SELECT_DELAY;
// FIXME: This is bad slow code (it scans the list linearly each time a // FIXME: This is bad slow code (it scans the list linearly each time a
// key is pressed); it could be much faster. Only of importance if we have // key is pressed); it could be much faster. Only of importance if we have
@ -463,3 +463,6 @@ void ListWidget::abortEditMode()
// Reset to normal data entry // Reset to normal data entry
EditableWidget::abortEditMode(); EditableWidget::abortEditMode();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int ListWidget::_QUICK_SELECT_DELAY = 300;

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: ListWidget.hxx,v 1.24 2009-01-04 02:28:12 stephena Exp $ // $Id: ListWidget.hxx,v 1.25 2009-01-05 22:05:35 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
@ -77,6 +77,8 @@ class ListWidget : public EditableWidget
void startEditMode(); void startEditMode();
void endEditMode(); void endEditMode();
static void setQuickSelectDelay(int time) { _QUICK_SELECT_DELAY = time; }
protected: protected:
virtual void drawWidget(bool hilite) = 0; virtual void drawWidget(bool hilite) = 0;
virtual GUI::Rect getEditRect() const = 0; virtual GUI::Rect getEditRect() const = 0;
@ -111,6 +113,9 @@ class ListWidget : public EditableWidget
string _backupString; string _backupString;
string _quickSelectStr; string _quickSelectStr;
int _quickSelectTime; int _quickSelectTime;
private:
static int _QUICK_SELECT_DELAY;
}; };
#endif #endif

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: UIDialog.cxx,v 1.19 2009-01-04 22:27:44 stephena Exp $ // $Id: UIDialog.cxx,v 1.20 2009-01-05 22:05:35 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
@ -25,6 +25,7 @@
#include "Dialog.hxx" #include "Dialog.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "ListWidget.hxx"
#include "PopUpWidget.hxx" #include "PopUpWidget.hxx"
#include "ScrollBarWidget.hxx" #include "ScrollBarWidget.hxx"
#include "Settings.hxx" #include "Settings.hxx"
@ -190,6 +191,21 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent,
wid.push_back(myPalettePopup); wid.push_back(myPalettePopup);
ypos += lineHeight + 4; ypos += lineHeight + 4;
// Delay between quick-selecting characters in ListWidget
myListDelaySlider = new SliderWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, "List quick delay: ",
lwidth, kLQDelayChanged);
myListDelaySlider->setMinValue(300);
myListDelaySlider->setMaxValue(1000);
myListDelaySlider->setStepValue(100);
wid.push_back(myListDelaySlider);
myListDelayLabel =
new StaticTextWidget(myTab, font,
xpos + myListDelaySlider->getWidth() + 4,
ypos + 1, 4*fontWidth, fontHeight, "", kTextAlignLeft);
myListDelayLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + 4;
// Number of lines a mouse wheel will scroll // Number of lines a mouse wheel will scroll
myWheelLinesSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myWheelLinesSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, "Mouse wheel scroll: ", lineHeight, "Mouse wheel scroll: ",
@ -278,6 +294,12 @@ void UIDialog::loadConfig()
const string& pal = instance().settings().getString("uipalette"); const string& pal = instance().settings().getString("uipalette");
myPalettePopup->setSelected(pal, "1"); myPalettePopup->setSelected(pal, "1");
// Listwidget quick delay
int delay = instance().settings().getInt("listdelay");
if(delay < 300 || delay > 1000) delay = 300;
myListDelaySlider->setValue(delay);
myListDelayLabel->setValue(delay);
// Mouse wheel lines // Mouse wheel lines
int mw = instance().settings().getInt("mwheel"); int mw = instance().settings().getInt("mwheel");
if(mw < 1 || mw > 10) mw = 1; if(mw < 1 || mw > 10) mw = 1;
@ -310,6 +332,11 @@ void UIDialog::saveConfig()
instance().settings().setString("uipalette", instance().settings().setString("uipalette",
myPalettePopup->getSelectedTag()); myPalettePopup->getSelectedTag());
// Listwidget quick delay
int delay = myListDelaySlider->getValue();
instance().settings().setInt("listdelay", delay);
ListWidget::setQuickSelectDelay(delay);
// Mouse wheel lines // Mouse wheel lines
int mw = myWheelLinesSlider->getValue(); int mw = myWheelLinesSlider->getValue();
instance().settings().setInt("mwheel", mw); instance().settings().setInt("mwheel", mw);
@ -343,6 +370,8 @@ void UIDialog::setDefaults()
case 2: // Misc. options case 2: // Misc. options
myPalettePopup->setSelected("1", "1"); myPalettePopup->setSelected("1", "1");
myListDelaySlider->setValue(300);
myListDelayLabel->setValue(300);
myWheelLinesSlider->setValue(4); myWheelLinesSlider->setValue(4);
myWheelLinesLabel->setValue(4); myWheelLinesLabel->setValue(4);
break; break;
@ -375,6 +404,10 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue()); myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue());
break; break;
case kLQDelayChanged:
myListDelayLabel->setValue(myListDelaySlider->getValue());
break;
case kWLinesChanged: case kWLinesChanged:
myWheelLinesLabel->setValue(myWheelLinesSlider->getValue()); myWheelLinesLabel->setValue(myWheelLinesSlider->getValue());
break; break;

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: UIDialog.hxx,v 1.11 2009-01-04 22:27:44 stephena Exp $ // $Id: UIDialog.hxx,v 1.12 2009-01-05 22:05:35 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
@ -58,7 +58,9 @@ class UIDialog : public Dialog
StaticTextWidget* myDebuggerHeightLabel; StaticTextWidget* myDebuggerHeightLabel;
// Misc options // Misc options
PopUpWidget* myPalettePopup; PopUpWidget* myPalettePopup;
SliderWidget* myListDelaySlider;
StaticTextWidget* myListDelayLabel;
SliderWidget* myWheelLinesSlider; SliderWidget* myWheelLinesSlider;
StaticTextWidget* myWheelLinesLabel; StaticTextWidget* myWheelLinesLabel;
@ -74,6 +76,7 @@ class UIDialog : public Dialog
kLHeightChanged = 'UIlh', kLHeightChanged = 'UIlh',
kDWidthChanged = 'UIdw', kDWidthChanged = 'UIdw',
kDHeightChanged = 'UIdh', kDHeightChanged = 'UIdh',
kLQDelayChanged = 'UIqd',
kWLinesChanged = 'UIsl' kWLinesChanged = 'UIsl'
}; };
}; };