mirror of https://github.com/stella-emu/stella.git
refactored file navigation bar into own class
enhanced BrowserDialog
This commit is contained in:
parent
41f7d70990
commit
369a5dfc16
|
@ -23,6 +23,7 @@
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "EditTextWidget.hxx"
|
#include "EditTextWidget.hxx"
|
||||||
#include "FileListWidget.hxx"
|
#include "FileListWidget.hxx"
|
||||||
|
#include "NavigationWidget.hxx"
|
||||||
#include "Widget.hxx"
|
#include "Widget.hxx"
|
||||||
#include "Font.hxx"
|
#include "Font.hxx"
|
||||||
#include "BrowserDialog.hxx"
|
#include "BrowserDialog.hxx"
|
||||||
|
@ -51,10 +52,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
xpos = HBORDER; ypos = VBORDER + _th;
|
xpos = HBORDER; ypos = VBORDER + _th;
|
||||||
|
|
||||||
// Current path - TODO: handle long paths ?
|
// Current path - TODO: handle long paths ?
|
||||||
StaticTextWidget* t = new StaticTextWidget(this, font, xpos, ypos + 2, "Path ");
|
_navigationBar = new NavigationWidget(this, font, xpos, ypos, _w - HBORDER * 2, lineHeight);
|
||||||
_currentPath = new EditTextWidget(this, font, xpos + t->getWidth(), ypos,
|
|
||||||
_w - t->getWidth() - 2 * xpos, lineHeight);
|
|
||||||
_currentPath->setEditable(false);
|
|
||||||
|
|
||||||
xpos = _w - (HBORDER + _font.getStringWidth("Save") + CheckboxWidget::prefixSize(_font));
|
xpos = _w - (HBORDER + _font.getStringWidth("Save") + CheckboxWidget::prefixSize(_font));
|
||||||
_savePathBox = new CheckboxWidget(this, font, xpos, ypos + 2, "Save");
|
_savePathBox = new CheckboxWidget(this, font, xpos, ypos + 2, "Save");
|
||||||
|
@ -66,6 +64,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
_h - selectHeight - buttonHeight - ypos - VBORDER * 2);
|
_h - selectHeight - buttonHeight - ypos - VBORDER * 2);
|
||||||
_fileList->setEditable(false);
|
_fileList->setEditable(false);
|
||||||
addFocusWidget(_fileList);
|
addFocusWidget(_fileList);
|
||||||
|
_navigationBar->setList(_fileList);
|
||||||
|
|
||||||
// Add currently selected item
|
// Add currently selected item
|
||||||
ypos += _fileList->getHeight() + VGAP * 2;
|
ypos += _fileList->getHeight() + VGAP * 2;
|
||||||
|
@ -183,8 +182,8 @@ void BrowserDialog::show(const string& startpath,
|
||||||
_fileList->setListMode(FilesystemNode::ListMode::All);
|
_fileList->setListMode(FilesystemNode::ListMode::All);
|
||||||
_fileList->setNameFilter(namefilter);
|
_fileList->setNameFilter(namefilter);
|
||||||
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
|
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
|
||||||
|
// Show "save" checkbox
|
||||||
_currentPath->setWidth(_savePathBox->getLeft() - _currentPath->getLeft() - fontWidth);
|
_navigationBar->setWidth(_savePathBox->getLeft() - _navigationBar->getLeft() - fontWidth);
|
||||||
_savePathBox->setEnabled(true);
|
_savePathBox->setEnabled(true);
|
||||||
_savePathBox->clearFlags(Widget::FLAG_INVISIBLE);
|
_savePathBox->clearFlags(Widget::FLAG_INVISIBLE);
|
||||||
_savePathBox->setState(instance().settings().getBool("saveuserdir"));
|
_savePathBox->setState(instance().settings().getBool("saveuserdir"));
|
||||||
|
@ -200,8 +199,8 @@ void BrowserDialog::show(const string& startpath,
|
||||||
_fileList->setListMode(FilesystemNode::ListMode::All);
|
_fileList->setListMode(FilesystemNode::ListMode::All);
|
||||||
_fileList->setNameFilter(namefilter);
|
_fileList->setNameFilter(namefilter);
|
||||||
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
|
_fileList->setHeight(_selected->getTop() - VGAP * 2 - _fileList->getTop());
|
||||||
|
// Show "save" checkbox
|
||||||
_currentPath->setWidth(_savePathBox->getLeft() - _currentPath->getLeft() - fontWidth);
|
_navigationBar->setWidth(_savePathBox->getLeft() - _navigationBar->getLeft() - fontWidth);
|
||||||
_savePathBox->setEnabled(true);
|
_savePathBox->setEnabled(true);
|
||||||
_savePathBox->clearFlags(Widget::FLAG_INVISIBLE);
|
_savePathBox->clearFlags(Widget::FLAG_INVISIBLE);
|
||||||
_savePathBox->setState(instance().settings().getBool("saveuserdir"));
|
_savePathBox->setState(instance().settings().getBool("saveuserdir"));
|
||||||
|
@ -220,8 +219,8 @@ void BrowserDialog::show(const string& startpath,
|
||||||
_fileList->setNameFilter([](const FilesystemNode&) { return true; });
|
_fileList->setNameFilter([](const FilesystemNode&) { return true; });
|
||||||
// TODO: scrollbar affected too!
|
// TODO: scrollbar affected too!
|
||||||
_fileList->setHeight(_selected->getBottom() - _fileList->getTop());
|
_fileList->setHeight(_selected->getBottom() - _fileList->getTop());
|
||||||
|
// Hide "save" checkbox
|
||||||
_currentPath->setWidth(_savePathBox->getRight() - _currentPath->getLeft());
|
_navigationBar->setWidth(_savePathBox->getRight() - _navigationBar->getLeft());
|
||||||
_savePathBox->setEnabled(false);
|
_savePathBox->setEnabled(false);
|
||||||
_savePathBox->setFlags(Widget::FLAG_INVISIBLE);
|
_savePathBox->setFlags(Widget::FLAG_INVISIBLE);
|
||||||
|
|
||||||
|
@ -259,6 +258,16 @@ const FilesystemNode& BrowserDialog::getResult() const
|
||||||
return _fileList->currentDir();
|
return _fileList->currentDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void BrowserDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
|
{
|
||||||
|
// Grab the key before passing it to the actual dialog and check for
|
||||||
|
// file list navigation keys
|
||||||
|
// Required because BrowserDialog does not want raw input
|
||||||
|
if(repeated || !_fileList->handleKeyDown(key, mod))
|
||||||
|
Dialog::handleKeyDown(key, mod, repeated);
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
|
void BrowserDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
@ -320,7 +329,7 @@ void BrowserDialog::updateUI(bool fileSelected)
|
||||||
_goUpButton->setEnabled(_fileList->currentDir().hasParent());
|
_goUpButton->setEnabled(_fileList->currentDir().hasParent());
|
||||||
|
|
||||||
// Update the path display
|
// Update the path display
|
||||||
_currentPath->setText(_fileList->currentDir().getShortPath());
|
_navigationBar->updateUI();
|
||||||
|
|
||||||
// Enable/disable OK button based on current mode and status
|
// Enable/disable OK button based on current mode and status
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
|
|
|
@ -22,6 +22,7 @@ class GuiObject;
|
||||||
class ButtonWidget;
|
class ButtonWidget;
|
||||||
class EditTextWidget;
|
class EditTextWidget;
|
||||||
class FileListWidget;
|
class FileListWidget;
|
||||||
|
class NavigationWidget;
|
||||||
class StaticTextWidget;
|
class StaticTextWidget;
|
||||||
|
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
|
@ -103,6 +104,7 @@ class BrowserDialog : public Dialog
|
||||||
/** Get resulting file node (called after receiving kChooseCmd) */
|
/** Get resulting file node (called after receiving kChooseCmd) */
|
||||||
const FilesystemNode& getResult() const;
|
const FilesystemNode& getResult() const;
|
||||||
|
|
||||||
|
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void updateUI(bool fileSelected);
|
void updateUI(bool fileSelected);
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ class BrowserDialog : public Dialog
|
||||||
Command _command{[](bool, const FilesystemNode&){}};
|
Command _command{[](bool, const FilesystemNode&){}};
|
||||||
|
|
||||||
FileListWidget* _fileList{nullptr};
|
FileListWidget* _fileList{nullptr};
|
||||||
EditTextWidget* _currentPath{nullptr};
|
NavigationWidget* _navigationBar{nullptr};
|
||||||
StaticTextWidget* _name{nullptr};
|
StaticTextWidget* _name{nullptr};
|
||||||
EditTextWidget* _selected{nullptr};
|
EditTextWidget* _selected{nullptr};
|
||||||
ButtonWidget* _goUpButton{nullptr};
|
ButtonWidget* _goUpButton{nullptr};
|
||||||
|
|
|
@ -76,8 +76,6 @@ void FileListWidget::setDirectory(const FilesystemNode& node,
|
||||||
void FileListWidget::setLocation(const FilesystemNode& node,
|
void FileListWidget::setLocation(const FilesystemNode& node,
|
||||||
const string select)
|
const string select)
|
||||||
{
|
{
|
||||||
cerr << node.getPath() << " : " << select << endl;
|
|
||||||
|
|
||||||
progress().resetProgress();
|
progress().resetProgress();
|
||||||
progress().open();
|
progress().open();
|
||||||
FilesystemNode::CancelCheck isCancelled = [this]() {
|
FilesystemNode::CancelCheck isCancelled = [this]() {
|
||||||
|
@ -286,6 +284,47 @@ void FileListWidget::incProgress()
|
||||||
progress().incProgress();
|
progress().incProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
|
{
|
||||||
|
// Grab the key before passing it to the actual dialog and check for
|
||||||
|
// file list navigation keys
|
||||||
|
bool handled = false;
|
||||||
|
|
||||||
|
if(StellaModTest::isAlt(mod))
|
||||||
|
{
|
||||||
|
handled = true;
|
||||||
|
cerr << " " << mod << ", " << key << endl;
|
||||||
|
switch(key)
|
||||||
|
{
|
||||||
|
case KBDK_HOME:
|
||||||
|
sendCommand(kHomeDirCmd, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_LEFT:
|
||||||
|
sendCommand(kPrevDirCmd, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_RIGHT:
|
||||||
|
sendCommand(kNextDirCmd, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_UP:
|
||||||
|
sendCommand(kParentDirCmd, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_DOWN:
|
||||||
|
sendCommand(kActivatedCmd, _selected, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
handled = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FileListWidget::handleText(char text)
|
bool FileListWidget::handleText(char text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,8 @@ class FileListWidget : public StringListWidget
|
||||||
int x, int y, int w, int h);
|
int x, int y, int w, int h);
|
||||||
~FileListWidget() override = default;
|
~FileListWidget() override = default;
|
||||||
|
|
||||||
|
bool handleKeyDown(StellaKey key, StellaMod mod) override;
|
||||||
|
|
||||||
string getToolTip(const Common::Point& pos) const override;
|
string getToolTip(const Common::Point& pos) const override;
|
||||||
|
|
||||||
/** Determines how to display files/folders; either setDirectory or reload
|
/** Determines how to display files/folders; either setDirectory or reload
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "EditTextWidget.hxx"
|
#include "EditTextWidget.hxx"
|
||||||
#include "FileListWidget.hxx"
|
#include "FileListWidget.hxx"
|
||||||
#include "LauncherFileListWidget.hxx"
|
#include "LauncherFileListWidget.hxx"
|
||||||
|
#include "NavigationWidget.hxx"
|
||||||
#include "FSNode.hxx"
|
#include "FSNode.hxx"
|
||||||
#include "MD5.hxx"
|
#include "MD5.hxx"
|
||||||
#include "OptionsDialog.hxx"
|
#include "OptionsDialog.hxx"
|
||||||
|
@ -79,6 +80,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
addRomWidgets(ypos, wid);
|
addRomWidgets(ypos, wid);
|
||||||
if(!myUseMinimalUI && bottomButtons)
|
if(!myUseMinimalUI && bottomButtons)
|
||||||
addButtonWidgets(ypos, wid);
|
addButtonWidgets(ypos, wid);
|
||||||
|
myNavigationBar->setList(myList);
|
||||||
|
|
||||||
tooltip().setFont(_font);
|
tooltip().setFont(_font);
|
||||||
|
|
||||||
|
@ -213,58 +215,22 @@ void LauncherDialog::addPathWidgets(int& ypos, WidgetArray& wid)
|
||||||
LBL_GAP = fontWidth,
|
LBL_GAP = fontWidth,
|
||||||
BTN_GAP = fontWidth / 4;
|
BTN_GAP = fontWidth / 4;
|
||||||
const bool smallIcon = lineHeight < 26;
|
const bool smallIcon = lineHeight < 26;
|
||||||
const int iconGap = (fontWidth + 1) & ~0b1; // round up to next even
|
|
||||||
const string lblFound = "12345 items";
|
const string lblFound = "12345 items";
|
||||||
const int lwFound = _font.getStringWidth(lblFound);
|
const int lwFound = _font.getStringWidth(lblFound);
|
||||||
const GUI::Icon& reloadIcon = smallIcon ? GUI::icon_reload_small : GUI::icon_reload_large;
|
const GUI::Icon& reloadIcon = smallIcon ? GUI::icon_reload_small : GUI::icon_reload_large;
|
||||||
const int iconWidth = reloadIcon.width();
|
const int iconWidth = reloadIcon.width();
|
||||||
|
const int buttonWidth = iconWidth + ((fontWidth + 1) & ~0b1) - 1; // round up to next odd
|
||||||
|
const int buttonHeight = lineHeight + 2;
|
||||||
|
const int wNav = _w - HBORDER * 2 - (myUseMinimalUI ? lwFound + LBL_GAP : buttonWidth + BTN_GAP);
|
||||||
|
|
||||||
int xpos = HBORDER;
|
int xpos = HBORDER;
|
||||||
|
myNavigationBar = new NavigationWidget(this, _font, xpos, ypos, wNav, buttonHeight);
|
||||||
|
|
||||||
if(!myUseMinimalUI)
|
if(!myUseMinimalUI)
|
||||||
{
|
{
|
||||||
const GUI::Icon& prevIcon = smallIcon ? GUI::icon_prev_small : GUI::icon_prev_large;
|
xpos = myNavigationBar->getRight() + BTN_GAP;
|
||||||
const GUI::Icon& nextIcon = smallIcon ? GUI::icon_next_small : GUI::icon_next_large;
|
|
||||||
const GUI::Icon& homeIcon = smallIcon ? GUI::icon_home_small : GUI::icon_home_large;
|
|
||||||
const GUI::Icon& upIcon = smallIcon ? GUI::icon_up_small : GUI::icon_up_large;
|
|
||||||
|
|
||||||
myHomeButton = new ButtonWidget(this, _font, xpos, ypos,
|
|
||||||
iconWidth + iconGap - 1, lineHeight + 2, homeIcon, FileListWidget::kHomeDirCmd);
|
|
||||||
myHomeButton->setToolTip("Go back to Stella's ROM directory.");
|
|
||||||
wid.push_back(myHomeButton);
|
|
||||||
xpos = myHomeButton->getRight() + BTN_GAP;
|
|
||||||
|
|
||||||
myPrevButton = new ButtonWidget(this, _font, xpos, ypos,
|
|
||||||
iconWidth + iconGap - 1, lineHeight + 2, prevIcon, FileListWidget::kPrevDirCmd);
|
|
||||||
myPrevButton->setToolTip("Go back in directory history.");
|
|
||||||
wid.push_back(myPrevButton);
|
|
||||||
xpos = myPrevButton->getRight() + BTN_GAP;
|
|
||||||
|
|
||||||
myNextButton = new ButtonWidget(this, _font, xpos, ypos,
|
|
||||||
iconWidth + iconGap - 1, lineHeight + 2, nextIcon, FileListWidget::kNextDirCmd);
|
|
||||||
myNextButton->setToolTip("Go forward in directory history.");
|
|
||||||
wid.push_back(myNextButton);
|
|
||||||
xpos = myNextButton->getRight() + BTN_GAP;
|
|
||||||
|
|
||||||
myUpButton = new ButtonWidget(this, _font, xpos, ypos,
|
|
||||||
iconWidth + iconGap - 1, lineHeight + 2, upIcon, ListWidget::kParentDirCmd);
|
|
||||||
myUpButton->setToolTip("Go Up");
|
|
||||||
wid.push_back(myUpButton);
|
|
||||||
xpos = myUpButton->getRight() + BTN_GAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
myDir = new EditTextWidget(this, _font, xpos, ypos,
|
|
||||||
_w - xpos - (myUseMinimalUI
|
|
||||||
? lwFound + LBL_GAP
|
|
||||||
: (iconWidth + iconGap + BTN_GAP))
|
|
||||||
- HBORDER, lineHeight, "");
|
|
||||||
myDir->setEditable(false, true);
|
|
||||||
myDir->clearFlags(Widget::FLAG_RETAIN_FOCUS);
|
|
||||||
|
|
||||||
if(!myUseMinimalUI)
|
|
||||||
{
|
|
||||||
xpos = myDir->getRight() + BTN_GAP;
|
|
||||||
myReloadButton = new ButtonWidget(this, _font, xpos, ypos,
|
myReloadButton = new ButtonWidget(this, _font, xpos, ypos,
|
||||||
iconWidth + iconGap - 1, lineHeight + 2, reloadIcon, kReloadCmd);
|
buttonWidth, buttonHeight, reloadIcon, kReloadCmd);
|
||||||
myReloadButton->setToolTip("Reload listing");
|
myReloadButton->setToolTip("Reload listing");
|
||||||
wid.push_back(myReloadButton);
|
wid.push_back(myReloadButton);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +242,7 @@ void LauncherDialog::addPathWidgets(int& ypos, WidgetArray& wid)
|
||||||
myRomCount = new StaticTextWidget(this, _font, xpos, ypos + 2,
|
myRomCount = new StaticTextWidget(this, _font, xpos, ypos + 2,
|
||||||
lwFound, fontHeight, "", TextAlign::Right);
|
lwFound, fontHeight, "", TextAlign::Right);
|
||||||
|
|
||||||
EditTextWidget* e = new EditTextWidget(this, _font, myDir->getRight() - 1, ypos,
|
EditTextWidget* e = new EditTextWidget(this, _font, myNavigationBar->getRight() - 1, ypos,
|
||||||
lwFound + LBL_GAP + 1, lineHeight, "");
|
lwFound + LBL_GAP + 1, lineHeight, "");
|
||||||
e->setEditable(false, true);
|
e->setEditable(false, true);
|
||||||
}
|
}
|
||||||
|
@ -522,17 +488,7 @@ void LauncherDialog::updateUI()
|
||||||
if(myGoUpButton)
|
if(myGoUpButton)
|
||||||
myGoUpButton->setEnabled(myList->currentDir().hasParent());
|
myGoUpButton->setEnabled(myList->currentDir().hasParent());
|
||||||
// Only enable the navigation buttons if function is available
|
// Only enable the navigation buttons if function is available
|
||||||
if(myHomeButton)
|
myNavigationBar->updateUI();
|
||||||
myHomeButton->setEnabled(myList->hasPrevHistory());
|
|
||||||
if(myPrevButton)
|
|
||||||
myPrevButton->setEnabled(myList->hasPrevHistory());
|
|
||||||
if(myNextButton)
|
|
||||||
myNextButton->setEnabled(myList->hasNextHistory());
|
|
||||||
if(myUpButton)
|
|
||||||
myUpButton->setEnabled(myList->currentDir().hasParent());
|
|
||||||
|
|
||||||
// Show current directory
|
|
||||||
myDir->setText(myList->currentDir().getShortPath());
|
|
||||||
|
|
||||||
// Indicate how many files were found
|
// Indicate how many files were found
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
|
@ -781,8 +737,6 @@ void LauncherDialog::handleContextMenu()
|
||||||
reload();
|
reload();
|
||||||
else if(cmd == "options")
|
else if(cmd == "options")
|
||||||
openSettings();
|
openSettings();
|
||||||
//else if(cmd == "quit")
|
|
||||||
// handleQuit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -809,40 +763,9 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
// context menu keys
|
// context menu keys
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
if(!(myPattern->isHighlighted()
|
if(StellaModTest::isControl(mod) &&
|
||||||
|
!(myPattern && myPattern->isHighlighted()
|
||||||
&& instance().eventHandler().eventForKey(EventMode::kEditMode, key, mod) != Event::NoType))
|
&& instance().eventHandler().eventForKey(EventMode::kEditMode, key, mod) != Event::NoType))
|
||||||
{
|
|
||||||
if(StellaModTest::isAlt(mod))
|
|
||||||
{
|
|
||||||
handled = true;
|
|
||||||
switch(key)
|
|
||||||
{
|
|
||||||
case KBDK_HOME:
|
|
||||||
sendCommand(FileListWidget::kHomeDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_LEFT:
|
|
||||||
sendCommand(FileListWidget::kPrevDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_RIGHT:
|
|
||||||
sendCommand(FileListWidget::kNextDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_UP:
|
|
||||||
sendCommand(ListWidget::kParentDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KBDK_DOWN:
|
|
||||||
sendCommand(kLoadROMCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(StellaModTest::isControl(mod))
|
|
||||||
{
|
{
|
||||||
handled = true;
|
handled = true;
|
||||||
switch(key)
|
switch(key)
|
||||||
|
@ -895,7 +818,6 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(!handled)
|
if(!handled)
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
// handle keys used by R77
|
// handle keys used by R77
|
||||||
|
@ -923,7 +845,9 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Dialog::handleKeyDown(key, mod);
|
// Required because BrowserDialog does not want raw input
|
||||||
|
if(repeated || !myList->handleKeyDown(key, mod))
|
||||||
|
Dialog::handleKeyDown(key, mod, repeated);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,7 +921,7 @@ void LauncherDialog::handleMouseUp(int x, int y, MouseButton b, int clickCount)
|
||||||
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case kAllfilesCmd:
|
case kAllfilesCmd:
|
||||||
toggleShowAll();
|
toggleShowAll();
|
||||||
|
@ -1007,22 +931,6 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
toggleSubDirs();
|
toggleSubDirs();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FileListWidget::kHomeDirCmd:
|
|
||||||
myList->sendCommand(FileListWidget::kHomeDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FileListWidget::kPrevDirCmd:
|
|
||||||
myList->sendCommand(FileListWidget::kPrevDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FileListWidget::kNextDirCmd:
|
|
||||||
myList->sendCommand(FileListWidget::kNextDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ListWidget::kParentDirCmd:
|
|
||||||
myList->sendCommand(ListWidget::kParentDirCmd, 0, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kLoadROMCmd:
|
case kLoadROMCmd:
|
||||||
if(myList->isDirectory(myList->selected()))
|
if(myList->isDirectory(myList->selected()))
|
||||||
{
|
{
|
||||||
|
@ -1242,7 +1150,6 @@ void LauncherDialog::openContextMenu(int x, int y)
|
||||||
//if(!instance().settings().getBool("launcherbuttons"))
|
//if(!instance().settings().getBool("launcherbuttons"))
|
||||||
//{
|
//{
|
||||||
// items.push_back(ContextItem("Options" + ELLIPSIS, "Ctrl+O", "options"));
|
// items.push_back(ContextItem("Options" + ELLIPSIS, "Ctrl+O", "options"));
|
||||||
// items.push_back(ContextItem("Quit", "Ctrl+Q", "quit"));
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class DialogContainer;
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class Properties;
|
class Properties;
|
||||||
class EditTextWidget;
|
class EditTextWidget;
|
||||||
|
class NavigationWidget;
|
||||||
class LauncherFileListWidget;
|
class LauncherFileListWidget;
|
||||||
class RomInfoWidget;
|
class RomInfoWidget;
|
||||||
class StaticTextWidget;
|
class StaticTextWidget;
|
||||||
|
@ -199,11 +200,7 @@ class LauncherDialog : public Dialog, CommandSender
|
||||||
ButtonWidget* mySubDirsButton{nullptr};
|
ButtonWidget* mySubDirsButton{nullptr};
|
||||||
StaticTextWidget* myRomCount{nullptr};
|
StaticTextWidget* myRomCount{nullptr};
|
||||||
|
|
||||||
ButtonWidget* myHomeButton{nullptr};
|
NavigationWidget* myNavigationBar{nullptr};
|
||||||
ButtonWidget* myPrevButton{nullptr};
|
|
||||||
ButtonWidget* myNextButton{nullptr};
|
|
||||||
ButtonWidget* myUpButton{nullptr};
|
|
||||||
EditTextWidget* myDir{nullptr};
|
|
||||||
ButtonWidget* myReloadButton{nullptr};
|
ButtonWidget* myReloadButton{nullptr};
|
||||||
|
|
||||||
LauncherFileListWidget* myList{nullptr};
|
LauncherFileListWidget* myList{nullptr};
|
||||||
|
|
|
@ -35,11 +35,12 @@ MODULE_OBJS := \
|
||||||
src/gui/MessageBox.o \
|
src/gui/MessageBox.o \
|
||||||
src/gui/MessageDialog.o \
|
src/gui/MessageDialog.o \
|
||||||
src/gui/MessageMenu.o \
|
src/gui/MessageMenu.o \
|
||||||
src/gui/MinUICommandDialog.o\
|
src/gui/MinUICommandDialog.o \
|
||||||
|
src/gui/NavigationWidget.o \
|
||||||
src/gui/OptionsDialog.o \
|
src/gui/OptionsDialog.o \
|
||||||
src/gui/OptionsMenu.o \
|
src/gui/OptionsMenu.o \
|
||||||
src/gui/PlusRomsMenu.o\
|
src/gui/PlusRomsMenu.o\
|
||||||
src/gui/PlusRomsSetupDialog.o\
|
src/gui/PlusRomsSetupDialog.o \
|
||||||
src/gui/PopUpWidget.o \
|
src/gui/PopUpWidget.o \
|
||||||
src/gui/ProgressDialog.o \
|
src/gui/ProgressDialog.o \
|
||||||
src/gui/QuadTariDialog.o \
|
src/gui/QuadTariDialog.o \
|
||||||
|
|
|
@ -913,6 +913,7 @@
|
||||||
<ClCompile Include="..\gui\HighScoresDialog.cxx" />
|
<ClCompile Include="..\gui\HighScoresDialog.cxx" />
|
||||||
<ClCompile Include="..\gui\HighScoresMenu.cxx" />
|
<ClCompile Include="..\gui\HighScoresMenu.cxx" />
|
||||||
<ClCompile Include="..\gui\LauncherFileListWidget.cxx" />
|
<ClCompile Include="..\gui\LauncherFileListWidget.cxx" />
|
||||||
|
<ClCompile Include="..\gui\NavigationWidget.cxx" />
|
||||||
<ClCompile Include="..\gui\PlusRomsMenu.cxx" />
|
<ClCompile Include="..\gui\PlusRomsMenu.cxx" />
|
||||||
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
||||||
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
||||||
|
@ -2120,6 +2121,7 @@
|
||||||
<ClInclude Include="..\gui\HighScoresMenu.hxx" />
|
<ClInclude Include="..\gui\HighScoresMenu.hxx" />
|
||||||
<ClInclude Include="..\gui\Icon.hxx" />
|
<ClInclude Include="..\gui\Icon.hxx" />
|
||||||
<ClInclude Include="..\gui\LauncherFileListWidget.hxx" />
|
<ClInclude Include="..\gui\LauncherFileListWidget.hxx" />
|
||||||
|
<ClInclude Include="..\gui\NavigationWidget.hxx" />
|
||||||
<ClInclude Include="..\gui\PlusRomsMenu.hxx" />
|
<ClInclude Include="..\gui\PlusRomsMenu.hxx" />
|
||||||
<ClInclude Include="..\gui\JoystickDialog.hxx" />
|
<ClInclude Include="..\gui\JoystickDialog.hxx" />
|
||||||
<ClInclude Include="..\gui\LoggerDialog.hxx" />
|
<ClInclude Include="..\gui\LoggerDialog.hxx" />
|
||||||
|
|
|
@ -1125,6 +1125,9 @@
|
||||||
<ClCompile Include="..\gui\FavoritesManager.cxx">
|
<ClCompile Include="..\gui\FavoritesManager.cxx">
|
||||||
<Filter>Source Files\gui</Filter>
|
<Filter>Source Files\gui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\gui\NavigationWidget.cxx">
|
||||||
|
<Filter>Source Files\gui</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\common\bspf.hxx">
|
<ClInclude Include="..\common\bspf.hxx">
|
||||||
|
@ -2318,6 +2321,9 @@
|
||||||
<ClInclude Include="..\gui\Icons.hxx">
|
<ClInclude Include="..\gui\Icons.hxx">
|
||||||
<Filter>Header Files\gui</Filter>
|
<Filter>Header Files\gui</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\gui\NavigationWidget.hxx">
|
||||||
|
<Filter>Header Files\gui</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="stella.ico">
|
<None Include="stella.ico">
|
||||||
|
|
Loading…
Reference in New Issue