Subversion Repositories Kolibri OS

Rev

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

Rev 7606 Rev 7628
Line 52... Line 52...
52
 
52
 
Line 53... Line 53...
53
dword col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
53
dword col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
Line 54... Line 54...
54
 
54
 
-
 
55
int toolbar_buttons_x[7]={9,46,85,134,167,203};
-
 
56
 
-
 
57
bool active_about = false;
-
 
58
bool active_settings = false;
-
 
59
bool _not_draw = false;
-
 
60
bool menu_call_mouse = false;
55
int toolbar_buttons_x[7]={9,46,85,134,167,203};
61
bool exif_load = false;
56
 
62
bool dir_at_fat16 = NULL;
57
byte active_about=0;
-
 
58
word about_window;
-
 
59
word settings_window;
-
 
60
byte active_settings=0;
-
 
Line 61... Line 63...
61
dword _not_draw = false;
63
 
62
byte menu_call_mouse=0;
64
word about_thread_id;
Line 63... Line 65...
63
byte exif_load=0;
65
word settings_window;
Line 72... Line 74...
72
dword buf;
74
dword buf;
73
dword file_mas[6898];
75
dword file_mas[6898];
74
int selected_count;
76
int selected_count;
75
int count_dir;
77
int count_dir;
Line 76... Line -...
76
 
-
 
77
byte
78
 
78
	path[4096],
79
byte path[4096];
79
	file_path[4096],
80
byte file_path[4096];
80
	file_name[256],
81
byte file_name[256];
81
	new_element_name[256],
82
byte new_element_name[256];
82
	temp[4096],
83
byte temp[4096];
Line 83... Line 84...
83
	itdir;
84
bool itdir;
Line 84... Line 85...
84
 
85
 
85
char active_path[4096], inactive_path[4096];
86
char active_path[4096], inactive_path[4096];
Line 130... Line 131...
130
#include "include\properties.h"
131
#include "include\properties.h"
131
#include "include\breadcrumbs.h"
132
#include "include\breadcrumbs.h"
Line 132... Line 133...
132
 
133
 
133
void main() 
134
void main() 
134
{
-
 
135
	char selected_filename[256];
135
{
136
	dword id;
136
	dword id;
137
	byte count_sl = 0;
137
	byte count_sl = 0;
138
	signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
138
	signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
139
	char stats;
139
	char stats;
Line 339... Line 339...
339
				}
339
				}
Line 340... Line 340...
340
 
340
 
341
				switch(id) 
341
				switch(id) 
