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