Subversion Repositories Kolibri OS

Rev

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