Subversion Repositories Kolibri OS

Rev

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