Subversion Repositories Kolibri OS

Rev

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