Rev 6251 | Rev 6289 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6251 | Rev 6278 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | //Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015 |
1 | //Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2016 |
2 | //GNU GPL licence. |
2 | //GNU GPL licence. |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
5 | #include "lang.h--" |
Line 14... | Line 14... | ||
14 | #include "..\lib\gui.h" |
14 | #include "..\lib\gui.h" |
15 | #include "..\lib\list_box.h" |
15 | #include "..\lib\list_box.h" |
16 | #include "..\lib\random.h" |
16 | #include "..\lib\random.h" |
17 | #include "..\lib\font.h" |
17 | #include "..\lib\font.h" |
18 | #include "..\lib\collection.h" |
18 | #include "..\lib\collection.h" |
19 | //obj |
- | |
20 | #include "..\lib\obj\libini.h" |
19 | #include "..\lib\obj\libini.h" |
21 | #include "..\lib\obj\box_lib.h" |
20 | #include "..\lib\obj\box_lib.h" |
22 | //patterns |
- | |
23 | #include "..\lib\patterns\history.h" |
21 | #include "..\lib\patterns\history.h" |
Line 24... | Line 22... | ||
24 | 22 | ||
25 | //images |
23 | //images |
26 | #include "imgs\toolbar.txt" |
24 | #include "imgs\toolbar.txt" |
27 | #include "imgs\left_p.txt" |
25 | #include "imgs\left_p.txt" |
Line -... | Line 26... | ||
- | 26 | #include "imgs\icons.txt" |
|
- | 27 | ||
- | 28 | //Button IDs |
|
- | 29 | enum { |
|
- | 30 | POPUP_BTN1 = 201, |
|
- | 31 | POPUP_BTN2 = 202 |
|
28 | #include "imgs\icons.txt" |
32 | }; |
- | 33 | ||
- | 34 | //NewElement options |
|
29 | 35 | enum { |
|
- | 36 | CREATE_FILE=1, |
|
- | 37 | CREATE_FOLDER, |
|
- | 38 | RENAME_ITEM |
|
- | 39 | }; |
|
- | 40 | ||
- | 41 | //OpenDir options |
|
- | 42 | enum { |
|
- | 43 | ONLY_SHOW, |
|
- | 44 | WITH_REDRAW, |
|
Line 30... | Line 45... | ||
30 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
45 | ONLY_OPEN |
Line 31... | Line 46... | ||
31 | enum {CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement |
46 | }; |
Line 102... | Line 117... | ||
102 | #include "include\gui.h" |
117 | #include "include\gui.h" |
103 | #include "include\sorting.h" |
118 | #include "include\sorting.h" |
104 | #include "include\icons.h" |
119 | #include "include\icons.h" |
105 | #include "include\left_panel.h" |
120 | #include "include\left_panel.h" |
106 | #include "include\menu.h" |
121 | #include "include\menu.h" |
- | 122 | #include "include\delete.h" |
|
107 | #include "include\about.h" |
123 | #include "include\about.h" |
108 | #include "include\properties.h" |
124 | #include "include\properties.h" |
Line 109... | Line 125... | ||
109 | 125 | ||
110 | void main() |
126 | void main() |
Line 191... | Line 207... | ||
191 | } |
207 | } |
192 | } |
208 | } |
193 | } |
209 | } |
194 | if (files.MouseOver(mouse.x, mouse.y)) |
210 | if (files.MouseOver(mouse.x, mouse.y)) |
195 | { |
211 | { |
196 | //open |
- | |
197 | if (mouse.key&MOUSE_LEFT)&&(mouse.dblclick) |
- | |
198 | { |
- | |
199 | if (mouse.y - files.y / files.item_h + files.first < files.count) |
- | |
200 | { |
- | |
201 | files.ProcessMouse(mouse.x, mouse.y); |
- | |
202 | List_ReDraw(); |
- | |
203 | Open(0); |
- | |
204 | } |
- | |
205 | } |
- | |
206 | //select file |
212 | //select file |
207 | else if (mouse.key&MOUSE_LEFT)&&((mouse.down) |
213 | if (mouse.key&MOUSE_LEFT) && (mouse.up) |
208 | { |
214 | { |
209 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
215 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
- | 216 | else if (mouse.dblclick)) Open(0); |
|
210 | } |
217 | } |
211 | //file menu |
218 | //file menu |
212 | else if (mouse.key&MOUSE_RIGHT)&&(mouse.up) |
219 | if (mouse.key&MOUSE_RIGHT) |
213 | { |
220 | { |
214 | menu_call_mouse = 1; |
221 | menu_call_mouse = 1; |
215 | - | ||
216 | if (files.MouseOver(mouse.x, mouse.y)) |
222 | if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); |
217 | { |
- | |
218 | files.cur_y = mouse.y - files.y / files.item_h + files.first; |
- | |
219 | List_ReDraw(); |
- | |
220 | menu_stak = malloc(4096); |
223 | menu_stak = malloc(4096); |
221 | CreateThread(#FileMenu,menu_stak+4092); |
224 | CreateThread(#FileMenu,menu_stak+4092); |
222 | } |
- | |
223 | break; |
225 | break; |
224 | } |
226 | } |
225 | } |
227 | } |
Line 226... | Line 228... | ||
226 | 228 | ||
Line 292... | Line 294... | ||
292 | } |
294 | } |
293 | break; |
295 | break; |
294 | //Button pressed----------------------------------------------------------------------------- |
296 | //Button pressed----------------------------------------------------------------------------- |
295 | case evButton: |
297 | case evButton: |
296 | id=GetButtonID(); |
298 | id=GetButtonID(); |
297 | if (id==1) |
299 | switch(id) |
298 | { |
300 | { |
- | 301 | case 01: |
|
299 | KillProcess(about_window); |
302 | KillProcess(about_window); |
300 | SaveIniSettings(); |
303 | SaveIniSettings(); |
301 | ExitProcess(); |
304 | ExitProcess(); |
302 | } |
- | |
303 | if (del_active) |
- | |
304 | { |
- | |
305 | if (id==301) || (id==302) Del_File(302-id); |
- | |
306 | break; |
- | |
307 | } |
- | |
308 | if (new_element_active) |
- | |
309 | { |
- | |
310 | if (id==301) || (id==302) NewElement(302-id); |
- | |
311 | break; |
- | |
312 | } |
- | |
313 | - | ||
314 | switch(id) |
- | |
315 | { |
- | |
316 | case 21: //Back |
305 | case 21: //Back |
317 | GoBack(); |
306 | GoBack(); |
318 | break; |
307 | break; |
319 | case 22: //Forward |
308 | case 22: //Forward |
320 | if (history.forward()) |
309 | if (history.forward()) |
Line 345... | Line 334... | ||
345 | FnProcess(id-50); |
334 | FnProcess(id-50); |
346 | break; |
335 | break; |
347 | case 100...120: |
336 | case 100...120: |
348 | SystemDiscs.Click(id-100); |
337 | SystemDiscs.Click(id-100); |
349 | break; |
338 | break; |
- | 339 | case POPUP_BTN1: |
|
- | 340 | case POPUP_BTN2: |
|
- | 341 | if (del_active) Del_File(id-POPUP_BTN2); |
|
- | 342 | if (new_element_active) NewElement(id-POPUP_BTN2); |
|
- | 343 | DeleteButton(POPUP_BTN1); |
|
- | 344 | DeleteButton(POPUP_BTN2); |
|
- | 345 | break; |
|
350 | } |
346 | } |
351 | break; |
347 | break; |
352 | //Key pressed----------------------------------------------------------------------------- |
348 | //Key pressed----------------------------------------------------------------------------- |
353 | case evKey: |
349 | case evKey: |
354 | GetKeys(); |
350 | GetKeys(); |
Line 409... | Line 405... | ||
409 | RunProgram("/sys/File Managers/Eolite", #path); |
405 | RunProgram("/sys/File Managers/Eolite", #path); |
410 | break; |
406 | break; |
411 | case 050: //Ctrl+M |
407 | case 050: //Ctrl+M |
412 | Open_Dir(#inactive_path,WITH_REDRAW); |
408 | Open_Dir(#inactive_path,WITH_REDRAW); |
413 | break; |
409 | break; |
414 | case 028: //Ctrl+Enter |
410 | case SCAN_CODE_ENTER: //Ctrl+Enter |
415 | if (!itdir) ShowOpenWithDialog(); |
411 | if (!itdir) ShowOpenWithDialog(); |
416 | else Open(1); |
412 | else Open(1); |
417 | break; |
413 | break; |
418 | case 030: //Ctrl+A - select all files |
414 | case 030: //Ctrl+A - select all files |
419 | for (i=0; i |
415 | for (i=0; i |
Line 681... | Line 677... | ||
681 | file_name_off = file_offet+40; |
677 | file_name_off = file_offet+40; |
Line 682... | Line 678... | ||
682 | 678 | ||
683 | if (! TestBit(attr, 4) ) //file or folder? |
679 | if (! TestBit(attr, 4) ) //file or folder? |
684 | { |
680 | { |
685 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
681 | ext1 = strrchr(file_name_off,'.') + file_name_off; |
686 | if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing |
- | |
687 | Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0); |
682 | if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing |
- | 683 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y+y+1, files.font_type, 0, ConvertSize(file.sizelo)); |
|
688 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo)); |
684 | if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
689 | } |
685 | } |
690 | else |
686 | else |
691 | { |
687 | { |
- | 688 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else { |
|
692 | if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=" |
689 | ext1=" |
- | 690 | WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); |
|
693 | Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0); |
691 | } |
- | 692 | } |
|
Line 694... | Line 693... | ||
694 | } |
693 | DrawIconByExtension(ext1, files.x+3, files.item_h/2-7+y, bgcol); |
695 | 694 | ||
696 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
695 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
697 | if (bgcol!=0xFFFfff) |
696 | if (bgcol!=0xFFFfff) |
Line 812... | Line 811... | ||
812 | 811 | ||
813 | 812 | ||
814 | void Del_Form() |
813 | void Del_Form() |
815 | { |
814 | { |
816 | dword selected_offset2; |
815 | dword selected_offset2; |
817 | int cont = 0; |
816 | int selected_count = 0; |
818 | byte f_count[128]; |
817 | byte f_count[128]; |
819 | int dform_x = files.w - 220 / 2 + files.x; |
818 | int dform_x = files.w - 220 / 2 + files.x; |
820 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
819 | if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return; |
Line 824... | Line 823... | ||
824 | DrawEolitePopup(T_YES, T_NO); |
823 | DrawEolitePopup(T_YES, T_NO); |
825 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
824 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE); |
826 | for (i=0; i |
825 | for (i=0; i |
827 | { |
826 | { |
828 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
827 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
829 | if (ESBYTE[selected_offset2]) cont++; |
828 | if (ESBYTE[selected_offset2]) selected_count++; |
830 | } |
829 | } |
831 | if (cont) |
830 | if (selected_count) |
832 | { |
831 | { |
833 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2); |
832 | sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2); |
834 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
833 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count); |
835 | } |
834 | } |
836 | else |
835 | else |
837 | { |
836 | { |
838 | if (strlen(#file_name)<28) |
837 | if (strlen(#file_name)<28) |
Line 849... | Line 848... | ||
849 | } |
848 | } |
850 | del_active=1; |
849 | del_active=1; |
851 | } |
850 | } |
852 | } |
851 | } |
Line 853... | Line -... | ||
853 | - | ||
854 | int del_error; |
- | |
855 | int Del_File2(dword way, sh_progr) |
- | |
856 | { |
- | |
857 | dword dirbuf, fcount, i, filename; |
- | |
858 | int error; |
- | |
859 | char del_from[4096]; |
- | |
860 | if (dir_exists(way)) |
- | |
861 | { |
- | |
862 | if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error; |
- | |
863 | for (i=0; i |
- | |
864 | { |
- | |
865 | if (CheckEvent()==evReDraw) draw_window(); |
- | |
866 | filename = i*304+dirbuf+72; |
- | |
867 | sprintf(#del_from,"%s/%s",way,filename); |
- | |
868 | if ( TestBit(ESDWORD[filename-40], 4) ) |
- | |
869 | { |
- | |
870 | Del_File2(#del_from, 1); |
- | |
871 | } |
- | |
872 | else |
- | |
873 | { |
- | |
874 | if (sh_progr) Operation_Draw_Progress(#del_from); |
- | |
875 | if (error = DeleteFile(#del_from)) del_error = error; |
- | |
876 | } |
- | |
877 | } |
- | |
878 | } |
- | |
879 | if (error = DeleteFile(way)) del_error = error; |
- | |
880 | } |
- | |
881 | - | ||
882 | void Del_File_Thread() |
- | |
883 | { |
- | |
884 | byte del_from[4096]; |
- | |
885 | dword selected_offset2; |
- | |
886 | int tst, count, i; |
- | |
887 | - | ||
888 | file_count_copy = 0; |
- | |
889 | copy_bar.value = 0; |
- | |
890 | operation_flag = DELETE_FLAG; |
- | |
891 | - | ||
892 | if (selected_count) |
- | |
893 | { |
- | |
894 | for (i=0; i |
- | |
895 | { |
- | |
896 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
- | |
897 | if (ESBYTE[selected_offset2]) { |
- | |
898 | sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72); |
- | |
899 | GetFileInfo(#del_from, #file_info_count); |
- | |
900 | if ( file_info_count.isfolder ) DirFileCount(#del_from); |
- | |
901 | else file_count_copy++; |
- | |
902 | } |
- | |
903 | } |
- | |
904 | } |
- | |
905 | else |
- | |
906 | { |
- | |
907 | if (itdir) DirFileCount(#file_path); |
- | |
908 | else file_count_copy++; |
- | |
909 | } |
- | |
910 | - | ||
911 | copy_bar.max = file_count_copy; |
- | |
912 | - | ||
913 | del_error = 0; |
- | |
914 | DisplayOperationForm(); |
- | |
915 | if (selected_count) |
- | |
916 | { |
- | |
917 | for (i=0; i |
- | |
918 | { |
- | |
919 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
- | |
920 | if (ESBYTE[selected_offset2]) { |
- | |
921 | sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72); |
- | |
922 | Del_File2(#del_from, 1); |
- | |
923 | } |
- | |
924 | } |
- | |
925 | } |
- | |
926 | else |
- | |
927 | { |
- | |
928 | Del_File2(#file_path, 1); |
- | |
929 | } |
- | |
930 | if (del_error) Write_Error(del_error); |
- | |
931 | cmd_free = 6; |
- | |
932 | DialogExit(); |
- | |
933 | } |
- | |
934 | - | ||
935 | void Del_File(byte dodel) { |
- | |
936 | del_active=0; |
- | |
937 | if (dodel) |
- | |
938 | { |
- | |
939 | delete_stak = malloc(40000); |
- | |
940 | CreateThread(#Del_File_Thread,delete_stak+40000-4); |
- | |
941 | } |
- | |
942 | else draw_window(); |
- | |
943 | } |
- | |
944 | 852 | ||
945 | void SelectFileByName(dword that_file) |
853 | void SelectFileByName(dword that_file) |
946 | { |
854 | { |
947 | int ind; |
855 | int ind; |
948 | files.KeyHome(); |
856 | files.KeyHome(); |
Line 1103... | Line 1011... | ||
1103 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
1011 | new_file_ed.size = new_file_ed.pos = strlen(strng); |
1104 | } |
1012 | } |
1105 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1013 | if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL); |
1106 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1014 | else DrawEolitePopup(T_CREATE, T_CANCEL); |
1107 | new_file_ed.left = dform_x+24; |
1015 | new_file_ed.left = dform_x+24; |
1108 | edit_box_draw stdcall (#new_file_ed); |
1016 | DrawEditBox(#new_file_ed); |
1109 | DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff); |
- | |
1110 | DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, col_graph); |
- | |
1111 | } |
1017 | } |
Line 1112... | Line 1018... | ||
1112 | 1018 | ||
1113 | void FnProcess(byte N) |
1019 | void FnProcess(byte N) |
1114 | { |
1020 | { |