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