diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 2bad88ef0..2e79307a8 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -66,7 +66,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), - bwidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1)), + bwidth = (_w - 2 * HBORDER - BUTTON_GAP * (5 - 1)), bheight = myUseMinimalUI ? lineHeight - 4 : lineHeight + 4, LBL_GAP = fontWidth; int xpos = 0, ypos = 0, lwidth = 0, lwidth2 = 0; @@ -176,35 +176,50 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, // Add four buttons at the bottom xpos = HBORDER; ypos += myDir->getHeight() + 8; #ifndef BSPF_MACOS - myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight, + myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 5, bheight, "Select", kLoadROMCmd); wid.push_back(myStartButton); - xpos += (bwidth + 0) / 4 + BUTTON_GAP; - myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight, + + xpos += (bwidth + 0) / 5 + BUTTON_GAP; + myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 5, bheight, "Go Up", kPrevDirCmd); wid.push_back(myPrevDirButton); - xpos += (bwidth + 1) / 4 + BUTTON_GAP; - myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 4, bheight, - "Options" + ELLIPSIS, kOptionsCmd); - wid.push_back(myOptionsButton); - xpos += (bwidth + 2) / 4 + BUTTON_GAP; - myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight, - "Quit", kQuitCmd); - wid.push_back(myQuitButton); - #else - myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight, - "Quit", kQuitCmd); - wid.push_back(myQuitButton); - xpos += (bwidth + 0) / 4 + BUTTON_GAP; - myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight, + + xpos += (bwidth + 1) / 5 + BUTTON_GAP; + mySetDefaultDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 5, bheight, + "Set Path", kDefaultDirCmd); + wid.push_back(mySetDefaultDirButton); + + xpos += (bwidth + 2) / 5 + BUTTON_GAP; + myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 5, bheight, "Options" + ELLIPSIS, kOptionsCmd); wid.push_back(myOptionsButton); - xpos += (bwidth + 1) / 4 + BUTTON_GAP; - myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 4, bheight, + + xpos += (bwidth + 3) / 5 + BUTTON_GAP; + myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 5, bheight, + "Quit", kQuitCmd); + wid.push_back(myQuitButton); + #else + myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 5, bheight, + "Quit", kQuitCmd); + wid.push_back(myQuitButton); + + xpos += (bwidth + 0) / 5 + BUTTON_GAP; + myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 5, bheight, + "Options" + ELLIPSIS, kOptionsCmd); + wid.push_back(myOptionsButton); + + xpos += (bwidth + 1) / 5 + BUTTON_GAP; + mySetDefaultDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 5, bheight, + "Set Path", kDefaultDirCmd); + + xpos += (bwidth + 2) / 5 + BUTTON_GAP; + myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 5, bheight, "Go Up", kPrevDirCmd); wid.push_back(myPrevDirButton); - xpos += (bwidth + 2) / 4 + BUTTON_GAP; - myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight, + + xpos += (bwidth + 3) / 5 + BUTTON_GAP; + myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 5, bheight, "Select", kLoadROMCmd); wid.push_back(myStartButton); #endif @@ -582,6 +597,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, myList->selectParent(); break; + case kDefaultDirCmd: + setDefaultDir(); + break; + case FileListWidget::ItemChanged: updateUI(); break; @@ -637,6 +656,12 @@ void LauncherDialog::loadRom() instance().frameBuffer().showMessage(result, MessagePosition::MiddleCenter, true); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void LauncherDialog::setDefaultDir() +{ + instance().settings().setValue("romdir", myList->currentDir().getShortPath()); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::openSettings() { diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index d734cdba5..6c03cd18d 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -117,6 +117,7 @@ class LauncherDialog : public Dialog void loadRomInfo(); void handleContextMenu(); void showOnlyROMs(bool state); + void setDefaultDir(); void openSettings(); private: @@ -131,6 +132,7 @@ class LauncherDialog : public Dialog ButtonWidget* myStartButton{nullptr}; ButtonWidget* myPrevDirButton{nullptr}; + ButtonWidget* mySetDefaultDirButton{nullptr}; ButtonWidget* myOptionsButton{nullptr}; ButtonWidget* myQuitButton{nullptr}; @@ -151,10 +153,11 @@ class LauncherDialog : public Dialog bool myEventHandled{false}; enum { - kAllfilesCmd = 'lalf', // show all files (or ROMs only) - kPrevDirCmd = 'PRVD', - kOptionsCmd = 'OPTI', - kQuitCmd = 'QUIT' + kAllfilesCmd = 'lalf', // show all files (or ROMs only) + kPrevDirCmd = 'PRVD', + kDefaultDirCmd = 'DEFD', + kOptionsCmd = 'OPTI', + kQuitCmd = 'QUIT' }; private: