mirror of https://github.com/stella-emu/stella.git
allow quick select for directories starting with non-letter chars (fixes #891)
This commit is contained in:
parent
75b4d5b362
commit
75fa3eb438
|
@ -349,7 +349,7 @@ class EventHandler
|
||||||
/**
|
/**
|
||||||
Check for QWERTZ keyboard layout
|
Check for QWERTZ keyboard layout
|
||||||
*/
|
*/
|
||||||
bool isQwertz() { return myQwertz; }
|
bool isQwertz() const { return myQwertz; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clipboard methods.
|
Clipboard methods.
|
||||||
|
|
|
@ -304,7 +304,9 @@ bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
if(StellaModTest::isAlt(mod))
|
if(StellaModTest::isAlt(mod))
|
||||||
{
|
{
|
||||||
handled = true;
|
handled = true;
|
||||||
|
#ifdef DEBUG_BUILD
|
||||||
cerr << " " << mod << ", " << key << endl;
|
cerr << " " << mod << ", " << key << endl;
|
||||||
|
#endif
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_HOME:
|
case KBDK_HOME:
|
||||||
|
@ -332,6 +334,11 @@ bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Handle shift input for quick directory selection
|
||||||
|
_lastKey = key; _lastMod = mod;
|
||||||
|
if(_quickSelectTime < TimerManager::getTicks() / 1000)
|
||||||
|
_firstMod = mod;
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +349,10 @@ bool FileListWidget::handleText(char text)
|
||||||
// (or a substring accumulated from the last couple key presses).
|
// (or a substring accumulated from the last couple key presses).
|
||||||
// Only works in a useful fashion if the list entries are sorted.
|
// Only works in a useful fashion if the list entries are sorted.
|
||||||
const uInt64 time = TimerManager::getTicks() / 1000;
|
const uInt64 time = TimerManager::getTicks() / 1000;
|
||||||
|
const bool firstShift = StellaModTest::isShift(_firstMod);
|
||||||
|
|
||||||
|
if(StellaModTest::isShift(_lastMod))
|
||||||
|
text = *StellaKeyName::forKey(_lastKey);
|
||||||
|
|
||||||
if(_quickSelectTime < time)
|
if(_quickSelectTime < time)
|
||||||
_quickSelectStr = text;
|
_quickSelectStr = text;
|
||||||
|
@ -354,7 +365,7 @@ bool FileListWidget::handleText(char text)
|
||||||
{
|
{
|
||||||
if(BSPF::startsWithIgnoreCase(i, _quickSelectStr))
|
if(BSPF::startsWithIgnoreCase(i, _quickSelectStr))
|
||||||
// Select directories when the first character is uppercase
|
// Select directories when the first character is uppercase
|
||||||
if((std::isupper(_quickSelectStr[0]) != 0) ==
|
if(firstShift ==
|
||||||
(_iconTypeList[selectedItem] == IconType::directory
|
(_iconTypeList[selectedItem] == IconType::directory
|
||||||
|| _iconTypeList[selectedItem] == IconType::userdir
|
|| _iconTypeList[selectedItem] == IconType::userdir
|
||||||
|| _iconTypeList[selectedItem] == IconType::recentdir
|
|| _iconTypeList[selectedItem] == IconType::recentdir
|
||||||
|
|
|
@ -182,6 +182,10 @@ class FileListWidget : public StringListWidget
|
||||||
|
|
||||||
uInt32 _selected{0};
|
uInt32 _selected{0};
|
||||||
|
|
||||||
|
// Allow quick select for "uppercase", non-letter input
|
||||||
|
StellaKey _lastKey{StellaKey::KBDK_UNKNOWN};
|
||||||
|
StellaMod _lastMod{StellaMod::KBDM_NONE};
|
||||||
|
StellaMod _firstMod{StellaMod::KBDM_NONE};
|
||||||
string _quickSelectStr;
|
string _quickSelectStr;
|
||||||
uInt64 _quickSelectTime{0};
|
uInt64 _quickSelectTime{0};
|
||||||
static uInt64 _QUICK_SELECT_DELAY;
|
static uInt64 _QUICK_SELECT_DELAY;
|
||||||
|
|
Loading…
Reference in New Issue