Rev 3441 | Rev 3447 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3363 | leency | 1 | //Leency & Veliant 2008-2013 |
2 | //GNU GPL licence. |
||
3 | |||
4 | //копировать через поток |
||
5 | |||
6 | //libraries |
||
7 | #define MEMSIZE 0xA0000 |
||
8 | #include "..\lib\kolibri.h" |
||
9 | #include "..\lib\strings.h" |
||
10 | #include "..\lib\mem.h" |
||
11 | #include "..\lib\dll.h" |
||
12 | #include "..\lib\lib.obj\box_lib.h" |
||
13 | #include "..\lib\file_system.h" |
||
14 | #include "..\lib\figures.h" |
||
3412 | leency | 15 | #include "..\lib\encoding.h" |
3434 | leency | 16 | #include "..\lib\list_box.h" |
17 | #include "..\lib\copyf.h" |
||
3363 | leency | 18 | //images |
19 | #include "imgs\toolbar.txt" |
||
20 | #include "imgs\left_p.txt" |
||
21 | |||
22 | |||
3444 | leency | 23 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
24 | |||
25 | #define TITLE "Eolite File Manager v1.88" |
||
26 | #define ABOUT_TITLE "Eolite v1.88" |
||
3363 | leency | 27 | dword col_work = 0xE4DFE1; |
3444 | leency | 28 | dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; |
3363 | leency | 29 | dword col_padding = 0xC8C9C9; |
30 | dword col_selec = 0x94AECE; |
||
31 | dword col_lpanel = 0x00699C; |
||
32 | |||
3434 | leency | 33 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
34 | char tmp_disk_del_param[3]="d0"; |
||
35 | struct path_string { char Item[4096]; }; |
||
3363 | leency | 36 | |
3434 | leency | 37 | llist files; |
38 | |||
39 | byte |
||
3363 | leency | 40 | path[4096], |
41 | file_path[4096], |
||
3404 | leency | 42 | file_name[256], |
3434 | leency | 43 | temp[4096]; |
44 | byte |
||
3439 | leency | 45 | rename_active=0, |
46 | del_active=0, |
||
3434 | leency | 47 | show_dev_name=1, |
48 | sort_num=2, |
||
3441 | leency | 49 | itdir; |
3363 | leency | 50 | |
51 | proc_info Form; |
||
52 | mouse m; |
||
3434 | leency | 53 | int mouse_dd, scroll_used, scroll_size; |
54 | dword buf, off; |
||
55 | dword file_mas[6898]; |
||
56 | int j, i; |
||
3363 | leency | 57 | |
58 | edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; |
||
3434 | leency | 59 | PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; |
3363 | leency | 60 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
61 | |||
62 | #include "include\some_code.h" |
||
63 | #include "include\about_dialog.h" |
||
64 | #include "include\sorting.h" |
||
65 | #include "include\icons_f.h" |
||
66 | #include "include\ini.h" |
||
67 | #include "include\left_panel.h" |
||
68 | #include "include\history.h" |
||
3434 | leency | 69 | #include "include\file_menu.h" |
3444 | leency | 70 | #include "include\copypaste.h" |
3363 | leency | 71 | |
72 | void main() |
||
73 | { |
||
3444 | leency | 74 | word key, id, can_show, can_select, m_selected; |
3363 | leency | 75 | |
3434 | leency | 76 | files.line_h=18; |
3363 | leency | 77 | mem_Init(); |
78 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj"); |
||
3434 | leency | 79 | SystemDiscsGet(); |
3432 | leency | 80 | GetIni(1); |
3363 | leency | 81 | if (param) |
82 | { |
||
83 | strcpy(#path, #param); |
||
3434 | leency | 84 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
3363 | leency | 85 | } |
86 | else |
||
3432 | leency | 87 | strcpy(#path, "/rd/1/"); |
3363 | leency | 88 | Open_Dir(#path,ONLY_OPEN); |
3432 | leency | 89 | SetEventMask(0x27); |
3434 | leency | 90 | loop() switch(WaitEvent()) |
3363 | leency | 91 | { |
92 | case evMouse: |
||
3434 | leency | 93 | IF (del_active) break; |
3363 | leency | 94 | id=GetProcessSlot(Form.ID); |
3444 | leency | 95 | IF (id!=GetActiveProcess()) || (Form.status_window>2) break; |
3434 | leency | 96 | IF (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
3363 | leency | 97 | |
98 | m.get(); |
||
99 | |||
3444 | leency | 100 | if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select) |
3363 | leency | 101 | { |
3444 | leency | 102 | m_selected = m.y - 57 / files.line_h; |
3434 | leency | 103 | if (m.lkm) can_select = 1; |
104 | if (m.pkm) |
||
105 | { |
||
106 | can_show = 1; |
||
107 | if (m.y - 57 / files.line_h != files.current) can_select = 1; |
||
108 | } |
||
109 | } |
||
110 | |||
111 | //select/open file { |
||
112 | if (!m.lkm) && (!m.pkm) && (can_select) |
||
113 | { |
||
114 | can_select = 0; |
||
115 | if (m.y<57) break; |
||
116 | id = m.y - 57 / files.line_h; |
||
3444 | leency | 117 | if (id!=m_selected) {can_show=0; break;} |
118 | if (files.current!=id) List_Current(id-files.current); |
||
3434 | leency | 119 | else Open(); |
120 | }; |
||
121 | // } select/open file |
||
122 | |||
123 | //file menu { |
||
124 | if (!m.pkm) && (!m.lkm) && (can_show) |
||
125 | { |
||
126 | can_show = 0; |
||
127 | if (m.y<57) break; |
||
3363 | leency | 128 | SwitchToAnotherThread(); |
3444 | leency | 129 | CreateThread(#FileMenu,#menu_stak); |
3434 | leency | 130 | break; |
131 | } |
||
132 | // } file menu |
||
3363 | leency | 133 | |
3434 | leency | 134 | |
135 | if (m.vert) |
||
136 | { |
||
137 | files.MouseScroll(m.vert); |
||
138 | List_ReDraw(); |
||
139 | break; |
||
140 | } |
||
141 | |||
3363 | leency | 142 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57) |
143 | { |
||
144 | IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF); |
||
3434 | leency | 145 | WHILE (m.lkm==1) && (files.first>0) |
3363 | leency | 146 | { |
3434 | leency | 147 | pause(8); |
148 | files.first--; |
||
3363 | leency | 149 | List_ReDraw(); |
150 | m.get(); |
||
151 | } |
||
152 | DrawRectangle3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7); |
||
153 | } |
||
154 | |||
155 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y |
||
156 | { |
||
157 | IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); |
||
3434 | leency | 158 | while (m.lkm==1) && (files.first |
3363 | leency | 159 | { |
3434 | leency | 160 | pause(8); |
161 | files.first++; |
||
3363 | leency | 162 | List_ReDraw(); |
163 | m.get(); |
||
164 | } |
||
165 | DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
||
166 | } |
||
167 | |||
3434 | leency | 168 | //Scrooll |
169 | if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); } |
||
170 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y |
||
3363 | leency | 171 | |
172 | if (scroll_used) |
||
173 | { |
||
3434 | leency | 174 | IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii |
175 | id=files.first; |
||
3363 | leency | 176 | j= scroll_size/2; |
3434 | leency | 177 | files.first = m.y -j -57 * files.count; |
178 | files.first /= onTop(22,57); |
||
179 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
||
3444 | leency | 180 | IF (id!=files.first) List_ReDraw(); |
3363 | leency | 181 | } |
182 | break; |
||
183 | //Button pressed----------------------------------------------------------------------------- |
||
184 | case evButton: |
||
185 | id=GetButtonID(); |
||
3439 | leency | 186 | if (id==1) ExitProcess(); |
187 | if (rename_active) break; |
||
188 | if (del_active) |
||
3363 | leency | 189 | { |
190 | IF (id==301) || (id==302) Del_File(302-id); |
||
191 | break; |
||
192 | } |
||
3439 | leency | 193 | |
3363 | leency | 194 | switch(id) |
195 | { |
||
196 | case 21: //Back |
||
197 | GoBack(); |
||
198 | break; |
||
199 | case 22: //Forward |
||
200 | if (HistoryPath(GO_FORWARD)) |
||
201 | { |
||
3434 | leency | 202 | files.first=files.current=NULL; //aaa?o nienea |
3363 | leency | 203 | Open_Dir(#path,WITH_REDRAW); |
204 | } |
||
205 | break; |
||
206 | case 23: //up! |
||
207 | Dir_Up(); |
||
208 | break; |
||
209 | case 24: //cut |
||
3444 | leency | 210 | Copy(#file_path, NOCUT); |
211 | break; |
||
33 |