Subversion Repositories Kolibri OS

Rev

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

Rev 7921 Rev 7972
Line 87... Line 87...
87
llist files, files_active, files_inactive;
87
llist files, files_active, files_inactive;
Line 88... Line 88...
88
 
88
 
Line 89... Line 89...
89
byte list_full_redraw;
89
byte list_full_redraw;
90
 
90
 
91
dword buf;
91
dword buf;
92
dword file_mas[6898];
92
collection_int items=0;
Line 93... Line 93...
93
int selected_count;
93
int selected_count;
94
int count_dir;
94
int count_dir;
Line 583... Line 583...
583
void DrawStatusBar()
583
void DrawStatusBar()
584
{
584
{
585
	char status_bar_str[80];
585
	char status_bar_str[80];
586
	int go_up_folder_exists=0;
586
	int go_up_folder_exists=0;
587
	if (!show_status_bar.checked) return;
587
	if (!show_status_bar.checked) return;
588
	if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1;
588
	if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1;
589
	DrawBar(0, Form.cheight - status_bar_h, Form.cwidth,  status_bar_h, sc.work);
589
	DrawBar(0, Form.cheight - status_bar_h, Form.cwidth,  status_bar_h, sc.work);
590
	sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir);
590
	sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir);
591
	WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
591
	WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
592
	if (selected_count) {
592
	if (selected_count) {
593
		sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count);
593
		sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count);
Line 719... Line 719...
719
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
719
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
720
	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);
720
	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);
721
	if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
721
	if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
722
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
722
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
Line 723... Line 723...
723
 
723
 
724
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
724
	file_offet = items.get(filenum+files.first)*304 + buf+32;
725
	attr = ESDWORD[file_offet];
725
	attr = ESDWORD[file_offet];
726
	file.selected = ESBYTE[file_offet+7];
726
	file.selected = ESBYTE[file_offet+7];
727
	file.sizelo   = ESDWORD[file_offet+32];
727
	file.sizelo   = ESDWORD[file_offet+32];
728
	file.sizehi   = ESDWORD[file_offet+36];
728
	file.sizehi   = ESDWORD[file_offet+36];
Line 804... Line 804...
804
			history.add(#path);
804
			history.add(#path);
805
			EventHistoryGoBack();
805
			EventHistoryGoBack();
806
			Write_Error(errornum);
806
			Write_Error(errornum);
807
			return;
807
			return;
808
		}
808
		}
809
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
-
 
810
		if (files.count>maxcount) files.count = maxcount;
-
 
811
		if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
809
		if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
812
	}
810
	}
813
	if (files.count!=-1)
811
	if (files.count!=-1)
814
	{
812
	{
815
		if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
813
		if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
Line 833... Line 831...
833
 
831
 
834
inline Sorting()
832
inline Sorting()
835
{
833
{
836
	dword d=0, f=1;
834
	dword d=0, f=1;
-
 
835
	int j=0;
837
	int j=0;
836
	dword tmp;
Line -... Line 837...
-
 
837
	dword file_off;
-
 
838
 
838
	dword file_off;
839
	items.drop();
839
 
840
 
840
	if (!strcmp(#path,"/")) //do not sort root folder
841
	if (!strcmp(#path,"/")) //do not sort root folder
841
	{
842
	{
842
		for(d=1;d
843
		for(d=1;d
843
		count_dir = d;
844
		count_dir = d;
844
		return;
845
		return;
845
	}
846
	}
846
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
847
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
847
	{
848
	{
848
		if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
849
		if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
849
		if (TestBit(ESDWORD[file_off],4)) //directory?
850
		if (TestBit(ESDWORD[file_off],4)) //directory?
850
		{
851
		{
851
			file_mas[d]=j;
852
			items.set(d, j);
852
			d++;
853
			d++;
853
		}
854
		}
854
		else
855
		else
855
		{
856
		{
856
			file_mas[files.count-f]=j;
857
			items.set(files.count-f, j);
857
			f++;
858
			f++;
858
		}
859
		}
859
	}
860
	}
Line 863... Line 864...
863
	if (sort_type==1) Sort_by_Name(d,files.count-1);
864
	if (sort_type==1) Sort_by_Name(d,files.count-1);
864
	else if (sort_type==2) Sort_by_Type(d,files.count-1);
865
	else if (sort_type==2) Sort_by_Type(d,files.count-1);
865
	else if (sort_type==3) Sort_by_Size(d,files.count-1);
866
	else if (sort_type==3) Sort_by_Size(d,files.count-1);
866
	//reversed sorting
867
	//reversed sorting
867
	if (sort_desc) {
868
	if (sort_desc) {
-
 
869
		for (j=0; j
868
		for (j=0; j
870
			items.swap(files.count-j-1, d+j);
-
 
871
		}
869
		//if (sort_type==1) for (j=0; j
872
		//if (sort_type==1) for (j=0; j
870
	}
873
	}
871
	//make ".." first item in list
874
	//make ".." first item in list
872
	if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
875
	if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0)
873
		for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]>
876
		for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;}
874
}
877
}
Line 875... Line 878...
875
 
878
 
876
 
879
 
Line 911... Line 914...
911
{
914
{
912
	int ind;
915
	int ind;
913
	files.KeyHome();
916
	files.KeyHome();
914
	Open_Dir(#path,ONLY_OPEN);
917
	Open_Dir(#path,ONLY_OPEN);
915
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
918
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
916
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
919
	for (ind=files.count-1; ind>=0; ind--;) { if (streq(items.get(ind)*304+buf+72,that_file)) break; }
917
	files.cur_y = ind - 1;
920
	files.cur_y = ind - 1;
918
	files.KeyDown();
921
	files.KeyDown();
919
	DrawStatusBar();
922
	DrawStatusBar();
920
	List_ReDraw();
923
	List_ReDraw();
921
}
924
}
Line 1148... Line 1151...
1148
void EventSelectFileByKeyPress()
1151
void EventSelectFileByKeyPress()
1149
{
1152
{
1150
	int i;
1153
	int i;
1151
	for (i=files.cur_y+1; i
1154
	for (i=files.cur_y+1; i
1152
	{
1155
	{
1153
		strcpy(#temp, file_mas[i]*304+buf+72);
1156
		strcpy(#temp, items.get(i)*304+buf+72);
1154
		if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
1157
		if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
1155
		{
1158
		{
1156
			files.cur_y = i - 1;
1159
			files.cur_y = i - 1;
1157
			files.KeyDown();
1160
			files.KeyDown();
1158
			List_ReDraw();
1161
			List_ReDraw();