From 7514b97c60fe12871672c826b1eb47bd753dee2b Mon Sep 17 00:00:00 2001 From: thrust26 Date: Thu, 20 Feb 2020 08:48:14 +0100 Subject: [PATCH] fix part 1 of #583 --- src/gui/LauncherDialog.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 2bca9014e..047b4e4c5 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -204,11 +204,9 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, addToFocusList(wid); - // Create context menu for ROM list options - VariantList l; - VarList::push_back(l, "Power-on options" + ELLIPSIS, "override"); - VarList::push_back(l, "Reload listing", "reload"); - myMenu = make_unique(this, osystem.frameBuffer().font(), l); + // Create (empty) context menu for ROM list options + myMenu = make_unique(this, osystem.frameBuffer().font(), EmptyVarList); + // Create global props dialog, which is used to temporarily overrride // ROM properties @@ -462,8 +460,17 @@ void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount // Grab right mouse button for context menu, send left to base class if(b == MouseButton::RIGHT) { + // Dynamically create context menu for ROM list options + VariantList items; + + if (!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode())) + VarList::push_back(items, "Power-on options" + ELLIPSIS, "override"); + VarList::push_back(items, "Reload listing", "reload"); + myMenu->addItems(items); + // Add menu at current x,y mouse location myMenu->show(x + getAbsX(), y + getAbsY(), surface().dstRect()); + } else Dialog::handleMouseDown(x, y, b, clickCount);