From d29a74af5ec0b4a58fee1e25f38caeb8f0406eae Mon Sep 17 00:00:00 2001 From: thrust26 Date: Wed, 29 Jul 2020 07:46:22 +0200 Subject: [PATCH] added missing files --- src/gui/WhatsNewDialog.cxx | 88 ++++++++++++++++++++++++++++++++++++++ src/gui/WhatsNewDialog.hxx | 41 ++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 src/gui/WhatsNewDialog.cxx create mode 100644 src/gui/WhatsNewDialog.hxx diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx new file mode 100644 index 000000000..9f0e6b690 --- /dev/null +++ b/src/gui/WhatsNewDialog.cxx @@ -0,0 +1,88 @@ +//============================================================================ +// +// 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-2020 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 "Version.hxx" + +#include "WhatsNewDialog.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, + int max_w, int max_h) + : Dialog(osystem, parent, font, "What's New in Stella " + string(STELLA_VERSION) + "?") +{ + const int lineHeight = _font.getLineHeight(), + fontHeight = _font.getFontHeight(), + fontWidth = _font.getMaxCharWidth(), + buttonHeight = _font.getLineHeight() * 1.25; + const int VGAP = fontHeight / 4; + const int VBORDER = fontHeight / 2; + const int HBORDER = fontWidth * 1.25; + int ypos = _th + VBORDER; + + + // Set preliminary dimensions + setSize(64 * fontWidth + HBORDER * 2, max_h, + max_w, max_h); + + add(ypos, "added autofire"); + add(ypos, "added new UI theme 'Dark'"); + add(ypos, "extended global hotkeys for debug options"); + add(ypos, "added option to playback a game using the Time Machine"); + add(ypos, "allow taking snapshots from within the Time Machine dialog"); + add(ypos, "added the ability to access most files that Stella uses from within a ZIP file"); + add(ypos, "added option to select the audio device"); + add(ypos, "added option to display detected settings info when a ROM is loaded"); + add(ypos, "replaced 'Re-disassemble' with 'Disassemble @ current line' in debugger"); + add(ypos, "fixed bug when taking fullscreen snapshots; the dimensions were sometimes cut"); + + // Set needed dimensions + setSize(64 * fontWidth + HBORDER * 2, + ypos + VGAP + buttonHeight + VBORDER, + max_w, max_h); + + WidgetArray wid; + addOKBGroup(wid, _font); + addBGroupToFocusList(wid); + + // We don't have a close/cancel button, but we still want the cancel + // event to be processed + processCancelWithoutWidget(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void WhatsNewDialog::add(int& ypos, const string& text) +{ + const int lineHeight = _font.getLineHeight(), + fontHeight = _font.getFontHeight(), + fontWidth = _font.getMaxCharWidth(), + HBORDER = fontWidth * 1.25; + const string DOT = "\x1f"; + string txt = DOT + " " + text; + + // automatically wrap too long texts + while(txt.length() > 64) + { + int i = 64; + + while(--i && txt[i] != ' '); + new StaticTextWidget(this, _font, HBORDER, ypos, txt.substr(0, i)); + txt = " " + txt.substr(i); + ypos += fontHeight; + } + new StaticTextWidget(this, _font, HBORDER, ypos, txt); + ypos += lineHeight; +} diff --git a/src/gui/WhatsNewDialog.hxx b/src/gui/WhatsNewDialog.hxx new file mode 100644 index 000000000..9ca7505e5 --- /dev/null +++ b/src/gui/WhatsNewDialog.hxx @@ -0,0 +1,41 @@ +//============================================================================ +// +// 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-2020 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 WHATSNEW_DIALOG_HXX +#define WHATSNEW_DIALOG_HXX + +#include "Dialog.hxx" + +class WhatsNewDialog : public Dialog +{ + public: + // These must be accessible from dialogs created by this class + enum { + kLoadROMCmd = 'STRT', // load currently selected ROM + kRomDirChosenCmd = 'romc' // rom dir chosen + }; + + public: + WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, + int max_w, int max_h); + virtual ~WhatsNewDialog() = default; + + private: + void add(int& ypos, const string& text); +}; + +#endif