From b1ef197f89dad1289a7cdea2282ad34c87a7c822 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 30 Nov 2021 11:13:46 +0100 Subject: [PATCH] slightly enhanced launcher context menu --- docs/index.html | 7 ++++++- src/gui/LauncherDialog.cxx | 29 +++++++++++++++-------------- src/gui/LauncherDialog.hxx | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/index.html b/docs/index.html index a661c9702..8850786ed 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2260,6 +2260,11 @@ Key (Standard) Key (macOS) + + Open context-sensitive help + F1 + Shift-Cmd + ? + Go to parent directory (also in other file dialogs) Backspace @@ -2291,7 +2296,7 @@ Control + E - Toggle show all ROMs + Toggle show all files Control + A Control + A diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 50eb2e4b0..501e98bab 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -816,17 +816,17 @@ Event::Type LauncherDialog::getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount) +void LauncherDialog::handleMouseUp(int x, int y, MouseButton b, int clickCount) { // Grab right mouse button for context menu, send left to base class if(b == MouseButton::RIGHT - && x + getAbsX() >= myList->getLeft() && x + getAbsX() <= myList->getRight() - && y + getAbsY() >= myList->getTop() && y + getAbsY() <= myList->getBottom()) + && x + getAbsX() >= myList->getLeft() && x + getAbsX() <= myList->getRight() + && y + getAbsY() >= myList->getTop() && y + getAbsY() <= myList->getBottom()) { openContextMenu(x, y); } else - Dialog::handleMouseDown(x, y, b, clickCount); + Dialog::handleMouseUp(x, y, b, clickCount); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1057,7 +1057,17 @@ void LauncherDialog::openContextMenu(int x, int y) } } if(myUseMinimalUI) + { + #ifndef RETRON77 + addContextItem(items, instance().settings().getBool("launcherroms") + ? "Show all files" + : "Show only ROMs", "Ctrl+A", "showall"); + addContextItem(items, instance().settings().getBool("launchersubdirs") + ? "Exclude subdirectories" + : "Include subdirectories", "Ctrl+D", "subdirs"); + #endif addContextItem(items, "Options" + ELLIPSIS, "Ctrl+O", "options"); + } else { addContextItem(items, instance().settings().getBool("launcherextensions") @@ -1067,21 +1077,12 @@ void LauncherDialog::openContextMenu(int x, int y) addContextItem(items, instance().settings().getBool("altsorting") ? "Normal sorting" : "Alternative sorting", "Ctrl+S", "sorting"); - else - { - addContextItem(items, instance().settings().getBool("launcherroms") - ? "Show all files" - : "Show only ROMs", "Ctrl+A", "showall"); - addContextItem(items, instance().settings().getBool("launchersubdirs") - ? "Exclude subdirectories" - : "Include subdirectories", "Ctrl+D", "subdirs"); - } addContextItem(items, "Reload listing", "Ctrl+R", "reload"); } contextMenu().addItems(items); // Add menu at current x,y mouse location - contextMenu().show(x + getAbsX(), y + getAbsY(), surface().dstRect()); + contextMenu().show(x + getAbsX(), y + getAbsY(), surface().dstRect(), 0); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 21142a5f7..b4a6864fd 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -105,7 +105,7 @@ class LauncherDialog : public Dialog void setPosition() override { positionAt(0); } void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; - void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; + void handleMouseUp(int x, int y, MouseButton b, int clickCount) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleJoyDown(int stick, int button, bool longPress) override; void handleJoyUp(int stick, int button) override;