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