1#!
2
3use strict;
4use warnings;
5use File::Basename;
6
7
8sub generate_theme
9	# Arguments: tallness, display name, display icon, file
10{
11	my $tallness = shift;
12	my $DisplayName = shift;
13	my $DisplayIcon = shift;
14	my $fileName = shift;
15
16	my $BackgroundColor = '{44 51 69}';
17	my $SourceSelectionColor = '{4 84 24}';
18	my $TargetSelectionColor = '{106 9 31}';
19	my $NormalNameColor = '{226 231 255 195}';
20	my $ExeNameColor = '{71 220 89 192}';
21	my $DirNameColor = '{85 130 255 244}';
22	my $FifoNameColor = '{242 82 152 190}';
23	my $BlkNameColor = '{212 141 52 194}';
24	my $ChrNameColor = '{163 192 46 191}';
25	my $SockNameColor = '{221 76 218 191}';
26	my $OtherNameColor = '{243 60 34 188}';
27	my $PathColor = '{174 188 230 163}';
28	my $SymLinkColor = '{186 255 254 219}';
29	my $LabelColor = '{174 188 230 85}';
30	my $InfoColor = '{174 188 230 103}';
31	my $FileContentColor = '{44 51 69}';
32	my $DirContentColor = '{34 40 56}';
33
34	my $Height = $tallness;
35
36	my $frame=sqrt($tallness)*0.025;
37
38	my $BackgroundX = 0.0;
39	my $BackgroundY = 0.0;
40	my $BackgroundW = 1-$frame*(140.0/150.0);
41	my $BackgroundH = $tallness-$frame*(140.0/150.0);
42	my $BackgroundRX = $frame;
43	my $BackgroundRY = $frame;
44
45	my $OuterBorderX = 0.0;
46	my $OuterBorderY = 0.0;
47	my $OuterBorderW = 1.0;
48	my $OuterBorderH = $tallness;
49	my $OuterBorderImg = 'NightOuterBorder.tga';
50	my $OuterBorderImgL = 270.0;
51	my $OuterBorderImgT = 350.0;
52	my $OuterBorderImgR = 390.0;
53	my $OuterBorderImgB = 310.0;
54	my $OuterBorderL = $frame*($OuterBorderImgL/150.0);
55	my $OuterBorderT = $frame*($OuterBorderImgT/150.0);
56	my $OuterBorderR = $frame*($OuterBorderImgR/150.0);
57	my $OuterBorderB = $frame*($OuterBorderImgB/150.0);
58
59	my $x1=$BackgroundX+$frame*1.3;
60	my $y1=$BackgroundY+$frame*1.3;
61	my $x2=$BackgroundX+$BackgroundW-$frame*1.3;
62	my $y2=$BackgroundY+$BackgroundH-$frame*1.3;
63
64	my $NameX=$x1;
65	my $NameY=$y1;
66	my $NameW=$x2-$x1;
67	my $NameH=0.099*$NameW;
68	my $NameAlignment = "left";
69
70	my $contentFrame=$frame*0.21;
71
72	my $PathY=$NameY+$NameH+$contentFrame*1.2;
73	my $PathH=$contentFrame*3.0;
74	my $PathAlignment = "bottom-left";
75
76	my $FileInnerBorderY=$PathY+$PathH+$contentFrame*0.16;
77	my $FileInnerBorderH=$y2-$FileInnerBorderY;
78	my $FileInnerBorderImg = "NightInnerBorder.tga";
79	my $FileInnerBorderImgL = 288.0;
80	my $FileInnerBorderImgT = 288.0;
81	my $FileInnerBorderImgR = 288.0;
82	my $FileInnerBorderImgB = 288.0;
83	my $FileInnerBorderL = $contentFrame*($FileInnerBorderImgL/280.0);
84	my $FileInnerBorderT = $contentFrame*($FileInnerBorderImgT/280.0);
85	my $FileInnerBorderR = $contentFrame*($FileInnerBorderImgR/280.0);
86	my $FileInnerBorderB = $contentFrame*($FileInnerBorderImgB/280.0);
87	my $FileContentY=$FileInnerBorderY+$contentFrame;
88	my $FileContentH=$FileInnerBorderH-$contentFrame-$contentFrame;
89	my $FileContentW=$FileContentH/$tallness;
90	my $FileInnerBorderW=$FileContentW+$contentFrame+$contentFrame;
91	my $FileInnerBorderX=$x2-$FileInnerBorderW;
92	my $FileContentX=$FileInnerBorderX+$contentFrame;
93
94	my $DirInnerBorderX=$FileInnerBorderX;
95	my $DirInnerBorderY=$FileInnerBorderY;
96	my $DirInnerBorderW=$FileInnerBorderW;
97	my $DirInnerBorderH=$FileInnerBorderH;
98	my $DirInnerBorderL=$FileInnerBorderL;
99	my $DirInnerBorderT=$FileInnerBorderT;
100	my $DirInnerBorderR=$FileInnerBorderR;
101	my $DirInnerBorderB=$FileInnerBorderB;
102	my $DirInnerBorderImg=$FileInnerBorderImg;
103	my $DirInnerBorderImgL=$FileInnerBorderImgL;
104	my $DirInnerBorderImgT=$FileInnerBorderImgT;
105	my $DirInnerBorderImgR=$FileInnerBorderImgR;
106	my $DirInnerBorderImgB=$FileInnerBorderImgB;
107	my $DirContentX=$FileContentX;
108	my $DirContentY=$FileContentY;
109	my $DirContentW=$FileContentW;
110	my $DirContentH=$FileContentH;
111
112	my $AltY=$PathY;
113	my $AltH=$PathH;
114
115	my $PathX=$FileInnerBorderX;
116
117	my $InfoX=$x1;
118	my $InfoY=$PathY;
119	my $InfoW=$FileInnerBorderX-$x1-$contentFrame;
120	my $InfoH=$y2-$InfoY;
121	my $InfoAlignment = "top-left";
122
123	my $altContentFrame=$contentFrame/$FileInnerBorderW;
124
125	my $AltLabelX = 0.0;
126	my $AltLabelY = 0.0;
127	my $AltLabelW = 1.0;
128	my $AltLabelH = 2.0*$altContentFrame;
129	my $AltLabelAlignment = "left";
130	my $AltPathX = $AltLabelX;
131	my $AltPathY = $AltLabelY+$AltLabelH;
132	my $AltPathH = 5.0*$altContentFrame;
133	my $AltPathAlignment = "bottom-left";
134	my $AltAltY = $AltPathY;
135	my $AltAltH = $AltPathH;
136	my $AltInnerBorderX=0.0;
137	my $AltInnerBorderY=$AltPathY+$AltPathH+$altContentFrame*0.16666665;
138	my $AltInnerBorderW=1.0;
139	my $AltInnerBorderImg = "NightInnerBorder.tga";
140	my $AltInnerBorderImgL = 288.0;
141	my $AltInnerBorderImgT = 288.0;
142	my $AltInnerBorderImgR = 288.0;
143	my $AltInnerBorderImgB = 288.0;
144	my $AltInnerBorderL = $altContentFrame*($AltInnerBorderImgL/280.0);
145	my $AltInnerBorderT = $altContentFrame*($AltInnerBorderImgT/280.0);
146	my $AltInnerBorderR = $altContentFrame*($AltInnerBorderImgR/280.0);
147	my $AltInnerBorderB = $altContentFrame*($AltInnerBorderImgB/280.0);
148	my $AltContentX=$AltInnerBorderX+$altContentFrame;
149	my $AltContentY=$AltInnerBorderY+$altContentFrame;
150	my $AltContentW=$AltInnerBorderW-$altContentFrame-$altContentFrame;
151	my $AltContentH=$AltContentW*$tallness;
152	my $AltInnerBorderH=$AltContentH+$altContentFrame+$altContentFrame;
153
154	my $AltW=$AltH*$AltInnerBorderW/($AltInnerBorderY+$AltInnerBorderH);
155	my $AltX=$x2-$AltW;
156	my $PathW=$AltX-$PathX-$PathH*0.4;
157
158	my $AltAltW=$AltAltH*$AltW/$AltH;
159	my $AltAltX=1.0-$AltAltW;
160	my $AltPathW=$AltAltX-$AltPathX-$AltPathH*0.4;
161
162	my $MinContentVW=26.0/sqrt($Height);
163	my $MinAltVW=15.0/sqrt($Height);
164
165	my $px=1.0-$BackgroundW-$BackgroundX*2;
166	my $py=$Height-$BackgroundH-$BackgroundY*2;
167	my $DirPaddingL=$px;
168	my $DirPaddingT=$py;
169	my $DirPaddingR=0.0;
170	my $DirPaddingB=0.0;
171	my $LnkPaddingL=$px*0.5;
172	my $LnkPaddingT=$py*0.5;
173	my $LnkPaddingR=-$px*0.5;
174	my $LnkPaddingB=-$py*0.5;
175
176	my $fh;
177	open($fh,">",$fileName);
178
179	print($fh
180		"#%rec:emFileManTheme%#\n".
181		"\n".
182		"DisplayName = \"$DisplayName\"\n".
183		"DisplayIcon = \"$DisplayIcon\"\n".
184		"BackgroundColor = $BackgroundColor\n".
185		"SourceSelectionColor = $SourceSelectionColor\n".
186		"TargetSelectionColor = $TargetSelectionColor\n".
187		"NormalNameColor = $NormalNameColor\n".
188		"ExeNameColor = $ExeNameColor\n".
189		"DirNameColor = $DirNameColor\n".
190		"FifoNameColor = $FifoNameColor\n".
191		"BlkNameColor = $BlkNameColor\n".
192		"ChrNameColor = $ChrNameColor\n".
193		"SockNameColor = $SockNameColor\n".
194		"OtherNameColor = $OtherNameColor\n".
195		"PathColor = $PathColor\n".
196		"SymLinkColor = $SymLinkColor\n".
197		"LabelColor = $LabelColor\n".
198		"InfoColor = $InfoColor\n".
199		"FileContentColor = $FileContentColor\n".
200		"DirContentColor = $DirContentColor\n".
201		"Height = $Height\n".
202		"BackgroundX = $BackgroundX\n".
203		"BackgroundY = $BackgroundY\n".
204		"BackgroundW = $BackgroundW\n".
205		"BackgroundH = $BackgroundH\n".
206		"BackgroundRX = $BackgroundRX\n".
207		"BackgroundRY = $BackgroundRY\n".
208		"OuterBorderX = $OuterBorderX\n".
209		"OuterBorderY = $OuterBorderY\n".
210		"OuterBorderW = $OuterBorderW\n".
211		"OuterBorderH = $OuterBorderH\n".
212		"OuterBorderL = $OuterBorderL\n".
213		"OuterBorderT = $OuterBorderT\n".
214		"OuterBorderR = $OuterBorderR\n".
215		"OuterBorderB = $OuterBorderB\n".
216		"OuterBorderImg = \"$OuterBorderImg\"\n".
217		"OuterBorderImgL = $OuterBorderImgL\n".
218		"OuterBorderImgT = $OuterBorderImgT\n".
219		"OuterBorderImgR = $OuterBorderImgR\n".
220		"OuterBorderImgB = $OuterBorderImgB\n".
221		"NameX = $NameX\n".
222		"NameY = $NameY\n".
223		"NameW = $NameW\n".
224		"NameH = $NameH\n".
225		"NameAlignment = $NameAlignment\n".
226		"PathX = $PathX\n".
227		"PathY = $PathY\n".
228		"PathW = $PathW\n".
229		"PathH = $PathH\n".
230		"PathAlignment = $PathAlignment\n".
231		"InfoX = $InfoX\n".
232		"InfoY = $InfoY\n".
233		"InfoW = $InfoW\n".
234		"InfoH = $InfoH\n".
235		"InfoAlignment = $InfoAlignment\n".
236		"FileInnerBorderX = $FileInnerBorderX\n".
237		"FileInnerBorderY = $FileInnerBorderY\n".
238		"FileInnerBorderW = $FileInnerBorderW\n".
239		"FileInnerBorderH = $FileInnerBorderH\n".
240		"FileInnerBorderL = $FileInnerBorderL\n".
241		"FileInnerBorderT = $FileInnerBorderT\n".
242		"FileInnerBorderR = $FileInnerBorderR\n".
243		"FileInnerBorderB = $FileInnerBorderB\n".
244		"FileInnerBorderImg = \"$FileInnerBorderImg\"\n".
245		"FileInnerBorderImgL = $FileInnerBorderImgL\n".
246		"FileInnerBorderImgT = $FileInnerBorderImgT\n".
247		"FileInnerBorderImgR = $FileInnerBorderImgR\n".
248		"FileInnerBorderImgB = $FileInnerBorderImgB\n".
249		"FileContentX = $FileContentX\n".
250		"FileContentY = $FileContentY\n".
251		"FileContentW = $FileContentW\n".
252		"FileContentH = $FileContentH\n".
253		"DirInnerBorderX = $DirInnerBorderX\n".
254		"DirInnerBorderY = $DirInnerBorderY\n".
255		"DirInnerBorderW = $DirInnerBorderW\n".
256		"DirInnerBorderH = $DirInnerBorderH\n".
257		"DirInnerBorderL = $DirInnerBorderL\n".
258		"DirInnerBorderT = $DirInnerBorderT\n".
259		"DirInnerBorderR = $DirInnerBorderR\n".
260		"DirInnerBorderB = $DirInnerBorderB\n".
261		"DirInnerBorderImg = \"$DirInnerBorderImg\"\n".
262		"DirInnerBorderImgL = $DirInnerBorderImgL\n".
263		"DirInnerBorderImgT = $DirInnerBorderImgT\n".
264		"DirInnerBorderImgR = $DirInnerBorderImgR\n".
265		"DirInnerBorderImgB = $DirInnerBorderImgB\n".
266		"DirContentX = $DirContentX\n".
267		"DirContentY = $DirContentY\n".
268		"DirContentW = $DirContentW\n".
269		"DirContentH = $DirContentH\n".
270		"AltX = $AltX\n".
271		"AltY = $AltY\n".
272		"AltW = $AltW\n".
273		"AltH = $AltH\n".
274		"AltLabelX = $AltLabelX\n".
275		"AltLabelY = $AltLabelY\n".
276		"AltLabelW = $AltLabelW\n".
277		"AltLabelH = $AltLabelH\n".
278		"AltLabelAlignment = $AltLabelAlignment\n".
279		"AltPathX = $AltPathX\n".
280		"AltPathY = $AltPathY\n".
281		"AltPathW = $AltPathW\n".
282		"AltPathH = $AltPathH\n".
283		"AltPathAlignment = $AltPathAlignment\n".
284		"AltAltX = $AltAltX\n".
285		"AltAltY = $AltAltY\n".
286		"AltAltW = $AltAltW\n".
287		"AltAltH = $AltAltH\n".
288		"AltInnerBorderX = $AltInnerBorderX\n".
289		"AltInnerBorderY = $AltInnerBorderY\n".
290		"AltInnerBorderW = $AltInnerBorderW\n".
291		"AltInnerBorderH = $AltInnerBorderH\n".
292		"AltInnerBorderL = $AltInnerBorderL\n".
293		"AltInnerBorderT = $AltInnerBorderT\n".
294		"AltInnerBorderR = $AltInnerBorderR\n".
295		"AltInnerBorderB = $AltInnerBorderB\n".
296		"AltInnerBorderImg = \"$AltInnerBorderImg\"\n".
297		"AltInnerBorderImgL = $AltInnerBorderImgL\n".
298		"AltInnerBorderImgT = $AltInnerBorderImgT\n".
299		"AltInnerBorderImgR = $AltInnerBorderImgR\n".
300		"AltInnerBorderImgB = $AltInnerBorderImgB\n".
301		"AltContentX = $AltContentX\n".
302		"AltContentY = $AltContentY\n".
303		"AltContentW = $AltContentW\n".
304		"AltContentH = $AltContentH\n".
305		"MinContentVW = $MinContentVW\n".
306		"MinAltVW = $MinAltVW\n".
307		"DirPaddingL = $DirPaddingL\n".
308		"DirPaddingT = $DirPaddingT\n".
309		"DirPaddingR = $DirPaddingR\n".
310		"DirPaddingB = $DirPaddingB\n".
311		"LnkPaddingL = $LnkPaddingL\n".
312		"LnkPaddingT = $LnkPaddingT\n".
313		"LnkPaddingR = $LnkPaddingR\n".
314		"LnkPaddingB = $LnkPaddingB\n"
315	);
316
317	close($fh);
318}
319
320
321my $ThemeName = basename($0);
322$ThemeName =~ s/(^gen)|(.pl$)//g;
323
324my $DisplayName = $ThemeName;
325
326generate_theme(3.0/8.0 , "${DisplayName}", "theme_${ThemeName}.tga", "../${ThemeName}1.emFileManTheme");
327generate_theme(9.0/16.0, "${DisplayName}", "theme_${ThemeName}.tga", "../${ThemeName}2.emFileManTheme");
328generate_theme(3.0/4.0 , "${DisplayName}", "theme_${ThemeName}.tga", "../${ThemeName}3.emFileManTheme");
329