Rev 7634 | Rev 7647 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7634 | Rev 7635 | ||
---|---|---|---|
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2019 |
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2019 |
2 | //GNU GPL license. |
2 | //GNU GPL license. |
3 | 3 | ||
4 | // 70.5 - get volume info and label |
4 | // 70.5 - get volume info and label |
5 | 5 | ||
6 | #ifndef AUTOBUILD |
6 | #ifndef AUTOBUILD |
7 | #include "lang.h--" |
7 | #include "lang.h--" |
8 | #endif |
8 | #endif |
9 | 9 | ||
10 | //libraries |
10 | //libraries |
11 | #define MEMSIZE 1024 * 720 |
11 | #define MEMSIZE 1024 * 720 |
12 | #include "../lib/clipboard.h" |
12 | #include "../lib/clipboard.h" |
13 | #include "../lib/strings.h" |
13 | #include "../lib/strings.h" |
14 | #include "../lib/mem.h" |
14 | #include "../lib/mem.h" |
15 | #include "../lib/fs.h" |
15 | #include "../lib/fs.h" |
16 | #include "../lib/gui.h" |
16 | #include "../lib/gui.h" |
17 | #include "../lib/list_box.h" |
17 | #include "../lib/list_box.h" |
18 | #include "../lib/random.h" |
18 | #include "../lib/random.h" |
19 | #include "../lib/kfont.h" |
19 | #include "../lib/kfont.h" |
20 | #include "../lib/collection.h" |
20 | #include "../lib/collection.h" |
21 | #include "../lib/copyf.h" |
21 | #include "../lib/copyf.h" |
22 | 22 | ||
23 | #include "../lib/obj/libini.h" |
23 | #include "../lib/obj/libini.h" |
24 | #include "../lib/obj/box_lib.h" |
24 | #include "../lib/obj/box_lib.h" |
25 | #include "../lib/obj/libimg.h" |
25 | #include "../lib/obj/libimg.h" |
26 | 26 | ||
27 | #include "../lib/patterns/history.h" |
27 | #include "../lib/patterns/history.h" |
28 | 28 | ||
29 | #include "imgs/images.h" |
29 | #include "imgs/images.h" |
30 | 30 | ||
31 | //Button IDs |
31 | //Button IDs |
32 | enum { |
32 | enum { |
33 | PATH_BTN = 10, |
33 | PATH_BTN = 10, |
34 | POPUP_BTN1 = 201, |
34 | POPUP_BTN1 = 201, |
35 | POPUP_BTN2 = 202, |
35 | POPUP_BTN2 = 202, |
36 | BREADCRUMB_ID = 300 |
36 | BREADCRUMB_ID = 300 |
37 | }; |
37 | }; |
38 | 38 | ||
39 | //NewElement options |
39 | //NewElement options |
40 | enum { |
40 | enum { |
41 | CREATE_FILE=1, |
41 | CREATE_FILE=1, |
42 | CREATE_FOLDER, |
42 | CREATE_FOLDER, |
43 | RENAME_ITEM |
43 | RENAME_ITEM |
44 | }; |
44 | }; |
45 | 45 | ||
46 | //OpenDir options |
46 | //OpenDir options |
47 | enum { |
47 | enum { |
48 | ONLY_SHOW, |
48 | ONLY_SHOW, |
49 | WITH_REDRAW, |
49 | WITH_REDRAW, |
50 | ONLY_OPEN |
50 | ONLY_OPEN |
51 | }; |
51 | }; |
52 | 52 | ||
53 | struct Eolite_colors |
53 | struct Eolite_colors |
54 | { |
54 | { |
55 | dword lpanel; |
55 | dword lpanel; |
56 | dword list_vert_line; //vertical line between columns in list |
56 | dword list_vert_line; //vertical line between columns in list |
57 | dword selec; |
57 | dword selec; |
58 | dword selec_active; |
58 | dword selec_active; |
59 | dword selec_inactive; |
59 | dword selec_inactive; |
60 | dword selec_text; |
60 | dword selec_text; |
61 | dword work; |
61 | dword work; |
62 | dword graph; |
62 | dword graph; |
63 | dword list_bg; |
63 | dword list_bg; |
64 | dword list_gb_text; |
64 | dword list_gb_text; |
65 | dword list_text_hidden; |
65 | dword list_text_hidden; |
66 | dword work_gradient[24]; |
66 | dword work_gradient[24]; |
67 | dword slider_bg_big; |
67 | dword slider_bg_big; |
68 | dword slider_bg_left; |
68 | dword slider_bg_left; |
69 | dword odd_line; |
69 | dword odd_line; |
70 | } col; |
70 | } col; |
71 | 71 | ||
72 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
72 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
73 | 73 | ||
74 | bool active_about = false; |
74 | bool active_about = false; |
75 | bool active_settings = false; |
75 | bool active_settings = false; |
76 | bool _not_draw = false; |
76 | bool _not_draw = false; |
77 | bool menu_call_mouse = false; |
77 | bool menu_call_mouse = false; |
78 | bool exif_load = false; |
78 | bool exif_load = false; |
79 | bool dir_at_fat16 = NULL; |
79 | bool dir_at_fat16 = NULL; |
80 | 80 | ||
81 | word about_thread_id; |
81 | word about_thread_id; |
82 | word settings_window; |
82 | word settings_window; |
83 | 83 | ||
84 | byte del_active=0; |
84 | byte del_active=0; |
85 | byte new_element_active=0; |
85 | byte new_element_active=0; |
86 | 86 | ||
87 | llist files, files_active, files_inactive; |
87 | llist files, files_active, files_inactive; |
88 | 88 | ||
89 | byte list_full_redraw; |
89 | byte list_full_redraw; |
90 | 90 | ||
91 | dword buf; |
91 | dword buf; |
92 | dword file_mas[6898]; |
92 | dword file_mas[6898]; |
93 | int selected_count; |
93 | int selected_count; |
94 | int count_dir; |
94 | int count_dir; |
95 | 95 | ||
96 | byte path[4096]; |
96 | byte path[4096]; |
97 | byte file_path[4096]; |
97 | byte file_path[4096]; |
98 | byte file_name[256]; |
98 | byte file_name[256]; |
99 | byte new_element_name[256]; |
99 | byte new_element_name[256]; |
100 | byte temp[4096]; |
100 | byte temp[4096]; |
101 | bool itdir; |
101 | bool itdir; |
102 | 102 | ||
103 | char active_path[4096], inactive_path[4096]; |
103 | char active_path[4096], inactive_path[4096]; |
104 | 104 | ||
105 | dword eolite_ini_path[4096]; |
105 | dword eolite_ini_path[4096]; |
106 | _ini ini; |
106 | _ini ini; |
107 | 107 | ||
108 | char scroll_used=false; |
108 | char scroll_used=false; |
109 | 109 | ||
110 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
110 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
111 | 111 | ||
112 | proc_info Form; |
112 | proc_info Form; |
113 | int sc_slider_h; |
113 | int sc_slider_h; |
114 | int action_buf; |
114 | int action_buf; |
115 | int rand_n; |
115 | int rand_n; |
116 | 116 | ||
117 | char sort_type=2; |
117 | char sort_type=2; |
118 | bool sort_desc=false; |
118 | bool sort_desc=false; |
119 | int active_panel=1; |
119 | int active_panel=1; |
120 | 120 | ||
121 | libimg_image icons16_default; |
121 | libimg_image icons16_default; |
122 | libimg_image icons16_selected; |
122 | libimg_image icons16_selected; |
123 | 123 | ||
124 | libimg_image icons32_default; |
124 | libimg_image icons32_default; |
125 | libimg_image icons32_selected; |
125 | libimg_image icons32_selected; |
126 | 126 | ||
127 | #define STATUS_BAR_H 16; |
127 | #define STATUS_BAR_H 16; |
128 | int status_bar_h = 0; |
128 | int status_bar_h = 0; |
129 | 129 | ||
130 | int icon_size = 16; |
130 | int icon_size = 16; |
131 | 131 | ||
132 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
132 | edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000, |
133 | 248,#new_element_name,0,100000000000010b,6,0}; |
133 | 248,#new_element_name,0,100000000000010b,6,0}; |
134 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
134 | PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
135 | byte cmd_free=0; |
135 | byte cmd_free=0; |
136 | #include "include\translations.h" |
136 | #include "include\translations.h" |
137 | 137 | ||
138 | #include "include\gui.h" |
138 | #include "include\gui.h" |
139 | #include "include\settings.h" |
139 | #include "include\settings.h" |
140 | #include "include\progress_dialog.h" |
140 | #include "include\progress_dialog.h" |
141 | #include "include\copy.h" |
141 | #include "include\copy.h" |
142 | #include "include\sorting.h" |
142 | #include "include\sorting.h" |
143 | #include "include\icons.h" |
143 | #include "include\icons.h" |
144 | #include "include\left_panel.h" |
144 | #include "include\left_panel.h" |
145 | #include "include\menu.h" |
145 | #include "include\menu.h" |
146 | #include "include\delete.h" |
146 | #include "include\delete.h" |
147 | #include "include\about.h" |
147 | #include "include\about.h" |
148 | #include "include\properties.h" |
148 | #include "include\properties.h" |
149 | #include "include\breadcrumbs.h" |
149 | #include "include\breadcrumbs.h" |
150 | 150 | ||
151 | void main() |
151 | void main() |
152 | { |
152 | { |
153 | dword id; |
153 | dword id; |
154 | byte count_sl = 0; |
154 | byte count_sl = 0; |
155 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
155 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
156 | char stats; |
156 | char stats; |
157 | rand_n = random(40); |
157 | rand_n = random(40); |
158 | 158 | ||
159 | load_dll(boxlib, #box_lib_init,0); |
159 | load_dll(boxlib, #box_lib_init,0); |
160 | load_dll(libini, #lib_init,1); |
160 | load_dll(libini, #lib_init,1); |
161 | load_dll(libio, #libio_init,1); |
161 | load_dll(libio, #libio_init,1); |
162 | load_dll(libimg, #libimg_init,1); |
162 | load_dll(libimg, #libimg_init,1); |
163 | 163 | ||
164 | SetAppColors(); |
164 | SetAppColors(); |
165 | LoadIniSettings(); |
165 | LoadIniSettings(); |
166 | SystemDiscs.Get(); |
166 | SystemDiscs.Get(); |
167 | - | ||
168 | Libimg_LoadImage(#icons16_default, "/sys/icons16.png"); |
- | |
169 | Libimg_LoadImage(#icons16_selected, "/sys/icons16.png"); |
- | |
170 | Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.selec); |
- | |
171 | Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.selec, 0, 200)); |
- | |
172 | if (col.list_bg!=0xFFFfff) { |
- | |
173 | Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.list_bg); |
- | |
174 | Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.list_bg, 0, 200)); |
- | |
175 | } |
- | |
176 | 167 | ||
177 | //-p just show file/folder properties dialog |
168 | //-p just show file/folder properties dialog |
178 | if (param) && (param[0]=='-') && (param[1]=='p') |
169 | if (param) && (param[0]=='-') && (param[1]=='p') |
179 | { |
170 | { |
180 | strcpy(#file_path, #param + 3); |
171 | strcpy(#file_path, #param + 3); |
181 | strcpy(#file_name, #param + strrchr(#param, '/')); |
172 | strcpy(#file_name, #param + strrchr(#param, '/')); |
182 | properties_dialog(); |
173 | properties_dialog(); |
183 | ExitProcess(); |
174 | ExitProcess(); |
184 | } |
175 | } |
185 | 176 | ||
186 | ESBYTE[0] = NULL; |
177 | ESBYTE[0] = NULL; |
187 | 178 | ||
188 | if (param) |
179 | if (param) |
189 | { |
180 | { |
190 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
181 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
191 | 182 | ||
192 | if (dir_exists(#param)==true) |
183 | if (dir_exists(#param)==true) |
193 | { |
184 | { |
194 | strcpy(#path, #param); |
185 | strcpy(#path, #param); |
195 | } |
186 | } |
196 | else |
187 | else |
197 | { |
188 | { |
198 | notify(T_NOTIFY_APP_PARAM_WRONG); |
189 | notify(T_NOTIFY_APP_PARAM_WRONG); |
199 | } |
190 | } |
200 | } |
191 | } |
201 | 192 | ||
202 | Open_Dir(#path,ONLY_OPEN); |
193 | Open_Dir(#path,ONLY_OPEN); |
203 | strcpy(#inactive_path, #path); |
194 | strcpy(#inactive_path, #path); |
204 | llist_copy(#files_inactive, #files); |
195 | llist_copy(#files_inactive, #files); |
205 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
196 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
206 | loop(){ |
197 | loop(){ |
207 | switch(WaitEventTimeout(50)) |
198 | switch(WaitEventTimeout(50)) |
208 | { |
199 | { |
209 | case evMouse: |
200 | case evMouse: |
210 | if (del_active) || (Form.status_window>2) break; |
201 | if (del_active) || (Form.status_window>2) break; |
211 | if (new_element_active) |
202 | if (new_element_active) |
212 | { |
203 | { |
213 | edit_box_mouse stdcall(#new_file_ed); |
204 | edit_box_mouse stdcall(#new_file_ed); |
214 | break; |
205 | break; |
215 | } |
206 | } |
216 | 207 | ||
217 | mouse.get(); |
208 | mouse.get(); |
218 | 209 | ||
219 | if (!mouse.mkm) && (stats>0) stats = 0; |
210 | if (!mouse.mkm) && (stats>0) stats = 0; |
220 | if (mouse.mkm) && (!stats) |
211 | if (mouse.mkm) && (!stats) |
221 | { |
212 | { |
222 | x_old = mouse.x; |
213 | x_old = mouse.x; |
223 | y_old = mouse.y; |
214 | y_old = mouse.y; |
224 | stats = 1; |
215 | stats = 1; |
225 | } |
216 | } |
226 | if (mouse.mkm) && (stats==1) |
217 | if (mouse.mkm) && (stats==1) |
227 | { |
218 | { |
228 | dif_x = mouse.x-x_old; |
219 | dif_x = mouse.x-x_old; |
229 | dif_y = mouse.y-y_old; |
220 | dif_y = mouse.y-y_old; |
230 | adif_x = fabs(dif_x); |
221 | adif_x = fabs(dif_x); |
231 | adif_y = fabs(dif_y); |
222 | adif_y = fabs(dif_y); |
232 | 223 | ||
233 | if (adif_x>adif_y) |
224 | if (adif_x>adif_y) |
234 | { |
225 | { |
235 | if (dif_x > 150) |
226 | if (dif_x > 150) |
236 | { |
227 | { |
237 | if (history.forward()) |
228 | if (history.forward()) |
238 | { |
229 | { |
239 | strcpy(#path, history.current()); |
230 | strcpy(#path, history.current()); |
240 | files.KeyHome(); |
231 | files.KeyHome(); |
241 | Open_Dir(#path,WITH_REDRAW); |
232 | Open_Dir(#path,WITH_REDRAW); |
242 | } |
233 | } |
243 | stats = 0; |
234 | stats = 0; |
244 | } |
235 | } |
245 | if (dif_x < -150) |
236 | if (dif_x < -150) |
246 | { |
237 | { |
247 | GoBack(); |
238 | GoBack(); |
248 | stats = 0; |
239 | stats = 0; |
249 | } |
240 | } |
250 | } |
241 | } |
251 | else |
242 | else |
252 | { |
243 | { |
253 | if (dif_y < -100) |
244 | if (dif_y < -100) |
254 | { |
245 | { |
255 | Dir_Up(); |
246 | Dir_Up(); |
256 | stats = 0; |
247 | stats = 0; |
257 | } |
248 | } |
258 | } |
249 | } |
259 | } |
250 | } |
260 | if (files.MouseOver(mouse.x, mouse.y)) |
251 | if (files.MouseOver(mouse.x, mouse.y)) |
261 | { |
252 | { |
262 | //select file |
253 | //select file |
263 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
254 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
264 | { |
255 | { |
265 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else { |
256 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else { |
266 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) Open(0); |
257 | if (mouse.y - files.y / files.item_h + files.first == files.cur_y) Open(0); |
267 | } |
258 | } |
268 | } |
259 | } |
269 | //file menu |
260 | //file menu |
270 | if (mouse.key&MOUSE_RIGHT) |
261 | if (mouse.key&MOUSE_RIGHT) |
271 | { |
262 | { |
272 | menu_call_mouse = 1; |
263 | menu_call_mouse = 1; |
273 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
264 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
274 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
265 | if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] |
275 | menu_stak = malloc(4096); |
266 | menu_stak = malloc(4096); |
276 | CreateThread(#FileMenu,menu_stak+4092); |
267 | CreateThread(#FileMenu,menu_stak+4092); |
277 | break; |
268 | break; |
278 | } |
269 | } |
279 | } |
270 | } |
280 | 271 | ||
281 | if (mouse.vert) |
272 | if (mouse.vert) |
282 | { |
273 | { |
283 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
274 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
284 | break; |
275 | break; |
285 | } |
276 | } |
286 | 277 | ||
287 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
278 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
288 | { |
279 | { |
289 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,system.color.work_dark,system.color.work_light); |
280 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,system.color.work_dark,system.color.work_light); |
290 | WHILE (mouse.lkm) && (files.first>0) |
281 | WHILE (mouse.lkm) && (files.first>0) |
291 | { |
282 | { |
292 | pause(8); |
283 | pause(8); |
293 | files.first--; |
284 | files.first--; |
294 | List_ReDraw(); |
285 | List_ReDraw(); |
295 | mouse.get(); |
286 | mouse.get(); |
296 | } |
287 | } |
297 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,system.color.work_light,system.color.work_dark); |
288 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,system.color.work_light,system.color.work_dark); |
298 | } |
289 | } |
299 | 290 | ||
300 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
291 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
301 | { |
292 | { |
302 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,system.color.work_dark,system.color.work_light); |
293 | if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,system.color.work_dark,system.color.work_light); |
303 | while (mouse.lkm) && (files.first |
294 | while (mouse.lkm) && (files.first |
304 | { |
295 | { |
305 | pause(8); |
296 | pause(8); |
306 | files.first++; |
297 | files.first++; |
307 | List_ReDraw(); |
298 | List_ReDraw(); |
308 | mouse.get(); |
299 | mouse.get(); |
309 | } |
300 | } |
310 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,system.color.work_light,system.color.work_dark); |
301 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,system.color.work_light,system.color.work_dark); |
311 | } |
302 | } |
312 | 303 | ||
313 | //Scrooll |
304 | //Scrooll |
314 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
305 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
315 | if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); } |
306 | if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); } |
316 | 307 | ||
317 | if (scroll_used) |
308 | if (scroll_used) |
318 | { |
309 | { |
319 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
310 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
320 | id = files.first; |
311 | id = files.first; |
321 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
312 | files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count; |
322 | files.first /= files.h - 18; |
313 | files.first /= files.h - 18; |
323 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
314 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
324 | if (files.first<0) files.first=0; |
315 | if (files.first<0) files.first=0; |
325 | if (id!=files.first) List_ReDraw(); |
316 | if (id!=files.first) List_ReDraw(); |
326 | break; |
317 | break; |
327 | } |
318 | } |
328 | 319 | ||
329 | if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) { |
320 | if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) { |
330 | if (mouse.x |
321 | if (mouse.x |
331 | { |
322 | { |
332 | if (active_panel!=1) |
323 | if (active_panel!=1) |
333 | { |
324 | { |
334 | active_panel = 1; |
325 | active_panel = 1; |
335 | ChangeActivePanel(); |
326 | ChangeActivePanel(); |
336 | } |
327 | } |
337 | } |
328 | } |
338 | else |
329 | else |
339 | { |
330 | { |
340 | if (active_panel!=2) |
331 | if (active_panel!=2) |
341 | { |
332 | { |
342 | active_panel = 2; |
333 | active_panel = 2; |
343 | ChangeActivePanel(); |
334 | ChangeActivePanel(); |
344 | } |
335 | } |
345 | } |
336 | } |
346 | } |
337 | } |
347 | break; |
338 | break; |
348 | //Button pressed----------------------------------------------------------------------------- |
339 | //Button pressed----------------------------------------------------------------------------- |
349 | case evButton: |
340 | case evButton: |
350 | id=GetButtonID(); |
341 | id=GetButtonID(); |
351 | 342 | ||
352 | if (new_element_active) || (del_active) { |
343 | if (new_element_active) || (del_active) { |
353 | if(POPUP_BTN1==id) || (POPUP_BTN2==id) { |
344 | if(POPUP_BTN1==id) || (POPUP_BTN2==id) { |
354 | if (del_active) Del_File(id-POPUP_BTN2); |
345 | if (del_active) Del_File(id-POPUP_BTN2); |
355 | if (new_element_active) NewElement(id-POPUP_BTN2); |
346 | if (new_element_active) NewElement(id-POPUP_BTN2); |
356 | DeleteButton(POPUP_BTN1); |
347 | DeleteButton(POPUP_BTN1); |
357 | DeleteButton(POPUP_BTN2); |
348 | DeleteButton(POPUP_BTN2); |
358 | } |
349 | } |
359 | break; |
350 | break; |
360 | } |
351 | } |
361 | 352 | ||
362 | switch(id) |
353 | switch(id) |
363 | { |
354 | { |
364 | case CLOSE_BTN: |
355 | case CLOSE_BTN: |
365 | KillProcess(about_thread_id); |
356 | KillProcess(about_thread_id); |
366 | SaveIniSettings(); |
357 | SaveIniSettings(); |
367 | ExitProcess(); |
358 | ExitProcess(); |
368 | case PATH_BTN: |
359 | case PATH_BTN: |
369 | notify(COPY_PATH_STR); |
360 | notify(COPY_PATH_STR); |
370 | Clipboard__CopyText(#path); |
361 | Clipboard__CopyText(#path); |
371 | break; |
362 | break; |
372 | case 21: //Back |
363 | case 21: //Back |
373 | GoBack(); |
364 | GoBack(); |
374 | break; |
365 | break; |
375 | case 22: //Forward |
366 | case 22: //Forward |
376 | if (history.forward()) |
367 | if (history.forward()) |
377 | { |
368 | { |
378 | strcpy(#path, history.current()); |
369 | strcpy(#path, history.current()); |
379 | files.KeyHome(); |
370 | files.KeyHome(); |
380 | Open_Dir(#path,WITH_REDRAW); |
371 | Open_Dir(#path,WITH_REDRAW); |
381 | } |
372 | } |
382 | break; |
373 | break; |
383 | case 23: |
374 | case 23: |
384 | Dir_Up(); |
375 | Dir_Up(); |
385 | break; |
376 | break; |
386 | case 24: |
377 | case 24: |
387 | Copy(#file_path, CUT); |
378 | Copy(#file_path, CUT); |
388 | break; |
379 | break; |
389 | case 25: |
380 | case 25: |
390 | Copy(#file_path, NOCUT); |
381 | Copy(#file_path, NOCUT); |
391 | break; |
382 | break; |
392 | case 26: |
383 | case 26: |
393 | Paste(); |
384 | Paste(); |
394 | break; |
385 | break; |
395 | case 31...33: |
386 | case 31...33: |
396 | EventSort(id-30); |
387 | EventSort(id-30); |
397 | break; |
388 | break; |
398 | case 50...60: //Actions |
389 | case 50...60: //Actions |
399 | FnProcess(id-50); |
390 | FnProcess(id-50); |
400 | break; |
391 | break; |
401 | case 61: // Set path as default |
392 | case 61: // Set path as default |
402 | SetDefaultPath(#path); |
393 | SetDefaultPath(#path); |
403 | break; |
394 | break; |
404 | case 100...120: |
395 | case 100...120: |
405 | SystemDiscs.Click(id-100); |
396 | SystemDiscs.Click(id-100); |
406 | break; |
397 | break; |
407 | case BREADCRUMB_ID...360: |
398 | case BREADCRUMB_ID...360: |
408 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
399 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
409 | break; |
400 | break; |
410 | } |
401 | } |
411 | break; |
402 | break; |
412 | 403 | ||
413 | //Key pressed----------------------------------------------------------------------------- |
404 | //Key pressed----------------------------------------------------------------------------- |
414 | case evKey: |
405 | case evKey: |
415 | GetKeys(); |
406 | GetKeys(); |
416 | 407 | ||
417 | if (Form.status_window>2) break; |
408 | if (Form.status_window>2) break; |
418 | 409 | ||
419 | if (new_element_active) || (del_active) |
410 | if (new_element_active) || (del_active) |
420 | { |
411 | { |
421 | if (del_active) |
412 | if (del_active) |
422 | { |
413 | { |
423 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
414 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
424 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
415 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
425 | } |
416 | } |
426 | if (new_element_active) |
417 | if (new_element_active) |
427 | { |
418 | { |
428 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
419 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
429 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
420 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
430 | EAX = key_editbox; |
421 | EAX = key_editbox; |
431 | edit_box_key stdcall (#new_file_ed); |
422 | edit_box_key stdcall (#new_file_ed); |
432 | } |
423 | } |
433 | break; |
424 | break; |
434 | } |
425 | } |
435 | 426 | ||
436 | if (files.ProcessKey(key_scancode)) |
427 | if (files.ProcessKey(key_scancode)) |
437 | { |
428 | { |
438 | List_ReDraw(); |
429 | List_ReDraw(); |
439 | break; |
430 | break; |
440 | } |
431 | } |
441 | 432 | ||
442 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
433 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
443 | { |
434 | { |
444 | switch(key_scancode) |
435 | switch(key_scancode) |
445 | { |
436 | { |
446 | case SCAN_CODE_F1...SCAN_CODE_F3: |
437 | case SCAN_CODE_F1...SCAN_CODE_F3: |
447 | EventSort(key_scancode - 58); |
438 | EventSort(key_scancode - 58); |
448 | break; |
439 | break; |
449 | case SCAN_CODE_1...SCAN_CODE_10: |
440 | case SCAN_CODE_1...SCAN_CODE_10: |
450 | key_scancode-=2; |
441 | key_scancode-=2; |
451 | if (key_scancode >= SystemDiscs.list.count) break; |
442 | if (key_scancode >= SystemDiscs.list.count) break; |
452 | if (!two_panels.checked) |
443 | if (!two_panels.checked) |
453 | { |
444 | { |
454 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
445 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
455 | pause(7); |
446 | pause(7); |
456 | } |
447 | } |
457 | SystemDiscs.Click(key_scancode); |
448 | SystemDiscs.Click(key_scancode); |
458 | break; |
449 | break; |
459 | case SCAN_CODE_KEY_X: |
450 | case SCAN_CODE_KEY_X: |
460 | Copy(#file_path, CUT); |
451 | Copy(#file_path, CUT); |
461 | break; |
452 | break; |
462 | case SCAN_CODE_KEY_C: |
453 | case SCAN_CODE_KEY_C: |
463 | Copy(#file_path, NOCUT); |
454 | Copy(#file_path, NOCUT); |
464 | break; |
455 | break; |
465 | case SCAN_CODE_KEY_V: |
456 | case SCAN_CODE_KEY_V: |
466 | Paste(); |
457 | Paste(); |
467 | break; |
458 | break; |
468 | case SCAN_CODE_KEY_D: //set image as bg |
459 | case SCAN_CODE_KEY_D: //set image as bg |
469 | strlcpy(#temp, "\\S__",4); |
460 | strlcpy(#temp, "\\S__",4); |
470 | strcat(#temp, #file_path); |
461 | strcat(#temp, #file_path); |
471 | RunProgram("/sys/media/kiv", #temp); |
462 | RunProgram("/sys/media/kiv", #temp); |
472 | break; |
463 | break; |
473 | case SCAN_CODE_KEY_N: //create new window |
464 | case SCAN_CODE_KEY_N: //create new window |
474 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
465 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
475 | RunProgram(I_Path, #path); |
466 | RunProgram(I_Path, #path); |
476 | break; |
467 | break; |
477 | case SCAN_CODE_KEY_M: |
468 | case SCAN_CODE_KEY_M: |
478 | Open_Dir(#inactive_path,WITH_REDRAW); |
469 | Open_Dir(#inactive_path,WITH_REDRAW); |
479 | break; |
470 | break; |
480 | case SCAN_CODE_ENTER: |
471 | case SCAN_CODE_ENTER: |
481 | if (!itdir) ShowOpenWithDialog(); |
472 | if (!itdir) ShowOpenWithDialog(); |
482 | else Open(1); |
473 | else Open(1); |
483 | break; |
474 | break; |
484 | case SCAN_CODE_KEY_A: |
475 | case SCAN_CODE_KEY_A: |
485 | EventSelectAllFiles(true); |
476 | EventSelectAllFiles(true); |
486 | break; |
477 | break; |
487 | case SCAN_CODE_KEY_U: //unselect all files |
478 | case SCAN_CODE_KEY_U: //unselect all files |
488 | selected_count = 0; |
479 | selected_count = 0; |
489 | EventSelectAllFiles(false); |
480 | EventSelectAllFiles(false); |
490 | break; |
481 | break; |
491 | } |
482 | } |
492 | break; |
483 | break; |
493 | } |
484 | } |
494 | 485 | ||
495 | switch (key_scancode) |
486 | switch (key_scancode) |
496 | { |
487 | { |
497 | case SCAN_CODE_BS: |
488 | case SCAN_CODE_BS: |
498 | //GoBack(); |
489 | //GoBack(); |
499 | Dir_Up(); |
490 | Dir_Up(); |
500 | break; |
491 | break; |
501 | case SCAN_CODE_ENTER: |
492 | case SCAN_CODE_ENTER: |
502 | Open(0); |
493 | Open(0); |
503 | break; |
494 | break; |
504 | case SCAN_CODE_TAB: |
495 | case SCAN_CODE_TAB: |
505 | if (!two_panels.checked) break; |
496 | if (!two_panels.checked) break; |
506 | if (active_panel==1) active_panel=2; else active_panel=1; |
497 | if (active_panel==1) active_panel=2; else active_panel=1; |
507 | ChangeActivePanel(); |
498 | ChangeActivePanel(); |
508 | DrawFilePanels(); |
499 | DrawFilePanels(); |
509 | break; |
500 | break; |
510 | case SCAN_CODE_MENU: |
501 | case SCAN_CODE_MENU: |
511 | menu_call_mouse=0; |
502 | menu_call_mouse=0; |
512 | menu_stak = malloc(4096); |
503 | menu_stak = malloc(4096); |
513 | CreateThread(#FileMenu,menu_stak+4092); |
504 | CreateThread(#FileMenu,menu_stak+4092); |
514 | break; |
505 | break; |
515 | case SCAN_CODE_DEL: |
506 | case SCAN_CODE_DEL: |
516 | Del_Form(); |
507 | Del_Form(); |
517 | break; |
508 | break; |
518 | case SCAN_CODE_INS: |
509 | case SCAN_CODE_INS: |
519 | if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false); |
510 | if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false); |
520 | else setElementSelectedFlag(files.cur_y, true); |
511 | else setElementSelectedFlag(files.cur_y, true); |
521 | files.KeyDown(); |
512 | files.KeyDown(); |
522 | List_ReDraw(); |
513 | List_ReDraw(); |
523 | DrawStatusBar(); |
514 | DrawStatusBar(); |
524 | break; |
515 | break; |
525 | case SCAN_CODE_F1...SCAN_CODE_F10: |
516 | case SCAN_CODE_F1...SCAN_CODE_F10: |
526 | FnProcess(key_scancode-58); |
517 | FnProcess(key_scancode-58); |
527 | break; |
518 | break; |
528 | default: |
519 | default: |
529 | EventSelectFileByKeyPress(); |
520 | EventSelectFileByKeyPress(); |
530 | } |
521 | } |
531 | break; |
522 | break; |
532 | case evIPC: |
523 | case evIPC: |
533 | case evReDraw: |
524 | case evReDraw: |
534 | draw_window(); |
525 | draw_window(); |
535 | if (action_buf) |
526 | if (action_buf) |
536 | { |
527 | { |
537 | if (action_buf==OPERATION_END) |
528 | if (action_buf==OPERATION_END) |
538 | { |
529 | { |
539 | FnProcess(5); |
530 | FnProcess(5); |
540 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
531 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
541 | } |
532 | } |
542 | if (action_buf==100) Open(0); |
533 | if (action_buf==100) Open(0); |
543 | if (action_buf==201) ShowOpenWithDialog(); |
534 | if (action_buf==201) ShowOpenWithDialog(); |
544 | if (action_buf==202) FnProcess(3); //F3 |
535 | if (action_buf==202) FnProcess(3); //F3 |
545 | if (action_buf==203) FnProcess(4); //F4 |
536 | if (action_buf==203) FnProcess(4); //F4 |
546 | if (action_buf==104) Copy(#file_path, NOCUT); |
537 | if (action_buf==104) Copy(#file_path, NOCUT); |
547 | if (action_buf==105) Copy(#file_path, CUT); |
538 | if (action_buf==105) Copy(#file_path, CUT); |
548 | if (action_buf==106) Paste(); |
539 | if (action_buf==106) Paste(); |
549 | if (action_buf==207) FnProcess(2); |
540 | if (action_buf==207) FnProcess(2); |
550 | if (action_buf==108) Del_Form(); |
541 | if (action_buf==108) Del_Form(); |
551 | if (action_buf==109) FnProcess(5); |
542 | if (action_buf==109) FnProcess(5); |
552 | if (action_buf==110) FnProcess(8); |
543 | if (action_buf==110) FnProcess(8); |
553 | action_buf=0; |
544 | action_buf=0; |
554 | } |
545 | } |
555 | break; |
546 | break; |
556 | default: |
547 | default: |
557 | if (Form.status_window>2) break; |
548 | if (Form.status_window>2) break; |
558 | EventRefreshDisksAndFolders(); |
549 | EventRefreshDisksAndFolders(); |
559 | } |
550 | } |
560 | 551 | ||
561 | if(cmd_free) |
552 | if(cmd_free) |
562 | { |
553 | { |
563 | if(cmd_free==1) menu_stak=free(menu_stak); |
554 | if(cmd_free==1) menu_stak=free(menu_stak); |
564 | else if(cmd_free==2) about_stak=free(about_stak); |
555 | else if(cmd_free==2) about_stak=free(about_stak); |
565 | else if(cmd_free==3) properties_stak=free(properties_stak); |
556 | else if(cmd_free==3) properties_stak=free(properties_stak); |
566 | else if(cmd_free==4) settings_stak=free(settings_stak); |
557 | else if(cmd_free==4) settings_stak=free(settings_stak); |
567 | else if(cmd_free==5) copy_stak=free(copy_stak); |
558 | else if(cmd_free==5) copy_stak=free(copy_stak); |
568 | else if(cmd_free==6) delete_stak=free(delete_stak); |
559 | else if(cmd_free==6) delete_stak=free(delete_stak); |
569 | cmd_free = false; |
560 | cmd_free = false; |
570 | } |
561 | } |
571 | } |
562 | } |
572 | } |
563 | } |
573 | 564 | ||
574 | void draw_window() |
565 | void draw_window() |
575 | { |
566 | { |
576 | dword i; |
567 | dword i; |
577 | if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
568 | if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0; |
578 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0); |
569 | DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0); |
579 | GetProcessInfo(#Form, SelfInfo); |
570 | GetProcessInfo(#Form, SelfInfo); |
580 | if (Form.status_window>2) return; |
571 | if (Form.status_window>2) return; |
581 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
572 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
582 | if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
573 | if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
583 | if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; } |
574 | if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; } |
584 | GetProcessInfo(#Form, SelfInfo); |
575 | GetProcessInfo(#Form, SelfInfo); |
- | 576 | SetAppColors(); |
|
585 | ESDWORD[#toolbar_pal] = col.work; |
577 | ESDWORD[#toolbar_pal] = col.work; |
586 | ESDWORD[#toolbar_pal+4] = MixColors(0, col.work, 35); |
578 | ESDWORD[#toolbar_pal+4] = MixColors(0, col.work, 35); |
587 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
579 | PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal); |
588 | DrawBar(127, 8, 1, 25, col.graph); |
580 | DrawBar(127, 8, 1, 25, col.graph); |
589 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i); |
581 | for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i); |
590 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i); |
582 | for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i); |
591 | DrawBar(246,0, Form.cwidth - 246, 34, col.work); |
583 | DrawBar(246,0, Form.cwidth - 246, 34, col.work); |
592 | DrawDot(Form.cwidth-17,12); |
584 | DrawDot(Form.cwidth-17,12); |
593 | DrawDot(Form.cwidth-17,12+6); |
585 | DrawDot(Form.cwidth-17,12+6); |
594 | DrawDot(Form.cwidth-17,12+12); |
586 | DrawDot(Form.cwidth-17,12+12); |
595 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
587 | DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots |
596 | //main rectangles |
588 | //main rectangles |
597 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col.graph); |
589 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col.graph); |
598 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
590 | DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg |
599 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col.work_gradient[11-i]); |
591 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col.work_gradient[11-i]); |
600 | llist_copy(#files_active, #files); |
592 | llist_copy(#files_active, #files); |
601 | strcpy(#active_path, #path); |
593 | strcpy(#active_path, #path); |
602 | DrawStatusBar(); |
594 | DrawStatusBar(); |
603 | if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
595 | if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] |
604 | DrawFilePanels(); |
596 | DrawFilePanels(); |
605 | } |
597 | } |
606 | 598 | ||
607 | void DrawList() |
599 | void DrawList() |
608 | { |
600 | { |
609 | word sorting_arrow_x; |
601 | word sorting_arrow_x; |
610 | dword sorting_arrow_t = "\x19"; |
602 | dword sorting_arrow_t = "\x19"; |
611 | if (sort_desc) sorting_arrow_t = "\x18"; |
603 | if (sort_desc) sorting_arrow_t = "\x18"; |
612 | DrawFlatButtonSmall(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
604 | DrawFlatButtonSmall(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
613 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
605 | DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
614 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
606 | DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
615 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
607 | DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
616 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
608 | DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
617 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
609 | if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
618 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
610 | if (sort_type==2) sorting_arrow_x = files.x + files.w - 90; |
619 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
611 | if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
620 | WriteText(sorting_arrow_x,files.y-12,0x80, system.color.work_text, sorting_arrow_t); |
612 | WriteText(sorting_arrow_x,files.y-12,0x80, system.color.work_text, sorting_arrow_t); |
621 | DrawBar(files.x+files.w,files.y,1,files.h,col.graph); |
613 | DrawBar(files.x+files.w,files.y,1,files.h,col.graph); |
622 | if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col.graph); |
614 | if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col.graph); |
623 | } |
615 | } |
624 | 616 | ||
625 | void DrawStatusBar() |
617 | void DrawStatusBar() |
626 | { |
618 | { |
627 | char status_bar_str[80]; |
619 | char status_bar_str[80]; |
628 | int go_up_folder_exists=0; |
620 | int go_up_folder_exists=0; |
629 | if (!show_status_bar.checked) return; |
621 | if (!show_status_bar.checked) return; |
630 | if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; |
622 | if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; |
631 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, system.color.work); |
623 | DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, system.color.work); |
632 | sprintf(#status_bar_str, STATUS_STR, files.count-go_up_folder_exists, count_dir-go_up_folder_exists, files.count-count_dir, selected_count); |
624 | sprintf(#status_bar_str, STATUS_STR, files.count-go_up_folder_exists, count_dir-go_up_folder_exists, files.count-count_dir, selected_count); |
633 | WriteText(6,Form.cheight - 13,0x80,system.color.work_text,#status_bar_str); |
625 | WriteText(6,Form.cheight - 13,0x80,system.color.work_text,#status_bar_str); |
634 | } |
626 | } |
635 | 627 | ||
636 | void DrawFilePanels() |
628 | void DrawFilePanels() |
637 | { |
629 | { |
638 | int files_y; |
630 | int files_y; |
639 | if (!two_panels.checked) |
631 | if (!two_panels.checked) |
640 | { |
632 | { |
641 | DrawDeviceAndActionsLeftPanel(); |
633 | DrawDeviceAndActionsLeftPanel(); |
642 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
634 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); |
643 | DrawList(); |
635 | DrawList(); |
644 | Open_Dir(#path,ONLY_SHOW); |
636 | Open_Dir(#path,ONLY_SHOW); |
645 | } |
637 | } |
646 | else |
638 | else |
647 | { |
639 | { |
648 | SystemDiscs.Get(); |
640 | SystemDiscs.Get(); |
649 | llist_copy(#files, #files_inactive); |
641 | llist_copy(#files, #files_inactive); |
650 | strcpy(#path, #inactive_path); |
642 | strcpy(#path, #inactive_path); |
651 | col.selec = col.selec_inactive; |
643 | col.selec = col.selec_inactive; |
652 | SystemDiscs.Draw(); |
644 | SystemDiscs.Draw(); |
653 | files_y = files.y; |
645 | files_y = files.y; |
654 | 646 | ||
655 | if (active_panel==1) |
647 | if (active_panel==1) |
656 | { |
648 | { |
657 | llist_copy(#files, #files_inactive); |
649 | llist_copy(#files, #files_inactive); |
658 | strcpy(#path, #inactive_path); |
650 | strcpy(#path, #inactive_path); |
659 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList(); |
651 | col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList(); |
660 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
652 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
661 | DrawList(); |
653 | DrawList(); |
662 | Open_Dir(#path,WITH_REDRAW); |
654 | Open_Dir(#path,WITH_REDRAW); |
663 | llist_copy(#files, #files_active); |
655 | llist_copy(#files, #files_active); |
664 | strcpy(#path, #active_path); |
656 | strcpy(#path, #active_path); |
665 | col.selec = col.selec_active; |
657 | col.selec = col.selec_active; |
666 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
658 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
667 | DrawList(); |
659 | DrawList(); |
668 | Open_Dir(#path,WITH_REDRAW); |
660 | Open_Dir(#path,WITH_REDRAW); |
669 | } |
661 | } |
670 | if (active_panel==2) |
662 | if (active_panel==2) |
671 | { |
663 | { |
672 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
664 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
673 | DrawList(); |
665 | DrawList(); |
674 | Open_Dir(#path,WITH_REDRAW); |
666 | Open_Dir(#path,WITH_REDRAW); |
675 | llist_copy(#files, #files_active); |
667 | llist_copy(#files, #files_active); |
676 | strcpy(#path, #active_path); |
668 | strcpy(#path, #active_path); |
677 | col.selec = col.selec_active; |
669 | col.selec = col.selec_active; |
678 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
670 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h); |
679 | DrawList(); |
671 | DrawList(); |
680 | Open_Dir(#path,WITH_REDRAW); |
672 | Open_Dir(#path,WITH_REDRAW); |
681 | } |
673 | } |
682 | } |
674 | } |
683 | } |
675 | } |
684 | 676 | ||
685 | 677 | ||
686 | void List_ReDraw() |
678 | void List_ReDraw() |
687 | { |
679 | { |
688 | int all_lines_h; |
680 | int all_lines_h; |
689 | dword j; |
681 | dword j; |
690 | static int old_cur_y, old_first; |
682 | static int old_cur_y, old_first; |
691 | 683 | ||
692 | files.CheckDoesValuesOkey(); //prevent some shit |
684 | files.CheckDoesValuesOkey(); //prevent some shit |
693 | 685 | ||
694 | if (list_full_redraw) || (old_first != files.first) |
686 | if (list_full_redraw) || (old_first != files.first) |
695 | { |
687 | { |
696 | old_cur_y = files.cur_y; |
688 | old_cur_y = files.cur_y; |
697 | old_first = files.first; |
689 | old_first = files.first; |
698 | list_full_redraw = false; |
690 | list_full_redraw = false; |
699 | goto _ALL_LIST_REDRAW; |
691 | goto _ALL_LIST_REDRAW; |
700 | } |
692 | } |
701 | if (old_cur_y != files.cur_y) |
693 | if (old_cur_y != files.cur_y) |
702 | { |
694 | { |
703 | if (old_cur_y-files.first |
695 | if (old_cur_y-files.first |
704 | Line_ReDraw(col.selec, files.cur_y-files.first); |
696 | Line_ReDraw(col.selec, files.cur_y-files.first); |
705 | old_cur_y = files.cur_y; |
697 | old_cur_y = files.cur_y; |
706 | return; |
698 | return; |
707 | } |
699 | } |
708 | 700 | ||
709 | _ALL_LIST_REDRAW: |
701 | _ALL_LIST_REDRAW: |
710 | 702 | ||
711 | for (j=0; j |
703 | for (j=0; j |
712 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
704 | if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); |
713 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
705 | else Line_ReDraw(col.selec, files.cur_y-files.first); |
714 | } |
706 | } |
715 | //in the bottom |
707 | //in the bottom |
716 | all_lines_h = j * files.item_h; |
708 | all_lines_h = j * files.item_h; |
717 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
709 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg); |
718 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
710 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
719 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
711 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line); |
720 | Scroll(); |
712 | Scroll(); |
721 | 713 | ||
722 | if (del_active) Del_Form(); |
714 | if (del_active) Del_Form(); |
723 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
715 | if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name); |
724 | } |
716 | } |
725 | 717 | ||
726 | bool file_name_is_8_3(dword name) |
718 | bool file_name_is_8_3(dword name) |
727 | { |
719 | { |
728 | int name_len = strlen(name); |
720 | int name_len = strlen(name); |
729 | int dot_pos = strrchr(name, '.'); |
721 | int dot_pos = strrchr(name, '.'); |
730 | if (name_len<=12) |
722 | if (name_len<=12) |
731 | { |
723 | { |
732 | if (dot_pos) { |
724 | if (dot_pos) { |
733 | if (name_len - dot_pos > 3) return false; |
725 | if (name_len - dot_pos > 3) return false; |
734 | } |
726 | } |
735 | else { |
727 | else { |
736 | if (name_len>8) return false; |
728 | if (name_len>8) return false; |
737 | } |
729 | } |
738 | return true; |
730 | return true; |
739 | } |
731 | } |
740 | return false; |
732 | return false; |
741 | } |
733 | } |
742 | 734 | ||
743 | void Line_ReDraw(dword bgcol, filenum){ |
735 | void Line_ReDraw(dword bgcol, filenum){ |
744 | dword text_col=col.list_gb_text, |
736 | dword text_col=col.list_gb_text, |
745 | ext1, attr, |
737 | ext1, attr, |
746 | file_offet, |
738 | file_offet, |
747 | file_name_off, |
739 | file_name_off, |
748 | file_size=0, |
740 | file_size=0, |
749 | y=filenum*files.item_h+files.y, |
741 | y=filenum*files.item_h+files.y, |
750 | icon_y = files.item_h-icon_size/2+1+y; |
742 | icon_y = files.item_h-icon_size/2+1+y; |
751 | BDVK file; |
743 | BDVK file; |
752 | char temp_path[sizeof(file_path)]; |
744 | char temp_path[sizeof(file_path)]; |
753 | char label_file_name[4096]; |
745 | char label_file_name[4096]; |
754 | if (filenum==-1) return; |
746 | if (filenum==-1) return; |
755 | DrawBar(files.x,y,4,files.item_h,bgcol); |
747 | DrawBar(files.x,y,4,files.item_h,bgcol); |
756 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
748 | DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol); |
757 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol); |
749 | if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol); |
758 | if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
750 | if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; |
759 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
751 | DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); |
760 | 752 | ||
761 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
753 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
762 | attr = ESDWORD[file_offet]; |
754 | attr = ESDWORD[file_offet]; |
763 | file.selected = ESBYTE[file_offet+7]; |
755 | file.selected = ESBYTE[file_offet+7]; |
764 | file.sizelo = ESDWORD[file_offet+32]; |
756 | file.sizelo = ESDWORD[file_offet+32]; |
765 | file.sizehi = ESDWORD[file_offet+36]; |
757 | file.sizehi = ESDWORD[file_offet+36]; |
766 | file_name_off = file_offet+40; |
758 | file_name_off = file_offet+40; |
767 | sprintf(#temp_path,"%s/%s",#path,file_name_off); |
759 | sprintf(#temp_path,"%s/%s",#path,file_name_off); |
768 | 760 | ||
769 | if (! TestBit(attr, 4) ) //file or folder? |
761 | if (! TestBit(attr, 4) ) //file or folder? |
770 | { |
762 | { |
771 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
763 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
772 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
764 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
773 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
765 | file_size = ConvertSize64(file.sizelo, file.sizehi); |
774 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
766 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
775 | } |
767 | } |
776 | else |
768 | else |
777 | { |
769 | { |
778 | if (!strcmp(file_name_off,"..")) ext1=" |
770 | if (!strcmp(file_name_off,"..")) ext1=" |
779 | ext1=" |
771 | ext1=" |
780 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
772 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1); |
781 | } |
773 | } |
782 | if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path); |
774 | if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path); |
783 | } |
775 | } |
784 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
776 | if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, |
785 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
777 | files.text_y+y+1, files.font_type, col.list_gb_text, file_size); |
786 | DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol); |
778 | DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol); |
787 | 779 | ||
788 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
780 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden? |
789 | if (bgcol==col.selec) |
781 | if (bgcol==col.selec) |
790 | { |
782 | { |
791 | file_name_is_8_3(file_name_off); |
783 | file_name_is_8_3(file_name_off); |
792 | itdir = TestBit(attr, 4); |
784 | itdir = TestBit(attr, 4); |
793 | strcpy(#file_name, file_name_off); |
785 | strcpy(#file_name, file_name_off); |
794 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
786 | if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off); |
795 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
787 | else sprintf(#file_path,"%s/%s",#path,file_name_off); |
796 | if (text_col==col.list_text_hidden) { |
788 | if (text_col==col.list_text_hidden) { |
797 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
789 | text_col=MixColors(col.selec_text, col.list_text_hidden, 65); |
798 | } else text_col=col.selec_text; |
790 | } else text_col=col.selec_text; |
799 | } |
791 | } |
800 | if (file.selected) text_col=0xFF0000; |
792 | if (file.selected) text_col=0xFF0000; |
801 | if (kfont.size.pt==9) || (!kfont.font) |
793 | if (kfont.size.pt==9) || (!kfont.font) |
802 | { |
794 | { |
803 | if (Form.width>=480) |
795 | if (Form.width>=480) |
804 | { |
796 | { |
805 | FileShow.start_x = files.x + 23; |
797 | FileShow.start_x = files.x + 23; |
806 | FileShow.font_color = text_col; |
798 | FileShow.font_color = text_col; |
807 | FileShow.area_size_x = files.w - 164; |
799 | FileShow.area_size_x = files.w - 164; |
808 | FileShow.text_pointer = file_name_off; |
800 | FileShow.text_pointer = file_name_off; |
809 | FileShow.start_y = files.text_y + y - 3; |
801 | FileShow.start_y = files.text_y + y - 3; |
810 | PathShow_prepare stdcall(#FileShow); |
802 | PathShow_prepare stdcall(#FileShow); |
811 | PathShow_draw stdcall(#FileShow); |
803 | PathShow_draw stdcall(#FileShow); |
812 | } |
804 | } |
813 | } |
805 | } |
814 | else |
806 | else |
815 | { |
807 | { |
816 | strcpy(#label_file_name, file_name_off); |
808 | strcpy(#label_file_name, file_name_off); |
817 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
809 | if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) |
818 | { |
810 | { |
819 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
811 | while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) { |
820 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
812 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
821 | } |
813 | } |
822 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
814 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
823 | } |
815 | } |
824 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
816 | kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, |
825 | bgcol, text_col, kfont.size.pt, #label_file_name); |
817 | bgcol, text_col, kfont.size.pt, #label_file_name); |
826 | } |
818 | } |
827 | DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1 |
819 | DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1 |
828 | DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2 |
820 | DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2 |
829 | } |
821 | } |
830 | 822 | ||
831 | 823 | ||
832 | void Open_Dir(dword dir_path, redraw){ |
824 | void Open_Dir(dword dir_path, redraw){ |
833 | int errornum, maxcount, i; |
825 | int errornum, maxcount, i; |
834 | if (redraw!=ONLY_SHOW) |
826 | if (redraw!=ONLY_SHOW) |
835 | { |
827 | { |
836 | selected_count = 0; |
828 | selected_count = 0; |
837 | if (buf) free(buf); |
829 | if (buf) free(buf); |
838 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
830 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
839 | if (errornum) |
831 | if (errornum) |
840 | { |
832 | { |
841 | history.add(#path); |
833 | history.add(#path); |
842 | GoBack(); |
834 | GoBack(); |
843 | Write_Error(errornum); |
835 | Write_Error(errornum); |
844 | return; |
836 | return; |
845 | } |
837 | } |
846 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
838 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
847 | if (files.count>maxcount) files.count = maxcount; |
839 | if (files.count>maxcount) files.count = maxcount; |
848 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
840 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
849 | } |
841 | } |
850 | if (files.count!=-1) |
842 | if (files.count!=-1) |
851 | { |
843 | { |
852 | if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar(); |
844 | if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar(); |
853 | history.add(#path); |
845 | history.add(#path); |
854 | SystemDiscs.Draw(); |
846 | SystemDiscs.Draw(); |
855 | files.visible = files.h / files.item_h; |
847 | files.visible = files.h / files.item_h; |
856 | if (files.count < files.visible) files.visible = files.count; |
848 | if (files.count < files.visible) files.visible = files.count; |
857 | if (!strncmp(dir_path, "/rd/1/",5)) |
849 | if (!strncmp(dir_path, "/rd/1/",5)) |
858 | dir_at_fat16 = true; else dir_at_fat16 = false; |
850 | dir_at_fat16 = true; else dir_at_fat16 = false; |
859 | if (redraw!=ONLY_SHOW) Sorting(); |
851 | if (redraw!=ONLY_SHOW) Sorting(); |
860 | list_full_redraw = true; |
852 | list_full_redraw = true; |
861 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
853 | if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();} |
862 | SetCurDir(dir_path); |
854 | SetCurDir(dir_path); |
863 | } |
855 | } |
864 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
856 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
865 | { |
857 | { |
866 | files.KeyHome(); |
858 | files.KeyHome(); |
867 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
859 | if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); } |
868 | } |
860 | } |
869 | } |
861 | } |
870 | 862 | ||
871 | inline Sorting() |
863 | inline Sorting() |
872 | { |
864 | { |
873 | dword d=0, f=1; |
865 | dword d=0, f=1; |
874 | int j=0; |
866 | int j=0; |
875 | dword file_off; |
867 | dword file_off; |
876 | 868 | ||
877 | if (!strcmp(#path,"/")) //do not sort root folder |
869 | if (!strcmp(#path,"/")) //do not sort root folder |
878 | { |
870 | { |
879 | for(d=1;d |
871 | for(d=1;d |
880 | count_dir = d; |
872 | count_dir = d; |
881 | return; |
873 | return; |
882 | } |
874 | } |
883 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
875 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
884 | { |
876 | { |
885 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
877 | if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); |
886 | if (TestBit(ESDWORD[file_off],4)) //directory? |
878 | if (TestBit(ESDWORD[file_off],4)) //directory? |
887 | { |
879 | { |
888 | file_mas[d]=j; |
880 | file_mas[d]=j; |
889 | d++; |
881 | d++; |
890 | } |
882 | } |
891 | else |
883 | else |
892 | { |
884 | { |
893 | file_mas[files.count-f]=j; |
885 | file_mas[files.count-f]=j; |
894 | f++; |
886 | f++; |
895 | } |
887 | } |
896 | } |
888 | } |
897 | count_dir = d; |
889 | count_dir = d; |
898 | //sorting: files first, then folders |
890 | //sorting: files first, then folders |
899 | Sort_by_Name(0,d-1); |
891 | Sort_by_Name(0,d-1); |
900 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
892 | if (sort_type==1) Sort_by_Name(d,files.count-1); |
901 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
893 | else if (sort_type==2) Sort_by_Type(d,files.count-1); |
902 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
894 | else if (sort_type==3) Sort_by_Size(d,files.count-1); |
903 | //reversed sorting |
895 | //reversed sorting |
904 | if (sort_desc) { |
896 | if (sort_desc) { |
905 | for (j=0; j |
897 | for (j=0; j |
906 | //if (sort_type==1) for (j=0; j |
898 | //if (sort_type==1) for (j=0; j |
907 | } |
899 | } |
908 | //make ".." first item in list |
900 | //make ".." first item in list |
909 | if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
901 | if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
910 | for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]> |
902 | for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]> |
911 | } |
903 | } |
912 | 904 | ||
913 | 905 | ||
914 | void Del_Form() |
906 | void Del_Form() |
915 | { |
907 | { |
916 | byte f_count[128]; |
908 | byte f_count[128]; |
917 | int dform_x = files.w - 220 / 2 + files.x; |
909 | int dform_x = files.w - 220 / 2 + files.x; |
918 | if (selected_count==0) && (!strncmp(#file_name,"..",2)) return; |
910 | if (selected_count==0) && (!strncmp(#file_name,"..",2)) return; |
919 | else |
911 | else |
920 | { |
912 | { |
921 | if (!files.count) return; |
913 | if (!files.count) return; |
922 | DrawEolitePopup(T_YES, T_NO); |
914 | DrawEolitePopup(T_YES, T_NO); |
923 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
915 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
924 | if (selected_count) |
916 | if (selected_count) |
925 | { |
917 | { |
926 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
918 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
927 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
919 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
928 | } |
920 | } |
929 | else |
921 | else |
930 | { |
922 | { |
931 | if (strlen(#file_name)<28) |
923 | if (strlen(#file_name)<28) |
932 | { |
924 | { |
933 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?"); |
925 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?"); |
934 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name); |
926 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name); |
935 | } |
927 | } |
936 | else |
928 | else |
937 | { |
929 | { |
938 | WriteText(164+dform_x,190,0x80,0,"...?"); |
930 | WriteText(164+dform_x,190,0x80,0,"...?"); |
939 | ESI = 24; |
931 | ESI = 24; |
940 | WriteText(dform_x+20,190,0,0,#file_name); |
932 | WriteText(dform_x+20,190,0,0,#file_name); |
941 | } |
933 | } |
942 | } |
934 | } |
943 | del_active=1; |
935 | del_active=1; |
944 | } |
936 | } |
945 | } |
937 | } |
946 | 938 | ||
947 | void SelectFileByName(dword that_file) |
939 | void SelectFileByName(dword that_file) |
948 | { |
940 | { |
949 | int ind; |
941 | int ind; |
950 | files.KeyHome(); |
942 | files.KeyHome(); |
951 | Open_Dir(#path,ONLY_OPEN); |
943 | Open_Dir(#path,ONLY_OPEN); |
952 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
944 | if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); |
953 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
945 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
954 | files.cur_y = ind - 1; |
946 | files.cur_y = ind - 1; |
955 | files.KeyDown(); |
947 | files.KeyDown(); |
956 | DrawStatusBar(); |
948 | DrawStatusBar(); |
957 | List_ReDraw(); |
949 | List_ReDraw(); |
958 | } |
950 | } |
959 | 951 | ||
960 | 952 | ||
961 | void Dir_Up() |
953 | void Dir_Up() |
962 | { |
954 | { |
963 | int iii; |
955 | int iii; |
964 | char old_folder_name[4096]; |
956 | char old_folder_name[4096]; |
965 | iii=strlen(#path)-1; |
957 | iii=strlen(#path)-1; |
966 | if (iii==0) return; |
958 | if (iii==0) return; |
967 | iii = strrchr(#path, '/'); |
959 | iii = strrchr(#path, '/'); |
968 | strcpy(#old_folder_name, #path+iii); |
960 | strcpy(#old_folder_name, #path+iii); |
969 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
961 | if (iii>1) path[iii-1]=NULL; else path[iii]=NULL; |
970 | SelectFileByName(#old_folder_name); |
962 | SelectFileByName(#old_folder_name); |
971 | } |
963 | } |
972 | 964 | ||
973 | void Open(byte rez) |
965 | void Open(byte rez) |
974 | { |
966 | { |
975 | byte temp[4096]; |
967 | byte temp[4096]; |
976 | selected_count = 0; |
968 | selected_count = 0; |
977 | if (rez) |
969 | if (rez) |
978 | { |
970 | { |
979 | if (!strncmp(#file_name,"..",3)) return; |
971 | if (!strncmp(#file_name,"..",3)) return; |
980 | strcpy(#temp, #file_path); |
972 | strcpy(#temp, #file_path); |
981 | RunProgram(I_Path, #temp); |
973 | RunProgram(I_Path, #temp); |
982 | return; |
974 | return; |
983 | } |
975 | } |
984 | if (!files.count) return; |
976 | if (!files.count) return; |
985 | if (!itdir) |
977 | if (!itdir) |
986 | { |
978 | { |
987 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
979 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
988 | } |
980 | } |
989 | else |
981 | else |
990 | { |
982 | { |
991 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
983 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
992 | strcpy(#path, #file_path); |
984 | strcpy(#path, #file_path); |
993 | files.first=files.cur_y=0; |
985 | files.first=files.cur_y=0; |
994 | Open_Dir(#path,WITH_REDRAW); |
986 | Open_Dir(#path,WITH_REDRAW); |
995 | } |
987 | } |
996 | } |
988 | } |
997 | 989 | ||
998 | inline fastcall void GoBack() |
990 | inline fastcall void GoBack() |
999 | { |
991 | { |
1000 | char cur_folder[4096]; |
992 | char cur_folder[4096]; |
1001 | strcpy(#cur_folder, #path); |
993 | strcpy(#cur_folder, #path); |
1002 | if (history.back()) { |
994 | if (history.back()) { |
1003 | strcpy(#path, history.current()); |
995 | strcpy(#path, history.current()); |
1004 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
996 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
1005 | } |
997 | } |
1006 | } |
998 | } |
1007 | 999 | ||
1008 | void ShowOpenWithDialog() |
1000 | void ShowOpenWithDialog() |
1009 | { |
1001 | { |
1010 | byte open_param[4097]; |
1002 | byte open_param[4097]; |
1011 | sprintf(#open_param,"~%s",#file_path); |
1003 | sprintf(#open_param,"~%s",#file_path); |
1012 | RunProgram("/sys/@open", #open_param); |
1004 | RunProgram("/sys/@open", #open_param); |
1013 | } |
1005 | } |
1014 | 1006 | ||
1015 | void NewElement(byte newf) |
1007 | void NewElement(byte newf) |
1016 | { |
1008 | { |
1017 | BDVK element_info; |
1009 | BDVK element_info; |
1018 | byte del_rezult, copy_rezult, info_result; |
1010 | byte del_rezult, copy_rezult, info_result; |
1019 | if (newf) |
1011 | if (newf) |
1020 | { |
1012 | { |
1021 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
1013 | sprintf(#temp,"%s/%s",#path,new_file_ed.text); |
1022 | info_result = GetFileInfo(#temp, #element_info); |
1014 | info_result = GetFileInfo(#temp, #element_info); |
1023 | switch(new_element_active) |
1015 | switch(new_element_active) |
1024 | { |
1016 | { |
1025 | case CREATE_FILE: |
1017 | case CREATE_FILE: |
1026 | if (info_result==5) |
1018 | if (info_result==5) |
1027 | { |
1019 | { |
1028 | CreateFile(0, 0, #temp); |
1020 | CreateFile(0, 0, #temp); |
1029 | if (EAX) |
1021 | if (EAX) |
1030 | { |
1022 | { |
1031 | if (EAX==5) notify(NOT_CREATE_FILE); |
1023 | if (EAX==5) notify(NOT_CREATE_FILE); |
1032 | else Write_Error(EAX); |
1024 | else Write_Error(EAX); |
1033 | } |
1025 | } |
1034 | } |
1026 | } |
1035 | else |
1027 | else |
1036 | { |
1028 | { |
1037 | notify(FS_ITEM_ALREADY_EXISTS); |
1029 | notify(FS_ITEM_ALREADY_EXISTS); |
1038 | } |
1030 | } |
1039 | break; |
1031 | break; |
1040 | case CREATE_FOLDER: |
1032 | case CREATE_FOLDER: |
1041 | if (info_result==5) |
1033 | if (info_result==5) |
1042 | { |
1034 | { |
1043 | CreateDir(#temp); |
1035 | CreateDir(#temp); |
1044 | if (EAX) |
1036 | if (EAX) |
1045 | { |
1037 | { |
1046 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
1038 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
1047 | else Write_Error(EAX); |
1039 | else Write_Error(EAX); |
1048 | } |
1040 | } |
1049 | } |
1041 | } |
1050 | else |
1042 | else |
1051 | { |
1043 | { |
1052 | notify(FS_ITEM_ALREADY_EXISTS); |
1044 | notify(FS_ITEM_ALREADY_EXISTS); |
1053 | } |
1045 | } |
1054 | break; |
1046 | break; |
1055 | case RENAME_ITEM: |
1047 | case RENAME_ITEM: |
1056 | if (info_result==5) |
1048 | if (info_result==5) |
1057 | { |
1049 | { |
1058 | if (itdir) |
1050 | if (itdir) |
1059 | { |
1051 | { |
1060 | //rename only empty folders |
1052 | //rename only empty folders |
1061 | if (del_rezult = DeleteFile(#file_path)) |
1053 | if (del_rezult = DeleteFile(#file_path)) |
1062 | { |
1054 | { |
1063 | Write_Error(del_rezult); |
1055 | Write_Error(del_rezult); |
1064 | return; |
1056 | return; |
1065 | } |
1057 | } |
1066 | if (CreateDir(#temp)) CreateDir(#file_path); |
1058 | if (CreateDir(#temp)) CreateDir(#file_path); |
1067 | Open_Dir(#path,WITH_REDRAW); |
1059 | Open_Dir(#path,WITH_REDRAW); |
1068 | SelectFileByName(new_file_ed.text); |
1060 | SelectFileByName(new_file_ed.text); |
1069 | } |
1061 | } |
1070 | else |
1062 | else |
1071 | { |
1063 | { |
1072 | if (copy_rezult = CopyFile(#file_path,#temp)) |
1064 | if (copy_rezult = CopyFile(#file_path,#temp)) |
1073 | { |
1065 | { |
1074 | Write_Error(copy_rezult); |
1066 | Write_Error(copy_rezult); |
1075 | } |
1067 | } |
1076 | else |
1068 | else |
1077 | { |
1069 | { |
1078 | DeleteFile(#file_path); |
1070 | DeleteFile(#file_path); |
1079 | SelectFileByName(new_file_ed.text); |
1071 | SelectFileByName(new_file_ed.text); |
1080 | } |
1072 | } |
1081 | } |
1073 | } |
1082 | } |
1074 | } |
1083 | else |
1075 | else |
1084 | { |
1076 | { |
1085 | notify(FS_ITEM_ALREADY_EXISTS); |
1077 | notify(FS_ITEM_ALREADY_EXISTS); |
1086 | } |
1078 | } |
1087 | } |
1079 | } |
1088 | new_element_active = 0; |
1080 | new_element_active = 0; |
1089 | Open_Dir(#path,WITH_REDRAW); |
1081 | Open_Dir(#path,WITH_REDRAW); |
1090 | SelectFileByName(new_file_ed.text); |
1082 | SelectFileByName(new_file_ed.text); |
1091 | } |
1083 | } |
1092 | new_element_active = 0; |
1084 | new_element_active = 0; |
1093 | Open_Dir(#path,WITH_REDRAW); |
1085 | Open_Dir(#path,WITH_REDRAW); |
1094 | } |
1086 | } |
1095 | 1087 | ||
1096 | void NewElement_Form(byte crt, dword strng) |
1088 | void NewElement_Form(byte crt, dword strng) |
1097 | { |
1089 | { |
1098 | int dform_x=files.w-220/2+files.x; |
1090 | int dform_x=files.w-220/2+files.x; |
1099 | if (!new_element_active) |
1091 | if (!new_element_active) |
1100 | { |
1092 | { |
1101 | new_element_active = crt; |
1093 | new_element_active = crt; |
1102 | strcpy(#new_element_name, strng); |
1094 | strcpy(#new_element_name, strng); |
1103 | EditBox_UpdateText(#new_file_ed, ed_focus+ed_always_focus); |
1095 | EditBox_UpdateText(#new_file_ed, ed_focus+ed_always_focus); |
1104 | } |
1096 | } |
1105 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1097 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1106 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1098 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1107 | new_file_ed.left = dform_x+10; |
1099 | new_file_ed.left = dform_x+10; |
1108 | DrawEditBox(#new_file_ed); |
1100 | DrawEditBox(#new_file_ed); |
1109 | } |
1101 | } |
1110 | 1102 | ||
1111 | void FnProcess(byte N) |
1103 | void FnProcess(byte N) |
1112 | { |
1104 | { |
1113 | switch(N) |
1105 | switch(N) |
1114 | { |
1106 | { |
1115 | case 1: |
1107 | case 1: |
1116 | if (!active_about) |
1108 | if (!active_about) |
1117 | { |
1109 | { |
1118 | about_stak = malloc(4096); |
1110 | about_stak = malloc(4096); |
1119 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1111 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1120 | break; |
1112 | break; |
1121 | } |
1113 | } |
1122 | else |
1114 | else |
1123 | { |
1115 | { |
1124 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1116 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1125 | } |
1117 | } |
1126 | break; |
1118 | break; |
1127 | case 2: |
1119 | case 2: |
1128 | if (!files.count) break; |
1120 | if (!files.count) break; |
1129 | NewElement_Form(RENAME_ITEM, #file_name); |
1121 | NewElement_Form(RENAME_ITEM, #file_name); |
1130 | break; |
1122 | break; |
1131 | case 3: |
1123 | case 3: |
1132 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
1124 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
1133 | break; |
1125 | break; |
1134 | case 4: |
1126 | case 4: |
1135 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1127 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1136 | break; |
1128 | break; |
1137 | case 5: //refresh cur dir & devs |
1129 | case 5: //refresh cur dir & devs |
1138 | if (two_panels.checked) |
1130 | if (two_panels.checked) |
1139 | { |
1131 | { |
1140 | DrawFilePanels(); |
1132 | DrawFilePanels(); |
1141 | } |
1133 | } |
1142 | else |
1134 | else |
1143 | { |
1135 | { |
1144 | Tip(56, T_DEVICES, 55, "-"); |
1136 | Tip(56, T_DEVICES, 55, "-"); |
1145 | Open_Dir(#path,WITH_REDRAW); |
1137 | Open_Dir(#path,WITH_REDRAW); |
1146 | pause(10); |
1138 | pause(10); |
1147 | SystemDiscs.Get(); |
1139 | SystemDiscs.Get(); |
1148 | Open_Dir(#path,WITH_REDRAW); |
1140 | Open_Dir(#path,WITH_REDRAW); |
1149 | DrawDeviceAndActionsLeftPanel(); |
1141 | DrawDeviceAndActionsLeftPanel(); |
1150 | } |
1142 | } |
1151 | break; |
1143 | break; |
1152 | case 6: |
1144 | case 6: |
1153 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1145 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1154 | break; |
1146 | break; |
1155 | case 7: |
1147 | case 7: |
1156 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1148 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1157 | break; |
1149 | break; |
1158 | case 8: |
1150 | case 8: |
1159 | properties_stak = malloc(8096); |
1151 | properties_stak = malloc(8096); |
1160 | CreateThread(#properties_dialog, properties_stak+8092); |
1152 | CreateThread(#properties_dialog, properties_stak+8092); |
1161 | break; |
1153 | break; |
1162 | case 10: //F10 |
1154 | case 10: //F10 |
1163 | if (!active_settings) |
1155 | if (!active_settings) |
1164 | { |
1156 | { |
1165 | settings_stak = malloc(4096); |
1157 | settings_stak = malloc(4096); |
1166 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1158 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1167 | break; |
1159 | break; |
1168 | } |
1160 | } |
1169 | else |
1161 | else |
1170 | { |
1162 | { |
1171 | ActivateWindow(GetProcessSlot(settings_window)); |
1163 | ActivateWindow(GetProcessSlot(settings_window)); |
1172 | } |
1164 | } |
1173 | break; |
1165 | break; |
1174 | } |
1166 | } |
1175 | } |
1167 | } |
1176 | 1168 | ||
1177 | void ChangeActivePanel() |
1169 | void ChangeActivePanel() |
1178 | { |
1170 | { |
1179 | llist_copy(#files_active, #files_inactive); |
1171 | llist_copy(#files_active, #files_inactive); |
1180 | llist_copy(#files_inactive, #files); |
1172 | llist_copy(#files_inactive, #files); |
1181 | strcpy(#active_path, #inactive_path); |
1173 | strcpy(#active_path, #inactive_path); |
1182 | strcpy(#inactive_path, #path); |
1174 | strcpy(#inactive_path, #path); |
1183 | DrawFilePanels(); |
1175 | DrawFilePanels(); |
1184 | } |
1176 | } |
1185 | 1177 | ||
1186 | void EventSelectAllFiles(dword state) |
1178 | void EventSelectAllFiles(dword state) |
1187 | { |
1179 | { |
1188 | int i; |
1180 | int i; |
1189 | for (i=0; i |
1181 | for (i=0; i |
1190 | List_ReDraw(); |
1182 | List_ReDraw(); |
1191 | DrawStatusBar(); |
1183 | DrawStatusBar(); |
1192 | } |
1184 | } |
1193 | 1185 | ||
1194 | void EventSelectFileByKeyPress() |
1186 | void EventSelectFileByKeyPress() |
1195 | { |
1187 | { |
1196 | int i; |
1188 | int i; |
1197 | for (i=files.cur_y+1; i |
1189 | for (i=files.cur_y+1; i |
1198 | { |
1190 | { |
1199 | strcpy(#temp, file_mas[i]*304+buf+72); |
1191 | strcpy(#temp, file_mas[i]*304+buf+72); |
1200 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1192 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
1201 | { |
1193 | { |
1202 | files.cur_y = i - 1; |
1194 | files.cur_y = i - 1; |
1203 | files.KeyDown(); |
1195 | files.KeyDown(); |
1204 | List_ReDraw(); |
1196 | List_ReDraw(); |
1205 | return; |
1197 | return; |
1206 | } |
1198 | } |
1207 | } |
1199 | } |
1208 | } |
1200 | } |
1209 | 1201 | ||
1210 | dword GetDeviceSizeLabel(dword path) |
1202 | dword GetDeviceSizeLabel(dword path) |
1211 | { |
1203 | { |
1212 | BDVK bdvk; |
1204 | BDVK bdvk; |
1213 | char cdname[8]; |
1205 | char cdname[8]; |
1214 | if (ESBYTE[path+1] == '/') path++; |
1206 | if (ESBYTE[path+1] == '/') path++; |
1215 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
1207 | if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd') |
1216 | && (ESBYTE[path+4] == 0) return 0; |
1208 | && (ESBYTE[path+4] == 0) return 0; |
1217 | GetFileInfo(path, #bdvk); |
1209 | GetFileInfo(path, #bdvk); |
1218 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
1210 | return ConvertSize64(bdvk.sizelo, bdvk.sizehi); |
1219 | } |
1211 | } |
1220 | 1212 | ||
1221 | int GetRealFileCountInFolder(dword folder_path) |
1213 | int GetRealFileCountInFolder(dword folder_path) |
1222 | { |
1214 | { |
1223 | int fcount; |
1215 | int fcount; |
1224 | dword countbuf; |
1216 | dword countbuf; |
1225 | 1217 | ||
1226 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
1218 | GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT); |
1227 | if (countbuf) free(countbuf); |
1219 | if (countbuf) free(countbuf); |
1228 | 1220 | ||
1229 | return fcount; |
1221 | return fcount; |
1230 | } |
1222 | } |
1231 | 1223 | ||
1232 | void EventRefreshDisksAndFolders() |
1224 | void EventRefreshDisksAndFolders() |
1233 | { |
1225 | { |
1234 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
1226 | if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) { |
1235 | FnProcess(5); |
1227 | FnProcess(5); |
1236 | } |
1228 | } |
1237 | if(two_panels.checked) |
1229 | if(two_panels.checked) |
1238 | { |
1230 | { |
1239 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
1231 | if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) { |
1240 | ChangeActivePanel(); |
1232 | ChangeActivePanel(); |
1241 | Open_Dir(#path,WITH_REDRAW); |
1233 | Open_Dir(#path,WITH_REDRAW); |
1242 | ChangeActivePanel(); |
1234 | ChangeActivePanel(); |
1243 | } |
1235 | } |
1244 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1236 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1245 | } |
1237 | } |
1246 | else |
1238 | else |
1247 | { |
1239 | { |
1248 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1240 | if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW); |
1249 | } |
1241 | } |
1250 | } |
1242 | } |
1251 | 1243 | ||
1252 | void EventSort(dword id) |
1244 | void EventSort(dword id) |
1253 | { |
1245 | { |
1254 | char selected_filename[256]; |
1246 | char selected_filename[256]; |
1255 | if (sort_type == id) sort_desc ^= 1; |
1247 | if (sort_type == id) sort_desc ^= 1; |
1256 | else sort_type = id; |
1248 | else sort_type = id; |
1257 | strcpy(#selected_filename, #file_name); |
1249 | strcpy(#selected_filename, #file_name); |
1258 | DrawList(); |
1250 | DrawList(); |
1259 | Open_Dir(#path,WITH_REDRAW); |
1251 | Open_Dir(#path,WITH_REDRAW); |
1260 | SelectFileByName(#selected_filename); |
1252 | SelectFileByName(#selected_filename); |
1261 | } |
1253 | } |
1262 | 1254 | ||
1263 | stop:28)> |
1255 | stop:28)> |
1264 | > |
1256 | > |
1265 | >>9)>=12)>5)>5;>6;>3;>>>> |
1257 | >>9)>=12)>5)>5;>6;>3;>>>> |
1266 | >0)>0)>=files.x+files.w+18)> |
1258 | >0)>0)>=files.x+files.w+18)> |
1267 | > |
1259 | > |
1268 | >=files.x+files.w+16)> |
1260 | >=files.x+files.w+16)> |
1269 | >=files.x+files.w+16)>>> |
1261 | >=files.x+files.w+16)>>> |