diff --git a/Changes.txt b/Changes.txt index 013c1a57c..2f733a6e3 100644 --- a/Changes.txt +++ b/Changes.txt @@ -16,15 +16,15 @@ * Added high scores saving. - * Enhanced cut/copy/paste for text editing (except PromptWidget). + * Improved text editing functionality (except PromptWidget): + - Enhanced selection and cut/copy/paste from keyboard. + - Added undo and redo support. + - Added mouse support (selection, cut/copy/paste). + - All actions have keyboard shortcuts. - * Added undo and redo to text editing (except PromptWidget). - - * Added mouse support for text editing (except PromptWidget). - - * Added wildcard support to launcher dialog filter. - - * Added option to search subdirectories in launcher. + * Various improvements to the ROM launcher: + - Added wildcard support to the dialog filter + - Added option to search subdirectories * Added static tooltips to some UI items. @@ -41,7 +41,8 @@ * Fixed Stelladaptor/2600'daptor devices sometimes not being assigned correct default mappings. - * Codebase now uses C++17 features. + * Codebase now uses C++17 features, which means a minimum of gcc7 + or clang5 for Linux/Mac, and Visual Studio 2019 for Windows. -Have fun! diff --git a/docs/debugger.html b/docs/debugger.html index bc0329c0f..689e5d958 100644 --- a/docs/debugger.html +++ b/docs/debugger.html @@ -223,7 +223,7 @@ present in the debugger):

For space reasons, the Prompt, TIA, I/O and Audio displays are split into 4 tabs, only one of which is visible at a time. You can use the mouse or keyboard to select which tab you want to view. Control/Cmd + Tab cycles between -tabs from left-to-right, Shift + Control/Cmd + Tab cycles right-to-left. +tabs from left-to-right, Shift-Control/Cmd + Tab cycles right-to-left. Pressing Tab (or Shift + Tab) cycles between widgets in the current tab (except for in the Prompt Tab, where 'tab' is used for something else).

@@ -339,7 +339,7 @@ previous rewind operation. The rewind buffer is 100 levels deep by default, the size can be configured e.g. in the Developer Settings - Time Machine dialog.

-

The other operations are Step, Trace, Scan+1, Frame+1 and Run.

+

The other operations are Step, Trace, Scan +1, Frame +1 and Run.

You can also use the buttons from anywhere in the GUI via hotkeys.

