missing files (again)

This commit is contained in:
Thomas Jentzsch 2021-09-01 14:11:28 +02:00
parent 0b5a3b9b36
commit 981b5c8fc3
4 changed files with 226 additions and 0 deletions

50
src/gui/PlusRomsMenu.cxx Normal file
View File

@ -0,0 +1,50 @@
//============================================================================
//
// 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 "PlusRomsSetupDialog.hxx"
#include "PlusRomsMenu.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlusRomsMenu::PlusRomsMenu(OSystem& osystem)
: DialogContainer(osystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlusRomsMenu::~PlusRomsMenu()
{
delete myPlusRomsSetupDialog; myPlusRomsSetupDialog = nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dialog* PlusRomsMenu::baseDialog()
{
return &plusRomsSetupDialog();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlusRomsSetupDialog& PlusRomsMenu::plusRomsSetupDialog()
{
StringList labels; // empty list
if(myPlusRomsSetupDialog == nullptr)
myPlusRomsSetupDialog = new PlusRomsSetupDialog(myOSystem, *this, myOSystem.frameBuffer().font(), labels);
return *myPlusRomsSetupDialog;
}

59
src/gui/PlusRomsMenu.hxx Normal file
View File

@ -0,0 +1,59 @@
//============================================================================
//
// 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 PlusRomsSetupDialog;
#include "DialogContainer.hxx"
/**
The dialog for Plus ROMs setup.
@author Thomas Jentzsch
*/
class PlusRomsMenu : public DialogContainer
{
public:
/**
Create a new menu stack
*/
explicit PlusRomsMenu(OSystem& osystem);
~PlusRomsMenu() override;
private:
/**
Return (and possibly create) the bottom-most dialog of this container.
*/
Dialog* baseDialog() override;
PlusRomsSetupDialog& plusRomsSetupDialog();
private:
PlusRomsSetupDialog* myPlusRomsSetupDialog{nullptr};
private:
// Following constructors and assignment operators not supported
PlusRomsMenu() = delete;
PlusRomsMenu(const PlusRomsMenu&) = delete;
PlusRomsMenu(PlusRomsMenu&&) = delete;
PlusRomsMenu& operator=(const PlusRomsMenu&) = delete;
PlusRomsMenu& operator=(PlusRomsMenu&&) = delete;
};
#endif

View File

@ -0,0 +1,70 @@
//============================================================================
//
// 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 "OSystem.hxx"
#include "EventHandler.hxx"
#include "PlusRomsSetupDialog.hxx"
static const int MIN_NICK_LEN = 2;
static const int MAX_NICK_LEN = 16;
static const char* MIN_NICK_LEN_STR = "Two";
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, const StringList& labels, const string& title)
: InputTextDialog(osystem, parent, font, "Nickname", "PlusROMs setup", MAX_NICK_LEN)
{
setText(instance().settings().getString("plusroms.nick"), 0);
EditableWidget::TextFilter filter = [](char c) {
return isalnum(c) || (c == '_');
};
setTextFilter(filter, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PlusRomsSetupDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id)
{
switch(cmd)
{
case GuiObject::kOKCmd:
case EditableWidget::kAcceptCmd:
{
const string nick = getResult(0);
if(nick.length() >= MIN_NICK_LEN)
{
instance().settings().setValue("plusroms.nick", nick);
instance().eventHandler().leaveMenuMode();
}
else
setMessage("Two characters minimum");
break;
}
case kCloseCmd:
instance().eventHandler().leaveMenuMode();
break;
case EditableWidget::kCancelCmd:
break;
default:
InputTextDialog::handleCommand(sender, cmd, data, id);
break;
}
}

View File

@ -0,0 +1,47 @@
//============================================================================
//
// 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 PLUSROMS_SETUP_DIALOG_HXX
#define PLUSROMS_SETUP_DIALOG_HXX
//class GuiObject;
//class StaticTextWidget;
//class EditTextWidget;
#include "InputTextDialog.hxx"
class PlusRomsSetupDialog: public InputTextDialog
{
public:
PlusRomsSetupDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font,
const StringList& labels, const string& title = "");
~PlusRomsSetupDialog() override = default;
protected:
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
// Following constructors and assignment operators not supported
PlusRomsSetupDialog() = delete;
PlusRomsSetupDialog(const PlusRomsSetupDialog&) = delete;
PlusRomsSetupDialog(PlusRomsSetupDialog&&) = delete;
PlusRomsSetupDialog& operator=(const PlusRomsSetupDialog&) = delete;
PlusRomsSetupDialog& operator=(PlusRomsSetupDialog&&) = delete;
};
#endif