Subversion Repositories Kolibri OS

Rev

Rev 5444 | Rev 5463 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5428 leency 1
//Leency 2008-2015
5416 punk_joker 2
 
3
#define EDITOR_PATH     "/sys/tinypad"
4
 
5
#ifdef LANG_RUS
5435 leency 6
	?define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов"
5416 punk_joker 7
	?define TITLE_SETT "Настройки"
5428 leency 8
	?define SET_1 "Выводить названия класса устройств"
9
	?define SET_2 "Показывать имена файлов не меняя регистр"
10
	?define SET_3 "Высота строки в списке"
5459 punk_joker 11
	?define SET_4 "Уведомлять о завершении копирования"
5416 punk_joker 12
	?define CANCEL_T "Отмена"
13
	?define APPLY_T "Применить"
14
#else
5435 leency 15
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
5428 leency 16
	?define TITLE_SETT "Settings"
17
	?define SET_1 "Show device class name"
18
	?define SET_2 "Show real file names without changing case"
19
	?define SET_3 "List line height"
5459 punk_joker 20
	?define SET_4 "To notify the completion of the copy"
5428 leency 21
	?define CANCEL_T "Cancel"
22
	?define APPLY_T "Apply"
5416 punk_joker 23
#endif
24
 
25
int	mouse_ddd;
26
char lineh_s[30]="18\0";
5459 punk_joker 27
edit_box LineHeight_ed = {52,10,90,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2};
5436 leency 28
checkbox2 ShowDeviceName_chb = {10*65536+15, 10*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_1, CH_FLAG_MIDDLE, 0};
29
checkbox2 RealFileNamesCase_chb = {10*65536+15, 30*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_2, CH_FLAG_MIDDLE, 0};
5459 punk_joker 30
checkbox2 InfoAfterCopy_chb = {10*65536+15, 50*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_4, CH_FLAG_MIDDLE, 0};
5416 punk_joker 31
 
32
void settings_dialog()
33
{
34
	byte id;
35
	unsigned int key;
5435 leency 36
	proc_info settings_form;
5459 punk_joker 37
 
38
	if (active_settings) ExitProcess();
39
	active_settings=1;
5436 leency 40
 
41
	ShowDeviceName_chb.size_of_str = strlen(SET_1) * 6;
42
	RealFileNamesCase_chb.size_of_str = strlen(SET_2) * 6;
5459 punk_joker 43
	InfoAfterCopy_chb.size_of_str = strlen(SET_4) * 6;
5436 leency 44
 
5416 punk_joker 45
	SetEventMask(0x27);
46
	loop() switch(WaitEvent())
47
	{
48
		case evButton:
49
				id=GetButtonID();
50
				if (id==10)
51
				{
5441 leency 52
					SaveIniSettings();
5459 punk_joker 53
					active_settings=0;
5428 leency 54
					action_buf = 300;
5416 punk_joker 55
					ExitProcess();
56
				}
5428 leency 57
				if (id==1) || (id==11)
5416 punk_joker 58
				{
5459 punk_joker 59
					active_settings=0;
5416 punk_joker 60
					ExitProcess();
61
				}
5435 leency 62
				if (id==5)
63
				{
64
					RunProgram("tinypad", "/sys/settings/assoc.ini");
65
				}
5416 punk_joker 66
				break;
67
 
68
		case evKey:
69
				key = GetKey();
5428 leency 70
				if (key==27)
5416 punk_joker 71
				{
5459 punk_joker 72
					active_settings=0;
5428 leency 73
					action_buf = 300;
5416 punk_joker 74
					ExitProcess();
75
				}
76
				EAX=key<<8;
77
				edit_box_key stdcall(#LineHeight_ed);
78
				break;
79
 
80
		case evMouse:
81
				check_box_mouse stdcall (#ShowDeviceName_chb);
82
				check_box_mouse stdcall (#RealFileNamesCase_chb);
5459 punk_joker 83
				check_box_mouse stdcall (#InfoAfterCopy_chb);
5416 punk_joker 84
				edit_box_mouse stdcall (#LineHeight_ed);
85
				break;
86
 
87
		case evReDraw:
5428 leency 88
				DefineAndDrawWindow(Form.left + 100, 150, 300, 200+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
5435 leency 89
				GetProcessInfo(#settings_form, SelfInfo);
5444 leency 90
 
91
				ShowDeviceName_chb.flags |= 1 << show_dev_name;
92
				RealFileNamesCase_chb.flags |= 1 << real_files_names_case;
5459 punk_joker 93
				InfoAfterCopy_chb.flags |= 1 << info_after_copy;
5444 leency 94
 
5416 punk_joker 95
				key = itoa(files.line_h);
96
				strcpy(#lineh_s, key);
97
 
98
				check_box_draw stdcall (#ShowDeviceName_chb);
99
				check_box_draw stdcall (#RealFileNamesCase_chb);
5459 punk_joker 100
				check_box_draw stdcall (#InfoAfterCopy_chb);
5416 punk_joker 101
				edit_box_draw stdcall (#LineHeight_ed);
5435 leency 102
				DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph);
5459 punk_joker 103
				WriteText(10, 77, 0x80, 0x000000, SET_3);
104
				DrawFlatButton(9, 120, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
5435 leency 105
				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
106
				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
5416 punk_joker 107
	}
5428 leency 108
}
109
 
110
 
5441 leency 111
void LoadIniSettings()
5428 leency 112
{
113
	ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
114
	edit2.shift_color = EAX;
115
	col_selec = EAX;
116
	ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
117
	files.line_h = EAX;
118
	ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
119
	show_dev_name = EAX;
120
	ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
121
	real_files_names_case = EAX;
5459 punk_joker 122
	ini_get_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", 0);
123
	info_after_copy = EAX;
5428 leency 124
}
125
 
5441 leency 126
void SaveIniSettings()
127
{
5444 leency 128
	show_dev_name = TestBit(ShowDeviceName_chb.flags, 1);
129
	real_files_names_case = TestBit(RealFileNamesCase_chb.flags, 1);
5459 punk_joker 130
	info_after_copy = TestBit(InfoAfterCopy_chb.flags, 1);
5441 leency 131
	ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name);
132
	ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case);
5459 punk_joker 133
	ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy);
5441 leency 134
	ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s));
135
}
5428 leency 136
 
5441 leency 137
 
138
 
5428 leency 139
void Write_Error(int error_number)
140
{
141
	char error_message[500];
142
	dword ii;
143
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
144
	pause(5);
145
	strcpy(#error_message, "\"Eolite\n");
146
	ii = get_error(error_number);
147
	strcat(#error_message, ii);
148
	strcat(#error_message, "\" -tE");
149
	notify(#error_message);
150
}
151
 
152
 
153
void SetAppColors()
154
{
155
	sc.work = 0xE4DFE1;
156
	sc.work_text = 0;
157
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
158
	sc.work_button_text = 0x000000;
159
	col_padding = 0xC8C9C9;
160
	//col_selec   = 0x94AECE;
161
	col_lpanel  = 0x00699C;
5416 punk_joker 162
}