Ticket #8711: backends-lib.v5.2

File backends-lib.v5.2, 4.4 KB (added by SF/sbatyuk, 17 years ago)

disabling GUI elements patch

Line 
1Index: backends/platform/sdl/sdl.cpp
2===================================================================
3--- backends/platform/sdl/sdl.cpp (revision 28758)
4+++ backends/platform/sdl/sdl.cpp (working copy)
5@@ -473,3 +473,8 @@
6 _cdEndTime = SDL_GetTicks() + _cdrom->track[_cdTrack].length * 1000 / CD_FPS;
7 }
8 }
9+
10+Common::String OSystem_SDL::getExtraThemeConfig() {
11+ Common::String myConfigINI("[XxY]\ngameoptions_gamepath.enabled=false\n");
12+ return myConfigINI;
13+}
14\ No newline at end of file
15Index: backends/platform/sdl/sdl.h
16===================================================================
17--- backends/platform/sdl/sdl.h (revision 28758)
18+++ backends/platform/sdl/sdl.h (working copy)
19@@ -410,6 +410,10 @@
20 virtual bool remapKey(SDL_Event &ev, Common::Event &event);
21
22 void handleScalerHotkeys(const SDL_KeyboardEvent &key);
23+
24+ // backend lib methods
25+
26+ virtual Common::String getExtraThemeConfig();
27 };
28
29 #endif
30Index: common/system.h
31===================================================================
32--- common/system.h (revision 28758)
33+++ common/system.h (working copy)
34@@ -885,6 +885,12 @@
35 */
36 virtual Common::SaveFileManager *getSavefileManager() = 0;
37
38+
39+ // backend lib methods
40+
41+ virtual Common::String getExtraThemeConfig() {
42+ return "";
43+ }
44 //@}
45 };
46
47 Index: gui/ThemeModern.cpp
48===================================================================
49--- gui/ThemeModern.cpp (revision 28758)
50+++ gui/ThemeModern.cpp (working copy)
51@@ -135,7 +135,7 @@
52
53 if (isThemeLoadingRequired()) {
54 loadTheme(_defaultConfig);
55- loadTheme(_configFile, false); // Don't reset
56+ loadTheme(_configFile, false, true); // Don't reset
57
58 processExtraValues();
59 }
60Index: gui/theme.h
61===================================================================
62--- gui/theme.h (revision 28758)
63+++ gui/theme.h (working copy)
64@@ -211,7 +211,7 @@
65 bool isThemeLoadingRequired();
66 bool sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h);
67 void loadTheme(Common::ConfigFile &config, bool reset = true);
68-
69+ void loadTheme(Common::ConfigFile &config, bool reset, bool doBackendSpecificPostProcessing);
70 Eval *_evaluator;
71
72 static bool themeConfigUseable(const Common::String &file, const Common::String &style="", Common::String *cStyle=0, Common::ConfigFile *cfg=0);
73Index: gui/widget.h
74===================================================================
75--- gui/widget.h (revision 28758)
76+++ gui/widget.h (working copy)
77@@ -148,7 +148,7 @@
78 int getHints() const { return _hints; }
79
80 void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); }
81- bool isEnabled() const { return _flags & WIDGET_ENABLED; }
82+ bool isEnabled() const;
83 bool isVisible() const;
84
85 protected:
86Index: gui/ThemeClassic.cpp
87===================================================================
88--- gui/ThemeClassic.cpp (revision 28758)
89+++ gui/ThemeClassic.cpp (working copy)
90@@ -70,7 +70,7 @@
91
92 if (isThemeLoadingRequired()) {
93 loadTheme(_defaultConfig);
94- loadTheme(_configFile, false);
95+ loadTheme(_configFile, false, true);
96
97 setupConfig();
98 }
99Index: gui/theme-config.cpp
100===================================================================
101--- gui/theme-config.cpp (revision 28758)
102+++ gui/theme-config.cpp (working copy)
103@@ -765,5 +765,16 @@
104
105 debug(3, "Number of variables: %d", _evaluator->getNumVars());
106 }
107+void Theme::loadTheme(Common::ConfigFile &config, bool reset, bool doBackendSpecificPostProcessing) {
108+ loadTheme(config, reset);
109
110+ if (doBackendSpecificPostProcessing && !g_system->getExtraThemeConfig().empty()) {
111+ Common::ConfigFile myConfig;
112+ Common::String myConfigINI = g_system->getExtraThemeConfig();
113+ Common::MemoryReadStream s((const byte *)myConfigINI.c_str(), strlen(myConfigINI.c_str()));
114+ myConfig.loadFromStream(s);
115+ loadTheme(myConfig, false);
116+ }
117+}
118+
119 } // End of namespace GUI
120Index: gui/widget.cpp
121===================================================================
122--- gui/widget.cpp (revision 28758)
123+++ gui/widget.cpp (working copy)
124@@ -134,6 +134,12 @@
125 }
126 return 0;
127 }
128+bool Widget::isEnabled() const {
129+ if (g_gui.evaluator()->getVar(_name + ".enabled") == 0) {
130+ return false;
131+ }
132+ return _flags & WIDGET_ENABLED;
133+}
134
135 bool Widget::isVisible() const {
136 if (g_gui.evaluator()->getVar(_name + ".visible") == 0)
137