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