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