Subversion Repositories Kolibri OS

Rev

Rev 5464 | Rev 5526 | 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
 
26
void settings_dialog()
27
{
28
	byte id;
29
	unsigned int key;
5435 leency 30
	proc_info settings_form;
5459 punk_joker 31
 
32
	if (active_settings) ExitProcess();
33
	active_settings=1;
5436 leency 34
 
5416 punk_joker 35
	loop() switch(WaitEvent())
36
	{
37
		case evButton:
38
				id=GetButtonID();
39
				if (id==10)
40
				{
5441 leency 41
					SaveIniSettings();
5459 punk_joker 42
					active_settings=0;
5428 leency 43
					action_buf = 300;
5416 punk_joker 44
					ExitProcess();
45
				}
5428 leency 46
				if (id==1) || (id==11)
5416 punk_joker 47
				{
5459 punk_joker 48
					active_settings=0;
5416 punk_joker 49
					ExitProcess();
50
				}
5435 leency 51
				if (id==5)
52
				{
53
					RunProgram("tinypad", "/sys/settings/assoc.ini");
5463 leency 54
					break;
5435 leency 55
				}
5463 leency 56
				if (id==20) show_dev_name ^= 1;
57
				if (id==21) real_files_names_case ^= 1;
58
				if (id==22) info_after_copy ^= 1;
5478 leency 59
				if (id==25) files.line_h++;
60
				if (id==26) && (files.line_h>8) files.line_h--;
5463 leency 61
				DrawSettingsCheckBoxes();
5416 punk_joker 62
				break;
63
 
64
		case evKey:
65
				key = GetKey();
5428 leency 66
				if (key==27)
5416 punk_joker 67
				{
5459 punk_joker 68
					active_settings=0;
5428 leency 69
					action_buf = 300;
5416 punk_joker 70
					ExitProcess();
71
				}
72
				break;
73
 
74
		case evReDraw:
5463 leency 75
				DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
5435 leency 76
				GetProcessInfo(#settings_form, SelfInfo);
5444 leency 77
 
5463 leency 78
				DrawSettingsCheckBoxes();
5444 leency 79
 
5463 leency 80
				DrawFlatButton(9, 127, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
81
 
5435 leency 82
				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
83
				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
5416 punk_joker 84
	}
5428 leency 85
}
86
 
5463 leency 87
void DrawSettingsCheckBoxes()
88
{
89
	CheckBox2(10, 11, 20, SET_1,  show_dev_name);
90
	CheckBox2(10, 33, 21, SET_2,  real_files_names_case);
5464 leency 91
	CheckBox2(10, 55, 22, SET_4,  info_after_copy);
5478 leency 92
	MoreLessBox(10, 82, 18, 25, 26, sc.work_graph, 0xD2D3D3, 0x000000, files.line_h, SET_3);
5463 leency 93
}
5428 leency 94
 
5463 leency 95
 
5441 leency 96
void LoadIniSettings()
5428 leency 97
{
98
	ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
99
	edit2.shift_color = EAX;
100
	col_selec = EAX;
101
	ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
102
	files.line_h = EAX;
103
	ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
104
	show_dev_name = EAX;
105
	ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
106
	real_files_names_case = EAX;
5459 punk_joker 107
	ini_get_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", 0);
108
	info_after_copy = EAX;
5428 leency 109
}
110
 
5441 leency 111
void SaveIniSettings()
112
{
113
	ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name);
114
	ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case);
5459 punk_joker 115
	ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy);
5478 leency 116
	ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", files.line_h);
5441 leency 117
}
5428 leency 118
 
5441 leency 119
 
120
 
5428 leency 121
void Write_Error(int error_number)
122
{
123
	char error_message[500];
124
	dword ii;
125
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
126
	pause(5);
127
	strcpy(#error_message, "\"Eolite\n");
128
	ii = get_error(error_number);
129
	strcat(#error_message, ii);
130
	strcat(#error_message, "\" -tE");
131
	notify(#error_message);
132
}
133
 
134
 
135
void SetAppColors()
136
{
137
	sc.work = 0xE4DFE1;
138
	sc.work_text = 0;
139
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
140
	sc.work_button_text = 0x000000;
141
	col_padding = 0xC8C9C9;
142
	//col_selec   = 0x94AECE;
143
	col_lpanel  = 0x00699C;
5463 leency 144
}
145
 
146
 
147
void CheckBox2(dword x, y, id, text, byte value) {
148
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
5416 punk_joker 149
}