Subversion Repositories Kolibri OS

Rev

Rev 5526 | Rev 5542 | 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 "Настройки"
5526 leency 8
	?define SHOW_DEVICE_CLASS "Выводить названия класса устройств"
9
	?define SHOW_REAL_NAMES "Показывать имена файлов не меняя регистр"
5532 leency 10
	?define USE_BIG_FONTS "Использовать увеличенные шрифты"
5526 leency 11
	?define LIST_LINE_HEIGHT "Высота строки в списке"
12
	?define NOTIFY_COPY_END "Уведомлять о завершении копирования"
5416 punk_joker 13
	?define CANCEL_T "Отмена"
14
	?define APPLY_T "Применить"
15
#else
5435 leency 16
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
5428 leency 17
	?define TITLE_SETT "Settings"
5526 leency 18
	?define SHOW_DEVICE_CLASS "Show device class name"
19
	?define SHOW_REAL_NAMES "Show real file names without changing case"
5532 leency 20
	?define USE_BIG_FONTS "Use big fonts"
5526 leency 21
	?define LIST_LINE_HEIGHT "List line height"
22
	?define NOTIFY_COPY_END "Notify when copying finished"
5428 leency 23
	?define CANCEL_T "Cancel"
24
	?define APPLY_T "Apply"
5416 punk_joker 25
#endif
26
 
5526 leency 27
char confir_section = "Config";
5416 punk_joker 28
 
5526 leency 29
 
5416 punk_joker 30
void settings_dialog()
31
{
32
	byte id;
33
	unsigned int key;
5435 leency 34
	proc_info settings_form;
5459 punk_joker 35
 
36
	if (active_settings) ExitProcess();
37
	active_settings=1;
5436 leency 38
 
5416 punk_joker 39
	loop() switch(WaitEvent())
40
	{
41
		case evButton:
42
				id=GetButtonID();
43
				if (id==10)
44
				{
5441 leency 45
					SaveIniSettings();
5459 punk_joker 46
					active_settings=0;
5428 leency 47
					action_buf = 300;
5416 punk_joker 48
					ExitProcess();
49
				}
5428 leency 50
				if (id==1) || (id==11)
5416 punk_joker 51
				{
5459 punk_joker 52
					active_settings=0;
5416 punk_joker 53
					ExitProcess();
54
				}
5435 leency 55
				if (id==5)
56
				{
57
					RunProgram("tinypad", "/sys/settings/assoc.ini");
5463 leency 58
					break;
5435 leency 59
				}
5463 leency 60
				if (id==20) show_dev_name ^= 1;
61
				if (id==21) real_files_names_case ^= 1;
62
				if (id==22) info_after_copy ^= 1;
5532 leency 63
				if (id==23) use_big_fonts ^= 1;
5478 leency 64
				if (id==25) files.line_h++;
65
				if (id==26) && (files.line_h>8) files.line_h--;
5463 leency 66
				DrawSettingsCheckBoxes();
5416 punk_joker 67
				break;
68
 
69
		case evKey:
70
				key = GetKey();
5428 leency 71
				if (key==27)
5416 punk_joker 72
				{
5526 leency 73
					active_settings = 0;
5428 leency 74
					action_buf = 300;
5416 punk_joker 75
					ExitProcess();
76
				}
77
				break;
78
 
79
		case evReDraw:
5532 leency 80
				DefineAndDrawWindow(Form.left + 100, 150, 300, 232+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
5435 leency 81
				GetProcessInfo(#settings_form, SelfInfo);
5463 leency 82
				DrawSettingsCheckBoxes();
5532 leency 83
				DrawFlatButton(9, 138, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
5435 leency 84
				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
85
				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
5416 punk_joker 86
	}
5428 leency 87
}
88
 
5463 leency 89
void DrawSettingsCheckBoxes()
90
{
5526 leency 91
	CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
92
	CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
93
	CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
5532 leency 94
	CheckBox2(10, 77, 23, USE_BIG_FONTS,  use_big_fonts);
95
	MoreLessBox(10, 104, 18, 25, 26, sc.work_graph, 0xD2D3D3, 0x000000, files.line_h, LIST_LINE_HEIGHT);
5463 leency 96
}
5428 leency 97
 
5463 leency 98
 
5441 leency 99
void LoadIniSettings()
5428 leency 100
{
5532 leency 101
	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); edit2.shift_color = col_selec = EAX;
102
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
103
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
104
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
105
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "UseBigFonts",       0); use_big_fonts = EAX;
106
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
107
 
108
	if (use_big_fonts)
109
	{
110
		font_type = 0x90;
111
		PathShow.font_size_x = FileShow.font_size_x = 8;
112
		PathShow.font_number = FileShow.font_number = 1;
113
	}
114
	else
115
	{
116
		font_type=0x80;
117
		PathShow.font_size_x = FileShow.font_size_x = 8;
118
		PathShow.font_number = FileShow.font_number = 0;
119
	}
5428 leency 120
}
121
 
5441 leency 122
void SaveIniSettings()
123
{
5526 leency 124
	ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
125
	ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
126
	ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
5532 leency 127
	ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
5526 leency 128
	ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
5441 leency 129
}
5428 leency 130
 
5441 leency 131
 
132
 
5428 leency 133
void Write_Error(int error_number)
134
{
135
	char error_message[500];
136
	dword ii;
137
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
138
	pause(5);
139
	strcpy(#error_message, "\"Eolite\n");
140
	ii = get_error(error_number);
141
	strcat(#error_message, ii);
142
	strcat(#error_message, "\" -tE");
143
	notify(#error_message);
144
}
145
 
146
 
147
void SetAppColors()
148
{
149
	sc.work = 0xE4DFE1;
150
	sc.work_text = 0;
151
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
152
	sc.work_button_text = 0x000000;
153
	col_padding = 0xC8C9C9;
154
	//col_selec   = 0x94AECE;
155
	col_lpanel  = 0x00699C;
5463 leency 156
}
157
 
158
 
159
void CheckBox2(dword x, y, id, text, byte value) {
160
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
5416 punk_joker 161
}