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