@@ -349,48 +349,48 @@ size can be configured e.g. in the Function - Control-s + Control + S Step - Control-t + Control + T Trace - Control-L - Scan+1 + Control + L + Scan +1 - Control-f - Frame+1 + Control + F + Frame +1 - Alt-Left arrow + Alt + Left arrow Rewind 1 - Shift-Alt-Left arrow + Shift-Alt + Left arrow Rewind 10 - Alt-Down arrow + Alt + Down arrow Rewind all - Alt-Right arrow + Alt + Right arrow Unwind 1 - Shift-Alt-Right arrow + Shift-Alt + Right arrow Unwind 10 - Alt-Up arrow + Alt + Up arrow Unwind all Backquote (`) - Run + Run, exits debugger

@@ -433,18 +433,18 @@ Bash-style commands are also supported:

EndMove cursor to end of line DeleteRemove character to right of cursor BackspaceRemove character to left of cursor - Control-aSame function as 'Home' - Control-eSame function as 'End' - Control-dSame function as 'Delete' - Control-kRemove all characters from cursor to end of line - Control-uRemove all characters from cursor to beginning of line - Control-wRemove entire word to left of cursor - Shift-PgUpScroll up through previous commands one screen/page - Shift-PgDownScroll down through previous commands one screen/page - Shift-UpScroll up through previous commands one line - Shift-DownScroll down through previous commands one line - Shift-HomeScroll to beginning of commands - Shift-EndScroll to end of commands + Control + ASame function as 'Home' + Control + ESame function as 'End' + Control + DSame function as 'Delete' + Control + KRemove all characters from cursor to end of line + Control + URemove all characters from cursor to beginning of line + Control + WRemove entire word to left of cursor + Shift + PgUpScroll up through previous commands one screen/page + Shift + PgDownScroll down through previous commands one screen/page + Shift + UpScroll up through previous commands one line + Shift + DownScroll down through previous commands one line + Shift + HomeScroll to beginning of commands + Shift + EndScroll to end of commands

You can also scroll with the mouse. Copy and paste is not yet supported.

diff --git a/docs/graphics/options_gameinfo_highscores.png b/docs/graphics/options_gameinfo_highscores.png index f88bc399d..6d18323e5 100644 Binary files a/docs/graphics/options_gameinfo_highscores.png and b/docs/graphics/options_gameinfo_highscores.png differ diff --git a/docs/index.html b/docs/index.html index 23ed6905a..f679feab6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -644,8 +644,8 @@ Exit emulator - Control + q - Cmd + q + Control + Q + Cmd + Q @@ -771,7 +771,7 @@ Pause/resume emulation Pause - Shift-Cmd + p + Shift-Cmd + P @@ -1377,8 +1377,8 @@ Toggle adapting display refresh rate to game frame rate
Note: Not available for macOS. - Alt + r - Cmd + r + Alt + R + Cmd + R Decrease overscan in fullscreen mode @@ -1402,8 +1402,8 @@ Toggle aspect ratio correct scaling - Control + c - Control + c + Control + C + Control + C Decrease vertical display size @@ -1417,18 +1417,18 @@ Switch to previous display format (NTSC/PAL/SECAM etc.) - Shift-Control + f - Shift-Control + f + Shift-Control + F + Shift-Control + F Switch to next display format (NTSC/PAL/SECAM etc.) - Control + f - Control + f + Control + F + Control + F Toggle display interpolation - Control + i - Control + i + Control + I + Control + I
@@ -1447,14 +1447,14 @@ Select previous palette (Standard/z26/User/Custom) - Shift-Control + p - Shift-Control + p + Shift-Control + P + Shift-Control + P Select next palette (Standard/z26/User/Custom) - Control + p - Control + p + Control + P + Control + P @@ -1527,8 +1527,8 @@ Toggle 'phosphor' mode - Alt + p - Cmd + p + Alt + P + Cmd + P Decrease 'phosphor' blend @@ -1627,13 +1627,13 @@ Decrease autofire rate - Shift-Control + a - Shift-Control + a + Shift-Control + A + Shift-Control + A Increase autofire rate - Control + a - Control + a + Control + A + Control + A @@ -1716,8 +1716,8 @@ Toggle grab mouse - Control + g - Control + g + Control + G + Control + G @@ -1823,38 +1823,38 @@ Toggle TIA Player0 object - Alt + z - Cmd + z + Alt + Z + Cmd + Z Toggle TIA Player1 object - Alt + x - Cmd + x + Alt + X + Cmd + X Toggle TIA Missile0 object - Alt + c - Cmd + c + Alt + C + Cmd + C Toggle TIA Missile1 object - Alt + v - Cmd + v + Alt + V + Cmd + V Toggle TIA Ball object - Alt + b - Cmd + b + Alt + B + Cmd + B Toggle TIA Playfield object - Alt + n - Cmd + n + Alt + N + Cmd + N @@ -1865,38 +1865,38 @@ Toggle TIA Player0 collisions - Shift-Alt + z - Shift-Cmd + z + Shift-Alt + Z + Shift-Cmd + Z Toggle TIA Player1 collisions - Shift-Alt + x - Shift-Cmd + x + Shift-Alt + X + Shift-Cmd + X Toggle TIA Missile0 collisions - Shift-Alt + c - Shift-Cmd + c + Shift-Alt + C + Shift-Cmd + C Toggle TIA Missile1 collisions - Shift-Alt + v - Shift-Cmd + v + Shift-Alt + V + Shift-Cmd + V Toggle TIA Ball collisions - Shift-Alt + b - Shift-Cmd + b + Shift-Alt + B + Shift-Cmd + B Toggle TIA Playfield collisions - Shift-Alt + n - Shift-Cmd + n + Shift-Alt + N + Shift-Cmd + N @@ -1919,8 +1919,8 @@ Toggle TV 'Jitter' effect - Alt + j - Cmd + j + Alt + J + Cmd + J
@@ -1988,14 +1988,14 @@ Load previous game in ROM (multicart ROM) - Shift-Control + r - Shift-Control + r + Shift-Control + R + Shift-Control + R Reload current ROM (singlecart ROM)
Load next game in ROM (multicart ROM) - Control + r - Control + r + Control + R + Control + R Emulate 'frying' effect @@ -2004,29 +2004,29 @@ Decrease emulation speed (disables 'Turbo' mode) - Shift-Control + s - Shift-Control + s + Shift-Control + S + Shift-Control + S Increase emulation speed (disables 'Turbo' mode) - Control + s - Control + s + Control + S + Control + S Toggle 'Turbo' mode (maximum emulation speed) - Control + t - Control + t + Control + T + Control + T Save continuous PNG snapshots
(per interval defined in Snapshot Settings) - Control-Alt + s - Control-Cmd + s + Control-Alt + S + Control-Cmd + S Save continuous PNG snapshots (every frame) - Shift-Control-Alt + s - Shift-Control-Cmd + s + Shift-Control-Alt + S + Shift-Control-Cmd + S Open the High Scores dialog. @@ -2035,13 +2035,13 @@ Toggle 'Time Machine' mode - Alt + t - Cmd + t + Alt + T + Cmd + T Enter/Exit the Time Machine dialog - Shift + t to enter, Shift + t/Escape to exit and continue with emulation - Shift + t to enter, Shift + t/Escape to exit and continue with emulation + Shift + T to enter, Shift + T/Escape to exit and continue with emulation + Shift + T to enter, Shift + T/Escape to exit and continue with emulation Playback the Time Machine from current state (without sound, from the TM dialog only) @@ -2168,11 +2168,6 @@ Control + Tab Control + Tab - - Go to parent directory - Backspace - Backspace - Toggle windowed/fullscreen mode Alt + Return @@ -2180,8 +2175,37 @@ Exit emulator - Control + q - Cmd + q + Control + Q + Cmd + Q + + + +

Additional Launcher Keys (cannot be remapped)

+ + + + + + + + + + + + + + + + + + + + + + + + +
FunctionKey (Standard)Key (macOS)
Go to parent directory (also in other file dialogs)BackspaceBackspace
Open Power-On options dialogControl + PControl + P
Open High Scores dialog (if available for selected ROM)Control + HControl + H
Reload ROM listingControl + RControl + R
@@ -2216,12 +2240,12 @@ Move cursor to beginning of line Home - Home, Control + a, Command + Left arrow + Home, Control + A, Command + Left arrow Move cursor to end of line End - End, Control + e, Command + Right arrow + End, Control + E, Command + Right arrow Delete character to left of cursor @@ -2230,28 +2254,28 @@ Delete character to right of cursor - Delete, Control + d - Delete, Control + d + Delete, Control + D + Delete, Control + D Delete word to left of cursor - Control + Backspace, Control + w - Option + Backspace, Control + w + Control + Backspace, Control + W + Option + Backspace, Control + W Delete word to right of cursor - Control + Delete, Alt + d + Control + Delete, Alt + D Option + Delete Delete all text to beginning of line - Control + Home, Control + u - Command + Backspace, Control + u + Control + Home, Control + U + Command + Backspace, Control + U Delete all text to end of line - Control + End, Control + k - Control + k + Control + End, Control + K + Control + K Select character to left of cursor @@ -2276,42 +2300,42 @@ Select all text to beginning of line Shift + Home - Shift + Home, Shift-Control + a, Shift-Command + Left arrow + Shift + Home, Shift-Control + A, Shift-Command + Left arrow Select all text to end of line Shift + End - Shift + End, Shift-Control + e, Shift-Command + Right arrow + Shift + End, Shift-Control + E, Shift-Command + Right arrow Select all text - Control + a - Command + a + Control + A + Command + A Cut selected text - Control + x, Shift + Delete - Command + x + Control + X, Shift + Delete + Command + X Copy selected text - Control + c, Control + Insert - Command + c + Control + C, Control + Insert + Command + C Paste at cursor and replace selection - Control + v, Shift + Insert - Command + v + Control + V, Shift + Insert + Command + V Undo last operation - Control + z - Command + z + Control + Z + Command + Z Redo last operation - Control + y, Shift-Control + z - Command + y, Shift-Command + z + Control + Y, Shift-Control + Z + Command + Y, Shift-Command + Z
@@ -2939,12 +2963,12 @@
-modcombo <1|0>
- Use modifier(Shift/Alt/Control) + x key combos. This is normally enabled, - since the 'Quit' command is tied to 'Control + q'. However, there are times + Use modifier (Shift/Alt/Control/Cmd) + x key combos. This is normally enabled, + since the 'Quit' command is tied to 'Control + Q'. However, there are times when you want to disable them.
- E.g. a 2-player game is using either the 'f' or 'r' keys for movement, + E.g. a 2-player game is using either the 'F' or 'R' keys for movement, and pressing Control (for Fire) will perform an unwanted action - associated with 'Control + r' or 'Control + f' default keys. + associated with 'Control + R' or 'Control + F' default keys. @@ -3881,7 +3905,7 @@ Clicking 'Combo' will show a dialog similar to the following:

In this dialog, you can assign various events to the selected combo event. - Note that this simply assigns multiple events to the combo; you still need + Note that this only assigns multiple events to the combo; you still need to map the combo event itself to some action, as described in the 'remap an event' section above.

@@ -4034,14 +4058,14 @@ -

This dialog can also be opened by pressing 'Control + p'.

+

This dialog can also be opened by pressing 'Control + P'.

  • High scores: This option displays the High Scores dialog for the selected ROM. Only available if high score - properties have been setup for the ROM. Also available via 'Control + h' keys combo.
  • + properties have been setup for the ROM. Also available via 'Control + H' keys combo.
  • Reload listing: Selecting this performs a reload of the - current listing. It is an alternative to pressing the 'Control + r' + current listing. It is an alternative to pressing the 'Control + R' key combo.

  • diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index 017479ceb..6a23f923b 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -49,8 +49,8 @@ class PhysicalJoystickHandler private: struct StickInfo { - StickInfo(const nlohmann::json& map = nullptr, PhysicalJoystickPtr stick = nullptr) - : mapping{map}, joy{std::move(stick)} { } + StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr) + : mapping(map), joy{std::move(stick)} {} nlohmann::json mapping; PhysicalJoystickPtr joy; diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 7003a73a4..d43080b7e 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -47,6 +47,7 @@ using uInt64 = uint64_t; #include #include #include +#include #include #include #include @@ -60,6 +61,7 @@ using std::cout; using std::cerr; using std::endl; using std::string; +using std::string_view; using std::istream; using std::ostream; using std::fstream; @@ -200,51 +202,47 @@ namespace BSPF catch(...) { return defaultValue; } } - // Compare two strings, ignoring case - inline int compareIgnoreCase(const string& s1, const string& s2) + // Compare two strings (case insensitive) + // Return negative, zero, positive result for <,==,> respectively + static constexpr int compareIgnoreCase(string_view s1, string_view s2) { - #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__ - return _stricmp(s1.c_str(), s2.c_str()); - #else - return strcasecmp(s1.c_str(), s2.c_str()); - #endif - } - inline int compareIgnoreCase(const char* s1, const char* s2) - { - #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__ - return _stricmp(s1, s2); - #else - return strcasecmp(s1, s2); - #endif - } + // Only compare up to the length of the shorter string + const auto maxsize = std::min(s1.size(), s2.size()); + for(size_t i = 0; i < maxsize; ++i) + if(toupper(s1[i]) != toupper(s2[i])) + return toupper(s1[i]) - toupper(s2[i]); - // Test whether the first string starts with the second one (case insensitive) - inline bool startsWithIgnoreCase(const string& s1, const string& s2) - { - #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__ - return _strnicmp(s1.c_str(), s2.c_str(), s2.length()) == 0; - #else - return strncasecmp(s1.c_str(), s2.c_str(), s2.length()) == 0; - #endif - } - inline bool startsWithIgnoreCase(const char* s1, const char* s2) - { - #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__ - return _strnicmp(s1, s2, strlen(s2)) == 0; - #else - return strncasecmp(s1, s2, strlen(s2)) == 0; - #endif + // Otherwise the length of the string takes priority + return static_cast(s1.size() - s2.size()); } // Test whether two strings are equal (case insensitive) - inline bool equalsIgnoreCase(const string& s1, const string& s2) + inline constexpr bool equalsIgnoreCase(string_view s1, string_view s2) { - return compareIgnoreCase(s1, s2) == 0; + return s1.size() == s2.size() ? (compareIgnoreCase(s1, s2) == 0) : false; + } + + // Test whether the first string starts with the second one (case insensitive) + inline constexpr bool startsWithIgnoreCase(string_view s1, string_view s2) + { + if(s1.size() >= s2.size()) + return compareIgnoreCase(s1.substr(0, s2.size()), s2) == 0; + + return false; + } + + // Test whether the first string ends with the second one (case insensitive) + inline constexpr bool endsWithIgnoreCase(string_view s1, string_view s2) + { + if(s1.size() >= s2.size()) + return compareIgnoreCase(s1.substr(s1.size() - s2.size()), s2) == 0; + + return false; } // Find location (if any) of the second string within the first, // starting from 'startpos' in the first string - inline size_t findIgnoreCase(const string& s1, const string& s2, size_t startpos = 0) + static size_t findIgnoreCase(const string& s1, const string& s2, size_t startpos = 0) { auto pos = std::search(s1.cbegin()+startpos, s1.cend(), s2.cbegin(), s2.cend(), [](char ch1, char ch2) { @@ -253,17 +251,6 @@ namespace BSPF return pos == s1.cend() ? string::npos : pos - (s1.cbegin()+startpos); } - // Test whether the first string ends with the second one (case insensitive) - inline bool endsWithIgnoreCase(const string& s1, const string& s2) - { - if(s1.length() >= s2.length()) - { - const char* end = s1.c_str() + s1.length() - s2.length(); - return compareIgnoreCase(end, s2.c_str()) == 0; - } - return false; - } - // Test whether the first string contains the second one (case insensitive) inline bool containsIgnoreCase(const string& s1, const string& s2) { @@ -275,12 +262,12 @@ namespace BSPF // - the following characters must appear in the order of the first string inline bool matches(const string& s1, const string& s2) { - if(BSPF::startsWithIgnoreCase(s1, s2.substr(0, 1))) + if(startsWithIgnoreCase(s1, s2.substr(0, 1))) { size_t pos = 1; for(uInt32 j = 1; j < s2.size(); ++j) { - size_t found = BSPF::findIgnoreCase(s1, s2.substr(j, 1), pos); + size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos); if(found == string::npos) return false; pos += found + 1; @@ -303,6 +290,14 @@ namespace BSPF } } + // Trim leading and trailing whitespace from a string + inline string trim(const string& str) + { + string::size_type first = str.find_first_not_of(' '); + return (first == string::npos) ? EmptyString : + str.substr(first, str.find_last_not_of(' ')-first+1); + } + // C++11 way to get local time // Equivalent to the C-style localtime() function, but is thread-safe inline std::tm localTime() diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index b0e6ae725..1e325a08c 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -18,15 +18,6 @@ #include "KeyValueRepositoryConfigfile.hxx" #include "Logger.hxx" -namespace { - string trim(const string& str) - { - string::size_type first = str.find_first_not_of(' '); - return (first == string::npos) ? EmptyString : - str.substr(first, str.find_last_not_of(' ')-first+1); - } -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file) : myFile{file} @@ -67,8 +58,8 @@ std::map KeyValueRepositoryConfigfile::load() continue; // Split the line into key/value pairs and trim any whitespace - key = trim(line.substr(0, equalPos)); - value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); + key = BSPF::trim(line.substr(0, equalPos)); + value = BSPF::trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); // Skip absent key if(key.length() == 0) diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index eb82844cb..30582d29b 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -739,8 +739,10 @@ inline bool FrameBuffer::drawMessage() if(myMsg.dirty) { + #ifdef DEBUG_BUILD cerr << "m"; //cerr << "--- draw message ---" << endl; + #endif // Draw the bounded box and text const Common::Rect& dst = myMsg.surface->dstRect(); diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index 7c129a392..decc70a24 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -116,20 +116,6 @@ class Settings void setPermanent(const string& key, const Variant& value); void setTemporary(const string& key, const Variant& value); - // Trim leading and following whitespace from a string - static string trim(const string& str) - { - string::size_type first = str.find_first_not_of(' '); - return (first == string::npos) ? EmptyString : - str.substr(first, str.find_last_not_of(' ')-first+1); - } - - // FIXME - Rework so that these aren't needed; hence no commenting added - const Options& getPermanentSettings() const - { return myPermanentSettings; } - const Options& getTemporarySettings() const - { return myTemporarySettings; } - private: /** This method must be called *after* settings have been fully loaded diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 13afb335a..a42744657 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -143,7 +143,7 @@ Common::Rect CheckListWidget::getEditRect() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CheckListWidget::getState(int line) +bool CheckListWidget::getState(int line) const { if(line >= 0 && line < int(_stateList.size())) return _stateList[line]; diff --git a/src/gui/CheckListWidget.hxx b/src/gui/CheckListWidget.hxx index 2ebec0d5d..30ccba814 100644 --- a/src/gui/CheckListWidget.hxx +++ b/src/gui/CheckListWidget.hxx @@ -39,8 +39,8 @@ class CheckListWidget : public ListWidget void setList(const StringList& list, const BoolArray& state); void setLine(int line, const string& str, const bool& state); - bool getState(int line); - bool getSelectedState() { return getState(_selectedItem); } + bool getState(int line) const; + bool getSelectedState() const { return getState(_selectedItem); } private: bool handleEvent(Event::Type e) override; diff --git a/src/gui/ColorWidget.cxx b/src/gui/ColorWidget.cxx index 94ef4bbf4..8320c9a88 100644 --- a/src/gui/ColorWidget.cxx +++ b/src/gui/ColorWidget.cxx @@ -28,8 +28,8 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, int cmd, bool framed) : Widget(boss, font, x, y, w, h), CommandSender(boss), - _framed(framed), - _cmd(cmd) + _framed{framed}, + _cmd{cmd} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; } diff --git a/src/gui/Command.hxx b/src/gui/Command.hxx index 64fab2151..0178670f8 100644 --- a/src/gui/Command.hxx +++ b/src/gui/Command.hxx @@ -48,7 +48,7 @@ class CommandSender // and add methods addTarget/removeTarget. public: explicit CommandSender(CommandReceiver* target) - : _target(target) { } + : _target{target} { } virtual ~CommandSender() = default; diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 2ecf50302..bcf87ca0e 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -31,9 +31,9 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font, const VariantList& items, int cmd, int width) : Dialog(boss->instance(), boss->parent(), font), CommandSender(boss), - _rowHeight(font.getLineHeight()), - _cmd(cmd), - _maxWidth(width) + _rowHeight{font.getLineHeight()}, + _cmd{cmd}, + _maxWidth{width} { setArrows(); addItems(items); diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx index 6807635ba..ab6a0f6ff 100644 --- a/src/gui/ContextMenu.hxx +++ b/src/gui/ContextMenu.hxx @@ -130,7 +130,7 @@ class ContextMenu : public Dialog, public CommandSender int _id{-1}; uInt32 _xorig{0}, _yorig{0}; - uInt32 _maxWidth{0}; + int _maxWidth{0}; int _textOfs{0}; int _arrowSize{0}; diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index fc16e302e..65d057e38 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -148,7 +148,7 @@ class DeveloperDialog : public Dialog CheckboxWidget* myGhostReadsTrapWidget{nullptr}; #endif - bool mySettings; + bool mySettings{false}; // Emulator sets std::array myFrameStats; std::array myDetectedInfo; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 8b052b032..95107b7b3 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -49,8 +49,8 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font, const string& title, int x, int y, int w, int h) : GuiObject(instance, parent, *this, x, y, w, h), - _font(font), - _title(title) + _font{font}, + _title{title} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG; setTitle(title); @@ -244,7 +244,9 @@ void Dialog::redraw(bool force) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::render() { +#ifdef DEBUG_BUILD //cerr << " render " << typeid(*this).name() << endl; +#endif // Update dialog surface; also render any extra surfaces // Extra surfaces must be rendered afterwards, so they are drawn on top @@ -263,8 +265,6 @@ void Dialog::render() if(!onTop) { - //cerr << " shade " << typeid(*this).name() << endl; - _shadeSurface->setDstRect(_surface->dstRect()); _shadeSurface->render(); } @@ -433,8 +433,10 @@ void Dialog::drawDialog() if(isDirty()) { - cerr << endl << "d"; + #ifdef DEBUG_BUILD //cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl; + cerr << endl << "d"; + #endif if(clearsBackground()) { @@ -453,7 +455,9 @@ void Dialog::drawDialog() } else { s.invalidate(); + #ifdef DEBUG_BUILD //cerr << "invalidate " << typeid(*this).name() << endl; + #endif } if(hasBorder()) // currently only used by Dialog itself s.frameRect(_x, _y, _w, _h, kColor); @@ -463,8 +467,10 @@ void Dialog::drawDialog() clearDirty(); } +#ifdef DEBUG_BUILD else cerr << endl; +#endif // Draw all children drawChain(); diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 0cc145d55..022334e47 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -213,7 +213,7 @@ class Dialog : public GuiObject Widget* widget{nullptr}; WidgetArray list; - explicit Focus(Widget* w = nullptr) : widget(w) { } + explicit Focus(Widget* w = nullptr) : widget{w} { } }; using FocusList = vector; @@ -222,7 +222,7 @@ class Dialog : public GuiObject FocusList focus; uInt32 currentTab{0}; - explicit TabFocus(TabWidget* w = nullptr) : widget(w) { } + explicit TabFocus(TabWidget* w = nullptr) : widget{w} { } void appendFocusList(WidgetArray& list); void saveCurrentFocus(Widget* w); diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index 16f32536a..b4307aa45 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -28,7 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DialogContainer::DialogContainer(OSystem& osystem) - : myOSystem(osystem) + : myOSystem{osystem} { _DOUBLE_CLICK_DELAY = osystem.settings().getInt("mdouble"); _REPEAT_INITIAL_DELAY = osystem.settings().getInt("ctrldelay"); @@ -94,8 +94,9 @@ void DialogContainer::draw(bool full) { if(myDialogStack.empty()) return; - +#ifdef DEBUG_BUILD //cerr << "draw " << full << " " << typeid(*this).name() << endl; +#endif // Draw and render all dirty dialogs myDialogStack.applyAll([&](Dialog*& d) { @@ -118,8 +119,9 @@ void DialogContainer::render() { if(myDialogStack.empty()) return; - +#ifdef DEBUG_BUILD //cerr << "full re-render " << typeid(*this).name() << endl; +#endif // Make sure we start in a clean state (with zero'ed buffers) if(!myOSystem.eventHandler().inTIAMode()) @@ -171,7 +173,9 @@ void DialogContainer::removeDialog() { if(!myDialogStack.empty()) { + #ifdef DEBUG_BUILD //cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl; + #endif myDialogStack.pop(); // Inform the frame buffer that it has to render all surfaces diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index 0336e4c51..4755c7789 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -40,7 +40,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, EventMode mode) : Widget(boss, font, x, y, w, h), CommandSender(boss), - myEventMode(mode) + myEventMode{mode} { const int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 169b9cddb..519c097fa 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -28,7 +28,7 @@ FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : StringListWidget(boss, font, x, y, w, h), - _filter([](const FilesystemNode& node) { return true; }) + _filter{[](const FilesystemNode& node) { return true; }} { // This widget is special, in that it catches signals and redirects them setTarget(this); diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index 32f6517f7..f60dd97d4 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -89,7 +89,7 @@ class FileListWidget : public StringListWidget const FilesystemNode& currentDir() const { return _node; } static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; } - uInt64 getQuickSelectDelay() { return _QUICK_SELECT_DELAY; } + uInt64 getQuickSelectDelay() const { return _QUICK_SELECT_DELAY; } ProgressDialog& progress(); void incProgress(); diff --git a/src/gui/Font.cxx b/src/gui/Font.cxx index e327fa8af..53797d031 100644 --- a/src/gui/Font.cxx +++ b/src/gui/Font.cxx @@ -26,7 +26,7 @@ namespace GUI { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Font::Font(const FontDesc& desc) - : myFontDesc(desc) + : myFontDesc{desc} { } diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index 992c9a09b..113569c0c 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -92,7 +92,7 @@ GameInfoDialog::GameInfoDialog( myTab->setActiveTab(0); // Add Defaults, OK and Cancel buttons - addDefaultsOKCancelBGroup(wid, font); + addDefaultsExtraOKCancelBGroup(wid, font, "Save", kSavePressed); addBGroupToFocusList(wid); } diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx index dd95d62cc..6d69cd04b 100644 --- a/src/gui/GuiObject.hxx +++ b/src/gui/GuiObject.hxx @@ -70,10 +70,10 @@ class GuiObject : public CommandReceiver public: GuiObject(OSystem& osystem, DialogContainer& parent, Dialog& dialog, int x, int y, int w, int h) - : myOSystem(osystem), - myParent(parent), - myDialog(dialog), - _x(x), _y(y), _w(w), _h(h) { } + : myOSystem{osystem}, + myParent{parent}, + myDialog{dialog}, + _x{x}, _y{y}, _w{w}, _h{h} { } ~GuiObject() override = default; diff --git a/src/gui/HighScoresDialog.hxx b/src/gui/HighScoresDialog.hxx index 90ca8fc82..2183f9964 100644 --- a/src/gui/HighScoresDialog.hxx +++ b/src/gui/HighScoresDialog.hxx @@ -35,7 +35,6 @@ class Serializer; using json = nlohmann::json; - /** The dialog for displaying high scores in Stella. diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index e9bb315c3..2345e3570 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -41,8 +41,8 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h) : Dialog(osystem, parent, font, "Input settings"), - myMaxWidth(max_w), - myMaxHeight(max_h) + myMaxWidth{max_w}, + myMaxHeight{max_h} { const int lineHeight = _font.getLineHeight(), fontWidth = _font.getMaxCharWidth(), diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index 91868282c..81605a703 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -28,7 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Launcher::Launcher(OSystem& osystem) : DialogContainer(osystem), - mySize(myOSystem.settings().getSize("launcherres")) + mySize{myOSystem.settings().getSize("launcherres")} { const Common::Size& d = myOSystem.frameBuffer().desktopSize(); double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0; diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index 1cf6c7e0d..a8c0c37da 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -28,7 +28,7 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, bool useScrollbar) : EditableWidget(boss, font, x, y, 16, 16), - _useScrollbar(useScrollbar) + _useScrollbar{useScrollbar} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kWidColor; diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index d5b5cf11b..ca3913543 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -33,8 +33,8 @@ MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font, bool focusOKButton) : Dialog(boss->instance(), boss->parent(), font, title, 0, 0, max_w, max_h), CommandSender(boss), - myOkCmd(okCmd), - myCancelCmd(cancelCmd) + myOkCmd{okCmd}, + myCancelCmd{cancelCmd} { addText(font, text); diff --git a/src/gui/MessageDialog.cxx b/src/gui/MessageDialog.cxx index ca52c99e6..2c2b19c7d 100644 --- a/src/gui/MessageDialog.cxx +++ b/src/gui/MessageDialog.cxx @@ -82,6 +82,7 @@ void MessageDialog::setMessage(const string& title, const string& text, bool yes setMessage(title, StringParser(text).stringList(), yesNo); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string MessageDialog::myTitle = ""; StringList MessageDialog::myText; bool MessageDialog::myYesNo = false; diff --git a/src/gui/MessageDialog.hxx b/src/gui/MessageDialog.hxx index d3c8a8228..6399abafb 100644 --- a/src/gui/MessageDialog.hxx +++ b/src/gui/MessageDialog.hxx @@ -26,36 +26,36 @@ class OSystem; class MessageDialog : public Dialog { -public: - MessageDialog(OSystem& osystem, DialogContainer& parent, - const GUI::Font& font, int max_w, int max_h); - ~MessageDialog() override; + public: + MessageDialog(OSystem& osystem, DialogContainer& parent, + const GUI::Font& font, int max_w, int max_h); + ~MessageDialog() override; - // Define the message displayed - void setMessage(const string& title, const string& text, bool yesNo = false); - void setMessage(const string& title, const StringList& text, bool yesNo = false); - bool confirmed() { return myConfirmed; } + // Define the message displayed + void setMessage(const string& title, const string& text, bool yesNo = false); + void setMessage(const string& title, const StringList& text, bool yesNo = false); + bool confirmed() { return myConfirmed; } -protected: - void loadConfig() override; - void handleCommand(CommandSender* sender, int cmd, int data, int id) override; + protected: + void loadConfig() override; + void handleCommand(CommandSender* sender, int cmd, int data, int id) override; -private: - static string myTitle; - static StringList myText; - static bool myYesNo; - static bool myConfirmed; + private: + static string myTitle; + static StringList myText; + static bool myYesNo; + static bool myConfirmed; - // Show a message - GUI::MessageBox* myMsg{nullptr}; + // Show a message + GUI::MessageBox* myMsg{nullptr}; -private: - // Following constructors and assignment operators not supported - MessageDialog() = delete; - MessageDialog(const MessageDialog&) = delete; - MessageDialog(MessageDialog&&) = delete; - MessageDialog& operator=(const MessageDialog&) = delete; - MessageDialog& operator=(MessageDialog&&) = delete; + private: + // Following constructors and assignment operators not supported + MessageDialog() = delete; + MessageDialog(const MessageDialog&) = delete; + MessageDialog(MessageDialog&&) = delete; + MessageDialog& operator=(const MessageDialog&) = delete; + MessageDialog& operator=(MessageDialog&&) = delete; }; #endif diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index 865103822..b2dc3b083 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -49,8 +49,8 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss, int max_w, int max_h, Menu::AppMode mode) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"), - myBoss(boss), - myMode(mode) + myBoss{boss}, + myMode{mode} { // do not show basic settings options in debugger bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger; diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx index bd13c3f37..ea0f38935 100644 --- a/src/gui/OptionsDialog.hxx +++ b/src/gui/OptionsDialog.hxx @@ -71,7 +71,7 @@ class OptionsDialog : public Dialog ButtonWidget* myGameInfoButton{nullptr}; ButtonWidget* myCheatCodeButton{nullptr}; - GuiObject* myBoss; + GuiObject* myBoss{nullptr}; // Indicates if this dialog is used for global (vs. in-game) settings Menu::AppMode myMode{Menu::AppMode::emulator}; diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index ab9560ed8..0bdd2e552 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -29,8 +29,8 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const VariantList& list, const string& label, int labelWidth, int cmd) : EditableWidget(boss, font, x, y - 1, w, h + 2), - _label(label), - _labelWidth(labelWidth) + _label{label}, + _labelWidth{labelWidth} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_TRACK_MOUSE; @@ -247,7 +247,6 @@ void PopUpWidget::setArrow() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PopUpWidget::drawWidget(bool hilite) { -//cerr << "PopUpWidget::drawWidget\n"; FBSurface& s = dialog().surface(); int x = _x + _labelWidth; diff --git a/src/gui/ProgressDialog.cxx b/src/gui/ProgressDialog.cxx index 7f0965fbc..1498b0cea 100644 --- a/src/gui/ProgressDialog.cxx +++ b/src/gui/ProgressDialog.cxx @@ -30,7 +30,7 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font, const string& message) : Dialog(boss->instance(), boss->parent()), - myFont(font) + myFont{font} { const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), diff --git a/src/gui/QuadTariDialog.cxx b/src/gui/QuadTariDialog.cxx index b4d1891ef..4b0ef8ead 100644 --- a/src/gui/QuadTariDialog.cxx +++ b/src/gui/QuadTariDialog.cxx @@ -29,7 +29,7 @@ QuadTariDialog::QuadTariDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h, Properties& properties) : Dialog(boss->instance(), boss->parent(), font, "QuadTari controllers", 0, 0, max_w, max_h), - myGameProperties(properties) + myGameProperties{properties} { const int lineHeight = font.getLineHeight(), fontHeight = font.getFontHeight(), diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 658859b97..7c3b8b16d 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -221,8 +221,8 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label, RadioButtonGroup* group, int cmd) : CheckboxWidget(boss, font, x, y, label, cmd), - myGroup(group), - _buttonSize(buttonSize(font)) // 14 | 22 + myGroup{group}, + _buttonSize{buttonSize(font)} // 14 | 22 { _flags = Widget::FLAG_ENABLED; _bgcolor = _bgcolorhi = kWidColor; diff --git a/src/gui/RadioButtonWidget.hxx b/src/gui/RadioButtonWidget.hxx index 8003a8627..52a81bb99 100644 --- a/src/gui/RadioButtonWidget.hxx +++ b/src/gui/RadioButtonWidget.hxx @@ -40,7 +40,7 @@ class RadioButtonWidget : public CheckboxWidget protected: void setFill(FillType type); void drawWidget(bool hilite) override; - static int buttonSize(const GUI::Font& font) + static uInt32 buttonSize(const GUI::Font& font) { return font.getFontHeight() < 24 ? 14 : 22; // box is square } diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index a95e4fce5..65b4d0c33 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -37,9 +37,9 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h) : Dialog(osystem, parent, font, "Audit ROMs"), - myFont(font), - myMaxWidth(max_w), - myMaxHeight(max_h) + myFont{font}, + myMaxWidth{max_w}, + myMaxHeight{max_h} { const int lineHeight = font.getLineHeight(), fontWidth = font.getMaxCharWidth(), diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 4cf7f4d33..11eddc6e5 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -37,7 +37,7 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const Common::Size& imgSize) : Widget(boss, font, x, y, w, h), - myAvail(imgSize) + myAvail{imgSize} { _flags = Widget::FLAG_ENABLED; _bgcolor = kDlgColor; diff --git a/src/gui/SnapshotDialog.cxx b/src/gui/SnapshotDialog.cxx index 792d7af7f..80af8ec1d 100644 --- a/src/gui/SnapshotDialog.cxx +++ b/src/gui/SnapshotDialog.cxx @@ -29,7 +29,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h) : Dialog(osystem, parent, font, "Snapshot settings"), - myFont(font) + myFont{font} { const int lineHeight = font.getLineHeight(), fontHeight = _font.getFontHeight(), diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index 06ff03b3e..5236735f0 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -32,7 +32,7 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h, Menu::AppMode mode) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"), - myMode(mode) + myMode{mode} { const int buttonHeight = _font.getLineHeight() + _font.getLineHeight() / 5, lineHeight = _font.getLineHeight(), diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index b94d1b5c4..5371947c5 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -27,7 +27,7 @@ StringListWidget::StringListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, bool hilite, bool useScrollbar) : ListWidget(boss, font, x, y, w, h, useScrollbar), - _hilite(hilite) + _hilite{hilite} { _bgcolorlo = kDlgColor; diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx index d2ca4305c..fa33c06c1 100644 --- a/src/gui/TabWidget.hxx +++ b/src/gui/TabWidget.hxx @@ -83,7 +83,7 @@ class TabWidget : public Widget, public CommandSender explicit Tab(const string& t, int tw = NO_WIDTH, Widget* first = nullptr, Widget* parent = nullptr, bool e = true) - : title(t), firstWidget(first), parentWidget(parent), enabled(e), tabWidth(tw) { } + : title{t}, firstWidget{first}, parentWidget{parent}, enabled{e}, tabWidth{tw} { } }; using TabList = vector; diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index 5f6e0e687..23d50d542 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -33,7 +33,7 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const string& label, uInt32 labelWidth, int cmd) : ButtonWidget(boss, font, x, y, w, h, label, cmd), - _labelWidth(labelWidth) + _labelWidth{labelWidth} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG | Widget::FLAG_NOBG; @@ -143,8 +143,6 @@ void TimeLineWidget::drawWidget(bool hilite) { FBSurface& s = _boss->dialog().surface(); - //cerr << "TimeLineWidget::drawWidget " << typeid(s).name() << endl; - // Draw the label, if any if(_labelWidth > 0) s.drawString(_font, _label, _x, _y + 2, _labelWidth, @@ -205,13 +203,13 @@ void TimeLineWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 TimeLineWidget::valueToPos(uInt32 value) +uInt32 TimeLineWidget::valueToPos(uInt32 value) const { return _stepValue[BSPF::clamp(value, _valueMin, _valueMax)]; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 TimeLineWidget::posToValue(uInt32 pos) +uInt32 TimeLineWidget::posToValue(uInt32 pos) const { // Find the interval in which 'pos' falls, and then the endpoint which // it is closest to diff --git a/src/gui/TimeLineWidget.hxx b/src/gui/TimeLineWidget.hxx index 5518fac20..e0cdd8980 100644 --- a/src/gui/TimeLineWidget.hxx +++ b/src/gui/TimeLineWidget.hxx @@ -49,8 +49,8 @@ class TimeLineWidget : public ButtonWidget void drawWidget(bool hilite) override; - uInt32 valueToPos(uInt32 value); - uInt32 posToValue(uInt32 pos); + uInt32 valueToPos(uInt32 value) const; + uInt32 posToValue(uInt32 pos) const; protected: uInt32 _value{0}; diff --git a/src/gui/TimeMachine.cxx b/src/gui/TimeMachine.cxx index 1dad57152..033aed076 100644 --- a/src/gui/TimeMachine.cxx +++ b/src/gui/TimeMachine.cxx @@ -23,7 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimeMachine::TimeMachine(OSystem& osystem) : DialogContainer(osystem), - myWidth(FBMinimum::Width) + myWidth{FBMinimum::Width} { myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth); } diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index 97020c825..ee98b5449 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -487,7 +487,7 @@ void TimeMachineDialog::initBar() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string TimeMachineDialog::getTimeString(uInt64 cycles) +string TimeMachineDialog::getTimeString(uInt64 cycles) const { const Int32 scanlines = std::max(instance().console().tia().scanlinesLastFrame(), 240); const bool isNTSC = scanlines <= 287; diff --git a/src/gui/TimeMachineDialog.hxx b/src/gui/TimeMachineDialog.hxx index 1d15d6b15..b9fe118fd 100644 --- a/src/gui/TimeMachineDialog.hxx +++ b/src/gui/TimeMachineDialog.hxx @@ -33,7 +33,7 @@ class TimeMachineDialog : public Dialog /** set/get number of winds when entering the dialog */ void setEnterWinds(Int32 numWinds) { _enterWinds = numWinds; } - Int32 getEnterWinds() { return _enterWinds; } + Int32 getEnterWinds() const { return _enterWinds; } private: void loadConfig() override; @@ -48,7 +48,7 @@ class TimeMachineDialog : public Dialog void setPosition() override; /** convert cycles into time */ - string getTimeString(uInt64 cycles); + string getTimeString(uInt64 cycles) const; /** re/unwind and update display */ void handleWinds(Int32 numWinds = 0); /** toggle Time Machine mode */ diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx index c2f7b7656..88e5915bd 100644 --- a/src/gui/ToolTip.cxx +++ b/src/gui/ToolTip.cxx @@ -27,7 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font) - : myDialog(dialog) + : myDialog{dialog} { myScale = myDialog.instance().frameBuffer().hidpiScaleFactor(); @@ -179,5 +179,5 @@ void ToolTip::show(const string& tip) void ToolTip::render() { if(myTipShown) - mySurface->render(); + mySurface->render(); } diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 11a9e0308..beb6f576d 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -42,8 +42,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, GuiObject* boss, int max_w, int max_h) : Dialog(osystem, parent, font, "User interface settings"), CommandSender(boss), - myFont(font), - myIsGlobal(boss != nullptr) + myFont{font}, + myIsGlobal{boss != nullptr} { const GUI::Font& ifont = instance().frameBuffer().infoFont(); const int lineHeight = font.getLineHeight(), diff --git a/src/gui/UndoHandler.cxx b/src/gui/UndoHandler.cxx index f8eeb0c48..4246d2f7f 100644 --- a/src/gui/UndoHandler.cxx +++ b/src/gui/UndoHandler.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UndoHandler::UndoHandler(size_t size) - : mySize(size) + : mySize{size} { reset(); } diff --git a/src/gui/VideoAudioDialog.hxx b/src/gui/VideoAudioDialog.hxx index f0d376140..25a78baa5 100644 --- a/src/gui/VideoAudioDialog.hxx +++ b/src/gui/VideoAudioDialog.hxx @@ -66,7 +66,7 @@ class VideoAudioDialog : public Dialog void updateSettingsWithPreset(AudioSettings&); private: - TabWidget* myTab; + TabWidget* myTab{nullptr}; // General options PopUpWidget* myRenderer{nullptr}; diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 7f605a6ea..2d4a4c135 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -32,8 +32,8 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : GuiObject(boss->instance(), boss->parent(), boss->dialog(), x, y, w, h), - _boss(boss), - _font(font) + _boss{boss}, + _font{font} { // Insert into the widget list of the boss _next = _boss->_firstWidget; @@ -99,8 +99,10 @@ void Widget::draw() if(isDirty()) { + #ifdef DEBUG_BUILD //cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl; cerr << "w"; + #endif FBSurface& s = _boss->dialog().surface(); int oldX = _x, oldY = _y; @@ -383,7 +385,9 @@ void Widget::setDirtyInChain(Widget* start) { while(start) { + #ifdef DEBUG_BUILD //cerr << "setDirtyInChain " << typeid(*start).name() << endl; + #endif start->setDirty(); start = start->_next; } @@ -395,8 +399,8 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font, const string& text, TextAlign align, ColorId shadowColor) : Widget(boss, font, x, y, w, h), - _label(text), - _align(align) + _label{text}, + _align{align} { _flags = Widget::FLAG_ENABLED | FLAG_CLEARBG; @@ -464,8 +468,8 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, const string& label, int cmd, bool repeat) : StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center), CommandSender(boss), - _cmd(cmd), - _repeat(repeat) + _cmd{cmd}, + _repeat{repeat} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG; _bgcolor = kBtnColor; @@ -739,11 +743,11 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font, int valueLabelWidth, const string& valueUnit, int valueLabelGap, bool forceLabelSign) : ButtonWidget(boss, font, x, y, w, h, label, cmd), - _labelWidth(labelWidth), - _valueUnit(valueUnit), - _valueLabelGap(valueLabelGap), - _valueLabelWidth(valueLabelWidth), - _forceLabelSign(forceLabelSign) + _labelWidth{labelWidth}, + _valueUnit{valueUnit}, + _valueLabelGap{valueLabelGap}, + _valueLabelWidth{valueLabelWidth}, + _forceLabelSign{forceLabelSign} { _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG; _bgcolor = kDlgColor; diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx index 7578ca658..b00fea94d 100644 --- a/src/libretro/FBSurfaceLIBRETRO.hxx +++ b/src/libretro/FBSurfaceLIBRETRO.hxx @@ -64,7 +64,7 @@ class FBSurfaceLIBRETRO : public FBSurface void applyAttributes() override { } private: - uInt32 myWidth, myHeight; + uInt32 myWidth{0}, myHeight{0}; unique_ptr myPixelData; Common::Rect mySrcGUIR, myDstGUIR; diff --git a/src/libretro/Makefile b/src/libretro/Makefile index ec83c6afa..a635f3d66 100644 --- a/src/libretro/Makefile +++ b/src/libretro/Makefile @@ -101,7 +101,7 @@ else ifeq ($(platform), libnx) include $(DEVKITPRO)/libnx/switch_rules TARGET := $(TARGET_NAME)_libretro_$(platform).a DEFINES := -DSWITCH=1 -D__SWITCH__ -DARM - CXXFLAGS := $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs + CXXFLAGS += $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs CXXFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -ffast-math $(ASFLAGS) STATIC_LINKING = 1 diff --git a/src/libretro/StellaLIBRETRO.hxx b/src/libretro/StellaLIBRETRO.hxx index d4ae39c87..3b76a93e3 100644 --- a/src/libretro/StellaLIBRETRO.hxx +++ b/src/libretro/StellaLIBRETRO.hxx @@ -43,7 +43,7 @@ class StellaLIBRETRO StellaLIBRETRO(); public: - OSystemLIBRETRO& osystem() { return *myOSystem; } + OSystemLIBRETRO& osystem() const { return *myOSystem; } bool create(bool logging); void destroy(); diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx index c49d7d1ce..1ef2b684b 100644 --- a/src/unix/FSNodePOSIX.cxx +++ b/src/unix/FSNodePOSIX.cxx @@ -25,8 +25,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodePOSIX::FilesystemNodePOSIX() - : _path(ROOT_DIR), - _displayName(_path) + : _path{ROOT_DIR}, + _displayName{_path} { } diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx index 82182fe83..179476b27 100644 --- a/src/windows/FSNodeWINDOWS.cxx +++ b/src/windows/FSNodeWINDOWS.cxx @@ -175,7 +175,7 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p) - : _path(p.length() > 0 ? p : "~") // Default to home directory + : _path{p.length() > 0 ? p : "~"} // Default to home directory { // Expand '~' to the users 'home' directory if(_path[0] == '~')