Rev 3441 | Rev 3447 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3441 | Rev 3444 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | #include "..\lib\copyf.h" |
17 | #include "..\lib\copyf.h" |
18 | //images |
18 | //images |
19 | #include "imgs\toolbar.txt" |
19 | #include "imgs\toolbar.txt" |
20 | #include "imgs\left_p.txt" |
20 | #include "imgs\left_p.txt" |
Line 21... | Line -... | ||
21 | - | ||
22 | //for OpenDir |
- | |
23 | #define ONLY_SHOW 0 |
- | |
24 | #define WITH_REDRAW 1 |
- | |
Line -... | Line 21... | ||
- | 21 | ||
- | 22 | ||
25 | #define ONLY_OPEN 2 |
23 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
26 | 24 | ||
27 | #define TITLE "Eolite File Manager v1.81" |
25 | #define TITLE "Eolite File Manager v1.88" |
28 | #define ABOUT_TITLE "Eolite v1.81" |
26 | #define ABOUT_TITLE "Eolite v1.88" |
29 | dword col_work = 0xE4DFE1; |
27 | dword col_work = 0xE4DFE1; |
30 | dword col_border = 0x819FC5; |
28 | dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; |
31 | dword col_padding = 0xC8C9C9; |
29 | dword col_padding = 0xC8C9C9; |
Line 32... | Line 30... | ||
32 | dword col_selec = 0x94AECE; |
30 | dword col_selec = 0x94AECE; |
Line 40... | Line 38... | ||
40 | 38 | ||
41 | byte |
39 | byte |
42 | path[4096], |
40 | path[4096], |
43 | file_path[4096], |
41 | file_path[4096], |
44 | file_name[256], |
- | |
45 | copy_file[4096], |
42 | file_name[256], |
46 | temp[4096]; |
43 | temp[4096]; |
47 | byte |
- | |
48 | cut_active=0, |
44 | byte |
49 | rename_active=0, |
45 | rename_active=0, |
50 | del_active=0, |
46 | del_active=0, |
51 | show_dev_name=1, |
47 | show_dev_name=1, |
52 | sort_num=2, |
48 | sort_num=2, |
Line 69... | Line 65... | ||
69 | #include "include\icons_f.h" |
65 | #include "include\icons_f.h" |
70 | #include "include\ini.h" |
66 | #include "include\ini.h" |
71 | #include "include\left_panel.h" |
67 | #include "include\left_panel.h" |
72 | #include "include\history.h" |
68 | #include "include\history.h" |
73 | #include "include\file_menu.h" |
69 | #include "include\file_menu.h" |
- | 70 | #include "include\copypaste.h" |
|
Line 74... | Line 71... | ||
74 | 71 | ||
75 | void main() |
72 | void main() |
76 | { |
73 | { |
Line 77... | Line 74... | ||
77 | word key, id, can_show, can_select; |
74 | word key, id, can_show, can_select, m_selected; |
78 | 75 | ||
79 | files.line_h=18; |
76 | files.line_h=18; |
80 | mem_Init(); |
77 | mem_Init(); |
Line 93... | Line 90... | ||
93 | loop() switch(WaitEvent()) |
90 | loop() switch(WaitEvent()) |
94 | { |
91 | { |
95 | case evMouse: |
92 | case evMouse: |
96 | IF (del_active) break; |
93 | IF (del_active) break; |
97 | id=GetProcessSlot(Form.ID); |
94 | id=GetProcessSlot(Form.ID); |
98 | IF (id<>GetActiveProcess()) || (Form.status_window>2) break; |
95 | IF (id!=GetActiveProcess()) || (Form.status_window>2) break; |
99 | IF (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
96 | IF (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
Line 100... | Line 97... | ||
100 | 97 | ||
Line 101... | Line 98... | ||
101 | m.get(); |
98 | m.get(); |
102 | 99 | ||
- | 100 | if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select) |
|
103 | if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) |
101 | { |
104 | { |
102 | m_selected = m.y - 57 / files.line_h; |
105 | if (m.lkm) can_select = 1; |
103 | if (m.lkm) can_select = 1; |
106 | if (m.pkm) |
104 | if (m.pkm) |
107 | { |
105 | { |
Line 114... | Line 112... | ||
114 | if (!m.lkm) && (!m.pkm) && (can_select) |
112 | if (!m.lkm) && (!m.pkm) && (can_select) |
115 | { |
113 | { |
116 | can_select = 0; |
114 | can_select = 0; |
117 | if (m.y<57) break; |
115 | if (m.y<57) break; |
118 | id = m.y - 57 / files.line_h; |
116 | id = m.y - 57 / files.line_h; |
- | 117 | if (id!=m_selected) {can_show=0; break;} |
|
119 | if (files.current!=id) FileList_ReDraw(id-files.current); |
118 | if (files.current!=id) List_Current(id-files.current); |
120 | else Open(); |
119 | else Open(); |
121 | }; |
120 | }; |
122 | // } select/open file |
121 | // } select/open file |
Line 123... | Line 122... | ||
123 | 122 | ||
124 | //file menu { |
123 | //file menu { |
125 | if (!m.pkm) && (!m.lkm) && (can_show) |
124 | if (!m.pkm) && (!m.lkm) && (can_show) |
126 | { |
125 | { |
127 | can_show = 0; |
126 | can_show = 0; |
128 | if (m.y<57) break; |
127 | if (m.y<57) break; |
129 | SwitchToAnotherThread(); |
128 | SwitchToAnotherThread(); |
130 | CreateThread(#FileMenu,#stak2); |
129 | CreateThread(#FileMenu,#menu_stak); |
131 | break; |
130 | break; |
132 | } |
131 | } |
Line 176... | Line 175... | ||
176 | id=files.first; |
175 | id=files.first; |
177 | j= scroll_size/2; |
176 | j= scroll_size/2; |
178 | files.first = m.y -j -57 * files.count; |
177 | files.first = m.y -j -57 * files.count; |
179 | files.first /= onTop(22,57); |
178 | files.first /= onTop(22,57); |
180 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
179 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
181 | IF (id<>files.first) List_ReDraw(); |
180 | IF (id!=files.first) List_ReDraw(); |
182 | } |
181 | } |
183 | break; |
182 | break; |
184 | //Button pressed----------------------------------------------------------------------------- |
183 | //Button pressed----------------------------------------------------------------------------- |
185 | case evButton: |
184 | case evButton: |
186 | id=GetButtonID(); |
185 | id=GetButtonID(); |
Line 206... | Line 205... | ||
206 | break; |
205 | break; |
207 | case 23: //up! |
206 | case 23: //up! |
208 | Dir_Up(); |
207 | Dir_Up(); |
209 | break; |
208 | break; |
210 | case 24: //cut |
209 | case 24: //cut |
- | 210 | Copy(#file_path, NOCUT); |
|
211 | key=24; |
211 | break; |
212 | case 25: //copy |
212 | case 25: //copy |
213 | goto CTRLC_MARK; |
213 | Copy(#file_path, CUT); |
- | 214 | break; |
|
214 | case 26: //paste |
215 | case 26: //paste |
215 | Paste(); |
216 | CreateThread(#Paste,#copy_stak); |
216 | break; |
217 | break; |
217 | case 31...33: //sort |
218 | case 31...33: //sort |
218 | IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10); |
219 | 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==2) DrawFilledBar(onLeft(115,0),42,6,10); |
220 | IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10); |
221 | IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10); |
221 | sort_num=id-30; |
222 | sort_num=id-30; |
222 | Open_Dir(#path,WITH_REDRAW); |
223 | Open_Dir(#path,WITH_REDRAW); |
223 | break; |
224 | break; |
224 | case 50...60: //Actions |
225 | case 50...60: //Actions |
225 | ActionsProcess(id-50); |
226 | FnProcess(id-50); |
226 | break; |
227 | break; |
227 | case 100...120: |
228 | case 100...120: |
228 | DEVICE_MARK: |
229 | DEVICE_MARK: |
229 | DrawRectangle3D(17,id-100*16+74,159,16, 0, 0); //auaaeaiea |
230 | DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea |
230 | strcpy(#path, #disk_list[id-100].Item); |
231 | strcpy(#path, #disk_list[id-100].Item); |
231 | files.first=files.current=0; |
232 | files.first=files.current=0; |
232 | Open_Dir(#path,1); |
233 | Open_Dir(#path,WITH_REDRAW); |
233 | pause(5); |
234 | pause(5); |
234 | DrawRectangle3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF); |
235 | DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF); |
235 | break; |
236 | break; |
236 | case 130...160: |
237 | case 130...160: |
237 | tmp_disk_del_param[1]=disk_list[id-130].Item[4]; |
238 | tmp_disk_del_param[1]=disk_list[id-130].Item[4]; |
238 | RunProgram("/sys/tmpdisk", #tmp_disk_del_param); |
239 | RunProgram("/sys/tmpdisk", #tmp_disk_del_param); |
239 | pause(10); |
240 | pause(10); |
Line 251... | Line 252... | ||
251 | { |
252 | { |
252 | IF (key==013) Del_File(true); |
253 | IF (key==013) Del_File(true); |
253 | IF (key==027) Del_File(false); |
254 | IF (key==027) Del_File(false); |
254 | break; |
255 | break; |
255 | } |
256 | } |
256 | IF (edit2.flags<>64) && (key<>13) && (key<>27) |
257 | IF (edit2.flags!=64) && (key!=13) && (key!=27) |
257 | { |
258 | { |
258 | EAX=key<<8; |
259 | EAX=key<<8; |
259 | edit_box_key stdcall (#edit2); |
260 | edit_box_key stdcall (#edit2); |
260 | break; |
261 | break; |
261 | } |
262 | } |
Line 277... | Line 278... | ||
277 | case 014: //Ctrl+N new window |
278 | case 014: //Ctrl+N new window |
278 | IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
279 | IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
279 | RunProgram("/sys/File Managers/Eolite", #path); |
280 | RunProgram("/sys/File Managers/Eolite", #path); |
280 | break; |
281 | break; |
281 | case 024: //Ctrl+X |
282 | case 024: //Ctrl+X |
- | 283 | Copy(#file_path, CUT); |
|
- | 284 | break; |
|
282 | case 003: //Ctrl+C |
285 | case 003: //Ctrl+C |
283 | CTRLC_MARK: |
- | |
284 | IF (itdir) break; |
- | |
285 | strcpy(#copy_file, #file_path); |
286 | Copy(#file_path, NOCUT); |
286 | IF (key==24) cut_active=1; ELSE cut_active=0; |
- | |
287 | break; |
287 | break; |
288 | case 022: //Ctrl+V |
288 | case 022: //Ctrl+V |
289 | Paste(); |
289 | CreateThread(#Paste,#copy_stak); |
290 | break; |
290 | break; |
291 | case 027: //Esc |
291 | case 027: //Esc |
292 | IF (rename_active==1) ReName(false); |
292 | IF (rename_active==1) ReName(false); |
293 | break; |
293 | break; |
294 | case 013: //Enter |
294 | case 013: //Enter |
295 | IF (rename_active==1) {ReName(true); break;} |
295 | IF (rename_active==1) {ReName(true); break;} |
296 | Open(); |
296 | Open(); |
297 | break; |
297 | break; |
298 | case 178: //up |
298 | case 178: //up |
299 | FileList_ReDraw(-1); |
299 | List_Current(-1); |
300 | break; |
300 | break; |
301 | case 177: //down |
301 | case 177: //down |
302 | FileList_ReDraw(1); |
302 | List_Current(1); |
303 | break; |
303 | break; |
304 | case 180: //home |
304 | case 180: //home |
305 | files.first=0; |
305 | files.first=0; |
306 | files.current=0; |
306 | files.current=0; |
307 | List_ReDraw(); |
307 | List_ReDraw(); |
Line 310... | Line 310... | ||
310 | files.first=files.count-files.visible; |
310 | files.first=files.count-files.visible; |
311 | files.current=files.visible-1; |
311 | files.current=files.visible-1; |
312 | List_ReDraw(); |
312 | List_ReDraw(); |
313 | break; |
313 | break; |
314 | case 183: //Page Down |
314 | case 183: //Page Down |
315 | FileList_ReDraw(files.visible-1); |
315 | List_Current(files.visible-1); |
316 | break; |
316 | break; |
317 | case 184: //Page Up |
317 | case 184: //Page Up |
318 | FileList_ReDraw(-files.visible+1); |
318 | List_Current(-files.visible+1); |
319 | break; |
319 | break; |
320 | case 182: //del |
320 | case 182: //del |
321 | Del_Form(); |
321 | Del_Form(); |
322 | break; |
322 | break; |
323 | case 050...059: //F1-F10 |
323 | case 050...059: //F1-F10 |
324 | ActionsProcess(key-49); |
324 | FnProcess(key-49); |
325 | break; |
325 | break; |
326 | default: |
326 | default: |
327 | for (i=files.current+files.first+1; i |
327 | for (i=files.current+files.first+1; i |
328 | { |
328 | { |
329 | strcpy(#temp, file_mas[i]*304+buf+72); |
329 | strcpy(#temp, file_mas[i]*304+buf+72); |
330 | IF (temp[0]==key) || (temp[0]==key-32) |
330 | IF (temp[0]==key) || (temp[0]==key-32) |
331 | { |
331 | { |
332 | FileList_ReDraw(i-files.current-files.first); |
332 | List_Current(i-files.current-files.first); |
333 | break; |
333 | break; |
334 | } |
334 | } |
335 | } |
335 | } |
336 | } |
336 | } |
337 | break; |
337 | break; |
338 | case evReDraw: |
338 | case evReDraw: |
- | 339 | draw_window(); |
|
- | 340 | } |
|
- | 341 | } |
|
- | 342 | ||
- | 343 | ||
- | 344 | void draw_window() |
|
- | 345 | { |
|
339 | DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE); |
346 | DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE); |
340 | GetProcessInfo(#Form, SelfInfo); |
347 | GetProcessInfo(#Form, SelfInfo); |
341 | if (Form.status_window>2) break; |
348 | if (Form.status_window>2) return; |
342 | files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h); |
349 | files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h); |
343 | if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); |
350 | if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); |
344 | if (Form.width<480) MoveSize(OLD,OLD,480,OLD); |
351 | if (Form.width<480) MoveSize(OLD,OLD,480,OLD); |
345 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
352 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
346 | draw_window(); |
- | |
347 | } |
- | |
348 | } |
- | |
349 | - | ||
Line 350... | Line -... | ||
350 | - | ||
351 | inline fastcall void draw_window() |
- | |
352 | { |
- | |
353 | //toolbar |
353 | |
- | 354 | PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal); |
|
354 | PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal); |
355 | DrawBar(127, 8, 1, 25, col_border); |
355 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work); |
356 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work); |
356 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work); |
357 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work); |
357 | DrawBar(246,0,onLeft(246,60),12, col_work); //ôîà Ãà ä ïîëîñîé à äðåñà |
358 | DrawBar(246,0,onLeft(246,60),12, col_work); //upper editbox |
358 | DrawBar(246,29,onLeft(246,60),5,col_work); //ôîà ïîä ïîëîñîé à äðåñà |
359 | DrawBar(246,29,onLeft(246,60),5,col_work); //under editbox |
359 | DrawRectangle3D(246,12,onLeft(66,246),16,col_border,col_border); |
360 | DrawRectangle(246,12,onLeft(66,246),16,col_border); |
360 | DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,col_work); //about |
361 | DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about |
361 | PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); |
362 | PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); |
362 | //main rectangles |
363 | //main rectangles |
363 | DrawRectangle3D(1,40,Form.cwidth-3,onTop(46,0),col_border,col_border); |
364 | DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),col_border); |
364 | DrawRectangle3D(0,39,Form.cwidth-1,onTop(44,0),col_palette[4],col_palette[4]); //bg |
365 | DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg |
365 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
366 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
366 | DrawLeftPanel(); |
367 | DrawLeftPanel(); |
367 | //ListBox |
368 | //ListBox |
368 | DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,"File"); |
369 | DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,"File"); |
Line 371... | Line 372... | ||
371 | DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll |
372 | DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll |
372 | DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18"); |
373 | DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18"); |
373 | DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19"); |
374 | DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19"); |
374 | Open_Dir(#path,ONLY_SHOW); |
375 | Open_Dir(#path,ONLY_SHOW); |
375 | if (del_active) Del_Form(); |
376 | if (del_active) Del_Form(); |
376 | if (rename_active) ActionsProcess(2); |
377 | if (rename_active) FnProcess(2); |
377 | } |
378 | } |
Line 378... | Line 379... | ||
378 | 379 | ||
379 | 380 | ||
Line 385... | Line 386... | ||
385 | PathShow_prepare stdcall(#PathShow); |
386 | PathShow_prepare stdcall(#PathShow); |
386 | PathShow_draw stdcall(#PathShow); |
387 | PathShow_draw stdcall(#PathShow); |
387 | } |
388 | } |
Line 388... | Line 389... | ||
388 | 389 | ||
389 | 390 | ||
390 | void FileList_ReDraw(int cur) |
391 | void List_Current(int cur) |
391 | { |
392 | { |
392 | if (cur<=0) //up |
393 | if (cur<=0) //up |
393 | { |
394 | { |
Line 438... | Line 439... | ||
438 | } |
439 | } |
439 | } |
440 | } |
440 | } |
441 | } |
Line 441... | Line -... | ||
441 | - | ||
442 | - | ||
443 | 442 | ||
444 | 443 | ||
445 | void List_ReDraw() |
444 | void List_ReDraw() |
446 | { |
445 | { |
447 | int paint_y; |
446 | int paint_y; |
448 | //åñëè ìû â êîÃöå ñïèñêà ôà éëîâ ðà çâåðøì îêÃî ïîÿâÿòüñÿ ïóñòÿå áåëûå êÃîïêè |
447 | //åñëè ìû â êîÃöå ñïèñêà ôà éëîâ ðà çâåðøì îêÃî ïîÿâÿòüñÿ ïóñòÿå áåëûå êÃîïêè |
449 | //ýòî åñëè âûäåëåÃèå ïîñëå ñõëîïûâà Ãèÿ îêÃà çà êà äðîì |
448 | //ýòî åñëè âûäåëåÃèå ïîñëå ñõëîïûâà Ãèÿ îêÃà çà êà äðîì |
Line 450... | Line 449... | ||
450 | if (files.count-files.first |
449 | if (files.count-files.first |
451 | { files.first=files.count-files.visible; files.current=files.visible-1; } |
450 | { files.first=files.count-files.visible; files.current=files.visible-1; } |
452 | 451 | ||
453 | for (j=0; j |
452 | for (j=0; j |
454 | //in the bottom |
453 | //in the bottom |
455 | paint_y = j * files.line_h + files.y; |
454 | paint_y = j * files.line_h + files.y; |
456 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
455 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
457 | DrawBar(onLeft(168,0),paint_y,1,onTop(paint_y,6),col_work); |
456 | DrawBar(onLeft(168,0),paint_y,1,onTop(paint_y,6),col_work); |
Line -... | Line 457... | ||
- | 457 | DrawBar(onLeft(95,0),paint_y,1,onTop(paint_y,6),col_work); |
|
458 | DrawBar(onLeft(95,0),paint_y,1,onTop(paint_y,6),col_work); |
458 | Scroll(); |
459 | Scroll(); |
459 | } |
460 | } |
460 | |
461 | 461 | ||
462 | void Line_ReDraw(dword color, filenum){ |
462 | void Line_ReDraw(dword color, filenum){ |
Line 478... | Line 478... | ||
478 | if (!strcmp("..",off)) |
478 | if (!strcmp("..",off)) |
479 | Put_icon("..", files.line_h/2-7+y, color); |
479 | Put_icon("..", files.line_h/2-7+y, color); |
480 | else |
480 | else |
481 | Put_icon(" |
481 | Put_icon(" |
482 | if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; //system or hiden? |
482 | if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; //system or hiden? |
483 | if (color<>0xFFFfff) |
483 | if (color!=0xFFFfff) |
484 | { |
484 | { |
485 | itdir=TestBit(ESDWORD[off-40], 4); |
485 | itdir=TestBit(ESDWORD[off-40], 4); |
486 | strcpy(#file_name, off); |
486 | strcpy(#file_name, off); |
487 | strcpy(#file_path, #path); |
487 | strcpy(#file_path, #path); |
488 | strcat(#file_path, #file_name); |
488 | strcat(#file_path, #file_name); |
Line 500... | Line 500... | ||
500 | DrawBar(onLeft(168,0),y,1,files.line_h,col_work); //gray line 1 |
500 | DrawBar(onLeft(168,0),y,1,files.line_h,col_work); //gray line 1 |
501 | DrawBar(onLeft(95,0),y,1,files.line_h,col_work); //gray line 2 |
501 | DrawBar(onLeft(95,0),y,1,files.line_h,col_work); //gray line 2 |
502 | } |
502 | } |
Line 503... | Line 503... | ||
503 | 503 | ||
504 | 504 | ||
505 | void Open_Dir(dword temp_, redraw){ |
- | |
506 | int errornum, count; |
- | |
Line 507... | Line 505... | ||
507 | char path_[4096], |
505 | void Open_Dir(dword dir_path, redraw){ |
508 | somelen=strlen(temp_)-1; |
506 | int errornum, maxcount; |
509 | - | ||
510 | if (redraw<>ONLY_SHOW) |
507 | |
511 | { |
- | |
512 | strcpy(#path_, temp_); |
508 | if (redraw!=ONLY_SHOW) |
513 | if (somelen) path_[somelen]=NULL; |
509 | { |
514 | 510 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
|
515 | if (buf) free(buf); |
511 | if (buf) free(buf); |
516 | buf = malloc(32); |
512 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
517 | errornum=ReadDir(0, buf, #path_); |
513 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
518 | if (errornum<>0) |
514 | if (errornum) |
519 | { |
515 | { |
520 | HistoryPath(ADD_NEW_PATH); |
516 | HistoryPath(ADD_NEW_PATH); |
521 | GoBack(); |
517 | GoBack(); |
522 | Write_Error(errornum); |
- | |
523 | return; |
- | |
524 | } |
- | |
525 | files.count = ESDWORD[buf+8]; |
- | |
526 | buf = realloc(buf, files.count * 304 + 32); |
518 | Write_Error(errornum); |
527 | ReadDir(files.count, buf, #path_); |
519 | return; |
528 | files.count=EBX; |
- | |
529 | count = sizeof(file_mas)/sizeof(dword)-1; |
520 | } |
530 | if (files.count>count) files.count=count; |
521 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
531 | 522 | if (files.count>maxcount) files.count = maxcount; |
|
532 | } |
523 | } |
533 | if (files.count<>-1) |
524 | if (files.count!=-1) |
534 | { |
- | |
535 | KEdit(); |
525 | { |
536 | HistoryPath(ADD_NEW_PATH); |
526 | KEdit(); |
537 | IF (!strcmp(".",buf+72)) {files.count--; memmov(buf,buf+304,files.count*304);} //oeeuo?oai yeaiaio "." |
527 | HistoryPath(ADD_NEW_PATH); |
538 | files.visible=onTop(6,57)/files.line_h; |
528 | files.visible = files.h / files.line_h; |
539 | IF (files.count |
529 | IF (files.count < files.visible) files.visible = files.count; |
540 | IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,0x4E78AC,"\x19"); |
530 | IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,col_border,"\x19"); |
541 | IF (sort_num==2) WriteText(Form.width-115,45,0x80,0x4E78AC,"\x19"); |
531 | IF (sort_num==2) WriteText(Form.width-115,45,0x80,col_border,"\x19"); |
542 | IF (sort_num==3) WriteText(Form.width-44,45,0x80,0x4E78AC,"\x19"); |
532 | IF (sort_num==3) WriteText(Form.width-44,45,0x80,col_border,"\x19"); |
543 | IF (redraw<>ONLY_SHOW) Sorting(); |
533 | IF (redraw!=ONLY_SHOW) Sorting(); |
544 | IF (redraw<>ONLY_OPEN) List_ReDraw(); |
534 | IF (redraw!=ONLY_OPEN) List_ReDraw(); |
Line 545... | Line -... | ||
545 | } |
- | |
546 | IF (files.count==-1) && (redraw<>ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();} |
535 | } |
547 | } |
536 | IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();} |
548 | 537 | } |
|
549 | 538 | ||
550 | 539 | ||
Line 575... | Line 564... | ||
575 | Sort_by_Name(0,k-1); |
564 | Sort_by_Name(0,k-1); |
576 | IF (sort_num==1) Sort_by_Name(k,files.count-1); |
565 | IF (sort_num==1) Sort_by_Name(k,files.count-1); |
577 | IF (sort_num==2) Sort_by_Type(k,files.count-1); |
566 | IF (sort_num==2) Sort_by_Type(k,files.count-1); |
578 | IF (sort_num==3) Sort_by_Size(k,files.count-1); |
567 | IF (sort_num==3) Sort_by_Size(k,files.count-1); |
579 | //".." should be first |
568 | //".." should be first |
- | 569 | IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0) |
|
580 | IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]> |
570 | FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]> |
581 | } |
571 | } |
Line 582... | Line 572... | ||
582 | 572 | ||
583 | 573 | ||
584 | void Del_Form() |
574 | void Del_Form() |
585 | { |
575 | { |
586 | int dform_x=Form.width/2-13; |
576 | int dform_x = files.w - 200 / 2 + files.x; |
587 | //oeia ieii |
577 | //oeia ieii |
588 | if (!files.count) return; |
578 | if (!files.count) return; |
589 | DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia |
579 | DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia |
Line 597... | Line 587... | ||
597 | { |
587 | { |
598 | WriteText(164+dform_x,190,0x80,0,"...?"); |
588 | WriteText(164+dform_x,190,0x80,0,"...?"); |
599 | ESI = 24; |
589 | ESI = 24; |
600 | WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy |
590 | WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy |
601 | } |
591 | } |
602 | //eiiii?ee |
- | |
603 | DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,"Yes"); |
592 | DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,"Yes"); |
604 | DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,"No"); |
593 | DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,"No"); |
605 | del_active=1; |
594 | del_active=1; |
606 | } |
595 | } |
Line 610... | Line 599... | ||
610 | { |
599 | { |
611 | int del_rezult; |
600 | int del_rezult; |
612 | IF (dodel==true) |
601 | IF (dodel==true) |
613 | { |
602 | { |
614 | del_rezult = DeleteFile(#file_path); |
603 | del_rezult = DeleteFile(#file_path); |
615 | IF (del_rezult<>0) |
604 | IF (del_rezult) |
616 | { |
605 | { |
617 | Write_Error(del_rezult); |
606 | Write_Error(del_rezult); |
618 | IF ( itdir) ShowMessage("Error. Folder isn't empty."); |
607 | IF ( itdir) ShowMessage("Error. Folder isn't empty."); |
619 | IF (!itdir) ShowMessage("Error. Filesystem read-only."); |
608 | IF (!itdir) ShowMessage("Error. Filesystem read-only."); |
620 | } |
609 | } |
621 | } |
610 | } |
622 | del_active=0; |
611 | del_active=0; |
623 | DeleteButton(301); DeleteButton(302); |
612 | DeleteButton(301); DeleteButton(302); |
624 | Open_Dir(#path,1); |
613 | Open_Dir(#path,WITH_REDRAW); |
625 | } |
- | |
626 | - | ||
627 | void Paste() |
- | |
628 | { |
- | |
629 | char new_copy_path[4096]; |
- | |
630 | int copy_rezult; |
- | |
631 | - | ||
632 | IF (!copy_file) return; |
- | |
633 | strcpy(#new_copy_path, #path); |
- | |
634 | strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/')); |
- | |
635 | if (!strcmp(#copy_file,#new_copy_path)) |
- | |
636 | { |
- | |
637 | strcpy(#new_copy_path, #path); |
- | |
638 | strcat(#new_copy_path, "new_"); |
- | |
639 | strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/')); |
- | |
640 | } |
- | |
641 | copy_rezult = CopyFile(#copy_file,#new_copy_path); |
- | |
642 | IF (copy_rezult!=0) |
- | |
643 | { |
- | |
644 | Write_Error(copy_rezult); |
- | |
645 | return; |
- | |
646 | } |
- | |
647 | IF (cut_active) |
- | |
648 | { |
- | |
649 | strcpy(#file_path, #copy_file); |
- | |
650 | Del_File(true); |
- | |
651 | copy_file=NULL; |
- | |
652 | cut_active=false; |
- | |
653 | } |
- | |
654 | SelectFile(#new_copy_path+strrchr(#new_copy_path,'/')); |
- | |
655 | } |
614 | } |
Line 656... | Line 615... | ||
656 | 615 | ||
657 | 616 | ||
Line 664... | Line 623... | ||
664 | if (rename==true) |
623 | if (rename==true) |
665 | { |
624 | { |
666 | strcpy(#temp, #path); |
625 | strcpy(#temp, #path); |
667 | strcpy(#edit_name, #file_name); //save edit name to select it later |
626 | strcpy(#edit_name, #file_name); //save edit name to select it later |
668 | strcat(#temp, #file_name); |
627 | strcat(#temp, #file_name); |
669 | if (strcmp(#file_path,#temp)<>0) && (file_name) |
628 | if (strcmp(#file_path,#temp)!=0) && (file_name) |
670 | IF (itdir) |
629 | if (itdir) |
671 | { |
630 | { |
672 | del_rezult = DeleteFile(#file_path); |
631 | del_rezult = DeleteFile(#file_path); |
673 | IF (del_rezult!=0) |
632 | if (del_rezult!=0) |
674 | { |
633 | { |
675 | Write_Error(del_rezult); |
634 | Write_Error(del_rezult); |
676 | ShowMessage("Error. Folder isn't empty."); |
635 | ShowMessage("Error. Folder isn't empty."); |
677 | return; |
636 | return; |
678 | } |
637 | } |
679 | ELSE CreateDir(#temp); |
638 | ELSE CreateDir(#temp); |
680 | Open_Dir(#path,1); |
639 | Open_Dir(#path,WITH_REDRAW); |
681 | } |
640 | } |
682 | ELSE |
641 | ELSE |
683 | { |
642 | { |
684 | copy_rezult = CopyFile(#file_path,#temp); |
643 | copy_rezult = CopyFile(#file_path,#temp); |
685 | if (copy_rezult!=0) Write_Error(copy_rezult); else Del_File(true); |
644 | if (copy_rezult!=0) Write_Error(copy_rezult); else Del_File(true); |
Line 695... | Line 654... | ||
695 | files.first=files.current=0; |
654 | files.first=files.current=0; |
696 | Open_Dir(#path,ONLY_OPEN); |
655 | Open_Dir(#path,ONLY_OPEN); |
697 | strttl(that_file); |
656 | strttl(that_file); |
698 | for (i=files.count-1; i>=0; i--;) |
657 | for (i=files.count-1; i>=0; i--;) |
699 | if (!strcmp(file_mas[i]*304+buf+72,that_file)) break; |
658 | if (!strcmp(file_mas[i]*304+buf+72,that_file)) break; |
700 | FileList_ReDraw(i); |
659 | List_Current(i); |
701 | List_ReDraw(); |
660 | List_ReDraw(); |
702 | } |
661 | } |
Line 703... | Line 662... | ||
703 | 662 | ||
Line 714... | Line 673... | ||
714 | SelectFile(#cur_folder); |
673 | SelectFile(#cur_folder); |
715 | } |
674 | } |
Line 716... | Line 675... | ||
716 | 675 | ||
717 | void Open() |
676 | void Open() |
- | 677 | { |
|
718 | { |
678 | if (!files.count) return; |
719 | if (!itdir) |
679 | if (!itdir) |
720 | { |
680 | { |
721 | GetIni(0); |
681 | GetIni(0); |
722 | } |
682 | } |
723 | else |
683 | else |
724 | { |
684 | { |
725 | if (!strcmp(#file_name,"..")) { Dir_Up(); return; } |
685 | if (!strcmp(#file_name,"..")) { Dir_Up(); return; } |
726 | strcpy(#path, #file_path); |
686 | strcpy(#path, #file_path); |
727 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
687 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
728 | files.first=files.current=0; |
688 | files.first=files.current=0; |
729 | Open_Dir(#path,1); |
689 | Open_Dir(#path,WITH_REDRAW); |
730 | } |
690 | } |
Line 731... | Line 691... | ||
731 | } |
691 | } |
Line 736... | Line 696... | ||
736 | char cur_folder[4096]; |
696 | char cur_folder[4096]; |
737 | strcpy(#cur_folder, GetCurrentFolder()); |
697 | strcpy(#cur_folder, GetCurrentFolder()); |
738 | if (HistoryPath(GO_BACK)) SelectFile(#cur_folder); |
698 | if (HistoryPath(GO_BACK)) SelectFile(#cur_folder); |
739 | } |
699 | } |
Line 740... | Line 700... | ||
740 | 700 | ||
741 | void ActionsProcess(char N) |
701 | void FnProcess(char N) |
742 | { |
702 | { |
743 | switch(N) |
703 | switch(N) |
744 | { |
704 | { |
745 | case 1: |
705 | case 1: |
746 | SwitchToAnotherThread(); |
706 | SwitchToAnotherThread(); |
747 | CreateThread(#about_dialog,#stak1); |
707 | CreateThread(#about_dialog,#about_stak); |
748 | break; |
708 | break; |
749 | case 2: |
709 | case 2: |
750 | if (!files.count) break; |
710 | if (!files.count) break; |
751 | edit2.flags=100000000000010b; //set active |
711 | edit2.flags=100000000000010b; //set active |
Line 766... | Line 726... | ||
766 | Tip(56, "Devices", 55, "-"); |
726 | Tip(56, "Devices", 55, "-"); |
767 | Open_Dir(#path,WITH_REDRAW); |
727 | Open_Dir(#path,WITH_REDRAW); |
768 | pause(10); |
728 | pause(10); |
769 | GetIni(1); |
729 | GetIni(1); |
770 | SystemDiscsGet(); |
730 | SystemDiscsGet(); |
771 | Open_Dir(#path,1); |
731 | Open_Dir(#path,WITH_REDRAW); |
772 | DrawLeftPanel(); |
732 | DrawLeftPanel(); |
773 | break; |
733 | break; |
774 | case 6: |
734 | case 6: |
775 | strcpy(#temp, #path); |
735 | strcpy(#temp, #path); |
776 | strcat(#temp, "New folder"); |
736 | strcat(#temp, "New folder"); |
777 | CreateDir(#temp); |
737 | CreateDir(#temp); |
778 | if (!EAX){ |
738 | if (!EAX){ |
779 | SelectFile("New folder"); |
739 | SelectFile("New folder"); |
780 | ActionsProcess(2); |
740 | FnProcess(2); |
781 | } |
741 | } |
782 | else |
742 | else |
783 | { |
743 | { |
784 | Write_Error(EAX); |
744 | Write_Error(EAX); |
785 | ShowMessage("Folder can not be created."); |
745 | ShowMessage("Folder can not be created."); |
Line 789... | Line 749... | ||
789 | strcpy(#temp, #path); |
749 | strcpy(#temp, #path); |
790 | strcat(#temp, "New file"); |
750 | strcat(#temp, "New file"); |
791 | WriteFile(0, 0, #temp); |
751 | WriteFile(0, 0, #temp); |
792 | if (!EAX){ |
752 | if (!EAX){ |
793 | SelectFile("New file"); |
753 | SelectFile("New file"); |
794 | ActionsProcess(2); |
754 | FnProcess(2); |
795 | } |
755 | } |
796 | else |
756 | else |
797 | { |
757 | { |
798 | Write_Error(EAX); |
758 | Write_Error(EAX); |
799 | ShowMessage("File can not be created."); |
759 | ShowMessage("File can not be created."); |
Line 803... | Line 763... | ||
803 | RunProgram(EDITOR_PATH, abspath("Eolite.ini")); |
763 | RunProgram(EDITOR_PATH, abspath("Eolite.ini")); |
804 | break; |
764 | break; |
805 | } |
765 | } |
806 | } |
766 | } |
Line 807... | Line -... | ||
807 | - | ||
808 | void copyf_Action() { |
- | |
809 | return; |
- | |
Line 810... | Line 767... | ||
810 | } |
767 | |
Line 811... | Line -... | ||
811 | - | ||
812 | stop: |
- | |
813 | 768 | ||
- | 769 | stop: |
|
- | 770 | ||
- | 771 | char about_stak[512]; |
|
814 | char stak1[512]; |
772 | char menu_stak[512]; |