Subversion Repositories Kolibri OS

Rev

Rev 4002 | Rev 4028 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4002 Rev 4022
Line 1... Line 1...
1
//Leency & Veliant 2008-2013
1
//Leency & Veliant 2008-2013
2
//GNU GPL licence.
2
//GNU GPL licence.
Line -... Line 3...
-
 
3
 
-
 
4
#ifndef AUTOBUILD
-
 
5
#include "lang.h--"
-
 
6
#endif
3
 
7
 
4
//libraries
8
//libraries
5
#define MEMSIZE 0xA0000
9
#define MEMSIZE 0xA0000
6
#include "..\lib\kolibri.h"
10
#include "..\lib\kolibri.h"
7
#include "..\lib\strings.h"
11
#include "..\lib\strings.h"
Line 15... Line 19...
15
#include "..\lib\copyf.h"
19
#include "..\lib\copyf.h"
16
//images
20
//images
17
#include "imgs\toolbar.txt"
21
#include "imgs\toolbar.txt"
18
#include "imgs\left_p.txt"
22
#include "imgs\left_p.txt"
Line 19... Line -...
19
 
-
 
20
#ifndef AUTOBUILD
-
 
21
#include "lang.h--"
-
 
22
#endif
-
 
23
 
23
 
24
#ifdef LANG_RUS
24
#ifdef LANG_RUS
25
	?define T_FILE "” ©«"
25
	?define T_FILE "” ©«"
26
	?define T_TYPE "’¨¯"
26
	?define T_TYPE "’¨¯"
27
	?define T_SIZE " §¬¥à"
27
	?define T_SIZE " §¬¥à"
Line 35... Line 35...
35
	?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
35
	?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
36
	?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
36
	?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
37
	?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
37
	?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
38
	?define T_PASTE_WINDOW "Š®¯¨àãî..."
38
	?define T_PASTE_WINDOW "Š®¯¨àãî..."
39
	?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
39
	?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
-
 
40
	?define T_CANCEL_PASTE "Š®¯¨à®¢ ­¨¥ ¯à¥ªà é¥­®.  ¯ª  ᪮¯¨à®¢ ­  ­¥ ¯®«­®áâìî."
40
#elif LANG_EST
41
#elif LANG_EST
41
	?define T_FILE "Fail"
42
	?define T_FILE "Fail"
42
	?define T_TYPE "Tüüp"
43
	?define T_TYPE "Tüüp"
43
	?define T_SIZE "Suurus"
44
	?define T_SIZE "Suurus"
44
	?define T_NEW_FOLDER "Uus kataloog"
45
	?define T_NEW_FOLDER "Uus kataloog"
Line 51... Line 52...
51
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
52
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
52
	?define NOT_CREATE_FILE "Faili ei saa luua."
53
	?define NOT_CREATE_FILE "Faili ei saa luua."
53
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
54
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
54
	?define T_PASTE_WINDOW "Kopeerin..."
55
	?define T_PASTE_WINDOW "Kopeerin..."
55
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
56
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
-
 
57
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
56
#else
58
#else
57
	?define T_FILE "File"
59
	?define T_FILE "File"
58
	?define T_TYPE "Type"
60
	?define T_TYPE "Type"
59
	?define T_SIZE "Size"
61
	?define T_SIZE "Size"
60
	?define T_NEW_FOLDER "New folder"
62
	?define T_NEW_FOLDER "New folder"
Line 67... Line 69...
67
	?define NOT_CREATE_FOLDER "Folder can not be created."
69
	?define NOT_CREATE_FOLDER "Folder can not be created."
68
	?define NOT_CREATE_FILE "File can not be created."
70
	?define NOT_CREATE_FILE "File can not be created."
69
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
71
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
70
	?define T_PASTE_WINDOW "Copying..."
72
	?define T_PASTE_WINDOW "Copying..."
71
	?define T_PASTE_WINDOW_TEXT "Copying file:"
73
	?define T_PASTE_WINDOW_TEXT "Copying file:"
-
 
74
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
72
#endif
75
#endif
Line 73... Line 76...
73
 
76
 
Line 74... Line 77...
74
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
77
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
75
 
78
 
76
#define TITLE "Eolite File Manager v1.98"
79
#define TITLE "Eolite File Manager v1.98.3"
77
#define ABOUT_TITLE "Eolite v1.98"
80
#define ABOUT_TITLE "Eolite v1.98.3"
78
dword col_work    = 0xE4DFE1;
81
dword col_work    = 0xE4DFE1;
79
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
82
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
80
dword col_padding = 0xC8C9C9;
83
dword col_padding = 0xC8C9C9;
Line 99... Line 102...
99
	sort_num=2,
102
	sort_num=2,
100
	itdir;
103
	itdir;
Line 101... Line 104...
101
 
104
 
102
proc_info Form;
105
proc_info Form;
103
mouse m;
106
mouse m;
104
int mouse_dd, scroll_used, scroll_size;
107
int mouse_dd, scroll_used, scroll_size, sorting_arrow_x;
105
dword buf, off;
108
dword buf, off;
106
dword file_mas[6898];
109
dword file_mas[6898];
Line 107... Line 110...
107
int j, i;
110
int j, i;
Line 278... Line 281...
278
						break;
