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