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