1 //------------------------------------------------------------------------------
2 // emFileManTheme.h
3 //
4 // Copyright (C) 2010,2016,2020 Oliver Hamann.
5 //
6 // Homepage: http://eaglemode.sourceforge.net/
7 //
8 // This program is free software: you can redistribute it and/or modify it under
9 // the terms of the GNU General Public License version 3 as published by the
10 // Free Software Foundation.
11 //
12 // This program is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
15 // more details.
16 //
17 // You should have received a copy of the GNU General Public License version 3
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //------------------------------------------------------------------------------
20
21 #ifndef emFileManTheme_h
22 #define emFileManTheme_h
23
24 #ifndef emAvlTreeMap_h
25 #include <emCore/emAvlTreeMap.h>
26 #endif
27
28 #ifndef emImage_h
29 #include <emCore/emImage.h>
30 #endif
31
32 #ifndef emConfigModel_h
33 #include <emCore/emConfigModel.h>
34 #endif
35
36
37 //==============================================================================
38 //=============================== emFileManTheme ===============================
39 //==============================================================================
40
41 class emFileManTheme : public emConfigModel, public emStructRec {
42
43 public:
44
45 static emString GetThemesDirPath();
46
47 static const char * ThemeFileEnding;
48
49 static emRef<emFileManTheme> Acquire(
50 emRootContext & rootContext, const emString & name
51 );
52
53 class ImageFileRec : public emStringRec, private emRecListener {
54
55 public:
56
57 ImageFileRec(
58 emFileManTheme * parent, const char * varIdentifier,
59 emRootContext & rootContext
60 );
61
62 const emImage & GetImage() const;
63
64 private:
65
66 virtual void OnRecChanged();
67
68 emRootContext & RootContext;
69 emImage Image;
70 };
71
72 emStringRec DisplayName;
73 emStringRec DisplayIcon;
74 emColorRec BackgroundColor;
75 emColorRec SourceSelectionColor;
76 emColorRec TargetSelectionColor;
77 emColorRec NormalNameColor;
78 emColorRec ExeNameColor;
79 emColorRec DirNameColor;
80 emColorRec FifoNameColor;
81 emColorRec BlkNameColor;
82 emColorRec ChrNameColor;
83 emColorRec SockNameColor;
84 emColorRec OtherNameColor;
85 emColorRec PathColor;
86 emColorRec SymLinkColor;
87 emColorRec LabelColor;
88 emColorRec InfoColor;
89 emColorRec FileContentColor;
90 emColorRec DirContentColor;
91 emDoubleRec Height;
92 emDoubleRec BackgroundX;
93 emDoubleRec BackgroundY;
94 emDoubleRec BackgroundW;
95 emDoubleRec BackgroundH;
96 emDoubleRec BackgroundRX;
97 emDoubleRec BackgroundRY;
98 emDoubleRec OuterBorderX;
99 emDoubleRec OuterBorderY;
100 emDoubleRec OuterBorderW;
101 emDoubleRec OuterBorderH;
102 emDoubleRec OuterBorderL;
103 emDoubleRec OuterBorderT;
104 emDoubleRec OuterBorderR;
105 emDoubleRec OuterBorderB;
106 ImageFileRec OuterBorderImg;
107 emIntRec OuterBorderImgL;
108 emIntRec OuterBorderImgT;
109 emIntRec OuterBorderImgR;
110 emIntRec OuterBorderImgB;
111 emDoubleRec NameX;
112 emDoubleRec NameY;
113 emDoubleRec NameW;
114 emDoubleRec NameH;
115 emAlignmentRec NameAlignment;
116 emDoubleRec PathX;
117 emDoubleRec PathY;
118 emDoubleRec PathW;
119 emDoubleRec PathH;
120 emAlignmentRec PathAlignment;
121 emDoubleRec InfoX;
122 emDoubleRec InfoY;
123 emDoubleRec InfoW;
124 emDoubleRec InfoH;
125 emAlignmentRec InfoAlignment;
126 emDoubleRec FileInnerBorderX;
127 emDoubleRec FileInnerBorderY;
128 emDoubleRec FileInnerBorderW;
129 emDoubleRec FileInnerBorderH;
130 emDoubleRec FileInnerBorderL;
131 emDoubleRec FileInnerBorderT;
132 emDoubleRec FileInnerBorderR;
133 emDoubleRec FileInnerBorderB;
134 ImageFileRec FileInnerBorderImg;
135 emIntRec FileInnerBorderImgL;
136 emIntRec FileInnerBorderImgT;
137 emIntRec FileInnerBorderImgR;
138 emIntRec FileInnerBorderImgB;
139 emDoubleRec FileContentX;
140 emDoubleRec FileContentY;
141 emDoubleRec FileContentW;
142 emDoubleRec FileContentH;
143 emDoubleRec DirInnerBorderX;
144 emDoubleRec DirInnerBorderY;
145 emDoubleRec DirInnerBorderW;
146 emDoubleRec DirInnerBorderH;
147 emDoubleRec DirInnerBorderL;
148 emDoubleRec DirInnerBorderT;
149 emDoubleRec DirInnerBorderR;
150 emDoubleRec DirInnerBorderB;
151 ImageFileRec DirInnerBorderImg;
152 emIntRec DirInnerBorderImgL;
153 emIntRec DirInnerBorderImgT;
154 emIntRec DirInnerBorderImgR;
155 emIntRec DirInnerBorderImgB;
156 emDoubleRec DirContentX;
157 emDoubleRec DirContentY;
158 emDoubleRec DirContentW;
159 emDoubleRec DirContentH;
160 emDoubleRec AltX;
161 emDoubleRec AltY;
162 emDoubleRec AltW;
163 emDoubleRec AltH;
164 emDoubleRec AltLabelX;
165 emDoubleRec AltLabelY;
166 emDoubleRec AltLabelW;
167 emDoubleRec AltLabelH;
168 emAlignmentRec AltLabelAlignment;
169 emDoubleRec AltPathX;
170 emDoubleRec AltPathY;
171 emDoubleRec AltPathW;
172 emDoubleRec AltPathH;
173 emAlignmentRec AltPathAlignment;
174 emDoubleRec AltAltX;
175 emDoubleRec AltAltY;
176 emDoubleRec AltAltW;
177 emDoubleRec AltAltH;
178 emDoubleRec AltInnerBorderX;
179 emDoubleRec AltInnerBorderY;
180 emDoubleRec AltInnerBorderW;
181 emDoubleRec AltInnerBorderH;
182 emDoubleRec AltInnerBorderL;
183 emDoubleRec AltInnerBorderT;
184 emDoubleRec AltInnerBorderR;
185 emDoubleRec AltInnerBorderB;
186 ImageFileRec AltInnerBorderImg;
187 emIntRec AltInnerBorderImgL;
188 emIntRec AltInnerBorderImgT;
189 emIntRec AltInnerBorderImgR;
190 emIntRec AltInnerBorderImgB;
191 emDoubleRec AltContentX;
192 emDoubleRec AltContentY;
193 emDoubleRec AltContentW;
194 emDoubleRec AltContentH;
195 emDoubleRec MinContentVW;
196 emDoubleRec MinAltVW;
197 emDoubleRec DirPaddingL;
198 emDoubleRec DirPaddingT;
199 emDoubleRec DirPaddingR;
200 emDoubleRec DirPaddingB;
201 emDoubleRec LnkPaddingL;
202 emDoubleRec LnkPaddingT;
203 emDoubleRec LnkPaddingR;
204 emDoubleRec LnkPaddingB;
205
206 virtual const char * GetFormatName() const;
207
208 protected:
209
210 emFileManTheme(emContext & context, const emString & name);
211 virtual ~emFileManTheme();
212 };
213
214
215 //==============================================================================
216 //============================ emFileManThemeNames =============================
217 //==============================================================================
218
219 class emFileManThemeNames : public emModel {
220
221 public:
222
223 static emRef<emFileManThemeNames> Acquire(
224 emRootContext & rootContext
225 );
226
227 int GetThemeStyleCount() const;
228 int GetThemeAspectRatioCount(int styleIndex) const;
229 emString GetThemeName(int styleIndex, int aspectRatioIndex) const;
230 emString GetDefaultThemeName() const;
231 emString GetThemeStyleDisplayName(int styleIndex) const;
232 emString GetThemeStyleDisplayIcon(int styleIndex) const;
233 emString GetThemeAspectRatio(int styleIndex, int aspectRatioIndex) const;
234 bool IsExistingThemeName(const emString & themeName) const;
235 int GetThemeStyleIndex(const emString & themeName) const;
236 int GetThemeAspectRatioIndex(const emString & themeName) const;
237
238 protected:
239
240 emFileManThemeNames(emContext & context, const emString & name);
241 virtual ~emFileManThemeNames();
242
243 private:
244
245 static emString HeightToAspectRatioString(double height);
246
247 struct ThemeAR {
248 emString Name;
249 emString AspectRatio;
250 double Height;
251 };
252
253 struct ThemeStyle {
254 emString DisplayName;
255 emString DisplayIcon;
256 emArray<ThemeAR> ThemeARs;
257 };
258
259 emArray<ThemeStyle> ThemeStyles;
260 emAvlTreeMap<emString,int> NameToPackedIndex;
261 };
262
GetThemeStyleCount()263 inline int emFileManThemeNames::GetThemeStyleCount() const
264 {
265 return ThemeStyles.GetCount();
266 }
267
268
269 #endif
270