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