281
						break;
279
				case 26: //paste
282
				case 26: //paste
280
						CreateThread(#Paste,#copy_stak);
283
						CreateThread(#Paste,#copy_stak);
281
						break;
284
						break;
282
				case 31...33: //sort
285
				case 31...33: //sort
283
						IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10);
286
						IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
284
						IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10);
287
						IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
285
						IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10);
288
						IF(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
286
						sort_num=id-30;
289
						sort_num=id-30;
287
						Open_Dir(#path,WITH_REDRAW);
290
						Open_Dir(#path,WITH_REDRAW);
288
						break;
291
						break;
289
				case 50...60: //Actions
292
				case 50...60: //Actions
290
						FnProcess(id-50);
293
						FnProcess(id-50);
Line 593... Line 596...
593
	{
596
	{
594
		KEdit();
597
		KEdit();
595
		HistoryPath(ADD_NEW_PATH);
598
		HistoryPath(ADD_NEW_PATH);
596
		files.visible = files.h / files.line_h;
599
		files.visible = files.h / files.line_h;
597
		IF (files.count < files.visible) files.visible = files.count;
600
		IF (files.count < files.visible) files.visible = files.count;
598
		IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,col_border,"\x19");
601
		IF (sort_num==1) sorting_arrow_x = Form.width+60/2;
599
		IF (sort_num==2) WriteText(Form.width-115,45,0x80,col_border,"\x19");
602
		IF (sort_num==2) sorting_arrow_x = Form.width-115;
-
 
603
		IF (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
600
		IF (sort_num==3) WriteText(Form.width-44,45,0x80,col_border,"\x19");
604
		WriteText(sorting_arrow_x,45,0x80,col_border,"\x19");
601
		IF (redraw!=ONLY_SHOW) Sorting();
605
		IF (redraw!=ONLY_SHOW) Sorting();
602
		IF (redraw!=ONLY_OPEN) List_ReDraw();
606
		IF (redraw!=ONLY_OPEN) List_ReDraw();
603
	}
607
	}
604
	IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
608
	IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
605
}
609
}
Line 640... Line 644...
640
 
644
 
641
 
645
 
642
void Del_Form()
646
void Del_Form()
-
 
647
{
643
{
648
	int dform_x=files.w-220/2+files.x;
644
	int dform_x=files.w-220/2+files.x;
649
	if (strcmp(#file_name,".")==0) || (strcmp(#file_name,"..")==0) return;
645
	if (del_active==2)
650
	if (del_active==2)
646
	{
651
	{
647
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
652
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
Line 666... Line 671...
666
		DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);		
671
		DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);		
667
		del_active=1;
672
		del_active=1;
668
	}
673
	}
669
}
674
}
Line 670... Line 675...
670
 
675
 
671
	
676
int del_error;
672
void Del_File2(dword way)
677
int Del_File2(dword way)
673
{    
678
{    
-
 
679
	dword dirbuf, fcount, i, filename;
674
	dword dirbuf, fcount, i, filename;
680
	int error;
675
	char del_from[4096], error;
681
	char del_from[4096];
676
	if (DeleteFile(way))
682
	if (isdir(way))
677
	{
683
	{
678
		error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
684
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
679
		for (i=0; i
685
		for (i=0; i
680
		{
686
		{
681
			if (CheckEvent()==evReDraw) draw_window();
687
			if (CheckEvent()==evReDraw) draw_window();
682
			filename = i*304+dirbuf+72;
688
			filename = i*304+dirbuf+72;
683
			strcpy(#del_from, way);
689
			strcpy(#del_from, way);
684
			chrcat(#del_from, '/');
690
			chrcat(#del_from, '/');
685
			strcat(#del_from, filename);
691
			strcat(#del_from, filename);
686
			if ( TestBit(ESDWORD[filename-40], 4) )
692
			if ( TestBit(ESDWORD[filename-40], 4) )
687
				Del_File2(#del_from);
693
				Del_File2(#del_from);
-
 
694
			else
688
			else
695
			{
-
 
696
				if (error = DeleteFile(#del_from)) del_error = error;
689
				DeleteFile(#del_from);
697
			}
690
		}
-
 
691
		DeleteFile(way);
698
		}
-
 
699
	}
692
	}
700
	if (error = DeleteFile(way)) del_error = error;
Line 693... Line 701...
693
}
701
}
694
 
702
 
695
 
703
 
696
void Del_File(byte dodel)
704
void Del_File(byte dodel)
697
{    
705
{   
698
	if (dodel==true)
-
 
699
	{
706
	if (dodel==true)
-
 
707
	{
700
		del_active=2;
708
		del_active=2;
-
 
709
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
701
		List_ReDraw();
710
		del_error = 0;
702
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
711
		Del_File2(#file_path);
703
		Del_File2(#file_path);
712
		if (del_error) Write_Error(del_error);
704
 	}
713
 	}
705
	del_active=0;
714
	del_active=0;