Subversion Repositories Kolibri OS

Rev

Rev 8826 | Rev 8854 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5416 punk_joker 1
 
2
	?define TITLE_SETT "Настройки"
3
	?define SHOW_DEVICE_CLASS "Выводить названия класса устройств"
5526 leency 4
	?define SHOW_STATUS_BAR "Показывать статус бар"
6505 punk_joker 5
	?define SHOW_BREADCRUMBS "Использовать 'хлебные крошки'"
6290 leency 6
	?define BIG_ICONS "Использовать большие иконки"
7242 leency 7
	?define USE_TWO_PANELS "Две панели"
6290 leency 8
	?define COLORED_LINES "Подсвечивать четные линии в списке"
7422 leency 9
	?define FONT_SIZE_LABEL "Размер шрифта"
5743 leency 10
	?define LIST_LINE_HEIGHT "Высота строки в списке"
5526 leency 11
	?define SAVE_PATH_AS_DEFAULT "Текущий путь"
6403 punk_joker 12
	?define SAVE_START_PATH_AS_DEFAULT "Введенный путь"
13
	?define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов"
6290 leency 14
	?define START_PATH " Стартовый путь: "
7227 leency 15
#else
5416 punk_joker 16
	?define TITLE_SETT "Settings"
5428 leency 17
	?define SHOW_DEVICE_CLASS "Show device class name"
5526 leency 18
	?define SHOW_STATUS_BAR "Show status bar"
6505 punk_joker 19
	?define SHOW_BREADCRUMBS "Show breadcrumbs"
6290 leency 20
	?define BIG_ICONS "Big icons in list"
7242 leency 21
	?define USE_TWO_PANELS "Two panels"
6290 leency 22
	?define COLORED_LINES "Highlight even lines in list"
7422 leency 23
	?define FONT_SIZE_LABEL "Font size"
5743 leency 24
	?define LIST_LINE_HEIGHT "List line height"
5526 leency 25
	?define SAVE_PATH_AS_DEFAULT "Current path"
7245 leency 26
	?define SAVE_START_PATH_AS_DEFAULT "Typed path"
6403 punk_joker 27
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
6290 leency 28
	?define START_PATH " Start path: "
7227 leency 29
#endif
5416 punk_joker 30
31
 
7252 leency 32
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
7227 leency 33
	                      #path_start,0, 100000000000010b,0,0};
7252 leency 34
6403 punk_joker 35
 
7244 leency 36
more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
7243 leency 37
checkbox show_dev_name    = { SHOW_DEVICE_CLASS };
7244 leency 38
checkbox show_status_bar  = { SHOW_STATUS_BAR };
39
checkbox show_breadcrumb  = { SHOW_BREADCRUMBS };
40
checkbox big_icons        = { BIG_ICONS };
41
checkbox two_panels       = { USE_TWO_PANELS };
42
checkbox colored_lines    = { COLORED_LINES };
7422 leency 43
7243 leency 44
 
45
 
