Rev 5606 | Rev 5609 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5481 | leency | 1 | //Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015 |
3363 | leency | 2 | //GNU GPL licence. |
3 | |||
4022 | leency | 4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
||
6 | #endif |
||
7 | |||
3363 | leency | 8 | //libraries |
4049 | leency | 9 | #define MEMSIZE 0xD0000 |
3363 | leency | 10 | #include "..\lib\kolibri.h" |
4427 | punk_joker | 11 | #include "..\lib\clipboard.h" |
3363 | leency | 12 | #include "..\lib\strings.h" |
13 | #include "..\lib\mem.h" |
||
14 | #include "..\lib\dll.h" |
||
15 | #include "..\lib\file_system.h" |
||
5499 | leency | 16 | #include "..\lib\gui.h" |
3434 | leency | 17 | #include "..\lib\list_box.h" |
18 | #include "..\lib\copyf.h" |
||
4863 | leency | 19 | #include "..\lib\random.h" |
5487 | leency | 20 | //obj |
5499 | leency | 21 | #include "..\lib\obj\libini.h" |
22 | #include "..\lib\obj\box_lib.h" |
||
3363 | leency | 23 | //images |
24 | #include "imgs\toolbar.txt" |
||
25 | #include "imgs\left_p.txt" |
||
4846 | leency | 26 | #include "imgs\icons.txt" |
3363 | leency | 27 | |
3848 | punk_joker | 28 | #ifdef LANG_RUS |
29 | ?define T_FILE "Файл" |
||
30 | ?define T_TYPE "Тип" |
||
31 | ?define T_SIZE "Размер" |
||
32 | ?define T_NEW_FOLDER "Новая папка" |
||
33 | ?define T_NEW_FILE "Новый файл" |
||
34 | ?define T_DELETE_FILE "Вы действительно хотите удалить" |
||
35 | ?define T_YES "Да" |
||
36 | ?define T_NO "Нет" |
||
5555 | punk_joker | 37 | ?define T_CANCEL "Отмена" |
38 | ?define T_CREATE "Создать" |
||
5571 | punk_joker | 39 | ?define T_RENAME "Переименовать" |
5557 | punk_joker | 40 | ?define FILE_EXISTS "Файл с таким именем существует" |
41 | ?define FOLDER_EXISTS "Папка с таким именем существует" |
||
3848 | punk_joker | 42 | ?define T_DEL_ERROR_1 "Ошибка. Папка не пустая." |
3997 | leency | 43 | ?define WAIT_DELETING_FOLDER "Удаляется папка. Подожите..." |
3848 | punk_joker | 44 | ?define NOT_CREATE_FOLDER "Не удалось создать папку." |
45 | ?define NOT_CREATE_FILE "Не удалось создать файл." |
||
5506 | punk_joker | 46 | ?define ERROR_1 "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj" |
5514 | leency | 47 | ?define T_PASTE_WINDOW_TITLE "Копирую..." |
3883 | leency | 48 | ?define T_PASTE_WINDOW_TEXT "Копируется файл:" |
5514 | leency | 49 | ?define T_PASTE_WINDOW_BUTTON "Прервать" |
50 | ?define INFO_AFTER_COPY "Копирование завершено" |
||
4022 | leency | 51 | ?define T_CANCEL_PASTE "Копирование прекращено. Папка скопирована не полностью." |
4049 | leency | 52 | ?define T_SELECT_APP_TO_OPEN_WITH "Выберите программу для открытия файла" |
5514 | leency | 53 | ?define DEL_MORE_FILES_1 "выбранные элементы (" |
5512 | punk_joker | 54 | ?define DEL_MORE_FILES_2 " шт.)?" |
3933 | kaitz | 55 | #elif LANG_EST |
56 | ?define T_FILE "Fail" |
||
57 | ?define T_TYPE "T№№p" |
||
58 | ?define T_SIZE "Suurus" |
||
59 | ?define T_NEW_FOLDER "Uus kataloog" |
||
60 | ?define T_NEW_FILE "Uus fail" |
||
61 | ?define T_DELETE_FILE "Kas sa tahad tїesti kustutada" |
||
62 | ?define T_YES "Jah" |
||
63 | ?define T_NO "Ei" |
||
5556 | punk_joker | 64 | ?define T_CANCEL "Cancel" |
65 | ?define T_CREATE "Create" |
||
5571 | punk_joker | 66 | ?define T_RENAME "Rename" |
5557 | punk_joker | 67 | ?define FILE_EXISTS "The file with the same name exists" |
68 | ?define FOLDER_EXISTS "A folder with the same name exists" |
||
3933 | kaitz | 69 | ?define T_DEL_ERROR_1 "Viga. Kataloog ei ole t№hi." |
3997 | leency | 70 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
3933 | kaitz | 71 | ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua." |
72 | ?define NOT_CREATE_FILE "Faili ei saa luua." |
||
5506 | punk_joker | 73 | ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" |
5514 | leency | 74 | ?define T_PASTE_WINDOW_TITLE "Kopeerin..." |
3933 | kaitz | 75 | ?define T_PASTE_WINDOW_TEXT "Kopeerin faili:" |
5514 | leency | 76 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
77 | ?define INFO_AFTER_COPY "Copy finished" |
||
4022 | leency | 78 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
4049 | leency | 79 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
5514 | leency | 80 | ?define DEL_MORE_FILES_1 "selected items(" |
81 | ?define DEL_MORE_FILES_2 " pcs.)?" |
||
3848 | punk_joker | 82 | #else |
83 | ?define T_FILE "File" |
||
84 | ?define T_TYPE "Type" |
||
85 | ?define T_SIZE "Size" |
||
86 | ?define T_NEW_FOLDER "New folder" |
||
87 | ?define T_NEW_FILE "New file" |
||
88 | ?define T_DELETE_FILE "Do you really want to delete" |
||
89 | ?define T_YES "Yes" |
||
90 | ?define T_NO "No" |
||
5556 | punk_joker | 91 | ?define T_CANCEL "Cancel" |
92 | ?define T_CREATE "Create" |
||
5571 | punk_joker | 93 | ?define T_RENAME "Rename" |
5557 | punk_joker | 94 | ?define FILE_EXISTS "The file with the same name exists" |
95 | ?define FOLDER_EXISTS "A folder with the same name exists" |
||
3848 | punk_joker | 96 | ?define T_DEL_ERROR_1 "Error. Folder isn't empty." |
3997 | leency | 97 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
3848 | punk_joker | 98 | ?define NOT_CREATE_FOLDER "Folder can not be created." |
99 | ?define NOT_CREATE_FILE "File can not be created." |
||
5506 | punk_joker | 100 | ?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj" |
5514 | leency | 101 | ?define T_PASTE_WINDOW_TITLE "Copying..." |
3883 | leency | 102 | ?define T_PASTE_WINDOW_TEXT "Copying file:" |
5514 | leency | 103 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
104 | ?define INFO_AFTER_COPY "Copy finished" |
||
4022 | leency | 105 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
4049 | leency | 106 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
5514 | leency | 107 | ?define DEL_MORE_FILES_1 "selected items(" |
108 | ?define DEL_MORE_FILES_2 " pcs.)?" |
||
3848 | punk_joker | 109 | #endif |
110 | |||
3444 | leency | 111 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
5581 | leency | 112 | enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement |
3444 | leency | 113 | |
5581 | leency | 114 | #define TITLE "Eolite File Manager v2.81" |
115 | #define ABOUT_TITLE "Eolite v2.81" |
||
4076 | leency | 116 | dword col_padding, col_selec, col_lpanel; |
3363 | leency | 117 | |
3434 | leency | 118 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
119 | struct path_string { char Item[4096]; }; |
||
3363 | leency | 120 | |
4136 | punk_joker | 121 | byte active_about=0; |
4070 | punk_joker | 122 | word about_window; |
5416 | punk_joker | 123 | byte active_settings=0; |
124 | word settings_window; |
||
5606 | pavelyakov | 125 | dword _not_draw = false; |
4136 | punk_joker | 126 | byte menu_call_mouse=0; |
127 | |||
3434 | leency | 128 | llist files; |
129 | |||
130 | byte |
||
3363 | leency | 131 | path[4096], |
132 | file_path[4096], |
||
3404 | leency | 133 | file_name[256], |
5555 | punk_joker | 134 | new_element_name[256], |
3434 | leency | 135 | temp[4096]; |
136 | byte |
||
3439 | leency | 137 | del_active=0, |
5555 | punk_joker | 138 | new_element_active=0, |
4399 | punk_joker | 139 | show_dev_name=1, |
4225 | punk_joker | 140 | real_files_names_case=0, |
5532 | leency | 141 | use_big_fonts=0, |
142 | font_type, |
||
5459 | punk_joker | 143 | info_after_copy=0, |
3434 | leency | 144 | sort_num=2, |
3441 | leency | 145 | itdir; |
3363 | leency | 146 | |
5441 | leency | 147 | dword eolite_ini_path; |
148 | |||
5608 | leency | 149 | dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak; |
150 | |||
3363 | leency | 151 | proc_info Form; |
4076 | leency | 152 | system_colors sc; |
3363 | leency | 153 | mouse m; |
5532 | leency | 154 | int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive; |
4897 | leency | 155 | dword buf; |
3434 | leency | 156 | dword file_mas[6898]; |
157 | int j, i; |
||
4028 | leency | 158 | int action_buf; |
4863 | leency | 159 | int rand_n; |
5513 | punk_joker | 160 | int selected_count; |
5591 | pavelyakov | 161 | byte CMD_REFRESH; |
3363 | leency | 162 | |
5549 | punk_joker | 163 | mouse gestures; |
164 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
||
165 | byte stats; |
||
166 | |||
5557 | punk_joker | 167 | edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_name,#mouse_dd,64,6,6}; |
5581 | leency | 168 | edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; |
3434 | leency | 169 | PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; |
3363 | leency | 170 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
5576 | pavelyakov | 171 | byte cmd_free; |
4042 | leency | 172 | #include "include\copy.h" |
5435 | leency | 173 | #include "include\gui.h" |
3363 | leency | 174 | #include "include\sorting.h" |
4042 | leency | 175 | #include "include\icons.h" |
3363 | leency | 176 | #include "include\left_panel.h" |
177 | #include "include\history.h" |
||
4042 | leency | 178 | #include "include\menu.h" |
179 | #include "include\about.h" |
||
5416 | punk_joker | 180 | #include "include\settings.h" |
5447 | punk_joker | 181 | #include "include\properties.h" |
3363 | leency | 182 | |
5576 | pavelyakov | 183 | |
3363 | leency | 184 | void main() |
185 | { |
||
3444 | leency | 186 | word key, id, can_show, can_select, m_selected; |
4897 | leency | 187 | dword selected_offset; |
5591 | pavelyakov | 188 | dword IPC_LEN,IPC_ID; |
189 | char IPC_BUF[10]; |
||
190 | dword tmp; |
||
4863 | leency | 191 | rand_n = random(40); |
5549 | punk_joker | 192 | gestures.get(); |
3363 | leency | 193 | mem_Init(); |
3848 | punk_joker | 194 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1); |
5399 | punk_joker | 195 | if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini"); |
5441 | leency | 196 | eolite_ini_path = abspath("Eolite.ini"); |
197 | LoadIniSettings(); |
||
198 | GetSystemDiscs(); |
||
4076 | leency | 199 | SetAppColors(); |
3363 | leency | 200 | if (param) |
201 | { |
||
5591 | pavelyakov | 202 | tmp = strlen(#path); |
203 | strncpy(#path, #param, tmp); |
||
204 | $dec tmp |
||
205 | if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string |
||
3363 | leency | 206 | } |
207 | else |
||
3695 | leency | 208 | { |
5591 | pavelyakov | 209 | strncpy(#path, "/rd/1/", 6); |
3695 | leency | 210 | } |
3363 | leency | 211 | Open_Dir(#path,ONLY_OPEN); |
5606 | pavelyakov | 212 | SetEventMask(1100111b); |
5591 | pavelyakov | 213 | loop(){ |
214 | switch(WaitEvent()) |
||
215 | { |
||
216 | case evMouse: |
||
217 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
||
218 | if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) |
||
219 | { |
||
220 | edit_box_mouse stdcall(#new_file_ed); |
||
221 | break; |
||
222 | } |
||
5549 | punk_joker | 223 | |
5591 | pavelyakov | 224 | m.get(); |
225 | |||
226 | |||
227 | gestures.get(); |
||
228 | if (!gestures.mkm) && (stats>0) stats = 0; |
||
229 | if (gestures.mkm) && (stats==0) |
||
5549 | punk_joker | 230 | { |
5591 | pavelyakov | 231 | x_old = gestures.x; |
232 | y_old = gestures.y; |
||
233 | stats = 1; |
||
234 | } |
||
235 | if (gestures.mkm) && (stats==1) |
||
236 | { |
||
237 | dif_x = gestures.x-x_old; |
||
238 | dif_y = gestures.y-y_old; |
||
239 | adif_x = fabs(dif_x); |
||
240 | adif_y = fabs(dif_y); |
||
241 | |||
242 | if (adif_x>adif_y) |
||
5549 | punk_joker | 243 | { |
5591 | pavelyakov | 244 | if (dif_x > 150) |
245 | { |
||
246 | if (HistoryPath(GO_FORWARD)) |
||
247 | { |
||
248 | files.first=files.current=NULL; |
||
249 | Open_Dir(#path,WITH_REDRAW); |
||
250 | } |
||
251 | stats = 0; |
||
252 | } |
||
253 | if (dif_x < -150) |
||
254 | { |
||
255 | GoBack(); |
||
256 | stats = 0; |
||
257 | } |
||
5549 | punk_joker | 258 | } |
5591 | pavelyakov | 259 | else |
5549 | punk_joker | 260 | { |
5591 | pavelyakov | 261 | if (dif_y < -100) |
262 | { |
||
263 | Dir_Up(); |
||
264 | stats = 0; |
||
265 | } |
||
5549 | punk_joker | 266 | } |
5591 | pavelyakov | 267 | } |
268 | if (files.MouseOver(m.x, m.y))&&((m.up)||(m.down)||(m.dblclick)) |
||
5549 | punk_joker | 269 | { |
5591 | pavelyakov | 270 | //select/open file { |
271 | if (m.key&MOUSE_LEFT)&&((m.down)||(m.dblclick)) |
||
5549 | punk_joker | 272 | { |
5591 | pavelyakov | 273 | if (m.y>=files.y)//&&(m.click) |
274 | { |
||
275 | id = m.y - files.y / files.line_h; |
||
276 | if (files.current!=id) |
||
277 | { |
||
278 | m.clearTime(); |
||
279 | if (id |
||
280 | } |
||
281 | else if(m.dblclick)Open(0); |
||
282 | } |
||
5549 | punk_joker | 283 | } |
5591 | pavelyakov | 284 | // } select/open file |
285 | else |
||
286 | //file menu { |
||
287 | if (m.key&MOUSE_RIGHT)&&(m.up) |
||
5575 | pavelyakov | 288 | { |
5591 | pavelyakov | 289 | menu_call_mouse = 1; |
290 | if (m.y>=files.y)//&&(m.click) |
||
5575 | pavelyakov | 291 | { |
5591 | pavelyakov | 292 | id = m.y - files.y / files.line_h; |
293 | if (files.current!=id) List_Current(id-files.current); |
||
294 | //SwitchToAnotherThread(); |
||
295 | menu_stak = malloc(4096); |
||
296 | CreateThread(#FileMenu,menu_stak+4092); |
||
5575 | pavelyakov | 297 | } |
5591 | pavelyakov | 298 | break; |
5575 | pavelyakov | 299 | } |
5591 | pavelyakov | 300 | // } file menu |
5575 | pavelyakov | 301 | } |
5591 | pavelyakov | 302 | |
303 | if (m.vert) |
||
5575 | pavelyakov | 304 | { |
5591 | pavelyakov | 305 | if (files.MouseScroll(m.vert)) List_ReDraw(); |
306 | break; |
||
307 | } |
||
308 | |||
309 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y |
||
310 | { |
||
311 | if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF); |
||
312 | WHILE (m.lkm==1) && (files.first>0) |
||
5575 | pavelyakov | 313 | { |
5591 | pavelyakov | 314 | pause(8); |
315 | files.first--; |
||
316 | List_ReDraw(); |
||
317 | m.get(); |
||
5575 | pavelyakov | 318 | } |
5591 | pavelyakov | 319 | DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7); |
5575 | pavelyakov | 320 | } |
3363 | leency | 321 | |
5591 | pavelyakov | 322 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y |
3363 | leency | 323 | { |
5591 | pavelyakov | 324 | if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); |
325 | while (m.lkm==1) && (files.first |
||
326 | { |
||
327 | pause(8); |
||
328 | files.first++; |
||
329 | List_ReDraw(); |
||
330 | m.get(); |
||
331 | } |
||
332 | DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
||
3363 | leency | 333 | } |
334 | |||
5591 | pavelyakov | 335 | //Scrooll |
336 | if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); } |
||
337 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y |
||
338 | |||
339 | if (scroll_used) |
||
3363 | leency | 340 | { |
5591 | pavelyakov | 341 | if (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
342 | id=files.first; |
||
343 | j= sc_slider_h/2; |
||
344 | files.first = m.y -j -files.y * files.count; |
||
345 | files.first /= onTop(22,files.y); |
||
346 | if (files.visible+files.first>files.count) files.first=files.count-files.visible; |
||
347 | if (id!=files.first) List_ReDraw(); |
||
3363 | leency | 348 | } |
5591 | pavelyakov | 349 | break; |
350 | //Button pressed----------------------------------------------------------------------------- |
||
351 | case evButton: |
||
352 | id=GetButtonID(); |
||
353 | if (id==1) |
||
354 | { |
||
355 | KillProcess(about_window); |
||
356 | ExitProcess(); |
||
357 | } |
||
358 | if (del_active) |
||
359 | { |
||
360 | if (id==301) || (id==302) Del_File(302-id); |
||
361 | break; |
||
362 | } |
||
363 | if (new_element_active) |
||
364 | { |
||
365 | if (id==301) || (id==302) NewElement(302-id); |
||
366 | break; |
||
367 | } |
||
368 | |||
369 | switch(id) |
||
370 | { |
||
371 | case 21: //Back |
||
372 | GoBack(); |
||
373 | break; |
||
374 | case 22: //Forward |
||
375 | if (HistoryPath(GO_FORWARD)) |
||
376 | { |
||
377 | files.first=files.current=NULL; //aaa?o nienea |
||
378 | Open_Dir(#path,WITH_REDRAW); |
||
379 | } |
||
380 | break; |
||
5608 | leency | 381 | case 23: |
3363 | leency | 382 | Dir_Up(); |
383 | break; |
||
5608 | leency | 384 | case 24: |
3444 | leency | 385 | Copy(#file_path, CUT); |
386 | break; |
||
5608 | leency | 387 | case 25: |
3444 | leency | 388 | Copy(#file_path, NOCUT); |
3363 | leency | 389 | break; |
5608 | leency | 390 | case 26: |
391 | Paste(); |
||
3363 | leency | 392 | break; |
5591 | pavelyakov | 393 | case 31...33: //sort |
394 | if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); |
||
395 | if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10); |
||
396 | if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10); |
||
397 | sort_num=id-30; |
||
398 | Open_Dir(#path,WITH_REDRAW); |
||
5512 | punk_joker | 399 | break; |
5591 | pavelyakov | 400 | case 50...60: //Actions |
401 | FnProcess(id-50); |
||
5512 | punk_joker | 402 | break; |
5591 | pavelyakov | 403 | case 100...120: |
404 | DEVICE_MARK: |
||
405 | DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea |
||
406 | strcpy(#path, #disk_list[id-100].Item); |
||
407 | files.first=files.current=0; |
||
408 | Open_Dir(#path,WITH_REDRAW); |
||
409 | pause(5); |
||
410 | DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF); |
||
3363 | leency | 411 | break; |
5591 | pavelyakov | 412 | } |
413 | break; |
||
414 | //Key pressed----------------------------------------------------------------------------- |
||
415 | case evKey: |
||
416 | key = GetKey(); |
||
417 | if (Form.status_window>2) break; |
||
418 | if (del_active) |
||
419 | { |
||
420 | if (key==013) Del_File(true); |
||
421 | if (key==027) Del_File(false); |
||
422 | break; |
||
423 | } |
||
424 | if (new_element_active) |
||
425 | { |
||
426 | if (key==027) NewElement(0); |
||
427 | if (key==013) NewElement(1); |
||
428 | EAX=key<<8; |
||
429 | edit_box_key stdcall (#new_file_ed); |
||
430 | break; |
||
431 | } |
||
432 | if (edit2.flags!=64) && (key!=13) && (key!=27) |
||
433 | { |
||
434 | EAX=key<<8; |
||
435 | edit_box_key stdcall (#edit2); |
||
436 | break; |
||
437 | } |
||
438 | switch (key) |
||
439 | { |
||
440 | case 209...217: |
||
441 | id=key-110; |
||
442 | if (id-100>=disc_num) break; |
||
443 | GOTO DEVICE_MARK; |
||
444 | case ASCII_KEY_BS: |
||
445 | //GoBack(); |
||
446 | Dir_Up(); |
||
447 | break; |
||
448 | case 004: //Ctrl+D set as bg |
||
449 | strncpy(#temp, "\\S__",4); |
||
450 | strcat(#temp, #file_path); |
||
451 | RunProgram("/sys/media/kiv", #temp); |
||
452 | break; |
||
453 | case 014: //Ctrl+N new window |
||
454 | if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
||
455 | RunProgram("/sys/File Managers/Eolite", #path); |
||
456 | break; |
||
457 | case 024: //Ctrl+X |
||
458 | Copy(#file_path, CUT); |
||
459 | break; |
||
460 | case 003: //Ctrl+C |
||
461 | Copy(#file_path, NOCUT); |
||
462 | break; |
||
463 | case 022: //Ctrl+V |
||
5608 | leency | 464 | Paste(); |
5591 | pavelyakov | 465 | break; |
466 | case 001: //Ctrl+A |
||
467 | debugln("press Ctrl+A"); |
||
468 | for (i=0; i |
||
3363 | leency | 469 | { |
5591 | pavelyakov | 470 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
471 | ESBYTE[selected_offset] = 1; |
||
472 | selected_count++; |
||
3363 | leency | 473 | } |
5591 | pavelyakov | 474 | List_ReDraw(); |
475 | break; |
||
476 | case 021: //Ctrl+U |
||
477 | debugln("press Ctrl+A"); |
||
478 | for (i=0; i |
||
479 | { |
||
480 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
||
481 | ESBYTE[selected_offset] = 0; |
||
482 | } |
||
483 | selected_count = 0; |
||
484 | List_ReDraw(); |
||
485 | break; |
||
486 | case ASCII_KEY_ESC: |
||
487 | break; |
||
488 | case ASCII_KEY_ENTER: |
||
489 | Open(0); |
||
490 | break; |
||
491 | case 074: //menu |
||
492 | menu_call_mouse=0; |
||
493 | //SwitchToAnotherThread(); |
||
494 | menu_stak = malloc(4096); |
||
495 | CreateThread(#FileMenu,menu_stak+4092); |
||
496 | break; |
||
497 | case 173: //Ctrl+Enter |
||
498 | if (!itdir) ShowOpenWithDialog(); |
||
499 | else Open(1); |
||
500 | break; |
||
501 | case ASCII_KEY_UP: |
||
502 | List_Current(-1); |
||
503 | break; |
||
504 | case ASCII_KEY_DOWN: |
||
505 | List_Current(1); |
||
506 | break; |
||
507 | case ASCII_KEY_HOME: |
||
508 | if (files.KeyHome()) List_ReDraw(); |
||
509 | break; |
||
510 | case ASCII_KEY_END: |
||
511 | if (files.KeyEnd()) List_ReDraw(); |
||
512 | break; |
||
513 | case ASCII_KEY_PGDN: |
||
514 | List_Current(files.visible-1); |
||
515 | break; |
||
516 | case ASCII_KEY_PGUP: |
||
517 | List_Current(-files.visible+1); |
||
518 | break; |
||
519 | case ASCII_KEY_DEL: |
||
520 | Del_Form(); |
||
521 | break; |
||
522 | case ASCII_KEY_INS: |
||
523 | selected_offset = file_mas[files.current+files.first]*304 + buf+32 + 7; |
||
524 | if (ESBYTE[selected_offset]) |
||
525 | { |
||
526 | ESBYTE[selected_offset]=0; |
||
527 | selected_count--; |
||
528 | } |
||
529 | else |
||
530 | { |
||
531 | ESBYTE[selected_offset] = 1; |
||
532 | selected_count++; |
||
533 | } |
||
534 | List_Current(1); |
||
535 | break; |
||
536 | case 048...059: //F1-F10 |
||
537 | FnProcess(key-49); |
||
538 | break; |
||
539 | default: |
||
540 | for (i=files.current+files.first+1; i |
||
541 | { |
||
542 | strcpy(#temp, file_mas[i]*304+buf+72); |
||
543 | if (temp[0]==key) || (temp[0]==key-32) |
||
544 | { |
||
545 | List_Current(i-files.current-files.first); |
||
546 | break; |
||
547 | } |
||
548 | } |
||
549 | } |
||
3363 | leency | 550 | break; |
5591 | pavelyakov | 551 | case evReDraw: |
552 | DRAW_WINDOW: |
||
553 | draw_window(); |
||
554 | if (action_buf) |
||
555 | { |
||
556 | menu_action(action_buf); |
||
557 | action_buf=0; |
||
558 | } |
||
559 | break; |
||
5606 | pavelyakov | 560 | case evIPC: |
561 | goto DRAW_WINDOW; |
||
562 | break; |
||
5591 | pavelyakov | 563 | } |
564 | |||
565 | if(cmd_free) |
||
566 | { |
||
5576 | pavelyakov | 567 | if(cmd_free==1) free(menu_stak); |
568 | else if(cmd_free==2)free(about_stak); |
||
569 | else if(cmd_free==3)free(properties_stak); |
||
570 | else if(cmd_free==4)free(settings_stak); |
||
571 | else if(cmd_free==5)free(copy_stak); |
||
5591 | pavelyakov | 572 | cmd_free = false; |
5576 | pavelyakov | 573 | } |
574 | } |
||
3363 | leency | 575 | } |
576 | |||
4225 | punk_joker | 577 | |
5435 | leency | 578 | inline fastcall signed int _strrchr( ESI,BL) |
579 | { |
||
580 | int jj=0, last=strlen(ESI); |
||
5591 | pavelyakov | 581 | do { |
5435 | leency | 582 | jj++; |
583 | $lodsb |
||
5591 | pavelyakov | 584 | if(AL==BL) last=jj; |
5435 | leency | 585 | } while(AL!=0); |
586 | return last; |
||
587 | } |
||
4225 | punk_joker | 588 | |
5435 | leency | 589 | |
4028 | leency | 590 | void menu_action(dword id) |
591 | { |
||
592 | if (id==COPY_PASTE_END) |
||
593 | { |
||
594 | FnProcess(5); |
||
595 | SelectFile(#copy_to+strrchr(#copy_to,'/')); |
||
596 | } |
||
5443 | punk_joker | 597 | if (id==100) Open(0); |
4225 | punk_joker | 598 | if (id==201) ShowOpenWithDialog(); |
4028 | leency | 599 | if (id==202) FnProcess(3); //F3 |
600 | if (id==203) FnProcess(4); //F4 |
||
601 | if (id==104) Copy(#file_path, NOCUT); |
||
602 | if (id==105) Copy(#file_path, CUT); |
||
5608 | leency | 603 | if (id==106) Paste(); |
4034 | leency | 604 | if (id==207) FnProcess(2); |
4028 | leency | 605 | if (id==108) Del_Form(); |
606 | if (id==109) FnProcess(5); |
||
5447 | punk_joker | 607 | if (id==110) FnProcess(8); |
5591 | pavelyakov | 608 | if (id==300) |
609 | { |
||
610 | FnProcess(5); |
||
611 | List_ReDraw(); |
||
612 | } |
||
4028 | leency | 613 | } |
3363 | leency | 614 | |
4028 | leency | 615 | |
3444 | leency | 616 | void draw_window() |
617 | { |
||
4863 | leency | 618 | DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,sc.work,TITLE,0); |
3444 | leency | 619 | GetProcessInfo(#Form, SelfInfo); |
620 | if (Form.status_window>2) return; |
||
5441 | leency | 621 | files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h); |
3444 | leency | 622 | if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); |
623 | if (Form.width<480) MoveSize(OLD,OLD,480,OLD); |
||
624 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
||
625 | |||
3363 | leency | 626 | PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal); |
4076 | leency | 627 | DrawBar(127, 8, 1, 25, sc.work_graph); |
628 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,sc.work); |
||
629 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,sc.work); |
||
5441 | leency | 630 | DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox |
631 | DrawBar(246,29,Form.cwidth - 297,5,sc.work); //under editbox |
||
632 | DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph); |
||
5576 | pavelyakov | 633 | DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about |
3363 | leency | 634 | PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); |
3434 | leency | 635 | //main rectangles |
4076 | leency | 636 | DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph); |
3444 | leency | 637 | DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg |
3363 | leency | 638 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
639 | DrawLeftPanel(); |
||
3434 | leency | 640 | //ListBox |
5444 | leency | 641 | DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,sc.work,T_FILE); |
642 | DrawFlatButton(Form.cwidth - 159,40,73,16,32,sc.work,T_TYPE); |
||
643 | DrawFlatButton(Form.cwidth - 86,40,68,16,33,sc.work,T_SIZE); |
||
4076 | leency | 644 | DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),sc.work_graph); //line to the left from the scroll |
645 | DrawFlatButton(files.x+files.w,40,16,16,0,sc.work,"\x18"); |
||
646 | DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,sc.work,"\x19"); |
||
3363 | leency | 647 | Open_Dir(#path,ONLY_SHOW); |
648 | if (del_active) Del_Form(); |
||
5581 | leency | 649 | if (new_element_active) NewElement_Form(new_element_active, #new_element_name); |
3363 | leency | 650 | } |
651 | |||
652 | |||
653 | void KEdit() |
||
654 | { |
||
3434 | leency | 655 | if (Form.width<480) return; |
3363 | leency | 656 | PathShow.area_size_x = Form.cwidth-306; |
657 | DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff); |
||
658 | PathShow_prepare stdcall(#PathShow); |
||
659 | PathShow_draw stdcall(#PathShow); |
||
660 | } |
||
661 | |||
662 | |||
5511 | leency | 663 | void List_Current(signed int cur) |
3363 | leency | 664 | { |
3434 | leency | 665 | if (cur<=0) //up |
3363 | leency | 666 | { |
5591 | pavelyakov | 667 | if (files.first==0) && (files.current<=0) return; |
668 | if (-cur-1 |
||
3363 | leency | 669 | { |
3434 | leency | 670 | Line_ReDraw(0xFFFFFF, files.current); |
671 | files.current+=cur; |
||
672 | Line_ReDraw(col_selec, files.current); |
||
3363 | leency | 673 | return; |
674 | } |
||
5591 | pavelyakov | 675 | else |
3363 | leency | 676 | { |
5591 | pavelyakov | 677 | if (-cur |
3434 | leency | 678 | files.current=0; |
3363 | leency | 679 | List_ReDraw(); |
680 | return; |
||
681 | } |
||
682 | } |
||
3434 | leency | 683 | else //down |
3363 | leency | 684 | { |
5591 | pavelyakov | 685 | if (files.first==files.count-files.visible) && (files.current==files.visible-1) |
5511 | leency | 686 | { |
687 | Line_ReDraw(col_selec, files.current); |
||
688 | return; |
||
689 | } |
||
5591 | pavelyakov | 690 | if (files.visible-files.current>cur) |
3363 | leency | 691 | { |
3434 | leency | 692 | Line_ReDraw(0xFFFFFF, files.current); |
693 | files.current+=cur; |
||
694 | Line_ReDraw(col_selec, files.current); |
||
3363 | leency | 695 | return; |
696 | } |
||
697 | else |
||
698 | { |
||
5591 | pavelyakov | 699 | if(files.first+files.current+cur>=files.count) |
3363 | leency | 700 | { |
3434 | leency | 701 | files.first=files.count-files.visible; |
702 | files.current=cur-files.first+files.current; |
||
3363 | leency | 703 | } |
5591 | pavelyakov | 704 | else |
3363 | leency | 705 | { |
3434 | leency | 706 | files.first+=cur+files.current-files.visible+1; |
707 | files.current=files.visible-1; |
||
3363 | leency | 708 | } |
709 | |||
5591 | pavelyakov | 710 | if (files.current<0) || (files.current>files.visible) |
3363 | leency | 711 | { |
3434 | leency | 712 | files.current=files.visible-1; |
3363 | leency | 713 | } |
714 | List_ReDraw(); |
||
715 | } |
||
716 | } |
||
717 | } |
||
718 | |||
719 | |||
720 | void List_ReDraw() |
||
721 | { |
||
3434 | leency | 722 | int paint_y; |
3876 | leency | 723 | //we are in the end of the list => maximize window => there will be white lines after the last element |
3434 | leency | 724 | if (files.count-files.first |
725 | { files.first=files.count-files.visible; files.current=files.visible-1; } |
||
3444 | leency | 726 | for (j=0; j |
3434 | leency | 727 | //in the bottom |
728 | paint_y = j * files.line_h + files.y; |
||
729 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
||
4076 | leency | 730 | DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),sc.work); |
731 | DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),sc.work); |
||
3434 | leency | 732 | Scroll(); |
3363 | leency | 733 | } |
734 | |||
3444 | leency | 735 | |
3363 | leency | 736 | void Line_ReDraw(dword color, filenum){ |
3467 | leency | 737 | dword text_col=0, |
5487 | leency | 738 | ext1, attr, |
4897 | leency | 739 | file_offet, |
740 | file_name_off, |
||
4042 | leency | 741 | y=filenum*files.line_h+files.y; |
4897 | leency | 742 | BDVK file; |
4859 | leency | 743 | if (filenum==-1) return; |
3447 | leency | 744 | DrawBar(files.x,y,3,files.line_h,color); |
745 | DrawBar(files.x+19,y,files.w-19,files.line_h,color); |
||
746 | DrawBar(files.x+3,y+17,16,1,color); |
||
747 | if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color); |
||
748 | if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); |
||
3363 | leency | 749 | |
4897 | leency | 750 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
5487 | leency | 751 | attr = ESDWORD[file_offet]; |
4897 | leency | 752 | file.selected = ESBYTE[file_offet+7]; |
753 | file.sizelo = ESDWORD[file_offet+32]; |
||
754 | file_name_off = file_offet+40; |
||
3363 | leency | 755 | |
5487 | leency | 756 | if (! TestBit(attr, 4) ) //file or folder? |
3363 | leency | 757 | { |
4897 | leency | 758 | Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0); |
5532 | leency | 759 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,font_type,0,ConvertSize(file.sizelo)); |
3363 | leency | 760 | } |
761 | else |
||
4846 | leency | 762 | { |
5606 | pavelyakov | 763 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=" |
4846 | leency | 764 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
765 | } |
||
766 | |||
5487 | leency | 767 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
3444 | leency | 768 | if (color!=0xFFFfff) |
3363 | leency | 769 | { |
5487 | leency | 770 | itdir = TestBit(attr, 4); |
4897 | leency | 771 | strcpy(#file_name, file_name_off); |
5606 | pavelyakov | 772 | sprintf(#file_path,"%s%s",#path,file_name_off); |
3363 | leency | 773 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
774 | } |
||
4897 | leency | 775 | if (file.selected) text_col=0xFF0000; |
3434 | leency | 776 | if (Form.width>=480) |
777 | { |
||
3447 | leency | 778 | FileShow.start_x = files.x + 23; |
3434 | leency | 779 | FileShow.font_color = text_col; |
780 | FileShow.area_size_x = Form.width - 380; |
||
4897 | leency | 781 | FileShow.text_pointer = file_name_off; |
782 | FileShow.start_y = files.text_y+y; |
||
3434 | leency | 783 | PathShow_prepare stdcall(#FileShow); |
784 | PathShow_draw stdcall(#FileShow); |
||
785 | } |
||
4076 | leency | 786 | DrawBar(Form.cwidth-159,y,1,files.line_h,sc.work); //gray line 1 |
787 | DrawBar(Form.cwidth-86,y,1,files.line_h,sc.work); //gray line 2 |
||
3363 | leency | 788 | } |
789 | |||
790 | |||
3444 | leency | 791 | void Open_Dir(dword dir_path, redraw){ |
792 | int errornum, maxcount; |
||
3434 | leency | 793 | |
3444 | leency | 794 | if (redraw!=ONLY_SHOW) |
3363 | leency | 795 | { |
3444 | leency | 796 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
3363 | leency | 797 | if (buf) free(buf); |
3444 | leency | 798 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
799 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
||
800 | if (errornum) |
||
3363 | leency | 801 | { |
802 | HistoryPath(ADD_NEW_PATH); |
||
803 | GoBack(); |
||
804 | Write_Error(errornum); |
||
805 | return; |
||
806 | } |
||
3444 | leency | 807 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
4225 | punk_joker | 808 | if (files.count>maxcount) files.count = maxcount; |
4859 | leency | 809 | if (files.count>0) && (files.current==-1) files.current=0; |
3363 | leency | 810 | } |
3444 | leency | 811 | if (files.count!=-1) |
3363 | leency | 812 | { |
5606 | pavelyakov | 813 | if(!_not_draw)KEdit(); |
3363 | leency | 814 | HistoryPath(ADD_NEW_PATH); |
3444 | leency | 815 | files.visible = files.h / files.line_h; |
5591 | pavelyakov | 816 | if (files.count < files.visible) files.visible = files.count; |
817 | if (sort_num==1) sorting_arrow_x = Form.width+60/2; |
||
818 | if (sort_num==2) sorting_arrow_x = Form.width-115; |
||
819 | if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
||
4076 | leency | 820 | WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19"); |
5591 | pavelyakov | 821 | if (redraw!=ONLY_SHOW) Sorting(); |
5606 | pavelyakov | 822 | if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw(); |
3363 | leency | 823 | } |
5606 | pavelyakov | 824 | if (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; if(!_not_draw)List_ReDraw();} |
3363 | leency | 825 | } |
826 | |||
827 | |||
828 | inline Sorting() |
||
829 | { |
||
830 | dword k=0, l=1; |
||
4897 | leency | 831 | dword file_off; |
3363 | leency | 832 | int i; |
5606 | pavelyakov | 833 | if (!strncmp(#path,"/",2)) //do not sort |
3363 | leency | 834 | { |
5591 | pavelyakov | 835 | for(k=1;k |
3363 | leency | 836 | return; |
837 | } |
||
5591 | pavelyakov | 838 | for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
3363 | leency | 839 | { |
4897 | leency | 840 | if (!real_files_names_case) strttl(file_off+40); |
841 | if (TestBit(ESDWORD[file_off],4)) //directory? |
||
3363 | leency | 842 | { |
843 | file_mas[k]=j; |
||
844 | k++; |
||
845 | } |
||
846 | else |
||
847 | { |
||
3434 | leency | 848 | file_mas[files.count-l]=j; |
3363 | leency | 849 | l++; |
850 | } |
||
851 | } |
||
3434 | leency | 852 | //sorting: files first, then folders |
3363 | leency | 853 | Sort_by_Name(0,k-1); |
5591 | pavelyakov | 854 | if (sort_num==1) Sort_by_Name(k,files.count-1); |
855 | if (sort_num==2) Sort_by_Type(k,files.count-1); |
||
856 | if (sort_num==3) Sort_by_Size(k,files.count-1); |
||
5581 | leency | 857 | //make ".." first item in list |
5606 | pavelyakov | 858 | if (k>0) && (!strncmp(file_mas[0]*304+buf+72,"..",3)) |
859 | for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",3)) {file_mas[k]> |
||
3363 | leency | 860 | } |
861 | |||
862 | |||
863 | void Del_Form() |
||
864 | { |
||
5512 | punk_joker | 865 | dword selected_offset2; |
866 | int cont = 0; |
||
867 | byte f_count[128]; |
||
5581 | leency | 868 | int dform_x = files.w - 220 / 2 + files.x; |
5606 | pavelyakov | 869 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
4002 | leency | 870 | if (del_active==2) |
3991 | leency | 871 | { |
4002 | leency | 872 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
3991 | leency | 873 | } |
874 | else |
||
875 | { |
||
4002 | leency | 876 | if (!files.count) return; |
5581 | leency | 877 | DrawPopup(dform_x,160,220,85,1,sc.work,sc.work_graph); |
4076 | leency | 878 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
5512 | punk_joker | 879 | for (i=0; i |
4002 | leency | 880 | { |
5512 | punk_joker | 881 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
882 | if (ESBYTE[selected_offset2]) cont++; |
||
4002 | leency | 883 | } |
5512 | punk_joker | 884 | if (cont) |
885 | { |
||
5576 | pavelyakov | 886 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2); |
5512 | punk_joker | 887 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
888 | } |
||
4002 | leency | 889 | else |
890 | { |
||
5591 | pavelyakov | 891 | if (strlen(#file_name)<28) |
5512 | punk_joker | 892 | { |
893 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
||
894 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
||
895 | } |
||
896 | else |
||
897 | { |
||
898 | WriteText(164+dform_x,190,0x80,0,"...?"); |
||
899 | ESI = 24; |
||
900 | WriteText(dform_x+20,190,0,0,#file_name); |
||
901 | } |
||
4002 | leency | 902 | } |
903 | DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES); |
||
904 | DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO); |
||
905 | del_active=1; |
||
3991 | leency | 906 | } |
3363 | leency | 907 | } |
908 | |||
4022 | leency | 909 | int del_error; |
910 | int Del_File2(dword way) |
||
3980 | punk_joker | 911 | { |
912 | dword dirbuf, fcount, i, filename; |
||
4022 | leency | 913 | int error; |
914 | char del_from[4096]; |
||
915 | if (isdir(way)) |
||
3997 | leency | 916 | { |
4022 | leency | 917 | if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error; |
3997 | leency | 918 | for (i=0; i |
3980 | punk_joker | 919 | { |
4002 | leency | 920 | if (CheckEvent()==evReDraw) draw_window(); |
3997 | leency | 921 | filename = i*304+dirbuf+72; |
5591 | pavelyakov | 922 | sprintf(#del_from,"%s/%s",way,filename); |
3997 | leency | 923 | if ( TestBit(ESDWORD[filename-40], 4) ) |
5581 | leency | 924 | { |
3997 | leency | 925 | Del_File2(#del_from); |
5581 | leency | 926 | } |
3997 | leency | 927 | else |
4022 | leency | 928 | { |
929 | if (error = DeleteFile(#del_from)) del_error = error; |
||
930 | } |
||
3980 | punk_joker | 931 | } |
3997 | leency | 932 | } |
4022 | leency | 933 | if (error = DeleteFile(way)) del_error = error; |
3980 | punk_joker | 934 | } |
935 | |||
936 | |||
3363 | leency | 937 | void Del_File(byte dodel) |
4022 | leency | 938 | { |
4896 | punk_joker | 939 | byte del_from[4096]; |
5214 | punk_joker | 940 | dword selected_offset2; |
941 | int tst, count, i; |
||
4896 | punk_joker | 942 | |
3980 | punk_joker | 943 | if (dodel==true) |
3363 | leency | 944 | { |
4002 | leency | 945 | del_active=2; |
3997 | leency | 946 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
4022 | leency | 947 | del_error = 0; |
5214 | punk_joker | 948 | |
5513 | punk_joker | 949 | if (selected_count) |
5214 | punk_joker | 950 | { |
5513 | punk_joker | 951 | for (i=0; i |
952 | { |
||
953 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
||
954 | if (ESBYTE[selected_offset2]) { |
||
5591 | pavelyakov | 955 | sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72); |
5513 | punk_joker | 956 | Del_File2(#del_from); |
957 | } |
||
958 | } |
||
5214 | punk_joker | 959 | } |
960 | else |
||
961 | { |
||
5513 | punk_joker | 962 | Del_File2(#file_path); |
5214 | punk_joker | 963 | } |
4022 | leency | 964 | if (del_error) Write_Error(del_error); |
3363 | leency | 965 | } |
966 | del_active=0; |
||
3997 | leency | 967 | DeleteButton(301); |
968 | DeleteButton(302); |
||
3444 | leency | 969 | Open_Dir(#path,WITH_REDRAW); |
3363 | leency | 970 | } |
971 | |||
972 | |||
973 | void SelectFile(dword that_file) |
||
974 | { |
||
3434 | leency | 975 | files.first=files.current=0; |
3363 | leency | 976 | Open_Dir(#path,ONLY_OPEN); |
4225 | punk_joker | 977 | if (!real_files_names_case) strttl(that_file); |
3434 | leency | 978 | for (i=files.count-1; i>=0; i--;) |
3363 | leency | 979 | if (!strcmp(file_mas[i]*304+buf+72,that_file)) break; |
3444 | leency | 980 | List_Current(i); |
3363 | leency | 981 | List_ReDraw(); |
982 | } |
||
983 | |||
984 | |||
985 | void Dir_Up() |
||
986 | { |
||
987 | char cur_folder[4096]; |
||
988 | i=strlen(#path)-1; |
||
989 | if (i==0) return; |
||
990 | path[i]=0x00; |
||
991 | i = strrchr(#path, '/'); |
||
992 | strcpy(#cur_folder, #path+i); |
||
993 | path[i]=0x00; |
||
994 | SelectFile(#cur_folder); |
||
995 | } |
||
996 | |||
5444 | leency | 997 | void Open(byte rez) |
3434 | leency | 998 | { |
5443 | punk_joker | 999 | byte temp[4096]; |
5513 | punk_joker | 1000 | selected_count = 0; |
5443 | punk_joker | 1001 | if (rez) |
1002 | { |
||
5606 | pavelyakov | 1003 | if (!strncmp(#file_name,"..",3)) return; |
5443 | punk_joker | 1004 | strcpy(#temp, #file_path); |
1005 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
||
1006 | RunProgram("/sys/File Managers/Eolite", #temp); |
||
1007 | return; |
||
1008 | } |
||
3444 | leency | 1009 | if (!files.count) return; |
3441 | leency | 1010 | if (!itdir) |
3434 | leency | 1011 | { |
5401 | leency | 1012 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
3434 | leency | 1013 | } |
1014 | else |
||
1015 | { |
||
5606 | pavelyakov | 1016 | if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; } |
3434 | leency | 1017 | strcpy(#path, #file_path); |
1018 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
||
1019 | files.first=files.current=0; |
||
3444 | leency | 1020 | Open_Dir(#path,WITH_REDRAW); |
3434 | leency | 1021 | } |
1022 | } |
||
3363 | leency | 1023 | |
3434 | leency | 1024 | |
1025 | inline fastcall void GoBack() |
||
3363 | leency | 1026 | { |
1027 | char cur_folder[4096]; |
||
1028 | strcpy(#cur_folder, GetCurrentFolder()); |
||
1029 | if (HistoryPath(GO_BACK)) SelectFile(#cur_folder); |
||
1030 | } |
||
1031 | |||
5397 | punk_joker | 1032 | void ShowOpenWithDialog() |
1033 | { |
||
1034 | byte param[4097]; |
||
5591 | pavelyakov | 1035 | sprintf(#param,"~%s",#file_path); |
5397 | punk_joker | 1036 | RunProgram("/sys/@open", #param); |
1037 | } |
||
1038 | |||
5555 | punk_joker | 1039 | void NewElement(byte newf) |
1040 | { |
||
5557 | punk_joker | 1041 | BDVK element_info; |
5581 | leency | 1042 | byte del_rezult, copy_rezult, info_result; |
5555 | punk_joker | 1043 | if (newf) |
1044 | { |
||
5591 | pavelyakov | 1045 | sprintf(#temp,"%s%s",#path,new_file_ed.text); |
5581 | leency | 1046 | info_result = GetFileInfo(#temp, #element_info); |
5571 | punk_joker | 1047 | switch(new_element_active) |
5555 | punk_joker | 1048 | { |
5581 | leency | 1049 | case CREATE_FILE: |
1050 | if (info_result==5) |
||
5557 | punk_joker | 1051 | { |
5571 | punk_joker | 1052 | WriteFile(0, 0, #temp); |
1053 | if (EAX) |
||
1054 | { |
||
1055 | Write_Error(EAX); |
||
1056 | ShowMessage(NOT_CREATE_FILE, 150); |
||
1057 | } |
||
5557 | punk_joker | 1058 | } |
5571 | punk_joker | 1059 | else |
5557 | punk_joker | 1060 | { |
5571 | punk_joker | 1061 | notify(FILE_EXISTS); |
5557 | punk_joker | 1062 | } |
5581 | leency | 1063 | break; |
1064 | case CREATE_FOLDER: |
||
1065 | if (info_result==5) |
||
5571 | punk_joker | 1066 | { |
1067 | CreateDir(#temp); |
||
1068 | if (EAX) |
||
1069 | { |
||
1070 | Write_Error(EAX); |
||
1071 | ShowMessage(NOT_CREATE_FOLDER, 150); |
||
1072 | } |
||
1073 | } |
||
1074 | else |
||
1075 | { |
||
1076 | notify(FOLDER_EXISTS); |
||
1077 | } |
||
5581 | leency | 1078 | break; |
1079 | case RENAME_ITEM: |
||
1080 | if (info_result==5) |
||
5571 | punk_joker | 1081 | { |
1082 | if (itdir) |
||
1083 | { |
||
1084 | if (del_rezult = DeleteFile(#file_path)) |
||
1085 | { |
||
1086 | Write_Error(del_rezult); |
||
1087 | ShowMessage(T_DEL_ERROR_1, 150); |
||
1088 | return; |
||
1089 | } |
||
1090 | if (CreateDir(#temp)) CreateDir(#file_path); |
||
1091 | Open_Dir(#path,WITH_REDRAW); |
||
1092 | SelectFile(new_file_ed.text); |
||
1093 | } |
||
1094 | else |
||
1095 | { |
||
1096 | if (copy_rezult = CopyFile(#file_path,#temp)) |
||
1097 | { |
||
1098 | Write_Error(copy_rezult); |
||
1099 | } |
||
1100 | else |
||
1101 | { |
||
1102 | Del_File(true); |
||
1103 | SelectFile(new_file_ed.text); |
||
1104 | } |
||
1105 | } |
||
1106 | } |
||
1107 | else |
||
1108 | { |
||
1109 | notify(FILE_EXISTS); |
||
1110 | } |
||
5555 | punk_joker | 1111 | } |
5557 | punk_joker | 1112 | new_element_active = 0; |
1113 | Open_Dir(#path,WITH_REDRAW); |
||
1114 | SelectFile(new_file_ed.text); |
||
5555 | punk_joker | 1115 | } |
1116 | new_element_active = 0; |
||
5557 | punk_joker | 1117 | Open_Dir(#path,WITH_REDRAW); |
5555 | punk_joker | 1118 | } |
1119 | |||
5571 | punk_joker | 1120 | void NewElement_Form(byte crt, dword strng) |
5555 | punk_joker | 1121 | { |
1122 | int dform_x=files.w-220/2+files.x; |
||
5557 | punk_joker | 1123 | if (!new_element_active) |
5555 | punk_joker | 1124 | { |
5557 | punk_joker | 1125 | new_element_active = crt; |
5571 | punk_joker | 1126 | strcpy(#new_element_name, strng); |
1127 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
||
5555 | punk_joker | 1128 | } |
5581 | leency | 1129 | DrawPopup(dform_x,160,220,85,1,sc.work,sc.work_graph); |
1130 | new_file_ed.left = dform_x+24; |
||
5555 | punk_joker | 1131 | edit_box_draw stdcall (#new_file_ed); |
5581 | leency | 1132 | DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff); |
1133 | DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, sc.work_graph); |
||
5591 | pavelyakov | 1134 | if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME); |
1135 | else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE); |
||
5581 | leency | 1136 | DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL); |
5555 | punk_joker | 1137 | } |
1138 | |||
5576 | pavelyakov | 1139 | void FnProcess(byte N) |
3434 | leency | 1140 | { |
1141 | switch(N) |
||
1142 | { |
||
1143 | case 1: |
||
4395 | punk_joker | 1144 | if (!active_about) |
1145 | { |
||
5576 | pavelyakov | 1146 | //SwitchToAnotherThread(); |
1147 | about_stak = malloc(4096); |
||
1148 | about_window = CreateThread(#about_dialog,about_stak+4092); |
||
4395 | punk_joker | 1149 | break; |
1150 | } |
||
1151 | else |
||
1152 | { |
||
1153 | ActivateWindow(GetProcessSlot(about_window)); |
||
1154 | } |
||
3434 | leency | 1155 | break; |
1156 | case 2: |
||
1157 | if (!files.count) break; |
||
5581 | leency | 1158 | NewElement_Form(RENAME_ITEM, #file_name); |
3434 | leency | 1159 | break; |
1160 | case 3: |
||
5591 | pavelyakov | 1161 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
3434 | leency | 1162 | break; |
1163 | case 4: |
||
5591 | pavelyakov | 1164 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
3434 | leency | 1165 | break; |
3440 | leency | 1166 | case 5: //refresh cur dir & devs |
3854 | leency | 1167 | Tip(56, T_DEVICES, 55, "-"); |
3440 | leency | 1168 | Open_Dir(#path,WITH_REDRAW); |
1169 | pause(10); |
||
5441 | leency | 1170 | LoadIniSettings(); |
1171 | GetSystemDiscs(); |
||
3444 | leency | 1172 | Open_Dir(#path,WITH_REDRAW); |
3440 | leency | 1173 | DrawLeftPanel(); |
3434 | leency | 1174 | break; |
1175 | case 6: |
||
5581 | leency | 1176 | NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER); |
3434 | leency | 1177 | break; |
1178 | case 7: |
||
5581 | leency | 1179 | NewElement_Form(CREATE_FILE, T_NEW_FILE); |
3434 | leency | 1180 | break; |
5447 | punk_joker | 1181 | case 8: |
5576 | pavelyakov | 1182 | //SwitchToAnotherThread(); |
1183 | properties_stak = malloc(8096); |
||
1184 | CreateThread(#properties_dialog, properties_stak+8092); |
||
5447 | punk_joker | 1185 | break; |
3434 | leency | 1186 | case 10: //F10 |
5416 | punk_joker | 1187 | if (!active_settings) |
1188 | { |
||
5576 | pavelyakov | 1189 | //SwitchToAnotherThread(); |
1190 | settings_stak = malloc(4096); |
||
1191 | settings_window = CreateThread(#settings_dialog, settings_stak+4092); |
||
5416 | punk_joker | 1192 | break; |
1193 | } |
||
1194 | else |
||
1195 | { |
||
1196 | ActivateWindow(GetProcessSlot(settings_window)); |
||
1197 | } |
||
3434 | leency | 1198 | break; |
1199 | } |
||
1200 | } |
||
1201 | |||
5435 | leency | 1202 | //need to remove these functiones, they are a very old shit :) |
1203 | dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;} |
||
3434 | leency | 1204 | |
5435 | leency | 1205 | |
3363 | leency | 1206 | stop:28)>>0)> |