1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef STELLA_OPTIONS_DIALOG_HXX
19#define STELLA_OPTIONS_DIALOG_HXX
20
21class PopUpWidget;
22
23#include "Props.hxx"
24#include "Menu.hxx"
25#include "Dialog.hxx"
26#include "MessageBox.hxx"
27
28#if defined(RETRON77)
29 #include "R77HelpDialog.hxx"
30#else
31 #include "HelpDialog.hxx"
32#endif
33
34namespace GUI {
35 class Font;
36}
37
38class StellaSettingsDialog : public Dialog
39{
40 public:
41 StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
42 const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode);
43 virtual ~StellaSettingsDialog() = default;
44
45 private:
46 void loadConfig() override;
47 void saveConfig() override;
48 void setDefaults() override;
49
50 void addVideoOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
51 void addUIOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
52 void addGameOptions(WidgetArray& wid, int& xpos, int& ypos, const GUI::Font& font);
53
54 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
55 void handleOverscanChange();
56
57 // switch to advanced settings after user confirmation
58 void switchSettingsMode();
59
60 // load the properties for the controller settings
61 void loadControllerProperties(const Properties& props);
62
63 // convert internal setting values to user friendly levels
64 int levelToValue(int level);
65 int valueToLevel(int value);
66
67 void openHelp();
68
69 void updateControllerStates();
70
71 private:
72 // UI theme
73 PopUpWidget* myThemePopup;
74 PopUpWidget* myPositionPopup;
75
76 // TV effects
77 PopUpWidget* myTVMode;
78
79 // TV scanline intensity
80 SliderWidget* myTVScanIntense;
81
82 // TV phosphor effect
83 SliderWidget* myTVPhosLevel;
84
85 // TV Overscan
86 SliderWidget* myTVOverscan;
87
88 // Controller properties
89 StaticTextWidget* myGameSettings;
90
91 StaticTextWidget* myLeftPortLabel;
92 StaticTextWidget* myRightPortLabel;
93 PopUpWidget* myLeftPort;
94 StaticTextWidget* myLeftPortDetected;
95 PopUpWidget* myRightPort;
96 StaticTextWidget* myRightPortDetected;
97
98 unique_ptr<GUI::MessageBox> myConfirmMsg;
99 #if defined(RETRON77)
100 unique_ptr<R77HelpDialog> myHelpDialog;
101 #else
102 unique_ptr<HelpDialog> myHelpDialog;
103 #endif
104
105 // Indicates if this dialog is used for global (vs. in-game) settings
106 Menu::AppMode myMode;
107
108 enum {
109 kAdvancedSettings = 'SSad',
110 kConfirmSwitchCmd = 'SScf',
111 kHelp = 'SShl',
112 kScanlinesChanged = 'SSsc',
113 kPhosphorChanged = 'SSph',
114 kOverscanChanged = 'SSov',
115 kLeftCChanged = 'LCch',
116 kRightCChanged = 'RCch',
117 };
118
119 // Game properties for currently loaded ROM
120 Properties myGameProperties;
121
122 // Following constructors and assignment operators not supported
123 StellaSettingsDialog() = delete;
124 StellaSettingsDialog(const StellaSettingsDialog&) = delete;
125 StellaSettingsDialog(StellaSettingsDialog&&) = delete;
126 StellaSettingsDialog& operator=(const StellaSettingsDialog&) = delete;
127 StellaSettingsDialog& operator=(StellaSettingsDialog&&) = delete;
128};
129
130#endif
131