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