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