Rev 6403 | Rev 6406 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6403 | Rev 6404 | ||
---|---|---|---|
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2016 |
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2016 |
2 | //GNU GPL licence. |
2 | //GNU GPL licence. |
3 | 3 | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
5 | #include "lang.h--" |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | //libraries |
8 | //libraries |
9 | #define MEMSIZE 4096 * 180 |
9 | #define MEMSIZE 4096 * 180 |
10 | #include "..\lib\clipboard.h" |
10 | #include "..\lib\clipboard.h" |
11 | #include "..\lib\strings.h" |
11 | #include "..\lib\strings.h" |
12 | #include "..\lib\mem.h" |
12 | #include "..\lib\mem.h" |
13 | #include "..\lib\file_system.h" |
13 | #include "..\lib\file_system.h" |
14 | #include "..\lib\gui.h" |
14 | #include "..\lib\gui.h" |
15 | #include "..\lib\list_box.h" |
15 | #include "..\lib\list_box.h" |
16 | #include "..\lib\random.h" |
16 | #include "..\lib\random.h" |
17 | #include "..\lib\font.h" |
17 | #include "..\lib\font.h" |
18 | #include "..\lib\collection.h" |
18 | #include "..\lib\collection.h" |
19 | #include "..\lib\obj\libini.h" |
19 | #include "..\lib\obj\libini.h" |
20 | #include "..\lib\obj\box_lib.h" |
20 | #include "..\lib\obj\box_lib.h" |
21 | #include "..\lib\patterns\history.h" |
21 | #include "..\lib\patterns\history.h" |
22 | 22 | ||
23 | //images |
23 | //images |
24 | #include "imgs\left_p.txt" |
24 | #include "imgs\left_p.txt" |
25 | #include "imgs\icons.txt" |
25 | #include "imgs\icons.txt" |
26 | 26 | ||
27 | //Button IDs |
27 | //Button IDs |
28 | enum { |
28 | enum { |
29 | POPUP_BTN1 = 201, |
29 | POPUP_BTN1 = 201, |
30 | POPUP_BTN2 = 202, |
30 | POPUP_BTN2 = 202, |
31 | BREADCRUMB_ID = 300 |
31 | BREADCRUMB_ID = 300 |
32 | }; |
32 | }; |
33 | 33 | ||
34 | //NewElement options |
34 | //NewElement options |
35 | enum { |
35 | enum { |
36 | CREATE_FILE=1, |
36 | CREATE_FILE=1, |
37 | CREATE_FOLDER, |
37 | CREATE_FOLDER, |
38 | RENAME_ITEM |
38 | RENAME_ITEM |
39 | }; |
39 | }; |
40 | 40 | ||
41 | //OpenDir options |
41 | //OpenDir options |
42 | enum { |
42 | enum { |
43 | ONLY_SHOW, |
43 | ONLY_SHOW, |
44 | WITH_REDRAW, |
44 | WITH_REDRAW, |
45 | ONLY_OPEN |
45 | ONLY_OPEN |
46 | }; |
46 | }; |
47 | 47 | ||
48 | dword col_padding, col_selec, col_lpanel, col_work, col_graph; |
48 | dword col_padding, col_selec, col_lpanel, col_work, col_graph; |
49 | 49 | ||
50 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
50 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
51 | 51 | ||
52 | byte active_about=0; |
52 | byte active_about=0; |
53 | word about_window; |
53 | word about_window; |
54 | word settings_window; |
54 | word settings_window; |
55 | byte active_settings=0; |
55 | byte active_settings=0; |
56 | dword _not_draw = false; |
56 | dword _not_draw = false; |
57 | byte menu_call_mouse=0; |
57 | byte menu_call_mouse=0; |
58 | byte exif_load=0; |
58 | byte exif_load=0; |
59 | 59 | ||
60 | byte del_active=0; |
60 | byte del_active=0; |
61 | byte new_element_active=0; |
61 | byte new_element_active=0; |
62 | 62 | ||
63 | llist files, files_active, files_inactive; |
63 | llist files, files_active, files_inactive; |
64 | 64 | ||
65 | byte list_full_redraw; |
65 | byte list_full_redraw; |
66 | 66 | ||
67 | dword buf; |
67 | dword buf; |
68 | dword file_mas[6898]; |
68 | dword file_mas[6898]; |
69 | int selected_count; |
69 | int selected_count; |
70 | 70 | ||
71 | 71 | ||
72 | byte |
72 | byte |
73 | path[4096], |
73 | path[4096], |
74 | DefaultPath[4096], |
74 | DefaultPath[4096], |
75 | file_path[4096], |
75 | file_path[4096], |
76 | file_name[256], |
76 | file_name[256], |
77 | new_element_name[256], |
77 | new_element_name[256], |
78 | temp[4096], |
78 | temp[4096], |
- | 79 | status_bar_str[50], |
|
79 | itdir; |
80 | itdir; |
80 | 81 | ||
81 | char active_path[4096], inactive_path[4096]; |
82 | char active_path[4096], inactive_path[4096]; |
82 | 83 | ||
83 | dword eolite_ini_path; |
84 | dword eolite_ini_path; |
84 | 85 | ||
85 | char scroll_used=false; |
86 | char scroll_used=false; |
86 | 87 | ||
87 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
88 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak; |
88 | 89 | ||
89 | proc_info Form; |
90 | proc_info Form; |
90 | int mouse_dd, sc_slider_h; |
91 | int mouse_dd, sc_slider_h; |
91 | int j, i; |
92 | int j, i; |
92 | int action_buf; |
93 | int action_buf; |
93 | int rand_n; |
94 | int rand_n; |
94 | byte CMD_REFRESH; |
95 | byte CMD_REFRESH; |
95 | 96 | ||
96 | //struct t_settings { |
97 | //struct t_settings { |
97 | char sort_num=2; |
98 | char sort_num=2; |
98 | bool show_dev_name=true, |
99 | bool show_dev_name=true, |
99 | real_files_names_case=false, |
100 | real_files_names_case=false, |
100 | info_after_copy=false, |
101 | info_after_copy=false, |
101 | two_panels=false, |
102 | two_panels=false, |
102 | show_breadcrumb=false, |
103 | show_breadcrumb=false, |
103 | active_panel=1; |
104 | active_panel=1; |
104 | //} settings; |
105 | //} settings; |
105 | 106 | ||
106 | edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; |
107 | edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; |
107 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
108 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
108 | byte cmd_free=0; |
109 | byte cmd_free=0; |
109 | #include "include\translations.h" |
110 | #include "include\translations.h" |
110 | #include "include\fs.h" |
111 | #include "include\fs.h" |
111 | 112 | ||
112 | char *fd_path_eolite_ini_path; |
113 | char *fd_path_eolite_ini_path; |
113 | 114 | ||
114 | #include "include\settings.h" |
115 | #include "include\settings.h" |
115 | #include "include\progress_dialog.h" |
116 | #include "include\progress_dialog.h" |
116 | #include "..\lib\copyf.h" |
117 | #include "..\lib\copyf.h" |
117 | #include "include\copy.h" |
118 | #include "include\copy.h" |
118 | #include "include\gui.h" |
119 | #include "include\gui.h" |
119 | #include "include\sorting.h" |
120 | #include "include\sorting.h" |
120 | #include "include\icons.h" |
121 | #include "include\icons.h" |
121 | #include "include\left_panel.h" |
122 | #include "include\left_panel.h" |
122 | #include "include\menu.h" |
123 | #include "include\menu.h" |
123 | #include "include\delete.h" |
124 | #include "include\delete.h" |
124 | #include "include\about.h" |
125 | #include "include\about.h" |
125 | #include "include\properties.h" |
126 | #include "include\properties.h" |
126 | #include "include\breadcrumbs.h" |
127 | #include "include\breadcrumbs.h" |
127 | 128 | ||
128 | void main() |
129 | void main() |
129 | { |
130 | { |
130 | dword id; |
131 | dword id; |
131 | byte count_sl = 0; |
132 | byte count_sl = 0; |
132 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
133 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
133 | char can_show, can_select, stats; |
134 | char can_show, can_select, stats; |
134 | dword selected_offset; |
135 | dword selected_offset; |
135 | dword IPC_LEN,IPC_ID; |
136 | dword IPC_LEN,IPC_ID; |
136 | char IPC_BUF[10]; |
137 | char IPC_BUF[10]; |
137 | rand_n = random(40); |
138 | rand_n = random(40); |
138 | 139 | ||
139 | load_dll(boxlib, #box_lib_init,0); |
140 | load_dll(boxlib, #box_lib_init,0); |
140 | load_dll(libini, #lib_init,1); |
141 | load_dll(libini, #lib_init,1); |
141 | 142 | ||
142 | eolite_ini_path = abspath("Eolite.ini"); |
143 | eolite_ini_path = abspath("Eolite.ini"); |
143 | fd_path_eolite_ini_path = "/fd/1/File Managers/Eolite.ini"; |
144 | fd_path_eolite_ini_path = "/fd/1/File Managers/Eolite.ini"; |
144 | 145 | ||
145 | LoadIniSettings(); |
146 | LoadIniSettings(); |
146 | SystemDiscs.Get(); |
147 | SystemDiscs.Get(); |
147 | SetAppColors(); |
148 | SetAppColors(); |
148 | if (param) |
149 | if (param) |
149 | { |
150 | { |
150 | strcpy(#path, #param); |
151 | strcpy(#path, #param); |
151 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
152 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
152 | } |
153 | } |
153 | 154 | ||
154 | Open_Dir(#path,ONLY_OPEN); |
155 | Open_Dir(#path,ONLY_OPEN); |
155 | strcpy(#inactive_path, #path); |
156 | strcpy(#inactive_path, #path); |
156 | llist_copy(#files_inactive, #files); |
157 | llist_copy(#files_inactive, #files); |
157 | SetEventMask(1100111b); |
158 | SetEventMask(1100111b); |
158 | loop(){ |
159 | loop(){ |
159 | switch(WaitEvent()) |
160 | switch(WaitEvent()) |
160 | { |
161 | { |
161 | case evMouse: |
162 | case evMouse: |
162 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
163 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
163 | if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) |
164 | if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) |
164 | { |
165 | { |
165 | edit_box_mouse stdcall(#new_file_ed); |
166 | edit_box_mouse stdcall(#new_file_ed); |
166 | break; |
167 | break; |
167 | } |
168 | } |
168 | 169 | ||
169 | mouse.get(); |
170 | mouse.get(); |
170 | 171 | ||
171 | if (!mouse.mkm) && (stats>0) stats = 0; |
172 | if (!mouse.mkm) && (stats>0) stats = 0; |
172 | if (mouse.mkm) && (!stats) |
173 | if (mouse.mkm) && (!stats) |
173 | { |
174 | { |
174 | x_old = mouse.x; |
175 | x_old = mouse.x; |
175 | y_old = mouse.y; |
176 | y_old = mouse.y; |
176 | stats = 1; |
177 | stats = 1; |
177 | } |
178 | } |
178 | if (mouse.mkm) && (stats==1) |
179 | if (mouse.mkm) && (stats==1) |
179 | { |
180 | { |
180 | dif_x = mouse.x-x_old; |
181 | dif_x = mouse.x-x_old; |
181 | dif_y = mouse.y-y_old; |
182 | dif_y = mouse.y-y_old; |
182 | adif_x = fabs(dif_x); |
183 | adif_x = fabs(dif_x); |
183 | adif_y = fabs(dif_y); |
184 | adif_y = fabs(dif_y); |
184 | 185 | ||
185 | if (adif_x>adif_y) |
186 | if (adif_x>adif_y) |
186 | { |
187 | { |
187 | if (dif_x > 150) |
188 | if (dif_x > 150) |
188 | { |
189 | { |
189 | if (history.forward()) |
190 | if (history.forward()) |
190 | { |
191 | { |
191 | strcpy(#path, history.current()); |
192 | strcpy(#path, history.current()); |
192 | files.KeyHome(); |
193 | files.KeyHome(); |
193 | Open_Dir(#path,WITH_REDRAW); |
194 | Open_Dir(#path,WITH_REDRAW); |
194 | } |
195 | } |
195 | stats = 0; |
196 | stats = 0; |
196 | } |
197 | } |
197 | if (dif_x < -150) |
198 | if (dif_x < -150) |
198 | { |
199 | { |
199 | GoBack(); |
200 | GoBack(); |
200 | stats = 0; |
201 | stats = 0; |
201 | } |
202 | } |
202 | } |
203 | } |
203 | else |
204 | else |
204 | { |
205 | { |
205 | if (dif_y < -100) |
206 | if (dif_y < -100) |
206 | { |
207 | { |
207 | Dir_Up(); |
208 | Dir_Up(); |
208 | stats = 0; |
209 | stats = 0; |
209 | } |
210 | } |
210 | } |
211 | } |
211 | } |
212 | } |
212 | if (files.MouseOver(mouse.x, mouse.y)) |
213 | if (files.MouseOver(mouse.x, mouse.y)) |
213 | { |
214 | { |
214 | //select file |
215 | //select file |
215 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
216 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
216 | { |
217 | { |
217 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
218 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
218 | else if (mouse.dblclick)) Open(0); |
219 | else if (mouse.dblclick)) Open(0); |
219 | } |
220 | } |
220 | //file menu |
221 | //file menu |
221 | if (mouse.key&MOUSE_RIGHT) |
222 | if (mouse.key&MOUSE_RIGHT) |
222 | { |
223 | { |
223 | menu_call_mouse = 1; |
224 | menu_call_mouse = 1; |
224 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
225 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
225 | menu_stak = malloc(4096); |
226 | menu_stak = malloc(4096); |
226 | CreateThread(#FileMenu,menu_stak+4092); |
227 | CreateThread(#FileMenu,menu_stak+4092); |
227 | break; |
228 | break; |
228 | } |
229 | } |
229 | } |
230 | } |
230 | 231 | ||
231 | if (mouse.vert) |
232 | if (mouse.vert) |
232 | { |
233 | { |
233 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
234 | if (files.MouseScroll(mouse.vert)) List_ReDraw(); |
234 | break; |
235 | break; |
235 | } |
236 | } |
236 | 237 | ||
237 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
238 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y |
238 | { |
239 | { |
239 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xC7C7C7,0xFFFFFF); |
240 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xC7C7C7,0xFFFFFF); |
240 | WHILE (mouse.lkm==1) && (files.first>0) |
241 | WHILE (mouse.lkm==1) && (files.first>0) |
241 | { |
242 | { |
242 | pause(8); |
243 | pause(8); |
243 | files.first--; |
244 | files.first--; |
244 | List_ReDraw(); |
245 | List_ReDraw(); |
245 | mouse.get(); |
246 | mouse.get(); |
246 | } |
247 | } |
247 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xFFFFFF,0xC7C7C7); |
248 | DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xFFFFFF,0xC7C7C7); |
248 | } |
249 | } |
249 | 250 | ||
250 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
251 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y |
251 | { |
252 | { |
252 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xC7C7C7,0xFFFFFF); |
253 | if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xC7C7C7,0xFFFFFF); |
253 | while (mouse.lkm==1) && (files.first |
254 | while (mouse.lkm==1) && (files.first |
254 | { |
255 | { |
255 | pause(8); |
256 | pause(8); |
256 | files.first++; |
257 | files.first++; |
257 | List_ReDraw(); |
258 | List_ReDraw(); |
258 | mouse.get(); |
259 | mouse.get(); |
259 | } |
260 | } |
260 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xFFFFFF,0xC7C7C7); |
261 | DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xFFFFFF,0xC7C7C7); |
261 | } |
262 | } |
262 | 263 | ||
263 | //Scrooll |
264 | //Scrooll |
264 | if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); } |
265 | if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); } |
265 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
266 | if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y |
266 | 267 | ||
267 | if (scroll_used) |
268 | if (scroll_used) |
268 | { |
269 | { |
269 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
270 | if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
270 | id = files.first; |
271 | id = files.first; |
271 | files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count; |
272 | files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count; |
272 | files.first /= files.h - 18; |
273 | files.first /= files.h - 18; |
273 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
274 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
274 | if (files.first<0) files.first=0; |
275 | if (files.first<0) files.first=0; |
275 | if (id!=files.first) List_ReDraw(); |
276 | if (id!=files.first) List_ReDraw(); |
276 | break; |
277 | break; |
277 | } |
278 | } |
278 | 279 | ||
279 | if (two_panels) && (mouse.y > files.y) && (mouse.down) { |
280 | if (two_panels) && (mouse.y > files.y) && (mouse.down) { |
280 | if (mouse.x |
281 | if (mouse.x |
281 | { |
282 | { |
282 | if (active_panel!=1) |
283 | if (active_panel!=1) |
283 | { |
284 | { |
284 | active_panel = 1; |
285 | active_panel = 1; |
285 | ChangeActivePanel(); |
286 | ChangeActivePanel(); |
286 | } |
287 | } |
287 | } |
288 | } |
288 | else |
289 | else |
289 | { |
290 | { |
290 | if (active_panel!=2) |
291 | if (active_panel!=2) |
291 | { |
292 | { |
292 | active_panel = 2; |
293 | active_panel = 2; |
293 | ChangeActivePanel(); |
294 | ChangeActivePanel(); |
294 | } |
295 | } |
295 | } |
296 | } |
296 | } |
297 | } |
297 | break; |
298 | break; |
298 | //Button pressed----------------------------------------------------------------------------- |
299 | //Button pressed----------------------------------------------------------------------------- |
299 | case evButton: |
300 | case evButton: |
300 | id=GetButtonID(); |
301 | id=GetButtonID(); |
301 | switch(id) |
302 | switch(id) |
302 | { |
303 | { |
303 | case 01: |
304 | case 01: |
304 | KillProcess(about_window); |
305 | KillProcess(about_window); |
305 | SaveIniSettings(); |
306 | SaveIniSettings(); |
306 | ExitProcess(); |
307 | ExitProcess(); |
307 | case 21: //Back |
308 | case 21: //Back |
308 | GoBack(); |
309 | GoBack(); |
309 | break; |
310 | break; |
310 | case 22: //Forward |
311 | case 22: //Forward |
311 | if (history.forward()) |
312 | if (history.forward()) |
312 | { |
313 | { |
313 | strcpy(#path, history.current()); |
314 | strcpy(#path, history.current()); |
314 | files.KeyHome(); |
315 | files.KeyHome(); |
315 | Open_Dir(#path,WITH_REDRAW); |
316 | Open_Dir(#path,WITH_REDRAW); |
316 | } |
317 | } |
317 | break; |
318 | break; |
318 | case 23: |
319 | case 23: |
319 | Dir_Up(); |
320 | Dir_Up(); |
320 | break; |
321 | break; |
321 | case 24: |
322 | case 24: |
322 | Copy(#file_path, CUT); |
323 | Copy(#file_path, CUT); |
323 | break; |
324 | break; |
324 | case 25: |
325 | case 25: |
325 | Copy(#file_path, NOCUT); |
326 | Copy(#file_path, NOCUT); |
326 | break; |
327 | break; |
327 | case 26: |
328 | case 26: |
328 | Paste(); |
329 | Paste(); |
329 | break; |
330 | break; |
330 | case 31...33: //sorting |
331 | case 31...33: //sorting |
331 | sort_num = id - 30; |
332 | sort_num = id - 30; |
332 | DrawList(); |
333 | DrawList(); |
333 | Open_Dir(#path,WITH_REDRAW); |
334 | Open_Dir(#path,WITH_REDRAW); |
334 | break; |
335 | break; |
335 | case 50...60: //Actions |
336 | case 50...60: //Actions |
336 | FnProcess(id-50); |
337 | FnProcess(id-50); |
337 | break; |
338 | break; |
338 | case 100...120: |
339 | case 100...120: |
339 | SystemDiscs.Click(id-100); |
340 | SystemDiscs.Click(id-100); |
340 | break; |
341 | break; |
341 | case POPUP_BTN1...POPUP_BTN2: |
342 | case POPUP_BTN1...POPUP_BTN2: |
342 | if (del_active) Del_File(id-POPUP_BTN2); |
343 | if (del_active) Del_File(id-POPUP_BTN2); |
343 | if (new_element_active) NewElement(id-POPUP_BTN2); |
344 | if (new_element_active) NewElement(id-POPUP_BTN2); |
344 | DeleteButton(POPUP_BTN1); |
345 | DeleteButton(POPUP_BTN1); |
345 | DeleteButton(POPUP_BTN2); |
346 | DeleteButton(POPUP_BTN2); |
346 | break; |
347 | break; |
347 | case BREADCRUMB_ID...400: |
348 | case BREADCRUMB_ID...400: |
348 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
349 | ClickOnBreadCrumb(id-BREADCRUMB_ID); |
349 | break; |
350 | break; |
350 | } |
351 | } |
351 | break; |
352 | break; |
352 | //Key pressed----------------------------------------------------------------------------- |
353 | //Key pressed----------------------------------------------------------------------------- |
353 | case evKey: |
354 | case evKey: |
354 | GetKeys(); |
355 | GetKeys(); |
355 | 356 | ||
356 | if (Form.status_window>2) break; |
357 | if (Form.status_window>2) break; |
357 | if (del_active) |
358 | if (del_active) |
358 | { |
359 | { |
359 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
360 | if (key_scancode == SCAN_CODE_ENTER) Del_File(true); |
360 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
361 | if (key_scancode == SCAN_CODE_ESC) Del_File(false); |
361 | break; |
362 | break; |
362 | } |
363 | } |
363 | if (new_element_active) |
364 | if (new_element_active) |
364 | { |
365 | { |
365 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
366 | if (key_scancode == SCAN_CODE_ENTER) NewElement(true); |
366 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
367 | if (key_scancode == SCAN_CODE_ESC) NewElement(false); |
367 | EAX= key_ascii << 8; |
368 | EAX= key_ascii << 8; |
368 | edit_box_key stdcall (#new_file_ed); |
369 | edit_box_key stdcall (#new_file_ed); |
369 | break; |
370 | break; |
370 | } |
371 | } |
371 | if (files.ProcessKey(key_scancode)) |
372 | if (files.ProcessKey(key_scancode)) |
372 | { |
373 | { |
373 | List_ReDraw(); |
374 | List_ReDraw(); |
374 | break; |
375 | break; |
375 | } |
376 | } |
376 | 377 | ||
377 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
378 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
378 | { |
379 | { |
379 | switch(key_scancode) |
380 | switch(key_scancode) |
380 | { |
381 | { |
381 | case 059...068: |
382 | case 059...068: |
382 | key_scancode -= 59; |
383 | key_scancode -= 59; |
383 | if (key_scancode < SystemDiscs.list.count) |
384 | if (key_scancode < SystemDiscs.list.count) |
384 | { |
385 | { |
385 | if (!two_panels) |
386 | if (!two_panels) |
386 | { |
387 | { |
387 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
388 | DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click |
388 | pause(7); |
389 | pause(7); |
389 | } |
390 | } |
390 | SystemDiscs.Click(key_scancode); |
391 | SystemDiscs.Click(key_scancode); |
391 | } |
392 | } |
392 | break; |
393 | break; |
393 | case 45: //Ctrl+X |
394 | case 45: //Ctrl+X |
394 | Copy(#file_path, CUT); |
395 | Copy(#file_path, CUT); |
395 | break; |
396 | break; |
396 | case 46: //Ctrl+C |
397 | case 46: //Ctrl+C |
397 | Copy(#file_path, NOCUT); |
398 | Copy(#file_path, NOCUT); |
398 | break; |
399 | break; |
399 | case 47: //Ctrl+V |
400 | case 47: //Ctrl+V |
400 | Paste(); |
401 | Paste(); |
401 | break; |
402 | break; |
402 | case 032: //Ctrl+D - set as bg |
403 | case 032: //Ctrl+D - set as bg |
403 | strlcpy(#temp, "\\S__",4); |
404 | strlcpy(#temp, "\\S__",4); |
404 | strcat(#temp, #file_path); |
405 | strcat(#temp, #file_path); |
405 | RunProgram("/sys/media/kiv", #temp); |
406 | RunProgram("/sys/media/kiv", #temp); |
406 | break; |
407 | break; |
407 | case 049: //Ctrl+N - create new window |
408 | case 049: //Ctrl+N - create new window |
408 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
409 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
409 | RunProgram("/sys/File Managers/Eolite", #path); |
410 | RunProgram("/sys/File Managers/Eolite", #path); |
410 | break; |
411 | break; |
411 | case 050: //Ctrl+M |
412 | case 050: //Ctrl+M |
412 | Open_Dir(#inactive_path,WITH_REDRAW); |
413 | Open_Dir(#inactive_path,WITH_REDRAW); |
413 | break; |
414 | break; |
414 | case SCAN_CODE_ENTER: //Ctrl+Enter |
415 | case SCAN_CODE_ENTER: //Ctrl+Enter |
415 | if (!itdir) ShowOpenWithDialog(); |
416 | if (!itdir) ShowOpenWithDialog(); |
416 | else Open(1); |
417 | else Open(1); |
417 | break; |
418 | break; |
418 | case 030: //Ctrl+A - select all files |
419 | case 030: //Ctrl+A - select all files |
419 | for (i=0; i |
420 | for (i=0; i |
420 | { |
421 | { |
421 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
422 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
422 | if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory |
423 | if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory |
423 | ESBYTE[selected_offset] = 1; |
424 | ESBYTE[selected_offset] = 1; |
424 | selected_count++; |
425 | selected_count++; |
425 | } |
426 | } |
426 | List_ReDraw(); |
427 | List_ReDraw(); |
- | 428 | DrawStatusBar(); |
|
427 | break; |
429 | break; |
428 | case 022: //Ctrl+U - unselect all files |
430 | case 022: //Ctrl+U - unselect all files |
429 | for (i=0; i |
431 | for (i=0; i |
430 | { |
432 | { |
431 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
433 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
432 | ESBYTE[selected_offset] = 0; |
434 | ESBYTE[selected_offset] = 0; |
433 | } |
435 | } |
434 | selected_count = 0; |
436 | selected_count = 0; |
435 | List_ReDraw(); |
437 | List_ReDraw(); |
- | 438 | DrawStatusBar(); |
|
436 | break; |
439 | break; |
437 | } |
440 | } |
438 | break; |
441 | break; |
439 | } |
442 | } |
440 | 443 | ||
441 | switch (key_scancode) |
444 | switch (key_scancode) |
442 | { |
445 | { |
443 | case SCAN_CODE_BS: |
446 | case SCAN_CODE_BS: |
444 | //GoBack(); |
447 | //GoBack(); |
445 | Dir_Up(); |
448 | Dir_Up(); |
446 | break; |
449 | break; |
447 | case SCAN_CODE_ENTER: |
450 | case SCAN_CODE_ENTER: |
448 | Open(0); |
451 | Open(0); |
449 | break; |
452 | break; |
450 | case SCAN_CODE_TAB: |
453 | case SCAN_CODE_TAB: |
451 | if (!two_panels) break; |
454 | if (!two_panels) break; |
452 | if (active_panel==1) active_panel=2; else active_panel=1; |
455 | if (active_panel==1) active_panel=2; else active_panel=1; |
453 | ChangeActivePanel(); |
456 | ChangeActivePanel(); |
- | 457 | DrawStatusBar(); |
|
454 | break; |
458 | break; |
455 | case 093: //menu |
459 | case 093: //menu |
456 | menu_call_mouse=0; |
460 | menu_call_mouse=0; |
457 | menu_stak = malloc(4096); |
461 | menu_stak = malloc(4096); |
458 | CreateThread(#FileMenu,menu_stak+4092); |
462 | CreateThread(#FileMenu,menu_stak+4092); |
459 | break; |
463 | break; |
460 | case SCAN_CODE_DEL: |
464 | case SCAN_CODE_DEL: |
461 | Del_Form(); |
465 | Del_Form(); |
462 | break; |
466 | break; |
463 | case SCAN_CODE_INS: |
467 | case SCAN_CODE_INS: |
464 | selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7; |
468 | selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7; |
465 | if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory |
469 | if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory |
466 | if (ESBYTE[selected_offset]) |
470 | if (ESBYTE[selected_offset]) |
467 | { |
471 | { |
468 | ESBYTE[selected_offset]=0; |
472 | ESBYTE[selected_offset]=0; |
469 | selected_count--; |
473 | selected_count--; |
470 | } |
474 | } |
471 | else |
475 | else |
472 | { |
476 | { |
473 | ESBYTE[selected_offset] = 1; |
477 | ESBYTE[selected_offset] = 1; |
474 | selected_count++; |
478 | selected_count++; |
475 | } |
479 | } |
476 | _INSERT_END: |
480 | _INSERT_END: |
477 | files.KeyDown(); |
481 | files.KeyDown(); |
478 | List_ReDraw(); |
482 | List_ReDraw(); |
- | 483 | DrawStatusBar(); |
|
479 | break; |
484 | break; |
480 | case 059...068: //F1-F10 |
485 | case 059...068: //F1-F10 |
481 | FnProcess(key_scancode-58); |
486 | FnProcess(key_scancode-58); |
482 | break; |
487 | break; |
483 | default: |
488 | default: |
484 | for (i=files.cur_y+1; i |
489 | for (i=files.cur_y+1; i |
485 | { |
490 | { |
486 | strcpy(#temp, file_mas[i]*304+buf+72); |
491 | strcpy(#temp, file_mas[i]*304+buf+72); |
487 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
492 | if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) |
488 | { |
493 | { |
489 | files.cur_y = i - 1; |
494 | files.cur_y = i - 1; |
490 | files.KeyDown(); |
495 | files.KeyDown(); |
491 | List_ReDraw(); |
496 | List_ReDraw(); |
492 | break; |
497 | break; |
493 | } |
498 | } |
494 | } |
499 | } |
495 | } |
500 | } |
496 | break; |
501 | break; |
497 | case evIPC: |
502 | case evIPC: |
498 | case evReDraw: |
503 | case evReDraw: |
499 | draw_window(); |
504 | draw_window(); |
500 | if (action_buf) |
505 | if (action_buf) |
501 | { |
506 | { |
502 | if (action_buf==OPERATION_END) |
507 | if (action_buf==OPERATION_END) |
503 | { |
508 | { |
504 | FnProcess(5); |
509 | FnProcess(5); |
505 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
510 | if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/')); |
506 | } |
511 | } |
507 | if (action_buf==100) Open(0); |
512 | if (action_buf==100) Open(0); |
508 | if (action_buf==201) ShowOpenWithDialog(); |
513 | if (action_buf==201) ShowOpenWithDialog(); |
509 | if (action_buf==202) FnProcess(3); //F3 |
514 | if (action_buf==202) FnProcess(3); //F3 |
510 | if (action_buf==203) FnProcess(4); //F4 |
515 | if (action_buf==203) FnProcess(4); //F4 |
511 | if (action_buf==104) Copy(#file_path, NOCUT); |
516 | if (action_buf==104) Copy(#file_path, NOCUT); |
512 | if (action_buf==105) Copy(#file_path, CUT); |
517 | if (action_buf==105) Copy(#file_path, CUT); |
513 | if (action_buf==106) Paste(); |
518 | if (action_buf==106) Paste(); |
514 | if (action_buf==207) FnProcess(2); |
519 | if (action_buf==207) FnProcess(2); |
515 | if (action_buf==108) Del_Form(); |
520 | if (action_buf==108) Del_Form(); |
516 | if (action_buf==109) FnProcess(5); |
521 | if (action_buf==109) FnProcess(5); |
517 | if (action_buf==110) FnProcess(8); |
522 | if (action_buf==110) FnProcess(8); |
518 | action_buf=0; |
523 | action_buf=0; |
519 | } |
524 | } |
520 | } |
525 | } |
521 | if(cmd_free) |
526 | if(cmd_free) |
522 | { |
527 | { |
523 | if(cmd_free==1) menu_stak=free(menu_stak); |
528 | if(cmd_free==1) menu_stak=free(menu_stak); |
524 | else if(cmd_free==2) about_stak=free(about_stak); |
529 | else if(cmd_free==2) about_stak=free(about_stak); |
525 | else if(cmd_free==3) properties_stak=free(properties_stak); |
530 | else if(cmd_free==3) properties_stak=free(properties_stak); |
526 | else if(cmd_free==4) settings_stak=free(settings_stak); |
531 | else if(cmd_free==4) settings_stak=free(settings_stak); |
527 | else if(cmd_free==5) copy_stak=free(copy_stak); |
532 | else if(cmd_free==5) copy_stak=free(copy_stak); |
528 | else if(cmd_free==6) delete_stak=free(delete_stak); |
533 | else if(cmd_free==6) delete_stak=free(delete_stak); |
529 | cmd_free = false; |
534 | cmd_free = false; |
530 | } |
535 | } |
531 | } |
536 | } |
532 | } |
537 | } |
533 | 538 | ||
534 | void DrawFavButton(int x) |
539 | void DrawFavButton(int x) |
535 | { |
540 | { |
536 | _PutImage(x,10,20,22,#fav); |
541 | _PutImage(x,10,20,22,#fav); |
537 | DefineButton(x,11,20-2,22-2,61+BT_HIDE+BT_NOFRAME,0); |
542 | DefineButton(x,11,20-2,22-2,61+BT_HIDE+BT_NOFRAME,0); |
538 | } |
543 | } |
539 | 544 | ||
540 | void draw_window() |
545 | void draw_window() |
541 | { |
546 | { |
542 | DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,NULL,TITLE,0); |
547 | DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,NULL,TITLE,0); |
543 | GetProcessInfo(#Form, SelfInfo); |
548 | GetProcessInfo(#Form, SelfInfo); |
544 | if (Form.status_window>2) return; |
549 | if (Form.status_window>2) return; |
545 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
550 | if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; } |
546 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
551 | if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; } |
547 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
552 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
548 | _PutImage(0,0,246,34,#toolbar); |
553 | _PutImage(0,0,246,34,#toolbar); |
549 | DrawBar(127, 8, 1, 25, col_graph); |
554 | DrawBar(127, 8, 1, 25, col_graph); |
550 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,NULL); |
555 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,NULL); |
551 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,NULL); |
556 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,NULL); |
552 | DrawBar(246,0, Form.cwidth - 246, 34, col_work); |
557 | DrawBar(246,0, Form.cwidth - 246, 34, col_work); |
553 | _PutImage(Form.cwidth-17,11,6,18,#dots); |
558 | _PutImage(Form.cwidth-17,11,6,18,#dots); |
554 | DefineButton(Form.cwidth-24,7,20,25,51+BT_HIDE+BT_NOFRAME,0); //dots |
559 | DefineButton(Form.cwidth-24,7,20,25,51+BT_HIDE+BT_NOFRAME,0); //dots |
555 | //main rectangles |
560 | //main rectangles |
556 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,col_graph); |
561 | DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,col_graph); |
557 | DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg |
562 | DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg |
558 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
563 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
559 | llist_copy(#files_active, #files); |
564 | llist_copy(#files_active, #files); |
560 | strcpy(#active_path, #path); |
565 | strcpy(#active_path, #path); |
561 | DrawFilePanels(); |
566 | DrawFilePanels(); |
- | 567 | DrawStatusBar(); |
|
562 | if (del_active) Del_Form(); |
568 | if (del_active) Del_Form(); |
563 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
569 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
564 | } |
570 | } |
565 | 571 | ||
566 | void DrawList() |
572 | void DrawList() |
567 | { |
573 | { |
568 | word sorting_arrow_x; |
574 | word sorting_arrow_x; |
569 | DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
575 | DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,T_FILE); |
570 | DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
576 | DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE); |
571 | DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
577 | DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE); |
572 | DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
578 | DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,"\x18"); |
573 | DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
579 | DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,"\x19"); |
574 | if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
580 | if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18; |
575 | if (sort_num==2) sorting_arrow_x = files.x + files.w - 90; |
581 | if (sort_num==2) sorting_arrow_x = files.x + files.w - 90; |
576 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
582 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
577 | WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19"); |
583 | WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19"); |
578 | DrawBar(files.x+files.w,files.y,1,files.h,col_graph); |
584 | DrawBar(files.x+files.w,files.y,1,files.h,col_graph); |
579 | if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph); |
585 | if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph); |
580 | } |
586 | } |
- | 587 | ||
- | 588 | void DrawStatusBar() |
|
- | 589 | { |
|
- | 590 | DrawBar(1, Form.cheight - 18, Form.cwidth-2, 17, col_palette); |
|
- | 591 | sprintf(#status_bar_str, STATUS_STR, files.count, selected_count); |
|
- | 592 | WriteText(6,Form.cheight - 13,0x80,0x000000,#status_bar_str); |
|
- | 593 | } |
|
581 | 594 | ||
582 | void DrawFilePanels() |
595 | void DrawFilePanels() |
583 | { |
596 | { |
584 | int files_y; |
597 | int files_y; |
585 | if (!two_panels) |
598 | if (!two_panels) |
586 | { |
599 | { |
587 | DrawDeviceAndActionsLeftPanel(); |
600 | DrawDeviceAndActionsLeftPanel(); |
588 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h); |
601 | files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 75, files.item_h); |
589 | DrawList(); |
602 | DrawList(); |
590 | Open_Dir(#path,ONLY_SHOW); |
603 | Open_Dir(#path,ONLY_SHOW); |
591 | } |
604 | } |
592 | else |
605 | else |
593 | { |
606 | { |
594 | SystemDiscs.Get(); |
607 | SystemDiscs.Get(); |
595 | llist_copy(#files, #files_inactive); |
608 | llist_copy(#files, #files_inactive); |
596 | strcpy(#path, #inactive_path); |
609 | strcpy(#path, #inactive_path); |
597 | col_selec = 0xCCCccc; |
610 | col_selec = 0xCCCccc; |
598 | SystemDiscs.Draw(); |
611 | SystemDiscs.Draw(); |
599 | files_y = files.y; |
612 | files_y = files.y; |
600 | 613 | ||
601 | if (active_panel==1) |
614 | if (active_panel==1) |
602 | { |
615 | { |
603 | llist_copy(#files, #files_inactive); |
616 | llist_copy(#files, #files_inactive); |
604 | strcpy(#path, #inactive_path); |
617 | strcpy(#path, #inactive_path); |
605 | col_selec = 0xCCCccc; |
618 | col_selec = 0xCCCccc; |
606 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h); |
619 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2-16, files.item_h); |
607 | DrawList(); |
620 | DrawList(); |
608 | Open_Dir(#path,WITH_REDRAW); |
621 | Open_Dir(#path,WITH_REDRAW); |
609 | llist_copy(#files, #files_active); |
622 | llist_copy(#files, #files_active); |
610 | strcpy(#path, #active_path); |
623 | strcpy(#path, #active_path); |
611 | col_selec = 0x94AECE; |
624 | col_selec = 0x94AECE; |
612 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h); |
625 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2-16, files.item_h); |
613 | DrawList(); |
626 | DrawList(); |
614 | Open_Dir(#path,WITH_REDRAW); |
627 | Open_Dir(#path,WITH_REDRAW); |
615 | } |
628 | } |
616 | if (active_panel==2) |
629 | if (active_panel==2) |
617 | { |
630 | { |
618 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h); |
631 | files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2-16, files.item_h); |
619 | DrawList(); |
632 | DrawList(); |
620 | Open_Dir(#path,WITH_REDRAW); |
633 | Open_Dir(#path,WITH_REDRAW); |
621 | llist_copy(#files, #files_active); |
634 | llist_copy(#files, #files_active); |
622 | strcpy(#path, #active_path); |
635 | strcpy(#path, #active_path); |
623 | col_selec = 0x94AECE; |
636 | col_selec = 0x94AECE; |
624 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h); |
637 | files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2-16, files.item_h); |
625 | DrawList(); |
638 | DrawList(); |
626 | Open_Dir(#path,WITH_REDRAW); |
639 | Open_Dir(#path,WITH_REDRAW); |
627 | } |
640 | } |
628 | } |
641 | } |
629 | } |
642 | } |
630 | 643 | ||
631 | 644 | ||
632 | void List_ReDraw() |
645 | void List_ReDraw() |
633 | { |
646 | { |
634 | int all_lines_h; |
647 | int all_lines_h; |
635 | static int old_cur_y, old_first; |
648 | static int old_cur_y, old_first; |
636 | 649 | ||
637 | files.CheckDoesValuesOkey(); //prevent some shit |
650 | files.CheckDoesValuesOkey(); //prevent some shit |
638 | 651 | ||
639 | if (list_full_redraw) || (old_first != files.first) |
652 | if (list_full_redraw) || (old_first != files.first) |
640 | { |
653 | { |
641 | old_cur_y = files.cur_y; |
654 | old_cur_y = files.cur_y; |
642 | old_first = files.first; |
655 | old_first = files.first; |
643 | list_full_redraw = false; |
656 | list_full_redraw = false; |
644 | goto _ALL_LIST_REDRAW; |
657 | goto _ALL_LIST_REDRAW; |
645 | } |
658 | } |
646 | if (old_cur_y != files.cur_y) |
659 | if (old_cur_y != files.cur_y) |
647 | { |
660 | { |
648 | if (old_cur_y-files.first |
661 | if (old_cur_y-files.first |
649 | Line_ReDraw(col_selec, files.cur_y-files.first); |
662 | Line_ReDraw(col_selec, files.cur_y-files.first); |
650 | old_cur_y = files.cur_y; |
663 | old_cur_y = files.cur_y; |
651 | return; |
664 | return; |
652 | } |
665 | } |
653 | 666 | ||
654 | _ALL_LIST_REDRAW: |
667 | _ALL_LIST_REDRAW: |
655 | 668 | ||
656 | for (j=0; j |
669 | for (j=0; j |
657 | //in the bottom |
670 | //in the bottom |
658 | all_lines_h = j * files.item_h; |
671 | all_lines_h = j * files.item_h; |
659 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF); |
672 | DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF); |
660 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
673 | DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
661 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
674 | DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work); |
662 | Scroll(); |
675 | Scroll(); |
663 | } |
676 | } |
664 | 677 | ||
665 | 678 | ||
666 | void Line_ReDraw(dword bgcol, filenum){ |
679 | void Line_ReDraw(dword bgcol, filenum){ |
667 | dword text_col=0, |
680 | dword text_col=0, |
668 | ext1, attr, |
681 | ext1, attr, |
669 | file_offet, |
682 | file_offet, |
670 | file_name_off, |
683 | file_name_off, |
671 | y=filenum*files.item_h+files.y, |
684 | y=filenum*files.item_h+files.y, |
672 | icon_y = files.item_h/2-7+y; |
685 | icon_y = files.item_h/2-7+y; |
673 | BDVK file; |
686 | BDVK file; |
674 | char label_file_name[4096]; |
687 | char label_file_name[4096]; |
675 | if (filenum==-1) return; |
688 | if (filenum==-1) return; |
676 | DrawBar(files.x,y,3,files.item_h,bgcol); |
689 | DrawBar(files.x,y,3,files.item_h,bgcol); |
677 | DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol); |
690 | DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol); |
678 | if (files.item_h>15) DrawBar(files.x+3,y,16,icon_y-y,bgcol); |
691 | if (files.item_h>15) DrawBar(files.x+3,y,16,icon_y-y,bgcol); |
679 | if (files.item_h>16) DrawBar(files.x+3,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); |
692 | if (files.item_h>16) DrawBar(files.x+3,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); |
680 | 693 | ||
681 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
694 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
682 | attr = ESDWORD[file_offet]; |
695 | attr = ESDWORD[file_offet]; |
683 | file.selected = ESBYTE[file_offet+7]; |
696 | file.selected = ESBYTE[file_offet+7]; |
684 | file.sizelo = ESDWORD[file_offet+32]; |
697 | file.sizelo = ESDWORD[file_offet+32]; |
685 | file_name_off = file_offet+40; |
698 | file_name_off = file_offet+40; |
686 | 699 | ||
687 | if (! TestBit(attr, 4) ) //file or folder? |
700 | if (! TestBit(attr, 4) ) //file or folder? |
688 | { |
701 | { |
689 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
702 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
690 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
703 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
691 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y+y+1, files.font_type, 0, ConvertSize(file.sizelo)); |
704 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y+y+1, files.font_type, 0, ConvertSize(file.sizelo)); |
692 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
705 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
693 | } |
706 | } |
694 | else |
707 | else |
695 | { |
708 | { |
696 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else { |
709 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else { |
697 | ext1=" |
710 | ext1=" |
698 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
711 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
699 | } |
712 | } |
700 | } |
713 | } |
701 | DrawIconByExtension(ext1, files.x+3, icon_y, bgcol); |
714 | DrawIconByExtension(ext1, files.x+3, icon_y, bgcol); |
702 | 715 | ||
703 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
716 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
704 | if (bgcol!=0xFFFfff) |
717 | if (bgcol!=0xFFFfff) |
705 | { |
718 | { |
706 | itdir = TestBit(attr, 4); |
719 | itdir = TestBit(attr, 4); |
707 | strcpy(#file_name, file_name_off); |
720 | strcpy(#file_name, file_name_off); |
708 | sprintf(#file_path,"%s%s",#path,file_name_off); |
721 | sprintf(#file_path,"%s%s",#path,file_name_off); |
709 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
722 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
710 | } |
723 | } |
711 | if (file.selected) text_col=0xFF0000; |
724 | if (file.selected) text_col=0xFF0000; |
712 | if (label.size.pt==9) || (!label.font) |
725 | if (label.size.pt==9) || (!label.font) |
713 | { |
726 | { |
714 | if (Form.width>=480) |
727 | if (Form.width>=480) |
715 | { |
728 | { |
716 | FileShow.start_x = files.x + 23; |
729 | FileShow.start_x = files.x + 23; |
717 | FileShow.font_color = text_col; |
730 | FileShow.font_color = text_col; |
718 | FileShow.area_size_x = files.w - 164; |
731 | FileShow.area_size_x = files.w - 164; |
719 | FileShow.text_pointer = file_name_off; |
732 | FileShow.text_pointer = file_name_off; |
720 | FileShow.start_y = files.text_y + y + 1; |
733 | FileShow.start_y = files.text_y + y + 1; |
721 | PathShow_prepare stdcall(#FileShow); |
734 | PathShow_prepare stdcall(#FileShow); |
722 | PathShow_draw stdcall(#FileShow); |
735 | PathShow_draw stdcall(#FileShow); |
723 | } |
736 | } |
724 | } |
737 | } |
725 | else |
738 | else |
726 | { |
739 | { |
727 | strcpy(#label_file_name, file_name_off); |
740 | strcpy(#label_file_name, file_name_off); |
728 | if (label.getsize(#label_file_name) + 141 + 26 > files.w) |
741 | if (label.getsize(#label_file_name) + 141 + 26 > files.w) |
729 | { |
742 | { |
730 | while (label.getsize(#label_file_name) + 141 + 26 > files.w) { |
743 | while (label.getsize(#label_file_name) + 141 + 26 > files.w) { |
731 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
744 | ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; |
732 | } |
745 | } |
733 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
746 | strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); |
734 | } |
747 | } |
735 | label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name); |
748 | label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name); |
736 | } |
749 | } |
737 | DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 |
750 | DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 |
738 | DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 |
751 | DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 |
739 | } |
752 | } |
740 | 753 | ||
741 | 754 | ||
742 | void Open_Dir(dword dir_path, redraw){ |
755 | void Open_Dir(dword dir_path, redraw){ |
743 | int errornum, maxcount; |
756 | int errornum, maxcount; |
744 | 757 | ||
745 | if (redraw!=ONLY_SHOW) |
758 | if (redraw!=ONLY_SHOW) |
746 | { |
759 | { |
747 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
760 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
748 | if (buf) free(buf); |
761 | if (buf) free(buf); |
749 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
762 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
750 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
763 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
751 | if (errornum) |
764 | if (errornum) |
752 | { |
765 | { |
753 | history.add(#path); |
766 | history.add(#path); |
754 | GoBack(); |
767 | GoBack(); |
755 | Write_Error(errornum); |
768 | Write_Error(errornum); |
756 | return; |
769 | return; |
757 | } |
770 | } |
758 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
771 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
759 | if (files.count>maxcount) files.count = maxcount; |
772 | if (files.count>maxcount) files.count = maxcount; |
760 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
773 | if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; |
761 | } |
774 | } |
762 | if (files.count!=-1) |
775 | if (files.count!=-1) |
763 | { |
776 | { |
764 | if(!_not_draw) if (show_breadcrumb) DrawBreadCrumbs(); else DrawPathBar(); |
777 | if(!_not_draw) if (show_breadcrumb) DrawBreadCrumbs(); else DrawPathBar(); |
765 | history.add(#path); |
778 | history.add(#path); |
766 | SystemDiscs.Draw(); |
779 | SystemDiscs.Draw(); |
767 | files.visible = files.h / files.item_h; |
780 | files.visible = files.h / files.item_h; |
768 | if (files.count < files.visible) files.visible = files.count; |
781 | if (files.count < files.visible) files.visible = files.count; |
769 | if (redraw!=ONLY_SHOW) Sorting(); |
782 | if (redraw!=ONLY_SHOW) Sorting(); |
770 | list_full_redraw = true; |
783 | list_full_redraw = true; |
771 | if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw(); |
784 | if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw(); |
772 | } |
785 | } |
773 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
786 | if (files.count==-1) && (redraw!=ONLY_OPEN) |
774 | { |
787 | { |
775 | files.KeyHome(); |
788 | files.KeyHome(); |
776 | if(!_not_draw) { list_full_redraw=true; List_ReDraw(); } |
789 | if(!_not_draw) { list_full_redraw=true; List_ReDraw(); } |
777 | } |
790 | } |
778 | } |
791 | } |
779 | 792 | ||
780 | 793 | ||
781 | inline Sorting() |
794 | inline Sorting() |
782 | { |
795 | { |
783 | dword k=0, l=1; |
796 | dword k=0, l=1; |
784 | dword file_off; |
797 | dword file_off; |
785 | if (!strncmp(#path,"/",2)) //do not sort |
798 | if (!strncmp(#path,"/",2)) //do not sort |
786 | { |
799 | { |
787 | for(k=1;k |
800 | for(k=1;k |
788 | return; |
801 | return; |
789 | } |
802 | } |
790 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
803 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
791 | { |
804 | { |
792 | if (!real_files_names_case) strttl(file_off+40); |
805 | if (!real_files_names_case) strttl(file_off+40); |
793 | if (TestBit(ESDWORD[file_off],4)) //directory? |
806 | if (TestBit(ESDWORD[file_off],4)) //directory? |
794 | { |
807 | { |
795 | file_mas[k]=j; |
808 | file_mas[k]=j; |
796 | k++; |
809 | k++; |
797 | } |
810 | } |
798 | else |
811 | else |
799 | { |
812 | { |
800 | file_mas[files.count-l]=j; |
813 | file_mas[files.count-l]=j; |
801 | l++; |
814 | l++; |
802 | } |
815 | } |
803 | } |
816 | } |
804 | //sorting: files first, then folders |
817 | //sorting: files first, then folders |
805 | Sort_by_Name(0,k-1); |
818 | Sort_by_Name(0,k-1); |
806 | if (sort_num==1) Sort_by_Name(k,files.count-1); |
819 | if (sort_num==1) Sort_by_Name(k,files.count-1); |
807 | if (sort_num==2) Sort_by_Type(k,files.count-1); |
820 | if (sort_num==2) Sort_by_Type(k,files.count-1); |
808 | if (sort_num==3) Sort_by_Size(k,files.count-1); |
821 | if (sort_num==3) Sort_by_Size(k,files.count-1); |
809 | //make ".." first item in list |
822 | //make ".." first item in list |
810 | if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
823 | if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) |
811 | for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]> |
824 | for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]> |
812 | } |
825 | } |
813 | 826 | ||
814 | 827 | ||
815 | void Del_Form() |
828 | void Del_Form() |
816 | { |
829 | { |
817 | dword selected_offset2; |
830 | dword selected_offset2; |
818 | int selected_count = 0; |
831 | int selected_count = 0; |
819 | byte f_count[128]; |
832 | byte f_count[128]; |
820 | int dform_x = files.w - 220 / 2 + files.x; |
833 | int dform_x = files.w - 220 / 2 + files.x; |
821 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
834 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
822 | else |
835 | else |
823 | { |
836 | { |
824 | if (!files.count) return; |
837 | if (!files.count) return; |
825 | DrawEolitePopup(T_YES, T_NO); |
838 | DrawEolitePopup(T_YES, T_NO); |
826 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
839 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
827 | for (i=0; i |
840 | for (i=0; i |
828 | { |
841 | { |
829 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
842 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
830 | if (ESBYTE[selected_offset2]) selected_count++; |
843 | if (ESBYTE[selected_offset2]) selected_count++; |
831 | } |
844 | } |
832 | if (selected_count) |
845 | if (selected_count) |
833 | { |
846 | { |
834 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
847 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
835 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
848 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
836 | } |
849 | } |
837 | else |
850 | else |
838 | { |
851 | { |
839 | if (strlen(#file_name)<28) |
852 | if (strlen(#file_name)<28) |
840 | { |
853 | { |
841 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?"); |
854 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?"); |
842 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name); |
855 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name); |
843 | } |
856 | } |
844 | else |
857 | else |
845 | { |
858 | { |
846 | WriteText(164+dform_x,190,0x80,0,"...?"); |
859 | WriteText(164+dform_x,190,0x80,0,"...?"); |
847 | ESI = 24; |
860 | ESI = 24; |
848 | WriteText(dform_x+20,190,0,0,#file_name); |
861 | WriteText(dform_x+20,190,0,0,#file_name); |
849 | } |
862 | } |
850 | } |
863 | } |
851 | del_active=1; |
864 | del_active=1; |
852 | } |
865 | } |
853 | } |
866 | } |
854 | 867 | ||
855 | void SelectFileByName(dword that_file) |
868 | void SelectFileByName(dword that_file) |
856 | { |
869 | { |
857 | int ind; |
870 | int ind; |
858 | files.KeyHome(); |
871 | files.KeyHome(); |
859 | Open_Dir(#path,ONLY_OPEN); |
872 | Open_Dir(#path,ONLY_OPEN); |
860 | if (!real_files_names_case) strttl(that_file); |
873 | if (!real_files_names_case) strttl(that_file); |
861 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
874 | for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } |
862 | files.cur_y = ind - 1; |
875 | files.cur_y = ind - 1; |
863 | files.KeyDown(); |
876 | files.KeyDown(); |
864 | List_ReDraw(); |
877 | List_ReDraw(); |
865 | } |
878 | } |
866 | 879 | ||
867 | 880 | ||
868 | void Dir_Up() |
881 | void Dir_Up() |
869 | { |
882 | { |
870 | char cur_folder[4096]; |
883 | char cur_folder[4096]; |
871 | i=strlen(#path)-1; |
884 | i=strlen(#path)-1; |
872 | if (i==0) return; |
885 | if (i==0) return; |
873 | path[i]=0x00; |
886 | path[i]=0x00; |
874 | i = strrchr(#path, '/'); |
887 | i = strrchr(#path, '/'); |
875 | strcpy(#cur_folder, #path+i); |
888 | strcpy(#cur_folder, #path+i); |
876 | path[i]=0x00; |
889 | path[i]=0x00; |
877 | SelectFileByName(#cur_folder); |
890 | SelectFileByName(#cur_folder); |
878 | } |
891 | } |
879 | 892 | ||
880 | void Open(byte rez) |
893 | void Open(byte rez) |
881 | { |
894 | { |
882 | byte temp[4096]; |
895 | byte temp[4096]; |
883 | selected_count = 0; |
896 | selected_count = 0; |
884 | if (rez) |
897 | if (rez) |
885 | { |
898 | { |
886 | if (!strncmp(#file_name,"..",3)) return; |
899 | if (!strncmp(#file_name,"..",3)) return; |
887 | strcpy(#temp, #file_path); |
900 | strcpy(#temp, #file_path); |
888 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
901 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
889 | RunProgram("/sys/File Managers/Eolite", #temp); |
902 | RunProgram("/sys/File Managers/Eolite", #temp); |
890 | return; |
903 | return; |
891 | } |
904 | } |
892 | if (!files.count) return; |
905 | if (!files.count) return; |
893 | if (!itdir) |
906 | if (!itdir) |
894 | { |
907 | { |
895 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
908 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
896 | } |
909 | } |
897 | else |
910 | else |
898 | { |
911 | { |
899 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
912 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
900 | strcpy(#path, #file_path); |
913 | strcpy(#path, #file_path); |
901 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
914 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
902 | files.first=files.cur_y=0; |
915 | files.first=files.cur_y=0; |
903 | Open_Dir(#path,WITH_REDRAW); |
916 | Open_Dir(#path,WITH_REDRAW); |
904 | } |
917 | } |
905 | } |
918 | } |
906 | 919 | ||
907 | inline fastcall void GoBack() |
920 | inline fastcall void GoBack() |
908 | { |
921 | { |
909 | char cur_folder[4096]; |
922 | char cur_folder[4096]; |
910 | strcpy(#cur_folder, #path); |
923 | strcpy(#cur_folder, #path); |
911 | cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/' |
924 | cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/' |
912 | if (history.back()) { |
925 | if (history.back()) { |
913 | strcpy(#path, history.current()); |
926 | strcpy(#path, history.current()); |
914 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
927 | SelectFileByName(#cur_folder+strrchr(#cur_folder,'/')); |
915 | } |
928 | } |
916 | } |
929 | } |
917 | 930 | ||
918 | void ShowOpenWithDialog() |
931 | void ShowOpenWithDialog() |
919 | { |
932 | { |
920 | byte param[4097]; |
933 | byte param[4097]; |
921 | sprintf(#param,"~%s",#file_path); |
934 | sprintf(#param,"~%s",#file_path); |
922 | RunProgram("/sys/@open", #param); |
935 | RunProgram("/sys/@open", #param); |
923 | } |
936 | } |
924 | 937 | ||
925 | void NewElement(byte newf) |
938 | void NewElement(byte newf) |
926 | { |
939 | { |
927 | BDVK element_info; |
940 | BDVK element_info; |
928 | byte del_rezult, copy_rezult, info_result; |
941 | byte del_rezult, copy_rezult, info_result; |
929 | if (newf) |
942 | if (newf) |
930 | { |
943 | { |
931 | sprintf(#temp,"%s%s",#path,new_file_ed.text); |
944 | sprintf(#temp,"%s%s",#path,new_file_ed.text); |
932 | info_result = GetFileInfo(#temp, #element_info); |
945 | info_result = GetFileInfo(#temp, #element_info); |
933 | switch(new_element_active) |
946 | switch(new_element_active) |
934 | { |
947 | { |
935 | case CREATE_FILE: |
948 | case CREATE_FILE: |
936 | if (info_result==5) |
949 | if (info_result==5) |
937 | { |
950 | { |
938 | WriteFile(0, 0, #temp); |
951 | WriteFile(0, 0, #temp); |
939 | if (EAX) |
952 | if (EAX) |
940 | { |
953 | { |
941 | if (EAX==5) notify(NOT_CREATE_FILE); |
954 | if (EAX==5) notify(NOT_CREATE_FILE); |
942 | else Write_Error(EAX); |
955 | else Write_Error(EAX); |
943 | } |
956 | } |
944 | } |
957 | } |
945 | else |
958 | else |
946 | { |
959 | { |
947 | notify(FS_ITEM_ALREADY_EXISTS); |
960 | notify(FS_ITEM_ALREADY_EXISTS); |
948 | } |
961 | } |
949 | break; |
962 | break; |
950 | case CREATE_FOLDER: |
963 | case CREATE_FOLDER: |
951 | if (info_result==5) |
964 | if (info_result==5) |
952 | { |
965 | { |
953 | CreateDir(#temp); |
966 | CreateDir(#temp); |
954 | if (EAX) |
967 | if (EAX) |
955 | { |
968 | { |
956 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
969 | if (EAX==5) notify(NOT_CREATE_FOLDER); |
957 | else Write_Error(EAX); |
970 | else Write_Error(EAX); |
958 | } |
971 | } |
959 | } |
972 | } |
960 | else |
973 | else |
961 | { |
974 | { |
962 | notify(FS_ITEM_ALREADY_EXISTS); |
975 | notify(FS_ITEM_ALREADY_EXISTS); |
963 | } |
976 | } |
964 | break; |
977 | break; |
965 | case RENAME_ITEM: |
978 | case RENAME_ITEM: |
966 | if (info_result==5) |
979 | if (info_result==5) |
967 | { |
980 | { |
968 | if (itdir) |
981 | if (itdir) |
969 | { |
982 | { |
970 | //rename only empty folders |
983 | //rename only empty folders |
971 | if (del_rezult = DeleteFile(#file_path)) |
984 | if (del_rezult = DeleteFile(#file_path)) |
972 | { |
985 | { |
973 | Write_Error(del_rezult); |
986 | Write_Error(del_rezult); |
974 | return; |
987 | return; |
975 | } |
988 | } |
976 | if (CreateDir(#temp)) CreateDir(#file_path); |
989 | if (CreateDir(#temp)) CreateDir(#file_path); |
977 | Open_Dir(#path,WITH_REDRAW); |
990 | Open_Dir(#path,WITH_REDRAW); |
978 | SelectFileByName(new_file_ed.text); |
991 | SelectFileByName(new_file_ed.text); |
979 | } |
992 | } |
980 | else |
993 | else |
981 | { |
994 | { |
982 | if (copy_rezult = CopyFile(#file_path,#temp)) |
995 | if (copy_rezult = CopyFile(#file_path,#temp)) |
983 | { |
996 | { |
984 | Write_Error(copy_rezult); |
997 | Write_Error(copy_rezult); |
985 | } |
998 | } |
986 | else |
999 | else |
987 | { |
1000 | { |
988 | DeleteFile(#file_path); |
1001 | DeleteFile(#file_path); |
989 | SelectFileByName(new_file_ed.text); |
1002 | SelectFileByName(new_file_ed.text); |
990 | } |
1003 | } |
991 | } |
1004 | } |
992 | } |
1005 | } |
993 | else |
1006 | else |
994 | { |
1007 | { |
995 | notify(FS_ITEM_ALREADY_EXISTS); |
1008 | notify(FS_ITEM_ALREADY_EXISTS); |
996 | } |
1009 | } |
997 | } |
1010 | } |
998 | new_element_active = 0; |
1011 | new_element_active = 0; |
999 | Open_Dir(#path,WITH_REDRAW); |
1012 | Open_Dir(#path,WITH_REDRAW); |
1000 | SelectFileByName(new_file_ed.text); |
1013 | SelectFileByName(new_file_ed.text); |
1001 | } |
1014 | } |
1002 | new_element_active = 0; |
1015 | new_element_active = 0; |
1003 | Open_Dir(#path,WITH_REDRAW); |
1016 | Open_Dir(#path,WITH_REDRAW); |
1004 | } |
1017 | } |
1005 | 1018 | ||
1006 | void NewElement_Form(byte crt, dword strng) |
1019 | void NewElement_Form(byte crt, dword strng) |
1007 | { |
1020 | { |
1008 | int dform_x=files.w-220/2+files.x; |
1021 | int dform_x=files.w-220/2+files.x; |
1009 | if (!new_element_active) |
1022 | if (!new_element_active) |
1010 | { |
1023 | { |
1011 | new_element_active = crt; |
1024 | new_element_active = crt; |
1012 | strcpy(#new_element_name, strng); |
1025 | strcpy(#new_element_name, strng); |
1013 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
1026 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
1014 | } |
1027 | } |
1015 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1028 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1016 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1029 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1017 | new_file_ed.left = dform_x+24; |
1030 | new_file_ed.left = dform_x+24; |
1018 | DrawEditBox(#new_file_ed); |
1031 | DrawEditBox(#new_file_ed); |
1019 | } |
1032 | } |
1020 | 1033 | ||
1021 | void FnProcess(byte N) |
1034 | void FnProcess(byte N) |
1022 | { |
1035 | { |
1023 | switch(N) |
1036 | switch(N) |
1024 | { |
1037 | { |
1025 | case 1: |
1038 | case 1: |
1026 | if (!active_about) |
1039 | if (!active_about) |
1027 | { |
1040 | { |
1028 | about_stak = malloc(4096); |
1041 | about_stak = malloc(4096); |
1029 | about_window = CreateThread(#about_dialog,about_stak+4092); |
1042 | about_window = CreateThread(#about_dialog,about_stak+4092); |
1030 | break; |
1043 | break; |
1031 | } |
1044 | } |
1032 | else |
1045 | else |
1033 | { |
1046 | { |
1034 | ActivateWindow(GetProcessSlot(about_window)); |
1047 | ActivateWindow(GetProcessSlot(about_window)); |
1035 | } |
1048 | } |
1036 | break; |
1049 | break; |
1037 | case 2: |
1050 | case 2: |
1038 | if (!files.count) break; |
1051 | if (!files.count) break; |
1039 | NewElement_Form(RENAME_ITEM, #file_name); |
1052 | NewElement_Form(RENAME_ITEM, #file_name); |
1040 | break; |
1053 | break; |
1041 | case 3: |
1054 | case 3: |
1042 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
1055 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
1043 | break; |
1056 | break; |
1044 | case 4: |
1057 | case 4: |
1045 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1058 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1046 | break; |
1059 | break; |
1047 | case 5: //refresh cur dir & devs |
1060 | case 5: //refresh cur dir & devs |
1048 | if (two_panels) |
1061 | if (two_panels) |
1049 | { |
1062 | { |
1050 | DrawFilePanels(); |
1063 | DrawFilePanels(); |
1051 | } |
1064 | } |
1052 | else |
1065 | else |
1053 | { |
1066 | { |
1054 | Tip(56, T_DEVICES, 55, "-"); |
1067 | Tip(56, T_DEVICES, 55, "-"); |
1055 | Open_Dir(#path,WITH_REDRAW); |
1068 | Open_Dir(#path,WITH_REDRAW); |
1056 | pause(10); |
1069 | pause(10); |
1057 | SystemDiscs.Get(); |
1070 | SystemDiscs.Get(); |
1058 | Open_Dir(#path,WITH_REDRAW); |
1071 | Open_Dir(#path,WITH_REDRAW); |
1059 | DrawDeviceAndActionsLeftPanel(); |
1072 | DrawDeviceAndActionsLeftPanel(); |
1060 | } |
1073 | } |
1061 | break; |
1074 | break; |
1062 | case 6: |
1075 | case 6: |
1063 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1076 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
1064 | break; |
1077 | break; |
1065 | case 7: |
1078 | case 7: |
1066 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1079 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
1067 | break; |
1080 | break; |
1068 | case 8: |
1081 | case 8: |
1069 | properties_stak = malloc(8096); |
1082 | properties_stak = malloc(8096); |
1070 | CreateThread(#properties_dialog, properties_stak+8092); |
1083 | CreateThread(#properties_dialog, properties_stak+8092); |
1071 | break; |
1084 | break; |
1072 | case 10: //F10 |
1085 | case 10: //F10 |
1073 | if (!active_settings) |
1086 | if (!active_settings) |
1074 | { |
1087 | { |
1075 | settings_stak = malloc(4096); |
1088 | settings_stak = malloc(4096); |
1076 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1089 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
1077 | break; |
1090 | break; |
1078 | } |
1091 | } |
1079 | else |
1092 | else |
1080 | { |
1093 | { |
1081 | ActivateWindow(GetProcessSlot(settings_window)); |
1094 | ActivateWindow(GetProcessSlot(settings_window)); |
1082 | } |
1095 | } |
1083 | break; |
1096 | break; |
1084 | } |
1097 | } |
1085 | } |
1098 | } |
1086 | 1099 | ||
1087 | void ChangeActivePanel() |
1100 | void ChangeActivePanel() |
1088 | { |
1101 | { |
1089 | llist_copy(#files_active, #files_inactive); |
1102 | llist_copy(#files_active, #files_inactive); |
1090 | llist_copy(#files_inactive, #files); |
1103 | llist_copy(#files_inactive, #files); |
1091 | strcpy(#active_path, #inactive_path); |
1104 | strcpy(#active_path, #inactive_path); |
1092 | strcpy(#inactive_path, #path); |
1105 | strcpy(#inactive_path, #path); |
1093 | DrawFilePanels(); |
1106 | DrawFilePanels(); |
1094 | } |
1107 | } |
1095 | 1108 | ||
1096 | 1109 | ||
1097 | stop:28)>>9)>5)>5;>6;>3;>>>>><> |
1110 | stop:28)>>9)>5)>5;>6;>3;>>>>><> |
1098 | >0)>0)>=files.x+files.w+18)> |
1111 | >0)>0)>=files.x+files.w+18)> |
1099 | > |
1112 | > |
1100 | >=files.x+files.w+16)> |
1113 | >=files.x+files.w+16)> |
1101 | >=files.x+files.w+16)>>> |
1114 | >=files.x+files.w+16)>>> |