Subversion Repositories Kolibri OS

Rev

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

Rev 8947 Rev 8949
Line 1... Line 1...
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
2
//GNU GPL license.
2
//GNU GPL license.
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
// 70.5 - get volume info and label
4
// 70.5 - get volume info and label
5
 
5
 
6
#define ABOUT_TITLE "EOLITE 5 Beta8"
6
#define ABOUT_TITLE "EOLITE 5 Beta9"
Line 7... Line 7...
7
#define TITLE_EOLITE "Eolite File Manager 5 Beta8"
7
#define TITLE_EOLITE "Eolite File Manager 5 Beta9"
8
#define TITLE_KFM "Kolibri File Manager 2 Beta8";
8
#define TITLE_KFM "Kolibri File Manager 2 Beta9";
9
 
9
 
10
#define MEMSIZE 1024 * 250
10
#define MEMSIZE 1024 * 250
Line 72... Line 72...
72
//Folder data
72
//Folder data
73
	dword buf;
73
	dword buf;
74
	collection_int items=0;
74
	collection_int items=0;
75
	int selected_count;
75
	int selected_count;
76
	int folder_count;
76
	int folder_count;
77
	//dword path;
77
	dword path;
78
	char path[4096];
-
 
Line 79... Line 78...
79
 
78
 
80
//Sselected element data
79
//Sselected element data
81
	byte file_path[4096];
80
	byte file_path[4096];
82
	byte file_name[256];
81
	byte file_name[256];
Line 91... Line 90...
91
	char sort_type=2;
90
	char sort_type=2;
92
	bool sort_desc=false;
91
	bool sort_desc=false;
93
	int status_bar_h;
92
	int status_bar_h;
94
	int icon_size = 18;
93
	int icon_size = 18;
Line 95... Line -...
95
 
-
 
96
 
94
 
97
int active_panel=0;
95
int active_panel=0;
98
int disk_popin_active_on_panel=0;
96
int disk_popin_active_on_panel=0;
99
#define PANES_COUNT 2
97
#define PANES_COUNT 2
100
unsigned char location[PANES_COUNT];
-
 
101
 
-
 
Line 102... Line 98...
102
char active_path[4096], inactive_path[4096];
98
dword location[PANES_COUNT];
103
 
99
 
Line 104... Line 100...
104
dword about_stak=0,properties_stak=0,settings_stak=0;
100
dword about_stak=0,properties_stak=0,settings_stak=0;
Line 132... Line 128...
132
	//-p  : just show file/folder properties dialog
128
	//-p  : just show file/folder properties dialog
133
	//-d  : delete file/folder
129
	//-d  : delete file/folder
134
	//-v : paste files/folder from clipboard
130
	//-v : paste files/folder from clipboard
135
	int i;
131
	int i;
136
	dword p = #param;
132
	dword p = #param;
137
	if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') {
