Subversion Repositories Kolibri OS

Rev

Rev 7252 | Rev 7256 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7252 Rev 7254
1
#ifdef LANG_RUS
1
#ifdef LANG_RUS
2
	?define TITLE_SETT " áâனª¨"
2
	?define TITLE_SETT " áâனª¨"
3
	?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
3
	?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
4
	?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
4
	?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
5
	?define SHOW_STATUS_BAR "®ª §ë¢ âì áâ âãá ¡ à"
5
	?define SHOW_STATUS_BAR "®ª §ë¢ âì áâ âãá ¡ à"
6
	?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
6
	?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
7
	?define SHOW_BREADCRUMBS "ˆá¯®«ì§®¢ âì 'å«¥¡­ë¥ ªà®èª¨'"
7
	?define SHOW_BREADCRUMBS "ˆá¯®«ì§®¢ âì 'å«¥¡­ë¥ ªà®èª¨'"
8
	?define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
8
	?define BIG_ICONS "ˆá¯®«ì§®¢ âì ¡®«ì訥 ¨ª®­ª¨"
9
	?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
9
	?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
10
	?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
10
	?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
11
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
11
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
12
	?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
12
	?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
13
	?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
13
	?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
14
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
14
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
15
	?define START_PATH " ‘â àâ®¢ë© ¯ãâì: "
15
	?define START_PATH " ‘â àâ®¢ë© ¯ãâì: "
16
#else
16
#else
17
	?define TITLE_SETT "Settings"
17
	?define TITLE_SETT "Settings"
18
	?define SHOW_DEVICE_CLASS "Show device class name"
18
	?define SHOW_DEVICE_CLASS "Show device class name"
19
	?define SHOW_REAL_NAMES "Show file names in original case"
19
	?define SHOW_REAL_NAMES "Show file names in original case"
20
	?define SHOW_STATUS_BAR "Show status bar"
20
	?define SHOW_STATUS_BAR "Show status bar"
21
	?define NOTIFY_COPY_END "Notify when copying finished"
21
	?define NOTIFY_COPY_END "Notify when copying finished"
22
	?define SHOW_BREADCRUMBS "Show breadcrumbs"
22
	?define SHOW_BREADCRUMBS "Show breadcrumbs"
23
	?define BIG_ICONS "Big icons in list"
23
	?define BIG_ICONS "Big icons in list"
24
	?define USE_TWO_PANELS "Two panels"
24
	?define USE_TWO_PANELS "Two panels"
25
	?define FONT_SIZE_LABEL "Font size"
25
	?define FONT_SIZE_LABEL "Font size"
26
	?define LIST_LINE_HEIGHT "List line height"
26
	?define LIST_LINE_HEIGHT "List line height"
27
	?define SAVE_PATH_AS_DEFAULT "Current path"
27
	?define SAVE_PATH_AS_DEFAULT "Current path"
28
	?define SAVE_START_PATH_AS_DEFAULT "Typed path"
28
	?define SAVE_START_PATH_AS_DEFAULT "Typed path"
29
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
29
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
30
	?define START_PATH " Start path: "
30
	?define START_PATH " Start path: "
31
#endif
31
#endif
32
 
32
 
33
int WinX, WinY, WinW, WinH;
33
int WinX, WinY, WinW, WinH;
34
 
34
 
35
char path_start[4096];
35
char path_start[4096];
36
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
36
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
37
	                      #path_start,0, 100000000000010b,0,0};
37
	                      #path_start,0, 100000000000010b,0,0};
38
 
38
 
