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