133
	if (streq(#program_path+strrchr(#program_path,'/'), "KFM")) efm = true;
138
		efm = true;
-
 
139
		p += 4;
-
 
140
		if (param[4]==' ') p++;
-
 
141
	}
-
 
Line 142... Line 134...
142
 
134
 
Line 143... Line 135...
143
	LoadIniSettings();
135
	LoadIniSettings();
144
 
136
 
145
	for (i=0; i
137
	for (i=0; i
146
		location[i] = malloc(4096);
138
		location[i] = malloc(4096);
147
		strcpy(location[i], #path_start);
139
		strcpy(location[i], #path_start);
Line 148... Line 140...
148
	}
140
	}
Line 149... Line 141...
149
	//path = location[0];
141
	path = location[0];
150
 
142
 
151
	if (ESBYTE[p]=='\0') return;
143
	if (ESBYTE[p]=='\0') return;
152
 
144
 
153
	if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) 
145
	if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) 
154
	{
146
	{
155
		case 'p':
147
		case 'p':
156
			strcpy(#file_path, p + 3);
148
			strcpy(#file_path, p + 3);
157
			itdir = dir_exists(#file_path);
149
			itdir = dir_exists(#file_path);
158
			strcpy(#file_name, p + strrchr(p, '/'));
150
			strcpy(#file_name, p + strrchr(p, '/'));
159
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
151
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
160
			strcpy(#path, p + 3);
152
			strcpy(path, p + 3);
161
			properties_dialog();
153
			properties_dialog();
162
			ExitProcess();
154
			ExitProcess();
163
		case 'd':
155
		case 'd':
164
			strcpy(#path, p + 3);
156
			strcpy(path, p + 3);
165
			DeleteThread();
157
			DeleteThread();
166
			ExitProcess();
158
			ExitProcess();
167
		case 'v':
159
		case 'v':
168
			cut_active = ESBYTE[p+2] - '0';
160
			cut_active = ESBYTE[p+2] - '0';
Line 169... Line -...
169
			strcpy(#path, p + 4);
-
 
170
			PasteThread();
-
 
171
			ExitProcess();
161
			strcpy(path, p + 4);
Line 172... Line 162...
172
	}
162
			PasteThread();
173
 
163
			ExitProcess();
174
	ESBYTE[0] = NULL;
164
	}
175
 
165
 
176
	if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end
166
	if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end
177
 
167
 
178
	if (dir_exists(p)) {
168
	if (dir_exists(p)) {
179
		strcpy(#path, p);
169
		strcpy(path, p);
180
	} else {
170
	} else {
181
		if (file_exists(p)) {
171
		if (file_exists(p)) {
182
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
172
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
183
			strcpy(#path, p);
173
			strcpy(path, p);
Line 198... Line 188...
198
	load_dll(libimg, #libimg_init,1);
188
	load_dll(libimg, #libimg_init,1);
Line 199... Line 189...
199
 
189
 
200
	SetAppColors();
190
	SetAppColors();
Line 201... Line -...
201
	handle_param();
-
 
202
 
-
 
203
	ESBYTE[0] = NULL;
191
	handle_param();
204
 
192
 
205
	SystemDiscs.Get();
-
 
206
	Open_Dir(#path,ONLY_OPEN);
193
	SystemDiscs.Get();
207
	strcpy(#inactive_path, #path);
194
	Open_Dir(path,ONLY_OPEN);
208
	llist_copy(#files_inactive, #files);
195
	llist_copy(#files_inactive, #files);
209
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
196
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
210
	loop() switch(@WaitEventTimeout(100))
197
	loop() switch(@WaitEventTimeout(100))
Line 331... Line 318...
331
 
318
 
332
			switch(id) 
319
			switch(id) 
333
			{
320
			{
334
				case PATH_BTN:
321
				case PATH_BTN:
335
						notify(COPY_PATH_STR);
322
						notify(COPY_PATH_STR);
336
						Clipboard__CopyText(#path);
323
						Clipboard__CopyText(path);
337
						break;
324
						break;
338
				case KFM_DEV_DROPDOWN_1:
325
				case KFM_DEV_DROPDOWN_1:
339
				case KFM_DEV_DROPDOWN_1+1:
326
				case KFM_DEV_DROPDOWN_1+1:
340
				case KFM_DEV_DROPDOWN_2:
327
				case KFM_DEV_DROPDOWN_2:
Line 357... Line 344...
357
						break;
344
						break;
358
				case 52...60: //Actions
345
				case 52...60: //Actions
359
						FnProcess(id-50);
346
						FnProcess(id-50);
360
						break;
347
						break;
361
				case 61: // Set path as default
348
				case 61: // Set path as default
362
						SetDefaultPath(#path);
349
						SetDefaultPath(path);
363
						break;
350
						break;
364
				case 100...120:
351
				case 100...120:
365
					EventDriveClick(id);
352
					EventDriveClick(id);
366
					break;
353
					break;
367
				case BREADCRUMB_ID...360:
354
				case BREADCRUMB_ID...360:
Line 442... Line 429...
442
							break;
429
							break;
443
					case SCAN_CODE_KEY_G:
430
					case SCAN_CODE_KEY_G:
444
							EventOpenConsoleHere();
431
							EventOpenConsoleHere();
445
							break;
432
							break;
446
					case SCAN_CODE_KEY_V:
433
					case SCAN_CODE_KEY_V:
447
							EventPaste(#path);
434
							EventPaste(path);
448
							break;
435
							break;
449
					case SCAN_CODE_KEY_D: //set image as bg
436
					case SCAN_CODE_KEY_D: //set image as bg
450
							strlcpy(#temp, "\\S__",4);
437
							strlcpy(#temp, "\\S__",4);
451
							strcat(#temp, #file_path);
438
							strcat(#temp, #file_path);
452
							RunProgram("/sys/media/kiv", #temp);
439
							RunProgram("/sys/media/kiv", #temp);
Line 586... Line 573...
586
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
573
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
587
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
574
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
588
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
575
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
589
	for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10));
576
	for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10));
590
	llist_copy(#files_active, #files);
577
	llist_copy(#files_active, #files);
591
	strcpy(#active_path, #path);
-
 
592
	DrawStatusBar();
578
	DrawStatusBar();
593
	if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
579
	if (!selected_count) Open_Dir(path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
594
	DrawFilePanels();
580
	DrawFilePanels();
595
	disk_popin_active_on_panel = 0;
581
	disk_popin_active_on_panel = 0;
596
}
582
}
Line 597... Line 583...
597
 
583
 
Line 608... Line 594...
608
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
594
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
609
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
595
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
610
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
596
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
611
	WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t);
597
	WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t);
612
	DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph);
598
	DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph);
-
 
599
	if (efm) && (files.x<5) {
613
	if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph);	
600
		DrawBar(files.x+files.w+16,files.y,1,files.h,EDX); //line between panel
-
 
601
	}
614
}
602
}
Line 615... Line 603...
615
 
603
 
616
void DrawFuncButtonsInKfm()
604
void DrawFuncButtonsInKfm()
617
{
605
{
618
	int i, x=0, len, min_w=0, padding;
606
	int i, x=0, len, min_w=0, padding;
619
	for (i=0; i<10; i++) min_w += strlen(kfm_func[i])+2*6 + 2;
607
	for (i=0; i<10; i++) min_w += strlen(kfm_func[i])+2*6 + 2;
620
	padding = Form.cwidth - min_w + 4 / 10;
608
	padding = Form.cwidth - min_w + 4 / 10;
621
	for (i=0; i<10; i++) {
609
	for (i=0; i<10; i++) {
622
		len = strlen(kfm_func[i])+2*6 + padding;
610
		len = strlen(kfm_func[i])+2*6 + padding;
-
 
611
		if (i==9) len = Form.cwidth - x - 3;
623
		if (i==9) len = Form.cwidth - x - 3;
612
		DrawBar(x, Form.cheight - 19, 1, 17, sc.work);
624
		DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]);
613
		DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]);
625
		x += len + 2;
614
		x += len + 2;
626
	}
615
	}
Line 630... Line 619...
630
{
619
{
631
	char status_bar_str[80];
620
	char status_bar_str[80];
632
	int go_up_folder_exists=0;
621
	int go_up_folder_exists=0;
Line 633... Line 622...
633
 
622
 
634
	if (efm) { 
623
	if (efm) { 
-
 
624
		DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth,  3, sc.work);
-
 
625
		DrawBar(0, Form.cheight - 2, Form.cwidth,  2, sc.work);
635
		DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth,  status_bar_h-15, sc.work);
626
		DrawBar(Form.cwidth-1, Form.cheight - 19, 1,  17, sc.work);
636
		DrawFuncButtonsInKfm();
627
		DrawFuncButtonsInKfm();
637
		DrawPathBar();
628
		DrawPathBar();
638
		return;
629
		return;
Line 650... Line 641...
650
	}
641
	}
651
}
642
}
Line 652... Line 643...
652
 
643
 
653
void DrawFilePanels()
644
void DrawFilePanels()
654
{
645
{
655
	int files_y;
646
	int files_y = files.y;
656
	int w2 = -Form.cwidth-1/2+Form.cwidth;
647
	int w2 = -Form.cwidth-1/2+Form.cwidth;
657
	int h2;
648
	int h2 = Form.cheight-files_y-2 - status_bar_h;
658
	if (!efm)
649
	if (!efm)
659
	{
650
	{
660
		DrawDeviceAndActionsLeftPanel();
651
		DrawDeviceAndActionsLeftPanel();
661
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
652
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
662
		DrawButtonsAroundList();
653
		DrawButtonsAroundList();
663
		List_ReDraw();
654
		List_ReDraw();
664
	}
655
	}
665
	else
656
	else
-
 
657
	{
666
	{
658
		llist_copy(#files_active, #files);
667
		llist_copy(#files, #files_inactive);
659
		llist_copy(#files, #files_inactive);
668
		strcpy(#path, #inactive_path);
-
 
669
		files_y = files.y;
-
 
670
		h2 = Form.cheight-files_y-2 - status_bar_h;
-
 
Line 671... Line 660...
671
		col.selec = col.selec_inactive;  //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList();
660
		path = location[active_panel^1];
672
 
661
 
673
		if (active_panel==0)
662
		if (active_panel==0)
674
		{
663
		{
675
			files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h);
664
			files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h);
676
			DrawButtonsAroundList();
665
			DrawButtonsAroundList();
677
			Open_Dir(#path,WITH_REDRAW);
666
			Open_Dir(path,WITH_REDRAW);
678
			files_inactive.count = files.count;
667
			files_inactive.count = files.count;
679
			llist_copy(#files, #files_active);
-
 
680
			strcpy(#path, #active_path);
668
			llist_copy(#files, #files_active);
681
			col.selec = col.selec_active;
669
			path = location[active_panel];
682
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
670
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
683
			DrawButtonsAroundList();
671
			DrawButtonsAroundList();
684
			Open_Dir(#path,WITH_REDRAW);
672
			Open_Dir(path,WITH_REDRAW);
685
		}
673
		}
686
		if (active_panel==1)
674
		if (active_panel==1)
687
		{
675
		{
688
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
676
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
689
			DrawButtonsAroundList();
677
			DrawButtonsAroundList();
690
			Open_Dir(#path,WITH_REDRAW);
678
			Open_Dir(path,WITH_REDRAW);
691
			files_inactive.count = files.count;
679
			files_inactive.count = files.count;
692
			llist_copy(#files, #files_active);
-
 
693
			strcpy(#path, #active_path);
680
			llist_copy(#files, #files_active);
694
			col.selec = col.selec_active;
681
			path = location[active_panel];
695
			files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h);
682
			files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h);
696
			DrawButtonsAroundList();
683
			DrawButtonsAroundList();
697
			Open_Dir(#path,WITH_REDRAW);
684
			Open_Dir(path,WITH_REDRAW);
698
		}
685
		}
Line 699... Line 686...
699
	}
686
	}
Line 743... Line 730...
743
}
730
}
Line 744... Line 731...
744
 
731
 
745
void Line_ReDraw(dword bgcol, filenum){
732
void Line_ReDraw(dword bgcol, filenum){
746
	dword text_col=col.list_gb_text,
733
	dword text_col=col.list_gb_text,
747
		  ext1, attr,
-
 
748
		  file_offet,
734
		  ext1, attr,
749
		  file_name_off,
735
		  file_name_off,
750
		  file_size=0,
736
		  file_size=0,
751
		  y=filenum*files.item_h+files.y,
737
		  y=filenum*files.item_h+files.y,
752
		  icon_y = files.item_h-icon_size/2+y;
738
		  icon_y = files.item_h-icon_size/2+y;
753
		  BDVK file;
739
		  BDVK file;
754
		  char full_path[4096];
740
		  char full_path[4096];
-
 
741
		  dword separator_color;
755
		  dword separator_color;
742
		  bool current_inactive = false;
756
	char label_file_name[4096];
743
	char label_file_name[4096];
Line -... Line 744...
-
 
744
	if (filenum==-1) return;
-
 
745
 
-
 
746
	if (bgcol==col.selec) && (files.x==files_inactive.x) {
-
 
747
		bgcol = col.list_bg;
-
 
748
		current_inactive = true;
757
	if (filenum==-1) return;
749
	}
758
 
750
 
759
	DrawBar(files.x,y,4,files.item_h,bgcol);
751
	DrawBar(files.x,y,4,files.item_h,bgcol);
760
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
752
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
761
	if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
753
	if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
Line 767... Line 759...
767
	}
759
	}
768
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
760
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
769
	DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color);
761
	DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color);
770
	DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color);
762
	DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color);
Line 771... Line 763...
771
 
763
 
772
	file_offet = items.get(filenum+files.first)*304 + buf+32;
764
	ESI = items.get(filenum+files.first)*304 + buf+32;
773
	attr = ESDWORD[file_offet];
765
	attr = ESDWORD[ESI];
774
	file.selected = ESBYTE[file_offet+7];
766
	file.selected = ESBYTE[ESI+7];
775
	file.sizelo   = ESDWORD[file_offet+32];
767
	file.sizelo   = ESDWORD[ESI+32];
776
	file.sizehi   = ESDWORD[file_offet+36];
768
	file.sizehi   = ESDWORD[ESI+36];
-
 
769
	file_name_off = ESI+40;
Line 777... Line 770...
777
	file_name_off = file_offet+40;
770
	sprintf(#full_path,"%s/%s",path,file_name_off);
778
 
-
 
779
	if (! attr & ATR_FOLDER) //file or folder?
-
 
780
	{	
-
 
781
		ext1 = strrchr(file_name_off,'.') + file_name_off;
-
 
782
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
-
 
783
		file_size = ConvertSize64(file.sizelo, file.sizehi);
-
 
784
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
-
 
785
	}
771
 
786
	else
772
	if (attr&ATR_FOLDER)
787
	{
773
	{	
788
		if (!strcmp(file_name_off,"..")) ext1=""; else {
774
		if (!strcmp(file_name_off,"..")) ext1=""; else {
789
			ext1="";
775
			ext1="";
790
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
776
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
-
 
777
		}
-
 
778
		if (chrnum(path, '/')==1) && (streq(path, "/kolibrios")==false) file_size = GetDeviceSize(#full_path);
-
 
779
	}
-
 
780
	else
-
 
781
	{
-
 
782
		ext1 = strrchr(file_name_off,'.') + file_name_off;
-
 
783
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
791
		}
784
		file_size = ConvertSize64(file.sizelo, file.sizehi);
792
		if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path);
785
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
793
	}
786
	}
Line 794... Line 787...
794
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
787
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
795
			files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
788
			files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
796
 
789
 
797
	if (attr&2) || (attr&4) text_col=col.list_text_hidden; //system or hiden?
790
	if (attr&ATR_HIDDEN) || (attr&ATR_SYSTEM) text_col=col.list_text_hidden;
798
	if (bgcol==col.selec)
791
	if (bgcol==col.selec)
799
	{
792
	{
800
		file_name_is_8_3(file_name_off);
793
		file_name_is_8_3(file_name_off);
801
		itdir = attr & ATR_FOLDER;
794
		itdir = attr & ATR_FOLDER;
802
		strcpy(#file_name, file_name_off);
795
		strcpy(#file_name, file_name_off);
803
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
796
		if (streq(path,"/")) sprintf(#file_path,"%s%s",path,file_name_off);
804
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
797
			else sprintf(#file_path,"%s/%s",path,file_name_off);
805
		if (text_col==col.list_text_hidden) {
798
		if (text_col==col.list_text_hidden) {
806
			text_col=MixColors(col.selec_text, col.list_text_hidden, 65); 
799
			text_col=MixColors(col.selec_text, col.list_text_hidden, 65); 
Line 820... Line 813...
820
			PathShow_draw stdcall(#FileShow);
813
			PathShow_draw stdcall(#FileShow);
821
		}		
814
		}		
822
	}
815
	}
823
	else
816
	else
824
	{
817
	{
-
 
818
		//that shit must be it a library
825
		strcpy(#label_file_name, file_name_off);
819
		strcpy(#label_file_name, file_name_off);
826
		if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
820
		if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
827
		{
821
		{
828
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
822
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
829
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
823
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
Line 831... Line 825...
831
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
825
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
832
		}
826
		}
833
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, 
827
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, 
834
			bgcol, text_col, kfont.size.pt, #label_file_name);
828
			bgcol, text_col, kfont.size.pt, #label_file_name);
835
	}
829
	}
836
	if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active);
-
 
837
 
-
 
838
	sprintf(#full_path,"%s/%s",#path,file_name_off);
-
 
839
	DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
830
	DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
-
 
831
	if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active);
840
}
832
}
Line 841... Line 833...
841
 
833
 
842
 
834
 
Line 846... Line 838...
846
	selected_count = 0;
838
	selected_count = 0;
847
	if (buf) free(buf);
839
	if (buf) free(buf);
848
	errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
840
	errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
849
	if (errornum)
841
	if (errornum)
850
	{
842
	{
851
		history.add(#path);
843
		history.add(path);
852
		EventHistoryGoBack();
844
		EventHistoryGoBack();
853
		Write_Error(errornum);
845
		Write_Error(errornum);
854
		return;
846
		return;
855
	}
847
	}
856
	if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
848
	if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
Line 857... Line -...
857
 
-
 
858
	history.add(#path);
849
 
859
	SystemDiscs.Draw();
850
	SystemDiscs.Draw();
860
	files.visible = files.h / files.item_h;
851
	files.visible = files.h / files.item_h;
861
	if (files.count < files.visible) files.visible = files.count;
852
	if (files.count < files.visible) files.visible = files.count;
862
	if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4)) 
853
	if (!strncmp(dir_path, "/rd/1",5)) || (!strncmp(dir_path, "/sys/",4)) 
863
		dir_at_fat16 = true; else dir_at_fat16 = false; 
854
		dir_at_fat16 = true; else dir_at_fat16 = false; 
864
	Sorting();
855
	Sorting();
865
	list_full_redraw = true;
856
	list_full_redraw = true;
866
	SetCurDir(dir_path);
857
	SetCurDir(dir_path);
867
	DrawPathBar();
858
	DrawPathBar();
-
 
859
	if (redraw!=ONLY_OPEN) {
868
	if (redraw!=ONLY_OPEN) {
860
		history.add(path);
869
		List_ReDraw();
861
		List_ReDraw();
870
		DrawStatusBar(); 
862
		DrawStatusBar(); 
871
	}
863
	}
Line 877... Line 869...
877
	int j=0;
869
	int j=0;
878
	dword file_off;
870
	dword file_off;
Line 879... Line 871...
879
 
871
 
Line 880... Line 872...
880
	items.drop();
872
	items.drop();
881
 
873
 
882
	if (!strcmp(#path,"/")) //do not sort root folder
874
	if (streq(path,"/")) //do not sort root folder
883
	{
875
	{
884
		for(d=1;d
876
		for(d=1;d
885
		folder_count = d;
877
		folder_count = d;
Line 950... Line 942...
950
 
942
 
951
void SelectFileByName(dword that_file)
943
void SelectFileByName(dword that_file)
952
{
944
{
953
	int ind;
945
	int ind;
954
	files.KeyHome();
946
	files.KeyHome();
955
	Open_Dir(#path,ONLY_OPEN);
947
	Open_Dir(path,ONLY_OPEN);
956
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
948
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
957
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
949
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
958
	files.cur_y = ind - 1;
950
	files.cur_y = ind - 1;
959
	files.KeyDown();
951
	files.KeyDown();
Line 964... Line 956...
964
 
956
 
965
void Dir_Up()
957
void Dir_Up()
966
{
958
{
967
	int iii;
959
	int iii;
968
	char old_folder_name[4096];
960
	char old_folder_name[4096];
969
	iii=strlen(#path)-1;
961
	iii=strlen(path)-1;
970
	if (iii==0) return;
962
	if (iii==0) return;
971
	iii = strrchr(#path, '/');
963
	iii = strrchr(path, '/');
972
	strcpy(#old_folder_name, #path+iii);
964
	strcpy(#old_folder_name, path+iii);
973
	if (iii>1) path[iii-1]=NULL; else path[iii]=NULL;
965
	if (iii>1) ESBYTE[path+iii-1]=NULL; else ESBYTE[path+iii]=NULL;
974
	SelectFileByName(#old_folder_name);
966
	SelectFileByName(#old_folder_name);
Line 975... Line 967...
975
}
967
}
976
 
968
 
977
void EventOpenSelected()
969
void EventOpenSelected()
978
{
970
{
979
	int i;
971
	int i;
980
	for (i=0; i
972
	for (i=0; i
981
		EDX = items.get(i)*304 + buf+32;
973
		EDX = items.get(i)*304 + buf+32;
982
		if (ESDWORD[EDX]&ATR_FOLDER) continue; //is foder
974
		if (ESDWORD[EDX]&ATR_FOLDER) continue; //is foder
983
		sprintf(#param,"%s/%s",#path, EDX+40);
975
		sprintf(#param,"%s/%s",path, EDX+40);
984
		RunProgram("/sys/@open", #param);
976
		RunProgram("/sys/@open", #param);
Line 985... Line 977...
985
	}
977
	}
Line 1000... Line 992...
1000
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
992
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
1001
	} 
993
	} 
1002
	else
994
	else
1003
	{
995
	{
1004
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
996
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
1005
		strcpy(#path, #file_path);
997
		strcpy(path, #file_path);
1006
		files.first=files.cur_y=0;
998
		files.first=files.cur_y=0;
1007
		Open_Dir(#path,WITH_REDRAW);
999
		Open_Dir(path,WITH_REDRAW);
1008
	}
1000
	}
1009
}
1001
}
Line 1010... Line 1002...
1010
 
1002
 
1011
inline fastcall void EventHistoryGoBack()
1003
inline fastcall void EventHistoryGoBack()
1012
{
1004
{
1013
	char cur_folder[4096];
1005
	char cur_folder[4096];
1014
	strcpy(#cur_folder, #path);
1006
	strcpy(#cur_folder, path);
1015
	if (history.back()) {
1007
	if (history.back()) {
1016
		strcpy(#path, history.current());
1008
		strcpy(path, history.current());
1017
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1009
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1018
	}
1010
	}
Line 1019... Line 1011...
1019
}
1011
}
Line 1028... Line 1020...
1028
void NewElement()
1020
void NewElement()
1029
{
1021
{
1030
	BDVK element_info;
1022
	BDVK element_info;
1031
	byte copy_result, info_result;
1023
	byte copy_result, info_result;
Line 1032... Line 1024...
1032
 
1024
 
1033
	sprintf(#temp,"%s/%s",#path,new_file_ed.text);
1025
	sprintf(#temp,"%s/%s",path,new_file_ed.text);
1034
	info_result = GetFileInfo(#temp, #element_info);
1026
	info_result = GetFileInfo(#temp, #element_info);
1035
	switch(new_element_active)
1027
	switch(new_element_active)
1036
	{
1028
	{
1037
		case CREATE_FILE:
1029
		case CREATE_FILE:
Line 1076... Line 1068...
1076
						}
1068
						}
1077
					}
1069
					}
1078
				}
1070
				}
1079
			}
1071
			}
1080
	}
1072
	}
1081
	Open_Dir(#path,WITH_REDRAW);
1073
	Open_Dir(path,WITH_REDRAW);
1082
	SelectFileByName(new_file_ed.text);
1074
	SelectFileByName(new_file_ed.text);
1083
	EventClosePopinForm();
1075
	EventClosePopinForm();
1084
}
1076
}
Line 1085... Line 1077...
1085
 
1077
 
Line 1124... Line 1116...
1124
			if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path);
1116
			if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path);
1125
			break;
1117
			break;
1126
		case 5:
1118
		case 5:
1127
			if (efm) {
1119
			if (efm) {
1128
				CopyFilesListToClipboard(COPY);
1120
				CopyFilesListToClipboard(COPY);
1129
				EventPaste(#inactive_path);
1121
				EventPaste(location[active_panel^1]);
1130
			} else {
1122
			} else {
1131
				EventManualFolderRefresh();
1123
				EventManualFolderRefresh();
1132
			}
1124
			}
1133
			break;
1125
			break;
1134
		case 6:
1126
		case 6:
1135
			if (efm) {
1127
			if (efm) {
1136
				CopyFilesListToClipboard(CUT);
1128
				CopyFilesListToClipboard(CUT);
1137
				EventPaste(#inactive_path);
1129
				EventPaste(location[active_panel^1]);
1138
			}
1130
			}
1139
			break;
1131
			break;
1140
		case 7:
1132
		case 7:
1141
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1133
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1142
			break;
1134
			break;
Line 1145... Line 1137...
1145
			break;
1137
			break;
1146
		case 9:
1138
		case 9:
1147
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1139
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1148
			break;
1140
			break;
1149
		case 10: //F10
1141
		case 10: //F10
1150
			if (!active_settings) 
1142
			if (active_settings) {
-
 
1143
				ActivateWindow(GetProcessSlot(settings_window));
1151
			{
1144
			} else {
1152
				settings_stak = malloc(4096);
1145
				settings_stak = malloc(4096);
1153
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1146
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1154
				break;
-
 
1155
			}
-
 
1156
			else
-
 
1157
			{
-
 
1158
				ActivateWindow(GetProcessSlot(settings_window));
-
 
1159
			}
1147
			}
1160
			break;
1148
			break;
1161
	}
1149
	}
1162
}
1150
}
Line 1165... Line 1153...
1165
{
1153
{
1166
	if (active_panel != _active) {	
1154
	if (active_panel != _active) {	
1167
		active_panel = _active;
1155
		active_panel = _active;
1168
		llist_copy(#files_active, #files_inactive);
1156
		llist_copy(#files_active, #files_inactive);
1169
		llist_copy(#files_inactive, #files);
1157
		llist_copy(#files_inactive, #files);
1170
		strcpy(#active_path, #inactive_path);
1158
		llist_copy(#files, #files_active);
1171
		strcpy(#inactive_path, #path);
1159
		path = location[active_panel];
1172
		DrawFilePanels();
1160
		DrawFilePanels();
1173
	}
1161
	}
1174
}
1162
}
Line 1175... Line 1163...
1175
 
1163
 
Line 1187... Line 1175...
1187
			return;
1175
			return;
1188
		}
1176
		}
1189
	}
1177
	}
1190
}
1178
}
Line 1191... Line 1179...
1191
 
1179
 
1192
dword GetDeviceSizeLabel(dword path)
1180
dword GetDeviceSize(dword p)
1193
{
1181
{
1194
	BDVK bdvk;
1182
	BDVK bdvk;
1195
	if (ESBYTE[path+1] == '/') path++;
1183
	if (ESBYTE[p+1] == '/') p++;
1196
	if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd')
1184
	if (ESBYTE[p+1] == 'c') && (ESBYTE[p+2] == 'd')
1197
		&& (ESBYTE[path+4] == 0) return 0;
1185
		&& (ESBYTE[p+4] == 0) return 0;
1198
	GetFileInfo(path, #bdvk);
1186
	GetFileInfo(p, #bdvk);
1199
	return ConvertSize64(bdvk.sizelo, bdvk.sizehi);
1187
	return ConvertSize64(bdvk.sizelo, bdvk.sizehi);
Line 1200... Line 1188...
1200
}
1188
}
1201
 
1189
 
Line 1211... Line 1199...
1211
}
1199
}
Line 1212... Line 1200...
1212
 
1200
 
1213
void EventRefreshDisksAndFolders()
1201
void EventRefreshDisksAndFolders()
1214
{
1202
{
1215
	if(efm) {
1203
	if(efm) {
1216
		if (GetRealFileCountInFolder(#inactive_path) != files_inactive.count) {
1204
		if (GetRealFileCountInFolder(location[active_panel^1]) != files_inactive.count) {
1217
			DrawFilePanels();
1205
			DrawFilePanels();
1218
			return;
1206
			return;
1219
		}
1207
		}
1220
	} else {
1208
	} else {
1221
		if (GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
1209
		if (GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
1222
			SystemDiscs.Get();
1210
			SystemDiscs.Get();
1223
			DrawDeviceAndActionsLeftPanel();
1211
			DrawDeviceAndActionsLeftPanel();
1224
		}
1212
		}
1225
	}
1213
	}
1226
	if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
1214
	if(GetRealFileCountInFolder(path) != files.count) Open_Dir(path,WITH_REDRAW);
Line 1227... Line 1215...
1227
}
1215
}
1228
 
1216
 
1229
void EventManualFolderRefresh()
1217
void EventManualFolderRefresh()
Line 1239... Line 1227...
1239
	char selected_filename[256];
1227
	char selected_filename[256];
1240
	if (sort_type == id) sort_desc ^= 1;
1228
	if (sort_type == id) sort_desc ^= 1;
1241
	else sort_type = id;
1229
	else sort_type = id;
1242
	strcpy(#selected_filename, #file_name);
1230
	strcpy(#selected_filename, #file_name);
1243
	DrawButtonsAroundList();
1231
	DrawButtonsAroundList();
1244
	Open_Dir(#path,WITH_REDRAW);
1232
	Open_Dir(path,WITH_REDRAW);
1245
	SelectFileByName(#selected_filename);
1233
	SelectFileByName(#selected_filename);
1246
}
1234
}
Line 1247... Line 1235...
1247
 
1235
 
1248
void EventHistoryGoForward()
1236
void EventHistoryGoForward()
1249
{
1237
{
1250
	if (history.forward()) {
1238
	if (history.forward()) {
1251
		strcpy(#path, history.current());
1239
		strcpy(path, history.current());
1252
		files.KeyHome();
1240
		files.KeyHome();
1253
		Open_Dir(#path,WITH_REDRAW);
1241
		Open_Dir(path,WITH_REDRAW);
1254
	}
1242
	}
Line 1255... Line 1243...
1255
}
1243
}
1256
 
1244
 
1257
void EventOpenNewEolite()
1245
void EventOpenNewEolite()
1258
{
1246
{
Line 1259... Line 1247...
1259
	RunProgram(I_Path, #path);
1247
	RunProgram(I_Path, path);
1260
}
1248
}
1261
 
1249
 
1262
void EventOpenConsoleHere()
1250
void EventOpenConsoleHere()
1263
{
1251
{
Line 1264... Line 1252...
1264
	sprintf(#param, "pwd cd %s", #path);
1252
	sprintf(#param, "pwd cd %s", path);
1265
	RunProgram("/sys/shell", #param);
1253
	RunProgram("/sys/shell", #param);
Line 1372... Line 1360...
1372
		case BACK_BTN: EventHistoryGoBack(); break;
1360
		case BACK_BTN: EventHistoryGoBack(); break;
1373
		case FWRD_BTN: EventHistoryGoForward(); break;
1361
		case FWRD_BTN: EventHistoryGoForward(); break;
1374
		case GOUP_BTN: Dir_Up(); break;
1362
		case GOUP_BTN: Dir_Up(); break;
1375
		case COPY_BTN: CopyFilesListToClipboard(CUT); break;
1363
		case COPY_BTN: CopyFilesListToClipboard(CUT); break;
1376
		case CUT_BTN:  CopyFilesListToClipboard(COPY); break;
1364
		case CUT_BTN:  CopyFilesListToClipboard(COPY); break;
1377
		case PASTE_BTN:EventPaste(#path); break;		
1365
		case PASTE_BTN:EventPaste(path); break;		
1378
	}
1366
	}
1379
}
1367
}
Line 1380... Line 1368...
1380
 
1368
 
1381
void EventDriveClick(int __id)
1369
void EventDriveClick(int __id)
Line 1389... Line 1377...
1389
void EventOpenDiskPopin(int panel_n)
1377
void EventOpenDiskPopin(int panel_n)
1390
{
1378
{
1391
	DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
1379
	DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
1392
	if (panel_n==0) {
1380
	if (panel_n==0) {
1393
		disk_popin_active_on_panel = 1;
1381
		disk_popin_active_on_panel = 1;
1394
		SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3);
1382
		SystemDiscs.DrawOptions(Form.cwidth/2-DDW);
1395
	} else {
1383
	} else {
1396
		disk_popin_active_on_panel = 2;
1384
		disk_popin_active_on_panel = 2;
1397
		SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3);
1385
		SystemDiscs.DrawOptions(Form.cwidth-DDW-2);
1398
	}
1386
	}
1399
}
1387
}
Line 1400... Line 1388...
1400
 
1388