Rev 3440 | Rev 3444 | 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 | |||
3440 | leency | 27 | #define TITLE "Eolite File Manager v1.81" |
28 | #define ABOUT_TITLE "Eolite v1.81" |
||
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 |
||
3439 | leency | 48 | cut_active=0, |
49 | rename_active=0, |
||
50 | del_active=0, |
||
3434 | leency | 51 | show_dev_name=1, |
52 | sort_num=2, |
||
3441 | leency | 53 | itdir; |
3363 | leency | 54 | |
55 | proc_info Form; |
||
56 | mouse m; |
||
3434 | leency | 57 | int mouse_dd, scroll_used, scroll_size; |
58 | dword buf, off; |
||
59 | dword file_mas[6898]; |
||
60 | int j, i; |
||
3363 | leency | 61 | |
62 | edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; |
||
3434 | leency | 63 | PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; |
3363 | leency | 64 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
65 | |||
66 | #include "include\some_code.h" |
||
67 | #include "include\about_dialog.h" |
||
68 | #include "include\sorting.h" |
||
69 | #include "include\icons_f.h" |
||
70 | #include "include\ini.h" |
||
71 | #include "include\left_panel.h" |
||
72 | #include "include\history.h" |
||
3434 | leency | 73 | #include "include\file_menu.h" |
3363 | leency | 74 | |
75 | void main() |
||
76 | { |
||
3434 | leency | 77 | word key, id, can_show, can_select; |
3363 | leency | 78 | |
3434 | leency | 79 | files.line_h=18; |
3363 | leency | 80 | mem_Init(); |
81 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj"); |
||
3434 | leency | 82 | SystemDiscsGet(); |
3432 | leency | 83 | GetIni(1); |
3363 | leency | 84 | if (param) |
85 | { |
||
86 | strcpy(#path, #param); |
||
3434 | leency | 87 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
3363 | leency | 88 | } |
89 | else |
||
3432 | leency | 90 | strcpy(#path, "/rd/1/"); |
3363 | leency | 91 | Open_Dir(#path,ONLY_OPEN); |
3432 | leency | 92 | SetEventMask(0x27); |
3434 | leency | 93 | loop() switch(WaitEvent()) |
3363 | leency | 94 | { |
95 | case evMouse: |
||
3434 | leency | 96 | IF (del_active) break; |
3363 | leency | 97 | id=GetProcessSlot(Form.ID); |
3434 | leency | 98 | IF (id<>GetActiveProcess()) || (Form.status_window>2) break; |
99 | IF (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
||
3363 | leency | 100 | |
101 | m.get(); |
||
102 | |||
3434 | leency | 103 | if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) |
3363 | leency | 104 | { |
3434 | leency | 105 | if (m.lkm) can_select = 1; |
106 | if (m.pkm) |
||
107 | { |
||
108 | can_show = 1; |
||
109 | if (m.y - 57 / files.line_h != files.current) can_select = 1; |
||
110 | } |
||
111 | } |
||
112 | |||
113 | //select/open file { |
||
114 | if (!m.lkm) && (!m.pkm) && (can_select) |
||
115 | { |
||
116 | can_select = 0; |
||
117 | if (m.y<57) break; |
||
118 | id = m.y - 57 / files.line_h; |
||
119 | if (files.current!=id) FileList_ReDraw(id-files.current); |
||
120 | else Open(); |
||
121 | }; |
||
122 | // } select/open file |
||
123 | |||
124 | //file menu { |
||
125 | if (!m.pkm) && (!m.lkm) && (can_show) |
||
126 | { |
||
127 | can_show = 0; |
||
128 | if (m.y<57) break; |
||
3363 | leency | 129 | SwitchToAnotherThread(); |
130 | CreateThread(#FileMenu,#stak2); |
||
3434 | leency | 131 | break; |
132 | } |
||
133 | // } file menu |
||
3363 | leency | 134 | |
3434 | leency | 135 | |
136 | if (m.vert) |
||
137 | { |
||
138 | files.MouseScroll(m.vert); |
||
139 | List_ReDraw(); |
||
140 | break; |
||
141 | } |
||
142 | |||
3363 | leency | 143 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57) |
144 | { |
||
145 | IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF); |
||
3434 | leency | 146 | WHILE (m.lkm==1) && (files.first>0) |
3363 | leency | 147 | { |
3434 | leency | 148 | pause(8); |
149 | files.first--; |
||
3363 | leency | 150 | List_ReDraw(); |
151 | m.get(); |
||
152 | } |
||
153 | DrawRectangle3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7); |
||
154 | } |
||
155 | |||
156 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y |
||
157 | { |
||
158 | IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); |
||
3434 | leency | 159 | while (m.lkm==1) && (files.first |
3363 | leency | 160 | { |
3434 | leency | 161 | pause(8); |
162 | files.first++; |
||
3363 | leency | 163 | List_ReDraw(); |
164 | m.get(); |
||
165 | } |
||
166 | DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
||
167 | } |
||
168 | |||
3434 | leency | 169 | //Scrooll |
170 | if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); } |
||
171 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y |
||
3363 | leency | 172 | |
173 | if (scroll_used) |
||
174 | { |
||
3434 | leency | 175 | IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii |
176 | id=files.first; |
||
3363 | leency | 177 | j= scroll_size/2; |
3434 | leency | 178 | files.first = m.y -j -57 * files.count; |
179 | files.first /= onTop(22,57); |
||
180 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
||
181 | IF (id<>files.first) List_ReDraw(); |
||
3363 | leency | 182 | } |
183 | break; |
||
184 | //Button pressed----------------------------------------------------------------------------- |
||
185 | case evButton: |
||
186 | id=GetButtonID(); |
||
3439 | leency | 187 | if (id==1) ExitProcess(); |
188 | if (rename_active) break; |
||
189 | if (del_active) |
||
3363 | leency | 190 | { |
191 | IF (id==301) || (id==302) Del_File(302-id); |
||
192 | break; |
||
193 | } |
||
3439 | leency | 194 | |
3363 | leency | 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) DrawFilled |