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