From e537eaffd5231bffe1aa744d4e542d01de389898 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Wed, 16 Feb 2022 21:54:20 +0100 Subject: [PATCH] enhanced launcher context menu with direct Game properties dialog link --- docs/index.html | 81 +++++++++++++++++++++----------------- src/gui/LauncherDialog.cxx | 25 ++++++++++-- src/gui/LauncherDialog.hxx | 1 + 3 files changed, 68 insertions(+), 39 deletions(-) diff --git a/docs/index.html b/docs/index.html index 579adba88..30e09ee45 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2290,6 +2290,11 @@ Control + F Control + F + + Open Game properties dialog + Control + G + Control + G + Open Power-On options dialog Control + P @@ -4317,46 +4322,50 @@


diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 35a1c94e7..b6b5bb943 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -28,6 +28,7 @@ #include "FSNode.hxx" #include "MD5.hxx" #include "OptionsDialog.hxx" +#include "GameInfoDialog.hxx" #include "HighScoresDialog.hxx" #include "HighScoresManager.hxx" #include "GlobalPropsDialog.hxx" @@ -245,7 +246,6 @@ void LauncherDialog::addPathWidgets(int& ypos) buttonWidth, buttonHeight, reloadIcon, kReloadCmd); myReloadButton->setToolTip("Reload listing"); wid.push_back(myReloadButton); - ypos = myNavigationBar->getBottom() + Dialog::vGap(); } else { @@ -256,10 +256,10 @@ void LauncherDialog::addPathWidgets(int& ypos) lwFound, fontHeight, "", TextAlign::Right); EditTextWidget* e = new EditTextWidget(this, _font, myNavigationBar->getRight() - 1, ypos, - lwFound + LBL_GAP + 1, lineHeight, ""); + lwFound + LBL_GAP + 1, buttonHeight - 2, ""); e->setEditable(false, true); - ypos = myNavigationBar->getBottom(); } + ypos = myNavigationBar->getBottom() + Dialog::vGap(); addToFocusList(wid); } @@ -739,6 +739,8 @@ void LauncherDialog::handleContextMenu() removeAllPopular(); else if(cmd == "removerecent") removeAllRecent(); + else if(cmd == "properties") + openGameProperties(); else if(cmd == "override") openGlobalProps(); else if(cmd == "extensions") @@ -807,6 +809,10 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) myList->toggleUserFavorite(); break; + case KBDK_G: + openGameProperties(); + break; + case KBDK_H: if(instance().highScores().enabled()) openHighScores(); @@ -1137,6 +1143,7 @@ void LauncherDialog::openContextMenu(int x, int y) } if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode())) { + items.push_back(ContextItem("Game properties" + ELLIPSIS, "Ctrl+G", "properties")); items.push_back(ContextItem("Power-on options" + ELLIPSIS, "Ctrl+P", "override")); if(instance().highScores().enabled()) items.push_back(ContextItem("High scores" + ELLIPSIS, "Ctrl+H", "highscores")); @@ -1212,6 +1219,18 @@ void LauncherDialog::openSettings() myDialog->open(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::openGameProperties() +{ + if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode())) + { + // Create game properties dialog + myDialog = make_unique(instance(), parent(), + myUseMinimalUI ? _font : instance().frameBuffer().font(), this, _w, _h); + myDialog->open(); + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::openGlobalProps() { diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index af01cd595..609d1cff7 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -168,6 +168,7 @@ class LauncherDialog : public Dialog, CommandSender void loadRom(); void loadRomInfo(); void openSettings(); + void openGameProperties(); void openContextMenu(int x = -1, int y = -1); void openGlobalProps(); void openHighScores();