342
				{
342
				{
343
					case CLOSE_BTN:
343
					case CLOSE_BTN:
344
							KillProcess(about_window);
344
							KillProcess(about_thread_id);
345
							SaveIniSettings();
345
							SaveIniSettings();
346
							ExitProcess();
346
							ExitProcess();
347
					case PATH_BTN:
347
					case PATH_BTN:
348
							notify(COPY_PATH_STR);
348
							notify(COPY_PATH_STR);
Line 369... Line 369...
369
							Copy(#file_path, NOCUT);
369
							Copy(#file_path, NOCUT);
370
							break;
370
							break;
371
					case 26:
371
					case 26:
372
							Paste();
372
							Paste();
373
							break;
373
							break;
374
					case 31...33: //sorting
374
					case 31...33:
375
							id -= 30;
-
 
376
							if (sort_type == id) sort_desc ^= 1;
-
 
377
							else sort_type = id;
-
 
378
							strcpy(#selected_filename, #file_name);
-
 
379
							DrawList();
375
							EventSort(id-30);
380
							Open_Dir(#path,WITH_REDRAW);
-
 
381
							SelectFileByName(#selected_filename);
-
 
382
							break;
376
							break;
383
					case 50...60: //Actions
377
					case 50...60: //Actions
384
							FnProcess(id-50);
378
							FnProcess(id-50);
385
							break;
379
							break;
386
					case 61: // Set path as default
380
					case 61: // Set path as default
Line 426... Line 420...
426
 
420
 
427
				if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
421
				if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
428
				{
422
				{
429
					switch(key_scancode)
423
					switch(key_scancode)
-
 
424
					{
-
 
425
						case SCAN_CODE_F1...SCAN_CODE_F3:
-
 
426
								EventSort(key_scancode - 58);
430
					{
427
								break;
431
						case 059...068:
428
						case SCAN_CODE_1...SCAN_CODE_10:
432
								key_scancode -= 59;
429
								key_scancode-=2;
433
								if (key_scancode < SystemDiscs.list.count)
-
 
434
								{
430
								if (key_scancode >= SystemDiscs.list.count) break;
435
									if (!two_panels.checked)
431
								if (!two_panels.checked)
436
									{
432
								{
437
										DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
433
									DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
438
										pause(7);										
434
									pause(7);										
439
									}
435
								}
440
									SystemDiscs.Click(key_scancode);
-
 
441
								}
436
								SystemDiscs.Click(key_scancode);
442
								break;
437
								break;
443
						case SCAN_CODE_KEY_X:
438
						case SCAN_CODE_KEY_X:
444
								Copy(#file_path, CUT);
439
								Copy(#file_path, CUT);
445
								break;						
440
								break;						
Line 702... Line 697...
702
 
697
 
703
	if (del_active) Del_Form();
698
	if (del_active) Del_Form();
704
	if (new_element_active) && (col_selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
699
	if (new_element_active) && (col_selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
Line -... Line 700...
-
 
700
}
-
 
701
 
-
 
702
bool file_name_is_8_3(dword name)
-
 
703
{
-
 
704
	int name_len = strlen(name);
-
 
705
	int dot_pos = strrchr(name, '.');
-
 
706
	if (name_len<=12) 
-
 
707
	{
-
 
708
		if (dot_pos) {
-
 
709
			if (name_len - dot_pos > 3) return false;
-
 
710
		}
-
 
711
		else {
-
 
712
			if (name_len>8) return false; 
-
 
713
		}
-
 
714
		return true;
-
 
715
	}
Line 705... Line 716...
705
}
716
	return false;
706
 
717
}
707
 
718
 
708
void Line_ReDraw(dword bgcol, filenum){
719
void Line_ReDraw(dword bgcol, filenum){
Line 751... Line 762...
751
	DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
762
	DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
Line 752... Line 763...
752
 
763
 
753
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
764
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
754
	if (bgcol==col_selec)
765
	if (bgcol==col_selec)
-
 
766
	{
755
	{
767
		file_name_is_8_3(file_name_off);
756
		itdir = TestBit(attr, 4);
768
		itdir = TestBit(attr, 4);
757
		strcpy(#file_name, file_name_off);
769
		strcpy(#file_name, file_name_off);
758
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
770
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
759
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
771
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
Line 813... Line 825...
813
		if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
825
		if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
814
		history.add(#path);
826
		history.add(#path);
815
		SystemDiscs.Draw();
827
		SystemDiscs.Draw();
816
		files.visible = files.h / files.item_h;
828
		files.visible = files.h / files.item_h;
817
		if (files.count < files.visible) files.visible = files.count;
829
		if (files.count < files.visible) files.visible = files.count;
-
 
830
		if (!strncmp(dir_path, "/rd/1/",5)) 
-
 
831
			dir_at_fat16 = true; else dir_at_fat16 = false; 
818
		if (redraw!=ONLY_SHOW) Sorting();
832
		if (redraw!=ONLY_SHOW) Sorting();
819
		list_full_redraw = true;
833
		list_full_redraw = true;
820
		if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
834
		if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
821
		SetCurDir(dir_path);
835
		SetCurDir(dir_path);
822
	}
836
	}
Line 839... Line 853...
839
		count_dir = d;
853
		count_dir = d;
840
		return;
854
		return;
841
	}
855
	}
842
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
856
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
843
	{
857
	{
844
		if (!show_real_names.checked) strttl(file_off+40);
858
		if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
845
		if (TestBit(ESDWORD[file_off],4)) //directory?
859
		if (TestBit(ESDWORD[file_off],4)) //directory?
846
		{
860
		{
847
			file_mas[d]=j;
861
			file_mas[d]=j;
848
			d++;
862
			d++;
849
		}
863
		}
Line 906... Line 920...
906
void SelectFileByName(dword that_file)
920
void SelectFileByName(dword that_file)
907
{
921
{
908
	int ind;
922
	int ind;
909
	files.KeyHome();
923
	files.KeyHome();
910
	Open_Dir(#path,ONLY_OPEN);
924
	Open_Dir(#path,ONLY_OPEN);
911
	if (!show_real_names.checked) strttl(that_file);
925
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
912
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
926
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
913
	files.cur_y = ind - 1;
927
	files.cur_y = ind - 1;
914
	files.KeyDown();
928
	files.KeyDown();
915
	DrawStatusBar();
929
	DrawStatusBar();
916
	List_ReDraw();
930
	List_ReDraw();
Line 1073... Line 1087...
1073
	{
1087
	{
1074
		case 1:
1088
		case 1:
1075
			if (!active_about) 
1089
			if (!active_about) 
1076
			{
1090
			{
1077
				about_stak = malloc(4096);
1091
				about_stak = malloc(4096);
1078
				about_window = CreateThread(#about_dialog,about_stak+4092);
1092
				about_thread_id = CreateThread(#about_dialog,about_stak+4092);
1079
				break;
1093
				break;
1080
			}
1094
			}
1081
			else
1095
			else
1082
			{
1096
			{
1083
				ActivateWindow(GetProcessSlot(about_window));
1097
				ActivateWindow(GetProcessSlot(about_thread_id));
1084
			}
1098
			}
1085
			break;
1099
			break;
1086
		case 2:
1100
		case 2:
1087
			if (!files.count) break;
1101
			if (!files.count) break;
1088
			NewElement_Form(RENAME_ITEM, #file_name);
1102
			NewElement_Form(RENAME_ITEM, #file_name);
Line 1206... Line 1220...
1206
	{
1220
	{
1207
		if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
1221
		if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
1208
	}
1222
	}
1209
}
1223
}
Line -... Line 1224...
-
 
1224
 
-
 
1225
void EventSort(dword id)
-
 
1226
{
-
 
1227
	char selected_filename[256];
-
 
1228
	if (sort_type == id) sort_desc ^= 1;
-
 
1229
	else sort_type = id;
-
 
1230
	strcpy(#selected_filename, #file_name);
-
 
1231
	DrawList();
-
 
1232
	Open_Dir(#path,WITH_REDRAW);
-
 
1233
	SelectFileByName(#selected_filename);
-
 
1234
}
1210
 
1235