mirror of https://github.com/stella-emu/stella.git
made PlusROM nick input dialog working
added settings for nick and id TODO: doc
This commit is contained in:
parent
3dab800c5e
commit
b77d605cd1
|
@ -602,6 +602,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
|
|||
{ Event::CmdMenuMode, KBDK_BACKSLASH },
|
||||
{ Event::TimeMachineMode, KBDK_T, KBDM_SHIFT },
|
||||
{ Event::DebuggerMode, KBDK_GRAVE },
|
||||
{ Event::PlusRomsSetupMode, KBDK_P, KBDM_SHIFT | KBDM_CTRL | MOD3 },
|
||||
{ Event::ExitMode, KBDK_ESCAPE },
|
||||
#ifdef BSPF_MACOS
|
||||
{ Event::Quit, KBDK_Q, MOD3 },
|
||||
|
|
|
@ -283,6 +283,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
|
|||
{Event::OptionsMenuMode, "OptionsMenuMode"},
|
||||
{Event::CmdMenuMode, "CmdMenuMode"},
|
||||
{Event::HighScoresMenuMode, "HighScoresMenuMode"},
|
||||
{Event::PlusRomsSetupMode, "PlusRomsSetupMode"},
|
||||
{Event::DebuggerMode, "DebuggerMode"},
|
||||
{Event::ExitMode, "ExitMode"},
|
||||
{Event::TakeSnapshot, "TakeSnapshot"},
|
||||
|
|
|
@ -128,6 +128,14 @@ class Cartridge : public Device
|
|||
*/
|
||||
virtual uInt8 internalRamGetValue(uInt16 addr) const { return 0; }
|
||||
|
||||
/**
|
||||
Answer whether this is a PlusROM cart. Note that until the
|
||||
initialize method has been called, this will always return false.
|
||||
|
||||
@return Whether this is actually a PlusROM cart
|
||||
*/
|
||||
virtual bool isPlusROM() const { return false; }
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
/**
|
||||
To be called at the start of each instruction.
|
||||
|
|
|
@ -157,6 +157,14 @@ class CartridgeEnhanced : public Cartridge
|
|||
*/
|
||||
bool poke(uInt16 address, uInt8 value) override;
|
||||
|
||||
/**
|
||||
Answer whether this is a PlusROM cart. Note that until the
|
||||
initialize method has been called, this will always return false.
|
||||
|
||||
@return Whether this is actually a PlusROM cart
|
||||
*/
|
||||
bool isPlusROM() const override { return myPlusROM.isValid(); }
|
||||
|
||||
/**
|
||||
Get the hotspot in ROM address space.
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class Event
|
|||
|
||||
Quit, ReloadConsole, Fry,
|
||||
TogglePauseMode, StartPauseMode,
|
||||
OptionsMenuMode, CmdMenuMode, DebuggerMode, ExitMode,
|
||||
OptionsMenuMode, CmdMenuMode, DebuggerMode, PlusRomsSetupMode, ExitMode,
|
||||
TakeSnapshot, ToggleContSnapshots, ToggleContSnapshotsFrame,
|
||||
ToggleTurbo,
|
||||
|
||||
|
@ -169,7 +169,6 @@ class Event
|
|||
SALeftAxis0Value, SALeftAxis1Value, SARightAxis0Value, SARightAxis1Value,
|
||||
QTPaddle3AFire, QTPaddle3BFire, QTPaddle4AFire, QTPaddle4BFire,
|
||||
UIHelp,
|
||||
InputTextDialogMode,
|
||||
LastType
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#include "CommandMenu.hxx"
|
||||
#include "HighScoresMenu.hxx"
|
||||
#include "MessageMenu.hxx"
|
||||
#include "InputMenu.hxx"
|
||||
#include "PlusRomsMenu.hxx"
|
||||
#include "DialogContainer.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "TimeMachine.hxx"
|
||||
|
@ -2155,21 +2155,18 @@ bool EventHandler::changeStateByEvent(Event::Type type)
|
|||
handled = false;
|
||||
break;
|
||||
|
||||
case Event::InputTextDialogMode: // TODO rename
|
||||
case Event::PlusRomsSetupMode:
|
||||
{
|
||||
StringList labels;
|
||||
|
||||
labels.push_back("Nick");
|
||||
myOSystem.inputMenu().setTitle("PlusROMs first start setup");
|
||||
myOSystem.inputMenu().setLabels(labels);
|
||||
|
||||
if(myState != EventHandlerState::INPUTMENU)
|
||||
enterMenuMode(EventHandlerState::INPUTMENU);
|
||||
else
|
||||
if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE
|
||||
|| myState == EventHandlerState::TIMEMACHINE || myState == EventHandlerState::PLAYBACK)
|
||||
enterMenuMode(EventHandlerState::PLUSROMSMENU);
|
||||
else if(myState == EventHandlerState::PLUSROMSMENU)
|
||||
leaveMenuMode();
|
||||
else
|
||||
handled = false;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif // GUI_SUPPORT
|
||||
|
||||
case Event::TimeMachineMode:
|
||||
if(myState == EventHandlerState::EMULATION || myState == EventHandlerState::PAUSE
|
||||
|
@ -3014,8 +3011,8 @@ void EventHandler::setState(EventHandlerState state)
|
|||
enableTextEvents(true);
|
||||
break;
|
||||
|
||||
case EventHandlerState::INPUTMENU:
|
||||
myOverlay = &myOSystem.inputMenu();
|
||||
case EventHandlerState::PLUSROMSMENU:
|
||||
myOverlay = &myOSystem.plusRomsMenu();
|
||||
enableTextEvents(true);
|
||||
break;
|
||||
|
||||
|
@ -3095,6 +3092,7 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
|||
{ Event::OptionsMenuMode, "Enter Options menu UI", "" },
|
||||
{ Event::CmdMenuMode, "Toggle Commands menu UI", "" },
|
||||
{ Event::HighScoresMenuMode, "Toggle High Scores UI", "" },
|
||||
{ Event::PlusRomsSetupMode, "Toggle PlusROM setup UI", "" },
|
||||
{ Event::TogglePauseMode, "Toggle Pause mode", "" },
|
||||
{ Event::StartPauseMode, "Start Pause mode", "" },
|
||||
{ Event::Fry, "Fry cartridge", "" },
|
||||
|
@ -3382,7 +3380,8 @@ EventHandler::MenuActionList EventHandler::ourMenuActionList = { {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Event::EventSet EventHandler::MiscEvents = {
|
||||
Event::Quit, Event::ReloadConsole, Event::Fry, Event::StartPauseMode,
|
||||
Event::TogglePauseMode, Event::OptionsMenuMode, Event::CmdMenuMode, Event::ExitMode,
|
||||
Event::TogglePauseMode, Event::OptionsMenuMode, Event::CmdMenuMode,
|
||||
Event::PlusRomsSetupMode, Event::ExitMode,
|
||||
Event::ToggleTurbo, Event::DecreaseSpeed, Event::IncreaseSpeed,
|
||||
Event::TakeSnapshot, Event::ToggleContSnapshots, Event::ToggleContSnapshotsFrame,
|
||||
// Event::MouseAxisXMove, Event::MouseAxisYMove,
|
||||
|
|
|
@ -645,7 +645,7 @@ class EventHandler
|
|||
#else
|
||||
REFRESH_SIZE = 0,
|
||||
#endif
|
||||
EMUL_ACTIONLIST_SIZE = 211 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
||||
EMUL_ACTIONLIST_SIZE = 212 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
||||
MENU_ACTIONLIST_SIZE = 19
|
||||
;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ enum class EventHandlerState {
|
|||
CMDMENU,
|
||||
HIGHSCORESMENU,
|
||||
MESSAGEMENU,
|
||||
INPUTMENU,
|
||||
PLUSROMSMENU,
|
||||
DEBUGGER,
|
||||
NONE
|
||||
};
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "CommandMenu.hxx"
|
||||
#include "HighScoresMenu.hxx"
|
||||
#include "MessageMenu.hxx"
|
||||
#include "InputMenu.hxx"
|
||||
#include "PlusRomsMenu.hxx"
|
||||
#include "TimeMachine.hxx"
|
||||
#endif
|
||||
|
||||
|
@ -447,17 +447,17 @@ void FrameBuffer::update(UpdateMode mode)
|
|||
break; // EventHandlerState::MESSAGEMENU
|
||||
}
|
||||
|
||||
case EventHandlerState::INPUTMENU:
|
||||
case EventHandlerState::PLUSROMSMENU:
|
||||
{
|
||||
myOSystem.inputMenu().tick();
|
||||
redraw |= myOSystem.inputMenu().needsRedraw();
|
||||
myOSystem.plusRomsMenu().tick();
|
||||
redraw |= myOSystem.plusRomsMenu().needsRedraw();
|
||||
if(redraw)
|
||||
{
|
||||
clear();
|
||||
myTIASurface->render(true);
|
||||
myOSystem.inputMenu().draw(forceRedraw);
|
||||
myOSystem.plusRomsMenu().draw(forceRedraw);
|
||||
}
|
||||
break; // EventHandlerState::INPUTMENU
|
||||
break; // EventHandlerState::PLUSROMSMENU
|
||||
}
|
||||
|
||||
case EventHandlerState::TIMEMACHINE:
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "CommandMenu.hxx"
|
||||
#include "HighScoresMenu.hxx"
|
||||
#include "MessageMenu.hxx"
|
||||
#include "InputMenu.hxx"
|
||||
#include "PlusRomsMenu.hxx"
|
||||
#include "Launcher.hxx"
|
||||
#include "TimeMachine.hxx"
|
||||
#include "Widget.hxx"
|
||||
|
@ -182,7 +182,7 @@ bool OSystem::initialize(const Settings::Options& options)
|
|||
myHighScoresManager = make_unique<HighScoresManager>(*this);
|
||||
myHighScoresMenu = make_unique<HighScoresMenu>(*this);
|
||||
myMessageMenu = make_unique<MessageMenu>(*this);
|
||||
myInputMenu = make_unique<InputMenu>(*this);
|
||||
myPlusRomMenu = make_unique<PlusRomsMenu>(*this);
|
||||
myTimeMachine = make_unique<TimeMachine>(*this);
|
||||
myLauncher = make_unique<Launcher>(*this);
|
||||
|
||||
|
@ -509,37 +509,10 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum,
|
|||
myFrameBuffer->showTextMessage(msg.str());
|
||||
}
|
||||
// Check for first PlusROM start
|
||||
if(true)
|
||||
// myConsole->cartridge().plusROM().isvalid() && Settings
|
||||
if(myConsole->cartridge().isPlusROM() &&
|
||||
settings().getString("plusroms.nick") == EmptyString)
|
||||
{
|
||||
//myEventHandler->changeStateByEvent(Event::OptionsMenuMode);
|
||||
myEventHandler->changeStateByEvent(Event::InputTextDialogMode);
|
||||
//TODO: Event::InputTextDialogMode
|
||||
|
||||
|
||||
/*
|
||||
// Inputbox which will pop up when searching RAM
|
||||
|
||||
StringList labels = {"Value"};
|
||||
myInputBox = make_unique<InputTextDialog>(boss, lfont, nfont, labels, " ");
|
||||
myInputBox->setTarget(this);
|
||||
|
||||
|
||||
|
||||
// Add inputbox in the middle of the RAM widget
|
||||
uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1);
|
||||
uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1);
|
||||
|
||||
myInputBox->show(x, y, dialog().surface().dstRect());
|
||||
myInputBox->setText("");
|
||||
myInputBox->setMessage("");
|
||||
myInputBox->setToolTip(cmd == kSValEntered
|
||||
? "Enter search value (leave blank for all)."
|
||||
: "Enter relative or absolute value\nto compare with searched values.");
|
||||
myInputBox->setFocus(0);
|
||||
myInputBox->setEmitSignal(cmd);
|
||||
myInputBox->setTitle(cmd == kSValEntered ? "Search" : "Compare");
|
||||
*/
|
||||
myEventHandler->changeStateByEvent(Event::PlusRomsSetupMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class AudioSettings;
|
|||
class Launcher;
|
||||
class Menu;
|
||||
class MessageMenu;
|
||||
class InputMenu;
|
||||
class PlusRomsMenu;
|
||||
class TimeMachine;
|
||||
class VideoAudioDialog;
|
||||
#endif
|
||||
|
@ -228,11 +228,11 @@ class OSystem
|
|||
MessageMenu& messageMenu() const { return *myMessageMenu; }
|
||||
|
||||
/**
|
||||
Get the input menu of the system.
|
||||
Get the Plus ROM menu of the system.
|
||||
|
||||
@return The input menu object
|
||||
@return The Plus ROM menu object
|
||||
*/
|
||||
InputMenu& inputMenu() const { return *myInputMenu; }
|
||||
PlusRomsMenu& plusRomsMenu() const { return *myPlusRomMenu; }
|
||||
|
||||
/**
|
||||
Get the ROM launcher of the system.
|
||||
|
@ -531,8 +531,8 @@ class OSystem
|
|||
// Pointer to the MessageMenu object
|
||||
unique_ptr<MessageMenu> myMessageMenu;
|
||||
|
||||
// Pointer to the InputMenu object
|
||||
unique_ptr<InputMenu> myInputMenu;
|
||||
// Pointer to the PlusRomsMenu object
|
||||
unique_ptr<PlusRomsMenu> myPlusRomMenu;
|
||||
|
||||
// Pointer to the TimeMachine object
|
||||
unique_ptr<TimeMachine> myTimeMachine;
|
||||
|
|
|
@ -181,6 +181,8 @@ Settings::Settings()
|
|||
setTemporary("maxres", "");
|
||||
setPermanent("initials", "");
|
||||
setTemporary("turbo", "0");
|
||||
setPermanent("plusroms.nick", "");
|
||||
setPermanent("plusroms.id", "");
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
// Debugger/disassembly options
|
||||
|
|
|
@ -78,6 +78,12 @@ Dialog::~Dialog()
|
|||
else
|
||||
cerr << "!!! framebuffer not available\n";
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Dialog::clear()
|
||||
{
|
||||
_myFocus.list.clear();
|
||||
_myTabList.clear();
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ class Dialog : public GuiObject
|
|||
const string& title = "", int x = 0, int y = 0, int w = 0, int h = 0);
|
||||
~Dialog() override;
|
||||
|
||||
void clear();
|
||||
void open();
|
||||
void close();
|
||||
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "InputTextDialog.hxx"
|
||||
#include "InputMenu.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
InputMenu::InputMenu(OSystem& osystem)
|
||||
: DialogContainer(osystem)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
InputMenu::~InputMenu()
|
||||
{
|
||||
delete myInputTextDialog; myInputTextDialog = nullptr;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Dialog* InputMenu::baseDialog()
|
||||
{
|
||||
StringList labels;
|
||||
|
||||
labels.push_back("test");
|
||||
|
||||
if(myInputTextDialog == nullptr)
|
||||
myInputTextDialog = new InputTextDialog(myOSystem, *this, myOSystem.frameBuffer().font(), labels);
|
||||
|
||||
return myInputTextDialog;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputMenu::setTitle(const string& title, bool yesNo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputMenu::setLabels(const StringList& text, bool yesNo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//void InputMenu::setMessage(const string& title, const StringList& text, bool yesNo)
|
||||
//{
|
||||
// //myInputTextDialog->setMessage(title);
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//void InputMenu::setMessage(const string& title, const string& text, bool yesNo)
|
||||
//{
|
||||
// //myInputTextDialog->setMessage(title);
|
||||
//}
|
||||
//
|
||||
//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
//bool InputMenu::confirmed()
|
||||
//{
|
||||
// //if(myInputTextDialog != nullptr)
|
||||
// // return myInputTextDialog->confirmed();
|
||||
//
|
||||
// return false;
|
||||
//}
|
|
@ -1,62 +0,0 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
|
||||
// and the Stella Team
|
||||
//
|
||||
// See the file "License.txt" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef INPUT_MENU_HXX
|
||||
#define INPUT_MENU_HXX
|
||||
|
||||
class OSystem;
|
||||
class InputTextDialog;
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
|
||||
/**
|
||||
The base dialog for all input menus in Stella.
|
||||
|
||||
@author Thomas Jentzsch
|
||||
*/
|
||||
class InputMenu : public DialogContainer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Create a new menu stack
|
||||
*/
|
||||
explicit InputMenu(OSystem& osystem);
|
||||
~InputMenu() override;
|
||||
|
||||
void setTitle(const string& title, bool yesNo = false);
|
||||
void setLabels(const StringList& text, bool yesNo = false);
|
||||
//bool confirmed();
|
||||
|
||||
private:
|
||||
/**
|
||||
Return (and possibly create) the bottom-most dialog of this container.
|
||||
*/
|
||||
Dialog* baseDialog() override;
|
||||
|
||||
private:
|
||||
InputTextDialog* myInputTextDialog{nullptr};
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
InputMenu() = delete;
|
||||
InputMenu(const InputMenu&) = delete;
|
||||
InputMenu(InputMenu&&) = delete;
|
||||
InputMenu& operator=(const InputMenu&) = delete;
|
||||
InputMenu& operator=(InputMenu&&) = delete;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -31,9 +31,11 @@
|
|||
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||
const StringList& labels, const string& title)
|
||||
: Dialog(boss->instance(), boss->parent(), font, title),
|
||||
CommandSender(boss)
|
||||
CommandSender(boss),
|
||||
lfont(font),
|
||||
nfont(font)
|
||||
{
|
||||
initialize(font, font, labels);
|
||||
initialize(labels);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -41,24 +43,31 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont,
|
|||
const GUI::Font& nfont,
|
||||
const StringList& labels, const string& title)
|
||||
: Dialog(boss->instance(), boss->parent(), lfont, title),
|
||||
CommandSender(boss)
|
||||
CommandSender(boss),
|
||||
lfont(lfont),
|
||||
nfont(nfont)
|
||||
{
|
||||
initialize(lfont, nfont, labels);
|
||||
initialize(labels);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
InputTextDialog::InputTextDialog(OSystem& osystem, DialogContainer& parent,
|
||||
const GUI::Font& font, const StringList& labels, const string& title)
|
||||
const GUI::Font& font, const string& label,
|
||||
const string& title, int numInput)
|
||||
: Dialog(osystem, parent, font, title),
|
||||
CommandSender(nullptr)
|
||||
CommandSender(nullptr),
|
||||
lfont(font),
|
||||
nfont(font)
|
||||
{
|
||||
initialize(font, font, labels);
|
||||
StringList labels;
|
||||
|
||||
clear();
|
||||
labels.push_back(label);
|
||||
initialize(labels, static_cast<int>(label.length()) + (numInput ? numInput : 24) + 2, numInput);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
const StringList& labels)
|
||||
void InputTextDialog::initialize(const StringList& labels, int widthChars, int numInput)
|
||||
{
|
||||
const int lineHeight = Dialog::lineHeight(),
|
||||
fontHeight = Dialog::fontHeight(),
|
||||
|
@ -71,7 +80,7 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
|
|||
WidgetArray wid;
|
||||
|
||||
// Calculate real dimensions
|
||||
_w = HBORDER * 2 + fontWidth * 39;
|
||||
_w = HBORDER * 2 + fontWidth * widthChars;
|
||||
_h = buttonHeight + lineHeight + VGAP + int(labels.size()) * (lineHeight + VGAP) + _th + VBORDER * 2;
|
||||
|
||||
// Determine longest label
|
||||
|
@ -83,7 +92,8 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
|
|||
maxIdx = i;
|
||||
}
|
||||
}
|
||||
lwidth = lfont.getStringWidth(labels[maxIdx]);
|
||||
if(labels.size())
|
||||
lwidth = lfont.getStringWidth(labels[maxIdx]);
|
||||
|
||||
// Create editboxes for all labels
|
||||
ypos = VBORDER + _th;
|
||||
|
@ -98,6 +108,8 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
|
|||
xpos += lwidth + fontWidth;
|
||||
EditTextWidget* w = new EditTextWidget(this, nfont, xpos, ypos,
|
||||
_w - xpos - HBORDER, lineHeight, "");
|
||||
if(numInput)
|
||||
w->setMaxLen(numInput);
|
||||
wid.push_back(w);
|
||||
|
||||
myInput.push_back(w);
|
||||
|
|
|
@ -35,7 +35,7 @@ class InputTextDialog : public Dialog, public CommandSender
|
|||
const GUI::Font& nfont, const StringList& labels,
|
||||
const string& title = "");
|
||||
InputTextDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
|
||||
const StringList& labels, const string& title = "");
|
||||
const string& label, const string& title, int numInput = 0);
|
||||
|
||||
~InputTextDialog() override = default;
|
||||
|
||||
|
@ -57,14 +57,15 @@ class InputTextDialog : public Dialog, public CommandSender
|
|||
void setFocus(int idx = 0);
|
||||
|
||||
protected:
|
||||
void initialize(const GUI::Font& lfont, const GUI::Font& nfont,
|
||||
const StringList& labels);
|
||||
void initialize(const StringList& labels, int widthChars = 39, int numInput = 0);
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
||||
/** This dialog uses its own positioning, so we override Dialog::center() */
|
||||
void setPosition() override;
|
||||
|
||||
private:
|
||||
const GUI::Font& lfont;
|
||||
const GUI::Font& nfont;
|
||||
vector<StaticTextWidget*> myLabel;
|
||||
vector<EditTextWidget*> myInput;
|
||||
StaticTextWidget* myMessage{nullptr};
|
||||
|
|
|
@ -1,66 +1,67 @@
|
|||
MODULE := src/gui
|
||||
|
||||
MODULE_OBJS := \
|
||||
src/gui/AboutDialog.o \
|
||||
src/gui/BrowserDialog.o \
|
||||
src/gui/CheckListWidget.o \
|
||||
src/gui/ColorWidget.o \
|
||||
src/gui/ComboDialog.o \
|
||||
src/gui/CommandDialog.o \
|
||||
src/gui/CommandMenu.o \
|
||||
src/gui/ContextMenu.o \
|
||||
src/gui/DeveloperDialog.o \
|
||||
src/gui/DialogContainer.o \
|
||||
src/gui/Dialog.o \
|
||||
src/gui/EditableWidget.o \
|
||||
src/gui/EditTextWidget.o \
|
||||
src/gui/EmulationDialog.o \
|
||||
src/gui/EventMappingWidget.o \
|
||||
src/gui/FileListWidget.o \
|
||||
src/gui/Font.o \
|
||||
src/gui/GameInfoDialog.o \
|
||||
src/gui/GlobalPropsDialog.o \
|
||||
src/gui/HelpDialog.o \
|
||||
src/gui/HighScoresDialog.o \
|
||||
src/gui/HighScoresMenu.o \
|
||||
src/gui/InputDialog.o \
|
||||
src/gui/InputMenu.o \
|
||||
src/gui/InputTextDialog.o \
|
||||
src/gui/JoystickDialog.o \
|
||||
src/gui/LauncherDialog.o \
|
||||
src/gui/Launcher.o \
|
||||
src/gui/ListWidget.o \
|
||||
src/gui/LoggerDialog.o \
|
||||
src/gui/Menu.o \
|
||||
src/gui/MessageBox.o \
|
||||
src/gui/MessageDialog.o \
|
||||
src/gui/MessageMenu.o \
|
||||
src/gui/MinUICommandDialog.o\
|
||||
src/gui/OptionsDialog.o \
|
||||
src/gui/PopUpWidget.o \
|
||||
src/gui/ProgressDialog.o \
|
||||
src/gui/QuadTariDialog.o \
|
||||
src/gui/R77HelpDialog.o \
|
||||
src/gui/RadioButtonWidget.o \
|
||||
src/gui/RomAuditDialog.o \
|
||||
src/gui/RomInfoWidget.o \
|
||||
src/gui/ScrollBarWidget.o \
|
||||
src/gui/SnapshotDialog.o \
|
||||
src/gui/StellaSettingsDialog.o \
|
||||
src/gui/StringListWidget.o \
|
||||
src/gui/TabWidget.o \
|
||||
src/gui/TimeLineWidget.o \
|
||||
src/gui/TimeMachineDialog.o \
|
||||
src/gui/TimeMachine.o \
|
||||
src/gui/ToolTip.o \
|
||||
src/gui/UndoHandler.o \
|
||||
src/gui/UIDialog.o \
|
||||
src/gui/VideoAudioDialog.o \
|
||||
src/gui/WhatsNewDialog.o \
|
||||
src/gui/Widget.o
|
||||
src/gui/AboutDialog.o \
|
||||
src/gui/BrowserDialog.o \
|
||||
src/gui/CheckListWidget.o \
|
||||
src/gui/ColorWidget.o \
|
||||
src/gui/ComboDialog.o \
|
||||
src/gui/CommandDialog.o \
|
||||
src/gui/CommandMenu.o \
|
||||
src/gui/ContextMenu.o \
|
||||
src/gui/DeveloperDialog.o \
|
||||
src/gui/DialogContainer.o \
|
||||
src/gui/Dialog.o \
|
||||
src/gui/EditableWidget.o \
|
||||
src/gui/EditTextWidget.o \
|
||||
src/gui/EmulationDialog.o \
|
||||
src/gui/EventMappingWidget.o \
|
||||
src/gui/FileListWidget.o \
|
||||
src/gui/Font.o \
|
||||
src/gui/GameInfoDialog.o \
|
||||
src/gui/GlobalPropsDialog.o \
|
||||
src/gui/HelpDialog.o \
|
||||
src/gui/HighScoresDialog.o \
|
||||
src/gui/HighScoresMenu.o \
|
||||
src/gui/InputDialog.o \
|
||||
src/gui/InputTextDialog.o \
|
||||
src/gui/JoystickDialog.o \
|
||||
src/gui/LauncherDialog.o \
|
||||
src/gui/Launcher.o \
|
||||
src/gui/ListWidget.o \
|
||||
src/gui/LoggerDialog.o \
|
||||
src/gui/Menu.o \
|
||||
src/gui/MessageBox.o \
|
||||
src/gui/MessageDialog.o \
|
||||
src/gui/MessageMenu.o \
|
||||
src/gui/MinUICommandDialog.o\
|
||||
src/gui/OptionsDialog.o \
|
||||
src/gui/PlusRomsMenu.o\
|
||||
src/gui/PlusRomsSetupDialog.o\
|
||||
src/gui/PopUpWidget.o \
|
||||
src/gui/ProgressDialog.o \
|
||||
src/gui/QuadTariDialog.o \
|
||||
src/gui/R77HelpDialog.o \
|
||||
src/gui/RadioButtonWidget.o \
|
||||
src/gui/RomAuditDialog.o \
|
||||
src/gui/RomInfoWidget.o \
|
||||
src/gui/ScrollBarWidget.o \
|
||||
src/gui/SnapshotDialog.o \
|
||||
src/gui/StellaSettingsDialog.o \
|
||||
src/gui/StringListWidget.o \
|
||||
src/gui/TabWidget.o \
|
||||
src/gui/TimeLineWidget.o \
|
||||
src/gui/TimeMachineDialog.o \
|
||||
src/gui/TimeMachine.o \
|
||||
src/gui/ToolTip.o \
|
||||
src/gui/UndoHandler.o \
|
||||
src/gui/UIDialog.o \
|
||||
src/gui/VideoAudioDialog.o \
|
||||
src/gui/WhatsNewDialog.o \
|
||||
src/gui/Widget.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
src/gui
|
||||
src/gui
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/common.rules
|
||||
|
|
|
@ -797,12 +797,13 @@
|
|||
<ClCompile Include="..\gui\FileListWidget.cxx" />
|
||||
<ClCompile Include="..\gui\HighScoresDialog.cxx" />
|
||||
<ClCompile Include="..\gui\HighScoresMenu.cxx" />
|
||||
<ClCompile Include="..\gui\InputMenu.cxx" />
|
||||
<ClCompile Include="..\gui\PlusRomsMenu.cxx" />
|
||||
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
||||
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
||||
<ClCompile Include="..\gui\MessageDialog.cxx" />
|
||||
<ClCompile Include="..\gui\MessageMenu.cxx" />
|
||||
<ClCompile Include="..\gui\MinUICommandDialog.cxx" />
|
||||
<ClCompile Include="..\gui\PlusRomsSetupDialog.cxx" />
|
||||
<ClCompile Include="..\gui\QuadTariDialog.cxx" />
|
||||
<ClCompile Include="..\gui\R77HelpDialog.cxx" />
|
||||
<ClCompile Include="..\gui\RadioButtonWidget.cxx" />
|
||||
|
@ -1886,12 +1887,13 @@
|
|||
<ClInclude Include="..\gui\FileListWidget.hxx" />
|
||||
<ClInclude Include="..\gui\HighScoresDialog.hxx" />
|
||||
<ClInclude Include="..\gui\HighScoresMenu.hxx" />
|
||||
<ClInclude Include="..\gui\InputMenu.hxx" />
|
||||
<ClInclude Include="..\gui\PlusRomsMenu.hxx" />
|
||||
<ClInclude Include="..\gui\JoystickDialog.hxx" />
|
||||
<ClInclude Include="..\gui\LoggerDialog.hxx" />
|
||||
<ClInclude Include="..\gui\MessageDialog.hxx" />
|
||||
<ClInclude Include="..\gui\MessageMenu.hxx" />
|
||||
<ClInclude Include="..\gui\MinUICommandDialog.hxx" />
|
||||
<ClInclude Include="..\gui\PlusRomsSetupDialog.hxx" />
|
||||
<ClInclude Include="..\gui\QuadTariDialog.hxx" />
|
||||
<ClInclude Include="..\gui\R77HelpDialog.hxx" />
|
||||
<ClInclude Include="..\gui\RadioButtonWidget.hxx" />
|
||||
|
|
|
@ -1119,7 +1119,10 @@
|
|||
<ClCompile Include="..\debugger\gui\CartARMWidget.cxx">
|
||||
<Filter>Source Files\debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\gui\InputMenu.cxx">
|
||||
<ClCompile Include="..\gui\PlusRomsMenu.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\gui\PlusRomsSetupDialog.cxx">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -2303,7 +2306,10 @@
|
|||
<ClInclude Include="..\debugger\gui\CartARMWidget.hxx">
|
||||
<Filter>Header Files\debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\gui\InputMenu.hxx">
|
||||
<ClInclude Include="..\gui\PlusRomsMenu.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\gui\PlusRomsSetupDialog.hxx">
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue