Subversion Repositories Kolibri OS

Rev

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