5416 punk_joker 46
{
47
	proc_info Settings;
7254 leency 48
	int id;
7244 leency 49
	active_settings = true;
8764 leency 50
	font_size.value = kfont.size.pt;
7243 leency 51
	line_height.value = files.item_h;
7252 leency 52
	SetEventMask(0x27);
6403 punk_joker 53
	loop(){
5576 pavelyakov 54
		switch(WaitEvent())
5591 pavelyakov 55
		{
56
			case evMouse:
6403 punk_joker 57
				edit_box_mouse stdcall (#path_start_ed);
58
				break;
59
60
 
5591 pavelyakov 61
				id=GetButtonID();
5416 punk_joker 62
				if (1==id) { ExitSettings(); break; }
7244 leency 63
				else if (id==5)
5591 pavelyakov 64
				{
5435 leency 65
					RunProgram("/sys/@open", "/sys/settings/assoc.ini");
8764 leency 66
					break;
5463 leency 67
				}
5435 leency 68
				else if (id==6)
5833 pavelyakov 69
				{
70
					strcpy(#path_start,#path);
6403 punk_joker 71
					path_start_ed.size = path_start_ed.pos = strlen(#path_start);
7245 leency 72
					ini.SetString("DefaultPath", #path, strlen(#path));
7202 leency 73
					edit_box_draw stdcall (#path_start_ed);
6403 punk_joker 74
					break;
5833 pavelyakov 75
				}
76
				else if (id==7)
6403 punk_joker 77
				{
78
					SetDefaultPath(#path_start);
7462 leency 79
					break;
6403 punk_joker 80
				}
81
				show_dev_name.click(id);
7244 leency 82
				two_panels.click(id);
83
				show_breadcrumb.click(id);
84
				show_status_bar.click(id);
85
				colored_lines.click(id);
7422 leency 86
				if (font_size.click(id)) {
7244 leency 87
					kfont.size.pt = font_size.value;
7243 leency 88
					kfont.changeSIZE();
89
					BigFontsChange();
90
				}
91
				if (line_height.click(id)) files.item_h = files_inactive.item_h = line_height.value;
7375 leency 92
				if (big_icons.click(id)) BigIconsSwitch();
7244 leency 93
				EventRedrawWindow(Form.left,Form.top);
5606 pavelyakov 94
				//RefreshWindow(Form.slot, Settings.slot);
7266 leency 95
				break;
6403 punk_joker 96
5591 pavelyakov 97
 
98
				GetKeys();
5707 leency 99
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
5743 leency 100
				EAX= key_ascii << 8;
6403 punk_joker 101
				edit_box_key stdcall (#path_start_ed);
102
				break;
5416 punk_joker 103
5591 pavelyakov 104
 
105
				DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
7242 leency 106
					365+skin_height,0x34,sc.work,TITLE_SETT,0);
8764 leency 107
				GetProcessInfo(#Settings, SelfInfo);
7254 leency 108
				DrawSettingsCheckBoxes();
5463 leency 109
		}
5591 pavelyakov 110
	}
5416 punk_joker 111
}
5428 leency 112
113
 
5743 leency 114
{
115
	active_settings = false;
8764 leency 116
	settings_window = 0;
5743 leency 117
	cmd_free = 4;
118
	ExitProcess();
119
}
120
121
 
5463 leency 122
{
123
	incn y;
6289 leency 124
	int x=11, frx=26, but_x;
7227 leency 125
	y.n = 0;
6289 leency 126
	show_dev_name.draw(x, y.inc(14));
7244 leency 127
	show_status_bar.draw(x, y.inc(25));
128
	show_breadcrumb.draw(x, y.inc(25));
129
	big_icons.draw(x, y.inc(25));
130
	//two_panels.draw(x, y.inc(25));
8764 leency 131
	colored_lines.draw(x, y.inc(25));
7422 leency 132
	font_size.draw(x, y.inc(31));
7243 leency 133
	line_height.draw(x, y.inc(31));
134
7227 leency 135
 
136
	// START_PATH {
137
	DrawEditBoxPos(frx, y.inc(21), #path_start_ed);
7245 leency 138
	but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
7227 leency 139
	DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
140
	// } START_PATH
141
142
 
143
}
5463 leency 144
5428 leency 145
 
5463 leency 146
 
5441 leency 147
{
5428 leency 148
	ini.path = GetIni(#eolite_ini_path, "app.ini");
7429 leency 149
	if (efm) ini.section = "EFM"; else ini.section = "Eolite";
8764 leency 150
	two_panels.checked = efm;
151
7202 leency 152
 
5767 leency 153
	show_dev_name.checked   = ini.GetInt("ShowDeviceName", true);
7244 leency 154
	show_status_bar.checked = ini.GetInt("ShowStatusBar", true);
155
	big_icons.checked       = ini.GetInt("BigIcons", false); BigIconsSwitch();
7375 leency 156
	//two_panels.checked      = ini.GetInt("TwoPanels", false);
8764 leency 157
	colored_lines.checked   = ini.GetInt("ColoredLines", true);
8826 leency 158
	kfont.size.pt   = ini.GetInt("FontSize", 13);
7202 leency 159
	files.item_h    = ini.GetInt("LineHeight", 19);
160
	Form.left   = ini.GetInt("WinX", 100);
8764 leency 161
	Form.top    = ini.GetInt("WinY", 30);
162
	Form.width  = ini.GetInt("WinW", efm*170+550);
163
	Form.height = ini.GetInt("WinH", efm*100+517);
8826 leency 164
	ini.GetString("DefaultPath", #path, 4096, "/rd/1");
7202 leency 165
	ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
166
	path_start_ed.size = path_start_ed.pos = strlen(#path_start);
7252 leency 167
5974 leency 168
 
5987 leency 169
	kfont.init(#temp);
6806 leency 170
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
5974 leency 171
	if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
6806 leency 172
}
5428 leency 173
174
 
5687 leency 175
 
5441 leency 176
{
177
	ini.SetInt("ShowDeviceName", show_dev_name.checked);
7244 leency 178
	ini.SetInt("ShowStatusBar", show_status_bar.checked);
179
	ini.SetInt("BigIcons", big_icons.checked);
7375 leency 180
	//ini.SetInt("TwoPanels", two_panels.checked);
8764 leency 181
	ini.SetInt("ColoredLines", colored_lines.checked);
7422 leency 182
	ini.SetInt("FontSize", kfont.size.pt);
183
	ini.SetInt("LineHeight", files.item_h);
7202 leency 184
	if (Form.status_window<=2) {
8764 leency 185
		ini.SetInt("WinX", Form.left);
186
		ini.SetInt("WinY", Form.top);
187
		ini.SetInt("WinW", Form.width);
188
		ini.SetInt("WinH", Form.height);
189
	}
190
}
5441 leency 191
5428 leency 192
 
5441 leency 193
 
194
 
5428 leency 195
{
196
	char error_message[500];
197
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
5576 pavelyakov 198
	notify(#error_message);
5620 leency 199
}
5428 leency 200
201
 
202
 
7635 leency 203
{
204
	dword selected_shadow = MixColors(col.selec, 0, 200);
8780 leency 205
	dword non_white_shadow = MixColors(col.list_bg, 0, 200);
206
	if (big_icons.checked)
207
	{
208
		icons32_default.load("/sys/icons32.png");
7992 leency 209
		icons32_selected.load("/sys/icons32.png");
210
		//FUUUUUU... the next ugly code may replace the previous line
8780 leency 211
		//we are copying raw data without loading and unpycking PNG
212
		//memmov(icons32_selected.imgsrc, icons32_default.imgsrc, icons32_default.h*32*4);
213
		//EDI = icons32_selected.image;
214
		//ESDWORD[EDI+04] = 32;
215
		//ESDWORD[EDI+08] = icons32_default.h;
216
		//ESDWORD[EDI+20] = IMAGE_BPP32;
217
		//ESDWORD[EDI+24] = icons32_selected.imgsrc;
218
		icons32_default.replace_color(0x00000000, col.list_bg);
7992 leency 219
		icons32_selected.replace_color(0x00000000, col.selec);
8780 leency 220
	} else {
221
		icons16_default.load("/sys/icons16.png");
222
		icons16_selected.load("/sys/icons16.png");
223
		icons16_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow);
224
		if (col.list_bg!=0xFFFfff) {
225
			icons16_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow);
8847 leency 226
		}
8780 leency 227
	}
7992 leency 228
8780 leency 229
 
7635 leency 230
231
 
5428 leency 232
{
233
	int i;
7462 leency 234
	static dword bg_col;
7806 leency 235
	dword old_list_bg_color = col.list_bg;
236
	sc.get();
237
	sc.work_dark = MixColors(0, sc.work, 35);
7819 leency 238
	if (sc.work == 0) sc.work = 1;
7928 leency 239
	if (bg_col == sc.work) return;
7806 leency 240
	bg_col = sc.work;
241
	if (skin_is_dark())
7780 leency 242
	{
7634 leency 243
		//use dark colors
244
		col.def = false;
7647 leency 245
		col.list_bg = sc.work;
7806 leency 246
		col.list_gb_text = sc.work_text;
247
		col.list_text_hidden = 0xA6A6B7;
7634 leency 248
		col.list_vert_line = sc.work_graph;
7806 leency 249
		col.lpanel  = MixColors(sc.work_graph, sc.work, 65);
250
		col.selec = col.selec_active = sc.button;
251
		col.selec_text = sc.button_text;
252
		if (col.list_bg==col.selec) col.selec = sc.work_graph; //for fucking skins
253
		col.slider_bg_big = MixColors(0xCED0D0, sc.work, 35);
254
		col.odd_line = MixColors(0xFFFfff, sc.work, 15);
255
		for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = MixColors(col.lpanel, blue_hl_pal[i], 180);
8240 leency 256
	}
7634 leency 257
	else
7780 leency 258
	{
259
		//use light colors
260
		col.def = true;
261
		col.list_bg = 0xFFFfff;
262
		col.list_gb_text = 0x000000;
263
		col.list_text_hidden = 0xA6A6B7;
264
		col.list_vert_line = 0xDDD7CF;
265
		col.lpanel  = 0x00699C;
266
		col.selec = col.selec_active = 0x92B1D9;
8779 leency 267
		col.selec_text = 0x000000;
7780 leency 268
		col.slider_bg_big = 0xCDCFCF;
269
		col.odd_line = 0xF4F5F5;
8779 leency 270
		for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = blue_hl_pal[i];
8240 leency 271
	}
7780 leency 272
	col.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65);
7634 leency 273
	col.slider_bg_left = MixColors(sc.work_graph, col.slider_bg_big, 10);
7806 leency 274
	for (i=0; i<20; i++) col.work_gradient[i] = MixColors(sc.work_light, sc.work, i*5);
275
	if (old_list_bg_color!=col.list_bg) LoadIcons();
7635 leency 276
}
5463 leency 277
278
 
279
 
5687 leency 280
{
281
	files.item_h = kfont.size.pt + 4;
6806 leency 282
	if (files.item_h
7375 leency 283
		files.item_h = icon_size+3;
284
		line_height.value = files.item_h;
285
		line_height.redraw();
286
	}
287
	files_active.item_h = files_inactive.item_h = files.item_h;
5825 leency 288
}
5687 leency 289
7244 leency 290
 
291
{
292
	if (big_icons.checked) {
7992 leency 293
		icon_size = 32;
8789 leency 294
		LoadIcons();
7992 leency 295
	} else {
296
		icon_size = icons16_default.w;
8789 leency 297
	}
7992 leency 298
	BigFontsChange();
7375 leency 299
}
7244 leency 300
7462 leency 301
 
302
{
303
	ini.SetString("DefaultPath", p, strlen(p));
304
	notify("'Default path has been set' -O");
305
}
306