39
more_less_box font_size   = { NULL, 9, 22, FONT_SIZE_LABEL };
39
more_less_box font_size   = { NULL, 9, 22, FONT_SIZE_LABEL };
40
more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
40
more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
41
checkbox show_dev_name    = { SHOW_DEVICE_CLASS };
41
checkbox show_dev_name    = { SHOW_DEVICE_CLASS };
42
checkbox show_real_names  = { SHOW_REAL_NAMES };
42
checkbox show_real_names  = { SHOW_REAL_NAMES };
43
checkbox show_status_bar  = { SHOW_STATUS_BAR };
43
checkbox show_status_bar  = { SHOW_STATUS_BAR };
44
checkbox info_after_copy  = { NOTIFY_COPY_END };
44
checkbox info_after_copy  = { NOTIFY_COPY_END };
45
checkbox show_breadcrumb  = { SHOW_BREADCRUMBS };
45
checkbox show_breadcrumb  = { SHOW_BREADCRUMBS };
46
checkbox big_icons        = { BIG_ICONS };
46
checkbox big_icons        = { BIG_ICONS };
47
checkbox two_panels       = { USE_TWO_PANELS };
47
checkbox two_panels       = { USE_TWO_PANELS };
48
 
48
 
49
 
49
 
50
void settings_dialog()
50
void settings_dialog()
51
{   
51
{   
52
	int id;
52
	proc_info Settings;
-
 
53
	int id;
53
	active_settings=1;
54
	active_settings=1;
54
	font_size.value = kfont.size.pt;
55
	font_size.value = kfont.size.pt;
55
	line_height.value = files.item_h;
56
	line_height.value = files.item_h;
56
	SetEventMask(0x27);
57
	SetEventMask(0x27);
57
	loop(){
58
	loop(){
58
		switch(WaitEvent())
59
		switch(WaitEvent())
59
		{
60
		{
60
			case evMouse:
61
			case evMouse:
61
				edit_box_mouse stdcall (#path_start_ed);
62
				edit_box_mouse stdcall (#path_start_ed);
62
				break;
63
				break;
63
				
64
				
64
			case evButton: 
65
			case evButton: 
65
				id=GetButtonID();
66
				id=GetButtonID();
66
				if (1==id) { ExitSettings(); break; }
67
				if (1==id) { ExitSettings(); break; }
67
				else if (id==5)
68
				else if (id==5)
68
				{
69
				{
69
					RunProgram("tinypad", "/sys/settings/assoc.ini");
70
					RunProgram("tinypad", "/sys/settings/assoc.ini");
70
					break;
71
					break;
71
				}
72
				}
72
				else if (id==6)
73
				else if (id==6)
73
				{
74
				{
74
					strcpy(#path_start,#path);
75
					strcpy(#path_start,#path);
75
					path_start_ed.size = path_start_ed.pos = strlen(#path_start);
76
					path_start_ed.size = path_start_ed.pos = strlen(#path_start);
76
					ini.SetString("DefaultPath", #path, strlen(#path));
77
					ini.SetString("DefaultPath", #path, strlen(#path));
77
					edit_box_draw stdcall (#path_start_ed);
78
					edit_box_draw stdcall (#path_start_ed);
78
					break;
79
					break;
79
				}
80
				}
80
				else if (id==7)
81
				else if (id==7)
81
				{
82
				{
82
					ini.SetString("DefaultPath", #path_start,strlen(#path_start));
83
					ini.SetString("DefaultPath", #path_start,strlen(#path_start));
83
					break;
84
					break;
84
				}
85
				}
85
				show_dev_name.click(id);
86
				show_dev_name.click(id);
86
				if (show_real_names.click(id)) action_buf=109;
87
				if (show_real_names.click(id)) action_buf=109;
87
				info_after_copy.click(id);
88
				info_after_copy.click(id);
88
				two_panels.click(id);
89
				two_panels.click(id);
89
				show_breadcrumb.click(id);
90
				show_breadcrumb.click(id);
90
				show_status_bar.click(id);
91
				show_status_bar.click(id);
91
				if (font_size.click(id)) { 
92
				if (font_size.click(id)) { 
92
					kfont.size.pt = font_size.value; 
93
					kfont.size.pt = font_size.value; 
93
					kfont.changeSIZE(); 
94
					kfont.changeSIZE(); 
94
					BigFontsChange(); 
95
					BigFontsChange(); 
95
				}
96
				}
96
				if (line_height.click(id)) files.item_h = line_height.value; 
97
				if (line_height.click(id)) files.item_h = line_height.value; 
97
				if (big_icons.click(id)) BigIconsSwitch();
98
				if (big_icons.click(id)) BigIconsSwitch();
98
				EventRedrawWindow(Form.left,Form.top);
99
				EventRedrawWindow(Form.left,Form.top);
99
				break;
100
				//RefreshWindow(Form.num_slot, Settings.num_slot);
-
 
101
				break;
100
					
102
					
101
			case evKey:
103
			case evKey:
102
				GetKeys();
104
				GetKeys();
103
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
105
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
104
				EAX= key_ascii << 8;
106
				EAX= key_ascii << 8;
105
				edit_box_key stdcall (#path_start_ed);	
107
				edit_box_key stdcall (#path_start_ed);	
106
				break;
108
				break;
107
				
109
				
108
			case evReDraw:
110
			case evReDraw:
109
				DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, 
111
				DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400, 
110
					410+skin_height,0x34,system.color.work,TITLE_SETT,0);
112
					410+skin_height,0x34,system.color.work,TITLE_SETT,0);
111
				DrawSettingsCheckBoxes();
113
				GetProcessInfo(#Settings, SelfInfo);
-
 
114
				DrawSettingsCheckBoxes();
112
		}
115
		}
113
	}
116
	}
114
}
117
}
115
 
118
 
116
void ExitSettings()
119
void ExitSettings()
117
{
120
{
118
	active_settings = 0;
121
	active_settings = 0;
119
	settings_window = 0;
122
	settings_window = 0;
120
	cmd_free = 4;
123
	cmd_free = 4;
121
	ExitProcess();
124
	ExitProcess();
122
}
125
}
123
 
126
 
124
void DrawSettingsCheckBoxes()
127
void DrawSettingsCheckBoxes()
125
{
128
{
126
	incn y;
129
	incn y;
127
	int x=11, frx=26, but_x;
130
	int x=11, frx=26, but_x;
128
	y.n = 0;
131
	y.n = 0;
129
	show_dev_name.draw(x, y.inc(14));
132
	show_dev_name.draw(x, y.inc(14));
130
	show_real_names.draw(x, y.inc(25));
133
	show_real_names.draw(x, y.inc(25));
131
	show_status_bar.draw(x, y.inc(25));
134
	show_status_bar.draw(x, y.inc(25));
132
	info_after_copy.draw(x, y.inc(25));
135
	info_after_copy.draw(x, y.inc(25));
133
	show_breadcrumb.draw(x, y.inc(25));
136
	show_breadcrumb.draw(x, y.inc(25));
134
	big_icons.draw(x, y.inc(25));
137
	big_icons.draw(x, y.inc(25));
135
	two_panels.draw(x, y.inc(25));
138
	two_panels.draw(x, y.inc(25));
136
	font_size.draw(x, y.inc(31));
139
	font_size.draw(x, y.inc(31));
137
	line_height.draw(x, y.inc(31));
140
	line_height.draw(x, y.inc(31));
138
	
141
	
139
	DrawFrame(x, y.inc(37), 340, 95, START_PATH);
142
	DrawFrame(x, y.inc(37), 340, 95, START_PATH);
140
	// START_PATH {
143
	// START_PATH {
141
	DrawEditBoxPos(frx, y.inc(21), #path_start_ed);
144
	DrawEditBoxPos(frx, y.inc(21), #path_start_ed);
142
	but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
145
	but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
143
	DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
146
	DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
144
	// } START_PATH
147
	// } START_PATH
145
 
148
 
146
	DrawStandartCaptButton(x, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS);
149
	DrawStandartCaptButton(x, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS);
147
}
150
}
148
 
151
 
149
 
152
 
150
void LoadIniSettings()
153
void LoadIniSettings()
151
{
154
{
152
	ini.path = GetIni(#eolite_ini_path, "EOLITE.INI");
155
	ini.path = GetIni(#eolite_ini_path, "EOLITE.INI");
153
	ini.section = "Config";
156
	ini.section = "Config";
154
 
157
 
155
	files.SetFont(6, 9, 10000000b);
158
	files.SetFont(6, 9, 10000000b);
156
	show_real_names.checked = ini.GetInt("RealFileNamesCase", true); 
159
	show_real_names.checked = ini.GetInt("RealFileNamesCase", true); 
157
	show_dev_name.checked   = ini.GetInt("ShowDeviceName", true); 
160
	show_dev_name.checked   = ini.GetInt("ShowDeviceName", true); 
158
	show_status_bar.checked = ini.GetInt("ShowStatusBar", true); 
161
	show_status_bar.checked = ini.GetInt("ShowStatusBar", true); 
159
	info_after_copy.checked = ini.GetInt("InfoAfterCopy", false); 
162
	info_after_copy.checked = ini.GetInt("InfoAfterCopy", false); 
160
	two_panels.checked      = ini.GetInt("TwoPanels", false); 
163
	two_panels.checked      = ini.GetInt("TwoPanels", false); 
161
	kfont.size.pt   = ini.GetInt("FontSize", 13); 
164
	kfont.size.pt   = ini.GetInt("FontSize", 13); 
162
	files.item_h    = ini.GetInt("LineHeight", 19);
165
	files.item_h    = ini.GetInt("LineHeight", 19);
163
	WinX = ini.GetInt("WinX", 200); 
166
	WinX = ini.GetInt("WinX", 200); 
164
	WinY = ini.GetInt("WinY", 50); 
167
	WinY = ini.GetInt("WinY", 50); 
165
	WinW = ini.GetInt("WinW", 550); 
168
	WinW = ini.GetInt("WinW", 550); 
166
	WinH = ini.GetInt("WinH", 506); 
169
	WinH = ini.GetInt("WinH", 506); 
167
	ini.GetString("DefaultPath", #path, 4096, "/rd/1");
170
	ini.GetString("DefaultPath", #path, 4096, "/rd/1");
168
	ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
171
	ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
169
	path_start_ed.size = path_start_ed.pos = strlen(#path_start);
172
	path_start_ed.size = path_start_ed.pos = strlen(#path_start);
170
 
173
 
171
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
174
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
172
	kfont.init(#temp);
175
	kfont.init(#temp);
173
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
176
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
174
	if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
177
	if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
175
}
178
}
176
 
179
 
177
 
180
 
178
void SaveIniSettings()
181
void SaveIniSettings()
179
{
182
{
180
	ini.SetInt("ShowDeviceName", show_dev_name.checked);
183
	ini.SetInt("ShowDeviceName", show_dev_name.checked);
181
	ini.SetInt("ShowStatusBar", show_status_bar.checked);
184
	ini.SetInt("ShowStatusBar", show_status_bar.checked);
182
	ini.SetInt("RealFileNamesCase", show_real_names.checked);
185
	ini.SetInt("RealFileNamesCase", show_real_names.checked);
183
	ini.SetInt("InfoAfterCopy", info_after_copy.checked);
186
	ini.SetInt("InfoAfterCopy", info_after_copy.checked);
184
	ini.SetInt("FontSize", kfont.size.pt);
187
	ini.SetInt("FontSize", kfont.size.pt);
185
	ini.SetInt("TwoPanels", two_panels.checked);
188
	ini.SetInt("TwoPanels", two_panels.checked);
186
	ini.SetInt("LineHeight", files.item_h);
189
	ini.SetInt("LineHeight", files.item_h);
187
	ini.SetInt("WinX", Form.left);
190
	ini.SetInt("WinX", Form.left);
188
	ini.SetInt("WinY", Form.top);
191
	ini.SetInt("WinY", Form.top);
189
	ini.SetInt("WinW", Form.width);
192
	ini.SetInt("WinW", Form.width);
190
	ini.SetInt("WinH", Form.height);
193
	ini.SetInt("WinH", Form.height);
191
}
194
}
192
 
195
 
193
 
196
 
194
 
197
 
195
void Write_Error(int error_number)
198
void Write_Error(int error_number)
196
{
199
{
197
	char error_message[500];
200
	char error_message[500];
198
	dword ii;
201
	dword ii;
199
	if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
202
	if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
200
	pause(5);
203
	pause(5);
201
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
204
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
202
	notify(#error_message);	
205
	notify(#error_message);	
203
}
206
}
204
 
207
 
205
 
208
 
206
void SetAppColors()
209
void SetAppColors()
207
{
210
{
208
	system.color.get();
211
	system.color.get();
209
	//system.color.work = 0xE4DFE1;
212
	//system.color.work = 0xE4DFE1;
210
	//system.color.work_text = 0;
213
	//system.color.work_text = 0;
211
	//system.color.work_graph  = 0x7E87A3; //A0A0B8;
214
	//system.color.work_graph  = 0x7E87A3; //A0A0B8;
212
	//system.color.work_button = 0x7E87A3;
215
	//system.color.work_button = 0x7E87A3;
213
	//system.color.work_button_text = 0x000000
216
	//system.color.work_button_text = 0x000000
214
	col_work    = 0xE4DFE1;
217
	col_work    = 0xE4DFE1;
215
	col_padding = 0xC8C9C9;
218
	col_padding = 0xC8C9C9;
216
	col_selec   = 0x94AECE;
219
	col_selec   = 0x94AECE;
217
	col_lpanel  = 0x00699C;
220
	col_lpanel  = 0x00699C;
218
	col_graph   = 0x7E87A3;
221
	col_graph   = 0x7E87A3;
219
}
222
}
220
 
223
 
221
 
224
 
222
void BigFontsChange()
225
void BigFontsChange()
223
{
226
{
224
	files.item_h = kfont.size.pt + 4;
227
	files.item_h = kfont.size.pt + 4;
225
	if (files.item_h<18) files.item_h = 18;
228
	if (files.item_h<18) files.item_h = 18;
226
	files_active.item_h = files_inactive.item_h = files.item_h;
229
	files_active.item_h = files_inactive.item_h = files.item_h;
227
}
230
}
228
 
231
 
229
void BigIconsSwitch()
232
void BigIconsSwitch()
230
{
233
{
231
	if (big_icons.checked) 
234
	if (big_icons.checked) 
232
	{
235
	{
233
		icon_size=32;
236
		icon_size=32;
234
		files.item_h = line_height.value = 34;
237
		files.item_h = line_height.value = 34;
235
		if (!icons32_default.image)
238
		if (!icons32_default.image)
236
		{
239
		{
237
			Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
240
			Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
238
			Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
241
			Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
239
			Libimg_ReplaceColor(icons32_default.image, icons32_selected.w, 
242
			Libimg_ReplaceColor(icons32_default.image, icons32_selected.w, 
240
				icons32_selected.h, 0x00000000, 0xffFFFfff);
243
				icons32_selected.h, 0x00000000, 0xffFFFfff);
241
			Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, 
244
			Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, 
242
				icons32_selected.h, 0x00000000, col_selec);								
245
				icons32_selected.h, 0x00000000, col_selec);								
243
		}
246
		}
244
	}
247
	}
245
	else {
248
	else {
246
		icon_size=16; 
249
		icon_size=16; 
247
		files.item_h = line_height.value = 18;
250
		files.item_h = line_height.value = 18;
248
	}	
251
	}	
249
}
252
}