mirror of https://github.com/stella-emu/stella.git
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:
parent
555d9c8273
commit
7f727528b8
|
@ -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).
|
||||
|
||||
|
|
|
@ -818,6 +818,12 @@
|
|||
complete.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-listdelay <delay></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>
|
||||
<td><pre>-mwheel <lines></pre></td>
|
||||
<td>Set the number of lines a mousewheel will scroll in the UI.</td>
|
||||
|
|
|
@ -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 <sstream>
|
||||
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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 <cassert>
|
||||
|
@ -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 <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"
|
||||
<< " -statedir <dir> Directory in which to save state files\n"
|
||||
<< " -cheatfile <file> Full pathname of cheatfile database\n"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue