Rev 9602 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9602 | Rev 9727 | ||
---|---|---|---|
1 | dword eolite_ini_path[4096]; |
1 | dword eolite_ini_path[4096]; |
2 | _ini ini; |
2 | _ini ini; |
3 | 3 | ||
4 | char path_start[4096]; |
4 | char path_start[4096]; |
5 | edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098, |
5 | edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098, |
6 | #path_start,0, 100000000000010b,0,0}; |
6 | #path_start,0, 100000000000010b,0,0}; |
7 | 7 | ||
8 | more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL }; |
8 | more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL }; |
9 | more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT }; |
9 | more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT }; |
10 | checkbox show_dev_name = { SHOW_DEVICE_CLASS }; |
10 | checkbox show_dev_name = { SHOW_DEVICE_CLASS }; |
11 | checkbox show_status_bar = { SHOW_STATUS_BAR }; |
11 | checkbox show_status_bar = { SHOW_STATUS_BAR }; |
12 | checkbox big_icons = { BIG_ICONS }; |
12 | checkbox big_icons = { BIG_ICONS }; |
13 | checkbox colored_lines = { COLORED_LINES }; |
13 | checkbox colored_lines = { COLORED_LINES }; |
14 | 14 | ||
15 | 15 | ||
16 | void settings_dialog() |
16 | void settings_dialog() |
17 | { |
17 | { |
18 | proc_info Settings; |
18 | proc_info Settings; |
19 | int id; |
19 | int id; |
20 | active_settings = true; |
20 | active_settings = true; |
21 | font_size.value = kfont.size.pt; |
21 | font_size.value = kfont.size.pt; |
22 | line_height.value = files.item_h; |
22 | line_height.value = files.item_h; |
23 | SetEventMask(0x27); |
23 | SetEventMask(0x27); |
24 | loop(){ |
24 | loop(){ |
25 | switch(WaitEvent()) |
25 | switch(WaitEvent()) |
26 | { |
26 | { |
27 | case evMouse: |
27 | case evMouse: |
28 | edit_box_mouse stdcall (#path_start_ed); |
28 | edit_box_mouse stdcall (#path_start_ed); |
29 | break; |
29 | break; |
30 | 30 | ||
31 | case evButton: |
31 | case evButton: |
32 | id=GetButtonID(); |
32 | id=GetButtonID(); |
33 | if (1==id) { ExitSettings(); break; } |
33 | if (1==id) { ExitSettings(); break; } |
34 | else if (id==5) |
34 | else if (id==5) |
35 | { |
35 | { |
36 | RunProgram("/sys/@open", "/sys/settings/assoc.ini"); |
36 | RunProgram("/sys/@open", "/sys/settings/assoc.ini"); |
37 | break; |
37 | break; |
38 | } |
38 | } |
39 | else if (id==6) |
39 | else if (id==6) |
40 | { |
40 | { |
41 | strcpy(#path_start,path); |
41 | strcpy(#path_start,path); |
42 | path_start_ed.size = path_start_ed.pos = strlen(#path_start); |
42 | path_start_ed.size = path_start_ed.pos = strlen(#path_start); |
43 | ini.SetString("DefaultPath", path, strlen(path)); |
43 | ini.SetString("DefaultPath", path, strlen(path)); |
44 | edit_box_draw stdcall (#path_start_ed); |
44 | edit_box_draw stdcall (#path_start_ed); |
45 | break; |
45 | break; |
46 | } |
46 | } |
47 | else if (id==7) |
47 | else if (id==7) |
48 | { |
48 | { |
49 | SetDefaultPath(#path_start); |
49 | SetDefaultPath(#path_start); |
50 | break; |
50 | break; |
51 | } |
51 | } |
52 | show_dev_name.click(id); |
52 | show_dev_name.click(id); |
53 | show_status_bar.click(id); |
53 | show_status_bar.click(id); |
54 | colored_lines.click(id); |
54 | colored_lines.click(id); |
55 | if (font_size.click(id)) { |
55 | if (font_size.click(id)) { |
56 | kfont.size.pt = font_size.value; |
56 | kfont.size.pt = font_size.value; |
57 | kfont.changeSIZE(); |
57 | kfont.changeSIZE(); |
58 | BigFontsChange(); |
58 | BigFontsChange(); |
59 | } |
59 | } |
60 | if (line_height.click(id)) files.item_h = files_inactive.item_h = line_height.value; |
60 | if (line_height.click(id)) files.item_h = files_inactive.item_h = line_height.value; |
61 | if (big_icons.click(id)) BigIconsSwitch(); |
61 | if (big_icons.click(id)) BigIconsSwitch(); |
62 | EventRedrawWindow(Form.left,Form.top); |
62 | EventRedrawWindow(Form.left,Form.top); |
63 | //RefreshWindow(Form.slot, Settings.slot); |
63 | //RefreshWindow(Form.slot, Settings.slot); |
64 | break; |
64 | break; |
65 | 65 | ||
66 | case evKey: |
66 | case evKey: |
67 | GetKeys(); |
67 | GetKeys(); |
68 | if (key_scancode==SCAN_CODE_ESC) ExitSettings(); |
68 | if (key_scancode==SCAN_CODE_ESC) ExitSettings(); |
69 | EAX= key_ascii << 8; |
69 | edit_box_key_c stdcall (#path_start_ed,key_ascii << 8); |
70 | edit_box_key stdcall (#path_start_ed); |
- | |
71 | break; |
70 | break; |
72 | 71 | ||
73 | case evReDraw: |
72 | case evReDraw: |
74 | DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, |
73 | DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, |
75 | -efm*42+345+skin_h,0x34,sc.work,TITLE_SETT,0); |
74 | -efm*42+345+skin_h,0x34,sc.work,TITLE_SETT,0); |
76 | GetProcessInfo(#Settings, SelfInfo); |
75 | GetProcessInfo(#Settings, SelfInfo); |
77 | DrawSettingsCheckBoxes(); |
76 | DrawSettingsCheckBoxes(); |
78 | } |
77 | } |
79 | } |
78 | } |
80 | } |
79 | } |
81 | 80 | ||
82 | void ExitSettings() |
81 | void ExitSettings() |
83 | { |
82 | { |
84 | active_settings = false; |
83 | active_settings = false; |
85 | settings_window = 0; |
84 | settings_window = 0; |
86 | cmd_free = 4; |
85 | cmd_free = 4; |
87 | ExitProcess(); |
86 | ExitProcess(); |
88 | } |
87 | } |
89 | 88 | ||
90 | void DrawSettingsCheckBoxes() |
89 | void DrawSettingsCheckBoxes() |
91 | { |
90 | { |
92 | incn y; |
91 | incn y; |
93 | int but_x; |
92 | int but_x; |
94 | #define FRX 26 |
93 | #define FRX 26 |
95 | #define XXX 11 |
94 | #define XXX 11 |
96 | y.n = 0; |
95 | y.n = 0; |
97 | if (!efm) { |
96 | if (!efm) { |
98 | show_dev_name.draw(XXX, y.inc(14)); |
97 | show_dev_name.draw(XXX, y.inc(14)); |
99 | show_status_bar.draw(XXX, y.inc(25)); |
98 | show_status_bar.draw(XXX, y.inc(25)); |
100 | } |
99 | } |
101 | big_icons.draw(XXX, y.inc(25)); |
100 | big_icons.draw(XXX, y.inc(25)); |
102 | colored_lines.draw(XXX, y.inc(25)); |
101 | colored_lines.draw(XXX, y.inc(25)); |
103 | font_size.draw(XXX, y.inc(31)); |
102 | font_size.draw(XXX, y.inc(31)); |
104 | line_height.draw(XXX, y.inc(31)); |
103 | line_height.draw(XXX, y.inc(31)); |
105 | 104 | ||
106 | DrawFrame(XXX, y.inc(37), 340, 95, START_PATH); |
105 | DrawFrame(XXX, y.inc(37), 340, 95, START_PATH); |
107 | // START_PATH { |
106 | // START_PATH { |
108 | DrawEditBoxPos(FRX, y.inc(21), #path_start_ed); |
107 | DrawEditBoxPos(FRX, y.inc(21), #path_start_ed); |
109 | but_x = DrawStandartCaptButton(FRX, y.inc(34), 6, SAVE_PATH_AS_DEFAULT); |
108 | but_x = DrawStandartCaptButton(FRX, y.inc(34), 6, SAVE_PATH_AS_DEFAULT); |
110 | DrawStandartCaptButton(FRX+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT); |
109 | DrawStandartCaptButton(FRX+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT); |
111 | // } START_PATH |
110 | // } START_PATH |
112 | 111 | ||
113 | DrawStandartCaptButton(XXX, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS); |
112 | DrawStandartCaptButton(XXX, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS); |
114 | } |
113 | } |
115 | 114 | ||
116 | 115 | ||
117 | void LoadIniSettings() |
116 | void LoadIniSettings() |
118 | { |
117 | { |
119 | ini.path = GetIni(#eolite_ini_path, "app.ini"); |
118 | ini.path = GetIni(#eolite_ini_path, "app.ini"); |
120 | if (efm) ini.section = "EFM"; else ini.section = "Eolite"; |
119 | if (efm) ini.section = "EFM"; else ini.section = "Eolite"; |
121 | 120 | ||
122 | files.SetFont(6, 9, 10000000b); |
121 | files.SetFont(6, 9, 10000000b); |
123 | show_dev_name.checked = ini.GetInt("ShowDeviceName", true); |
122 | show_dev_name.checked = ini.GetInt("ShowDeviceName", true); |
124 | show_status_bar.checked = ini.GetInt("ShowStatusBar", true); |
123 | show_status_bar.checked = ini.GetInt("ShowStatusBar", true); |
125 | big_icons.checked = ini.GetInt("BigIcons", false); BigIconsSwitch(); |
124 | big_icons.checked = ini.GetInt("BigIcons", false); BigIconsSwitch(); |
126 | colored_lines.checked = ini.GetInt("ColoredLines", true); |
125 | colored_lines.checked = ini.GetInt("ColoredLines", true); |
127 | kfont.size.pt = ini.GetInt("FontSize", 13); |
126 | kfont.size.pt = ini.GetInt("FontSize", 13); |
128 | files.item_h = ini.GetInt("LineHeight", 19); |
127 | files.item_h = ini.GetInt("LineHeight", 19); |
129 | Form.left = ini.GetInt("WinX", 100); |
128 | Form.left = ini.GetInt("WinX", 100); |
130 | Form.top = ini.GetInt("WinY", 30); |
129 | Form.top = ini.GetInt("WinY", 30); |
131 | Form.width = ini.GetInt("WinW", efm*170+550); |
130 | Form.width = ini.GetInt("WinW", efm*170+550); |
132 | Form.height = ini.GetInt("WinH", efm*100+517); |
131 | Form.height = ini.GetInt("WinH", efm*100+517); |
133 | ini.GetString("DefaultPath", #path_start, 4096, "/sys"); |
132 | ini.GetString("DefaultPath", #path_start, 4096, "/sys"); |
134 | path_start_ed.size = path_start_ed.pos = strlen(#path_start); |
133 | path_start_ed.size = path_start_ed.pos = strlen(#path_start); |
135 | kfont.init(DEFAULT_FONT); |
134 | kfont.init(DEFAULT_FONT); |
136 | ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on"); |
135 | ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on"); |
137 | if(streq(#temp,"off")) kfont.smooth = false; else kfont.smooth = true; |
136 | if(streq(#temp,"off")) kfont.smooth = false; else kfont.smooth = true; |
138 | } |
137 | } |
139 | 138 | ||
140 | 139 | ||
141 | void SaveIniSettings() |
140 | void SaveIniSettings() |
142 | { |
141 | { |
143 | ini.SetInt("ShowDeviceName", show_dev_name.checked); |
142 | ini.SetInt("ShowDeviceName", show_dev_name.checked); |
144 | ini.SetInt("ShowStatusBar", show_status_bar.checked); |
143 | ini.SetInt("ShowStatusBar", show_status_bar.checked); |
145 | ini.SetInt("BigIcons", big_icons.checked); |
144 | ini.SetInt("BigIcons", big_icons.checked); |
146 | ini.SetInt("ColoredLines", colored_lines.checked); |
145 | ini.SetInt("ColoredLines", colored_lines.checked); |
147 | ini.SetInt("FontSize", kfont.size.pt); |
146 | ini.SetInt("FontSize", kfont.size.pt); |
148 | ini.SetInt("LineHeight", files.item_h); |
147 | ini.SetInt("LineHeight", files.item_h); |
149 | if (Form.status_window<=2) { |
148 | if (Form.status_window<=2) { |
150 | ini.SetInt("WinX", Form.left); |
149 | ini.SetInt("WinX", Form.left); |
151 | ini.SetInt("WinY", Form.top); |
150 | ini.SetInt("WinY", Form.top); |
152 | ini.SetInt("WinW", Form.width); |
151 | ini.SetInt("WinW", Form.width); |
153 | ini.SetInt("WinH", Form.height); |
152 | ini.SetInt("WinH", Form.height); |
154 | } |
153 | } |
155 | } |
154 | } |
156 | 155 | ||
157 | 156 | ||
158 | 157 | ||
159 | void Write_Error(int error_number) |
158 | void Write_Error(int error_number) |
160 | { |
159 | { |
161 | char error_message[500]; |
160 | char error_message[500]; |
162 | sprintf(#error_message,"\"Eolite\n%s\" -tE", get_error(error_number)); |
161 | sprintf(#error_message,"\"Eolite\n%s\" -tE", get_error(error_number)); |
163 | notify(#error_message); |
162 | notify(#error_message); |
164 | } |
163 | } |
165 | 164 | ||
166 | 165 | ||
167 | void LoadIcons() |
166 | void LoadIcons() |
168 | { |
167 | { |
169 | dword selected_shadow = MixColors(col.selec, 0, 200); |
168 | dword selected_shadow = MixColors(col.selec, 0, 200); |
170 | dword non_white_shadow = MixColors(col.list_bg, 0, 200); |
169 | dword non_white_shadow = MixColors(col.list_bg, 0, 200); |
171 | if (big_icons.checked) |
170 | if (big_icons.checked) |
172 | { |
171 | { |
173 | icons32_default.load("/sys/icons32.png"); |
172 | icons32_default.load("/sys/icons32.png"); |
174 | icons32_selected.load("/sys/icons32.png"); |
173 | icons32_selected.load("/sys/icons32.png"); |
175 | //FUUUUUU... the next ugly code may replace the previous line |
174 | //FUUUUUU... the next ugly code may replace the previous line |
176 | //we are copying raw data without loading and unpycking PNG |
175 | //we are copying raw data without loading and unpycking PNG |
177 | //memmov(icons32_selected.imgsrc, icons32_default.imgsrc, icons32_default.h*32*4); |
176 | //memmov(icons32_selected.imgsrc, icons32_default.imgsrc, icons32_default.h*32*4); |
178 | //EDI = icons32_selected.image; |
177 | //EDI = icons32_selected.image; |
179 | //ESDWORD[EDI+04] = 32; |
178 | //ESDWORD[EDI+04] = 32; |
180 | //ESDWORD[EDI+08] = icons32_default.h; |
179 | //ESDWORD[EDI+08] = icons32_default.h; |
181 | //ESDWORD[EDI+20] = IMAGE_BPP32; |
180 | //ESDWORD[EDI+20] = IMAGE_BPP32; |
182 | //ESDWORD[EDI+24] = icons32_selected.imgsrc; |
181 | //ESDWORD[EDI+24] = icons32_selected.imgsrc; |
183 | icons32_default.replace_color(0x00000000, col.list_bg); |
182 | icons32_default.replace_color(0x00000000, col.list_bg); |
184 | icons32_selected.replace_color(0x00000000, col.selec); |
183 | icons32_selected.replace_color(0x00000000, col.selec); |
185 | } else { |
184 | } else { |
186 | icons16_default.load("/sys/icons16.png"); |
185 | icons16_default.load("/sys/icons16.png"); |
187 | icons16_selected.load("/sys/icons16.png"); |
186 | icons16_selected.load("/sys/icons16.png"); |
188 | icons16_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow); |
187 | icons16_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow); |
189 | if (col.list_bg!=0xFFFfff) { |
188 | if (col.list_bg!=0xFFFfff) { |
190 | icons16_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow); |
189 | icons16_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow); |
191 | } |
190 | } |
192 | } |
191 | } |
193 | 192 | ||
194 | } |
193 | } |
195 | 194 | ||
196 | void SetAppColors() |
195 | void SetAppColors() |
197 | { |
196 | { |
198 | int i; |
197 | int i; |
199 | static dword bg_col; |
198 | static dword bg_col; |
200 | dword old_list_bg_color = col.list_bg; |
199 | dword old_list_bg_color = col.list_bg; |
201 | sc.get(); |
200 | sc.get(); |
202 | sc.dark = MixColors(0, sc.work, 35); |
201 | sc.dark = MixColors(0, sc.work, 35); |
203 | if (sc.work == 0) sc.work = 1; |
202 | if (sc.work == 0) sc.work = 1; |
204 | if (bg_col == sc.work) return; |
203 | if (bg_col == sc.work) return; |
205 | bg_col = sc.work; |
204 | bg_col = sc.work; |
206 | if (skin_is_dark()) |
205 | if (skin_is_dark()) |
207 | { |
206 | { |
208 | //use dark colors |
207 | //use dark colors |
209 | col.skin_is_dark = true; |
208 | col.skin_is_dark = true; |
210 | col.list_bg = sc.work; |
209 | col.list_bg = sc.work; |
211 | col.list_gb_text = sc.work_text; |
210 | col.list_gb_text = sc.work_text; |
212 | col.list_text_hidden = 0xA6A6B7; |
211 | col.list_text_hidden = 0xA6A6B7; |
213 | col.list_vert_line = sc.line; |
212 | col.list_vert_line = sc.line; |
214 | col.lpanel = MixColors(sc.line, sc.work, 65); |
213 | col.lpanel = MixColors(sc.line, sc.work, 65); |
215 | col.selec = col.selec_active = sc.button; |
214 | col.selec = col.selec_active = sc.button; |
216 | col.selec_text = sc.button_text; |
215 | col.selec_text = sc.button_text; |
217 | if (col.list_bg==col.selec) col.selec = sc.line; //for fucking skins |
216 | if (col.list_bg==col.selec) col.selec = sc.line; //for fucking skins |
218 | col.slider_bg_big = MixColors(0xCED0D0, sc.work, 35); |
217 | col.slider_bg_big = MixColors(0xCED0D0, sc.work, 35); |
219 | col.odd_line = MixColors(0xFFFfff, sc.work, 15); |
218 | col.odd_line = MixColors(0xFFFfff, sc.work, 15); |
220 | for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = MixColors(col.lpanel, blue_hl_pal[i], 180); |
219 | for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = MixColors(col.lpanel, blue_hl_pal[i], 180); |
221 | } |
220 | } |
222 | else |
221 | else |
223 | { |
222 | { |
224 | //use light colors |
223 | //use light colors |
225 | col.skin_is_dark = false; |
224 | col.skin_is_dark = false; |
226 | col.list_bg = 0xFFFfff; |
225 | col.list_bg = 0xFFFfff; |
227 | col.list_gb_text = 0x000000; |
226 | col.list_gb_text = 0x000000; |
228 | col.list_text_hidden = 0xA6A6B7; |
227 | col.list_text_hidden = 0xA6A6B7; |
229 | col.list_vert_line = 0xDDD7CF; |
228 | col.list_vert_line = 0xDDD7CF; |
230 | col.lpanel = 0x00699C; |
229 | col.lpanel = 0x00699C; |
231 | if (efm) EBX = 0x84BEFB; else EBX = 0x92B1D9; |
230 | if (efm) EBX = 0x84BEFB; else EBX = 0x92B1D9; |
232 | col.selec = col.selec_active = EBX; |
231 | col.selec = col.selec_active = EBX; |
233 | col.selec_text = 0x000000; |
232 | col.selec_text = 0x000000; |
234 | col.slider_bg_big = 0xCDCFCF; |
233 | col.slider_bg_big = 0xCDCFCF; |
235 | col.odd_line = 0xF4F5F5; |
234 | col.odd_line = 0xF4F5F5; |
236 | for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = blue_hl_pal[i]; |
235 | for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = blue_hl_pal[i]; |
237 | } |
236 | } |
238 | col.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65); |
237 | col.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65); |
239 | col.slider_bg_left = MixColors(sc.line, col.slider_bg_big, 10); |
238 | col.slider_bg_left = MixColors(sc.line, col.slider_bg_big, 10); |
240 | for (i=0; i<20; i++) col.work_gradient[i] = MixColors(sc.light, sc.work, i*5); |
239 | for (i=0; i<20; i++) col.work_gradient[i] = MixColors(sc.light, sc.work, i*5); |
241 | if (old_list_bg_color!=col.list_bg) LoadIcons(); |
240 | if (old_list_bg_color!=col.list_bg) LoadIcons(); |
242 | } |
241 | } |
243 | 242 | ||
244 | 243 | ||
245 | void BigFontsChange() |
244 | void BigFontsChange() |
246 | { |
245 | { |
247 | files.item_h = kfont.size.pt + 4; |
246 | files.item_h = kfont.size.pt + 4; |
248 | if (files.item_h |
247 | if (files.item_h |
249 | files.item_h = icon_size+3; |
248 | files.item_h = icon_size+3; |
250 | line_height.value = files.item_h; |
249 | line_height.value = files.item_h; |
251 | line_height.redraw(); |
250 | line_height.redraw(); |
252 | } |
251 | } |
253 | files_active.item_h = files_inactive.item_h = files.item_h; |
252 | files_active.item_h = files_inactive.item_h = files.item_h; |
254 | } |
253 | } |
255 | 254 | ||
256 | void BigIconsSwitch() |
255 | void BigIconsSwitch() |
257 | { |
256 | { |
258 | if (big_icons.checked) { |
257 | if (big_icons.checked) { |
259 | icon_size = 32; |
258 | icon_size = 32; |
260 | LoadIcons(); |
259 | LoadIcons(); |
261 | } else { |
260 | } else { |
262 | icon_size = icons16_default.w; |
261 | icon_size = icons16_default.w; |
263 | } |
262 | } |
264 | BigFontsChange(); |
263 | BigFontsChange(); |
265 | } |
264 | } |
266 | 265 | ||
267 | void SetDefaultPath(dword p) |
266 | void SetDefaultPath(dword p) |
268 | { |
267 | { |
269 | ini.SetString("DefaultPath", p, strlen(p)); |
268 | ini.SetString("DefaultPath", p, strlen(p)); |
270 | notify("'Default path has been set' -O"); |
269 | notify("'Default path has been set' -O"); |
271 | }20;>=2)>><> |
270 | }20;>=2)>><> |