slightly enhanced launcher context menu

This commit is contained in:
Thomas Jentzsch 2021-11-30 11:13:46 +01:00
parent b3e5c4b8f2
commit 9ed29a81e7
3 changed files with 22 additions and 16 deletions

View File

@ -2260,6 +2260,11 @@
<th>Key (Standard)</th>
<th>Key (macOS)</th>
</tr>
<tr>
<td>Open context-sensitive help</td>
<td>F1</td>
<td>Shift-Cmd + ?</td>
</tr>
<tr>
<td>Go to parent directory (also in other file dialogs)</td>
<td>Backspace</td>
@ -2291,7 +2296,7 @@
<td>Control + E</td>
</tr>
<tr>
<td>Toggle show all ROMs</td>
<td>Toggle show all files</td>
<td>Control + A</td>
<td>Control + A</td>
</tr>

View File

@ -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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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;