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