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