diff --git a/stella/Todo.txt b/stella/Todo.txt index 8a2488102..0800579be 100644 --- a/stella/Todo.txt +++ b/stella/Todo.txt @@ -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 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). diff --git a/stella/docs/index.html b/stella/docs/index.html index 861e89713..6781728ad 100644 --- a/stella/docs/index.html +++ b/stella/docs/index.html @@ -818,6 +818,12 @@ complete. + +
-listdelay <delay>
+ Set the amount of time to wait between successive keypresses in + list widgets (value can range from 300-1000). + +
-mwheel <lines>
Set the number of lines a mousewheel will scroll in the UI. diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 68be156cf..ef0e78d15 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.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: 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 @@ -33,6 +33,7 @@ #include "Joystick.hxx" #include "Paddles.hxx" #include "PropsSet.hxx" +#include "ListWidget.hxx" #include "ScrollBarWidget.hxx" #include "Settings.hxx" #include "Snapshot.hxx" @@ -145,6 +146,9 @@ void EventHandler::initialize() Joystick::setDeadZone(myOSystem->settings().getInt("joydeadzone")); 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 ScrollBarWidget::setWheelLines(myOSystem->settings().getInt("mwheel")); } diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 366010405..558cd2937 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.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: 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 @@ -96,6 +96,7 @@ Settings::Settings(OSystem* osystem) // UI-related options setInternal("debuggerres", "1030x690"); setInternal("uipalette", "0"); + setInternal("listdelay", "300"); setInternal("mwheel", "4"); // Misc options @@ -339,6 +340,7 @@ void Settings::usage() << " allroms| (exts is a ':' separated list of extensions\n" << " exts\n" << " -uipalette <1|2> Used the specified palette for UI elements\n" + << " -listdelay Time to wait between keypresses in list widgets (300-1000)\n" << " -mwheel Number of lines the mouse wheel will scroll in UI\n" << " -statedir Directory in which to save state files\n" << " -cheatfile Full pathname of cheatfile database\n" diff --git a/stella/src/gui/ListWidget.cxx b/stella/src/gui/ListWidget.cxx index 3ba192c8e..94ca7d2fb 100644 --- a/stella/src/gui/ListWidget.cxx +++ b/stella/src/gui/ListWidget.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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -241,7 +241,7 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers) _quickSelectStr = (char)ascii; else _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 // 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 EditableWidget::abortEditMode(); } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int ListWidget::_QUICK_SELECT_DELAY = 300; diff --git a/stella/src/gui/ListWidget.hxx b/stella/src/gui/ListWidget.hxx index 7e106ac33..da45559d7 100644 --- a/stella/src/gui/ListWidget.hxx +++ b/stella/src/gui/ListWidget.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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -77,6 +77,8 @@ class ListWidget : public EditableWidget void startEditMode(); void endEditMode(); + static void setQuickSelectDelay(int time) { _QUICK_SELECT_DELAY = time; } + protected: virtual void drawWidget(bool hilite) = 0; virtual GUI::Rect getEditRect() const = 0; @@ -111,6 +113,9 @@ class ListWidget : public EditableWidget string _backupString; string _quickSelectStr; int _quickSelectTime; + + private: + static int _QUICK_SELECT_DELAY; }; #endif diff --git a/stella/src/gui/UIDialog.cxx b/stella/src/gui/UIDialog.cxx index 2c31d9d9e..2ab59ccae 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.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 // Copyright (C) 2002-2004 The ScummVM project @@ -25,6 +25,7 @@ #include "Dialog.hxx" #include "OSystem.hxx" +#include "ListWidget.hxx" #include "PopUpWidget.hxx" #include "ScrollBarWidget.hxx" #include "Settings.hxx" @@ -190,6 +191,21 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent, wid.push_back(myPalettePopup); 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 myWheelLinesSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Mouse wheel scroll: ", @@ -278,6 +294,12 @@ void UIDialog::loadConfig() const string& pal = instance().settings().getString("uipalette"); 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 int mw = instance().settings().getInt("mwheel"); if(mw < 1 || mw > 10) mw = 1; @@ -310,6 +332,11 @@ void UIDialog::saveConfig() instance().settings().setString("uipalette", myPalettePopup->getSelectedTag()); + // Listwidget quick delay + int delay = myListDelaySlider->getValue(); + instance().settings().setInt("listdelay", delay); + ListWidget::setQuickSelectDelay(delay); + // Mouse wheel lines int mw = myWheelLinesSlider->getValue(); instance().settings().setInt("mwheel", mw); @@ -343,6 +370,8 @@ void UIDialog::setDefaults() case 2: // Misc. options myPalettePopup->setSelected("1", "1"); + myListDelaySlider->setValue(300); + myListDelayLabel->setValue(300); myWheelLinesSlider->setValue(4); myWheelLinesLabel->setValue(4); break; @@ -375,6 +404,10 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id) myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue()); break; + case kLQDelayChanged: + myListDelayLabel->setValue(myListDelaySlider->getValue()); + break; + case kWLinesChanged: myWheelLinesLabel->setValue(myWheelLinesSlider->getValue()); break; diff --git a/stella/src/gui/UIDialog.hxx b/stella/src/gui/UIDialog.hxx index 828fd1435..62fa5ffd9 100644 --- a/stella/src/gui/UIDialog.hxx +++ b/stella/src/gui/UIDialog.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: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -58,7 +58,9 @@ class UIDialog : public Dialog StaticTextWidget* myDebuggerHeightLabel; // Misc options - PopUpWidget* myPalettePopup; + PopUpWidget* myPalettePopup; + SliderWidget* myListDelaySlider; + StaticTextWidget* myListDelayLabel; SliderWidget* myWheelLinesSlider; StaticTextWidget* myWheelLinesLabel; @@ -74,6 +76,7 @@ class UIDialog : public Dialog kLHeightChanged = 'UIlh', kDWidthChanged = 'UIdw', kDHeightChanged = 'UIdh', + kLQDelayChanged = 'UIqd', kWLinesChanged = 'UIsl' }; };