mirror of https://github.com/stella-emu/stella.git
allow minimal command dialog to open options dialog
define cancel key (P2 Skill) for R77
This commit is contained in:
parent
e34575753a
commit
80482aa7e5
|
@ -163,11 +163,11 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
// use the '1' define for testing
|
||||
#if defined(RETRON77)
|
||||
// #if 1
|
||||
setDefaultKey( KBDK_F4, Event::ConsoleColorToggle ); // back
|
||||
setDefaultKey( KBDK_F6, Event::ConsoleLeftDiffToggle ); // front
|
||||
setDefaultKey( KBDK_F8, Event::ConsoleRightDiffToggle ); // front
|
||||
setDefaultKey( KBDK_F13, Event::CmdMenuMode) ); // back
|
||||
setDefaultKey( KBDK_BACKSPACE, Event::LauncherMode ); // back
|
||||
setDefaultKey( KBDK_F4, Event::ConsoleColorToggle ); // back ("COLOR","B/W")
|
||||
setDefaultKey( KBDK_F6, Event::ConsoleLeftDiffToggle ); // front ("SKILL P1")
|
||||
setDefaultKey( KBDK_F8, Event::ConsoleRightDiffToggle ); // front ("SKILL P2")
|
||||
setDefaultKey( KBDK_F13, Event::CmdMenuMode ); // back ("4:3","16:9")
|
||||
setDefaultKey( KBDK_BACKSPACE, Event::LauncherMode ); // back ("FRY")
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -189,13 +189,14 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
// use the '1' define for testing
|
||||
#if defined(RETRON77)
|
||||
// #if 1
|
||||
setDefaultKey( KBDK_F9, Event::UIUp ); // front
|
||||
setDefaultKey( KBDK_F2, Event::UIDown ); // front
|
||||
setDefaultKey( KBDK_F11, Event::UINavPrev ); // front
|
||||
setDefaultKey( KBDK_F1, Event::UINavNext ); // front
|
||||
setDefaultKey( KBDK_F6, Event::UISelect ); // front
|
||||
setDefaultKey( KBDK_F13, Event::UIPgUp ); // back (redundant)
|
||||
setDefaultKey( KBDK_BACKSPACE, Event::UIPgDown ); // back (redundant)
|
||||
setDefaultKey( KBDK_F9, Event::UIUp ); // front ("SAVE")
|
||||
setDefaultKey( KBDK_F2, Event::UIDown ); // front ("RESET")
|
||||
setDefaultKey( KBDK_F11, Event::UINavPrev ); // front ("LOAD")
|
||||
setDefaultKey( KBDK_F1, Event::UINavNext ); // front ("MODE")
|
||||
setDefaultKey( KBDK_F6, Event::UISelect ); // front ("SKILL P1")
|
||||
setDefaultKey( KBDK_F8, Event::UICancel ); // front ("SKILL P2")
|
||||
setDefaultKey( KBDK_F13, Event::UIPgUp ); // back ("4:3","16:9")(redundant)
|
||||
setDefaultKey( KBDK_BACKSPACE, Event::UIPgDown ); // back (FRY)(redundant)
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -460,20 +460,20 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
|||
// handle keys used by R77
|
||||
switch(key)
|
||||
{
|
||||
case KBDK_F8:
|
||||
case KBDK_F8: // front ("Skill P2")
|
||||
openSettings();
|
||||
break;
|
||||
|
||||
case KBDK_F4:
|
||||
case KBDK_F4: // back ("COLOR", "B/W")
|
||||
myGlobalProps->open();
|
||||
break;
|
||||
|
||||
case KBDK_F11:
|
||||
case KBDK_F11: // front ("LOAD")
|
||||
// convert unused previous item key into page-up key
|
||||
Dialog::handleKeyDown(KBDK_F13, mod);
|
||||
break;
|
||||
|
||||
case KBDK_F1:
|
||||
case KBDK_F1: // front ("MODE")
|
||||
// convert unused next item key into page-down key
|
||||
Dialog::handleKeyDown(KBDK_BACKSPACE, mod);
|
||||
break;
|
||||
|
|
|
@ -26,13 +26,15 @@
|
|||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "StellaSettingsDialog.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
#include "TIASurface.hxx"
|
||||
#include "MinUICommandDialog.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent)
|
||||
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"),
|
||||
myStellaSettingsDialog(nullptr)
|
||||
myStellaSettingsDialog(nullptr),
|
||||
myOptionsDialog(nullptr)
|
||||
{
|
||||
const int HBORDER = 10;
|
||||
const int VBORDER = 10;
|
||||
|
@ -83,7 +85,7 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent
|
|||
wid.push_back(myRewindButton);
|
||||
myUnwindButton = ADD_CD_BUTTON("Unwind", kUnwindCmd);
|
||||
wid.push_back(myUnwindButton);
|
||||
bw = ADD_CD_BUTTON("Close", kCloseCmd);
|
||||
bw = ADD_CD_BUTTON("Close", GuiObject::kCloseCmd);
|
||||
wid.push_back(bw);
|
||||
|
||||
// Column 3
|
||||
|
@ -121,6 +123,21 @@ void MinUICommandDialog::loadConfig()
|
|||
myPhosphorButton->setLabel(instance().frameBuffer().tiaSurface().phosphorEnabled() ? "Phosphor On" : "Phosphor Off");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MinUICommandDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case KBDK_F8: // front ("Skill P2")
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleKeyDown(key, mod);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
|
@ -188,7 +205,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
updateWinds();
|
||||
break;
|
||||
|
||||
case kCloseCmd:
|
||||
case GuiObject::kCloseCmd:
|
||||
instance().eventHandler().leaveMenuMode();
|
||||
break;
|
||||
|
||||
|
@ -209,19 +226,8 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kSettings:
|
||||
{
|
||||
// This dialog is resizable under certain conditions, so we need
|
||||
// to re-create it as necessary
|
||||
uInt32 w = 0, h = 0;
|
||||
|
||||
if(myStellaSettingsDialog == nullptr || myStellaSettingsDialog->shouldResize(w, h))
|
||||
{
|
||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||
instance().frameBuffer().font(), w, h, Menu::AppMode::emulator);
|
||||
}
|
||||
myStellaSettingsDialog->open();
|
||||
openSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
case kExitGameCmd:
|
||||
instance().eventHandler().handleEvent(Event::LauncherMode);
|
||||
|
@ -268,3 +274,22 @@ void MinUICommandDialog::updateWinds()
|
|||
myUnwindButton->setEnabled(!r.atLast());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MinUICommandDialog::openSettings()
|
||||
{
|
||||
// Create an options dialog, similar to the in-game one
|
||||
if (instance().settings().getBool("basic_settings"))
|
||||
{
|
||||
if (myStellaSettingsDialog == nullptr)
|
||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||
instance().frameBuffer().launcherFont(), FBMinimum::Width, FBMinimum::Height, Menu::AppMode::launcher);
|
||||
myStellaSettingsDialog->open();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myOptionsDialog == nullptr)
|
||||
myOptionsDialog = make_unique<OptionsDialog>(instance(), parent(), this,
|
||||
FBMinimum::Width, FBMinimum::Height, Menu::AppMode::launcher);
|
||||
myOptionsDialog->open();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ class CommandSender;
|
|||
class DialogContainer;
|
||||
class OSystem;
|
||||
class StellaSettingsDialog;
|
||||
class OptionsDialog;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
|
@ -34,10 +35,12 @@ class MinUICommandDialog : public Dialog
|
|||
|
||||
protected:
|
||||
void loadConfig() override;
|
||||
void handleKeyDown(StellaKey key, StellaMod mod) override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
void updateSlot(int slot);
|
||||
void updateWinds();
|
||||
void updateTVFormat();
|
||||
void openSettings();
|
||||
|
||||
// column 0
|
||||
ButtonWidget* myColorButton;
|
||||
|
@ -55,6 +58,7 @@ class MinUICommandDialog : public Dialog
|
|||
ButtonWidget* myPhosphorButton;
|
||||
|
||||
unique_ptr<StellaSettingsDialog> myStellaSettingsDialog;
|
||||
unique_ptr<OptionsDialog> myOptionsDialog;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -74,7 +78,6 @@ class MinUICommandDialog : public Dialog
|
|||
kPhosphorCmd = 'Cpho',
|
||||
kSettings = 'Cscn',
|
||||
kExitGameCmd = 'Cext',
|
||||
kCloseCmd = 'Ccls'
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -83,7 +83,7 @@ void StellaSettingsDialog::addUIOptions(WidgetArray& wid, int& xpos, int& ypos,
|
|||
const int VGAP = 4;
|
||||
const int lineHeight = font.getLineHeight();
|
||||
VariantList items;
|
||||
int pwidth = font.getStringWidth("Bad adjust");
|
||||
int pwidth = font.getStringWidth("Bad adjust"); // align width with other popup
|
||||
|
||||
ypos += 1;
|
||||
VarList::push_back(items, "Standard", "standard");
|
||||
|
|
Loading…
Reference in New Issue