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