Subversion Repositories Kolibri OS

Rev

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

Rev 7041 Rev 7054
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 USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
8
	?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
9
	?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
9
	?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
10
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
10
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
11
	?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
11
	?define SAVE_PATH_AS_DEFAULT "’¥ªã騩 ¯ãâì"
12
	?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
12
	?define SAVE_START_PATH_AS_DEFAULT "‚¢¥¤¥­­ë© ¯ãâì"
13
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
13
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
14
	?define START_PATH "‘â àâ®¢ë© ¯ãâì:"
14
	?define START_PATH "‘â àâ®¢ë© ¯ãâì:"
15
#else
15
#else
16
	?define TITLE_SETT "Settings"
16
	?define TITLE_SETT "Settings"
17
	?define SHOW_DEVICE_CLASS "Show device class name"
17
	?define SHOW_DEVICE_CLASS "Show device class name"
18
	?define SHOW_REAL_NAMES "Show file names in original case"
18
	?define SHOW_REAL_NAMES "Show file names in original case"
19
	?define SHOW_STATUS_BAR "Show status bar"
19
	?define SHOW_STATUS_BAR "Show status bar"
20
	?define NOTIFY_COPY_END "Notify when copying finished"
20
	?define NOTIFY_COPY_END "Notify when copying finished"
21
	?define SHOW_BREADCRUMBS "Show breadcrumbs"
21
	?define SHOW_BREADCRUMBS "Show breadcrumbs"
22
	?define USE_TWO_PANELS "Two panels"
22
	?define USE_TWO_PANELS "Two panels"
23
	?define FONT_SIZE_LABEL "Font size"
23
	?define FONT_SIZE_LABEL "Font size"
24
	?define LIST_LINE_HEIGHT "List line height"
24
	?define LIST_LINE_HEIGHT "List line height"
25
	?define SAVE_PATH_AS_DEFAULT "‘urrent path"
25
	?define SAVE_PATH_AS_DEFAULT "‘urrent path"
26
	?define SAVE_START_PATH_AS_DEFAULT "Typed path"
26
	?define SAVE_START_PATH_AS_DEFAULT "Typed path"
27
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
27
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
28
	?define START_PATH "Start path:"
28
	?define START_PATH "Start path:"
29
#endif
29
#endif
30
 
30
 
31
char config_section[] = "Config";
31
char config_section[] = "Config";
32
int WinX, WinY, WinW, WinH;
32
int WinX, WinY, WinW, WinH;
33
 
33
 
34
dword set_mouse_dd;
34
dword set_mouse_dd;
35
char path_start[4096]="\0";
35
char path_start[4096]="\0";
36
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,#path_start,#set_mouse_dd, 100000000000010b,0,0};
36
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,#path_start,#set_mouse_dd, 100000000000010b,0,0};
37
 
37
 
38
void settings_dialog()
38
void settings_dialog()
39
{   
39
{   
40
	byte id;
40
	byte id;
41
	active_settings=1;
41
	active_settings=1;
42
	SetEventMask(0x27);
42
	SetEventMask(0x27);
43
	loop(){
43
	loop(){
44
		switch(WaitEvent())
44
		switch(WaitEvent())
45
		{
45
		{
46
			case evMouse:
46
			case evMouse:
47
				edit_box_mouse stdcall (#path_start_ed);
47
				edit_box_mouse stdcall (#path_start_ed);
48
				break;
48
				break;
49
				
49
				
50
			case evButton: 
50
			case evButton: 
51
				id=GetButtonID();
51
				id=GetButtonID();
52
				if (id==1) { ExitSettings(); break; }
52
				if (id==1) { ExitSettings(); break; }
53
				else if (id==5)
53
				else if (id==5)
54
				{
54
				{
55
					RunProgram("tinypad", "/sys/settings/assoc.ini");
55
					RunProgram("tinypad", "/sys/settings/assoc.ini");
56
					break;
56
					break;
57
				}
57
				}
58
				else if (id==6)
58
				else if (id==6)
59
				{
59
				{
60
					strcpy(#path_start,#path);
60
					strcpy(#path_start,#path);
61
					path_start_ed.size = strlen(#path_start);
61
					path_start_ed.size = strlen(#path_start);
62
					path_start_ed.pos = strlen(#path_start);
62
					path_start_ed.pos = strlen(#path_start);
63
					ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,strlen(#path));
63
					ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,strlen(#path));
64
					edit_box_draw stdcall (#path_start_ed);
64
					edit_box_draw stdcall (#path_start_ed);
65
					break;
65
					break;
66
				}
66
				}
67
				else if (id==7)
67
				else if (id==7)
68
				{
68
				{
69
					ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,strlen(#path_start));
69
					ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,strlen(#path_start));
70
					break;
70
					break;
71
				}
71
				}
72
				else if (id==20) show_dev_name ^= 1;
72
				else if (id==20) show_dev_name ^= 1;
73
				else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
73
				else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
74
				else if (id==22) info_after_copy ^= 1;
74
				else if (id==22) info_after_copy ^= 1;
75
				else if (id==24) two_panels ^= true;
75
				else if (id==24) two_panels ^= true;
76
				else if (id==32) show_breadcrumb ^= true;
76
				else if (id==32) show_breadcrumb ^= true;
77
				else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; }
77
				else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; }
78
				else if (id==26) && (files.item_h>15) files_inactive.item_h = files.item_h = files.item_h-1;
78
				else if (id==26) && (files.item_h>16) files_inactive.item_h = files.item_h = files.item_h-1;
79
				else if (id==27) show_status_bar ^= 1;
79
				else if (id==27) show_status_bar ^= 1;
80
				else if (id==30) { kfont.size.pt++; IF(!kfont.changeSIZE()) kfont.size.pt--; BigFontsChange(); }
80
				else if (id==30) { kfont.size.pt++; IF(!kfont.changeSIZE()) kfont.size.pt--; BigFontsChange(); }
81
				else if (id==31) { kfont.size.pt--; IF(!kfont.changeSIZE()) kfont.size.pt++; BigFontsChange(); }
81
				else if (id==31) { kfont.size.pt--; IF(!kfont.changeSIZE()) kfont.size.pt++; BigFontsChange(); }
82
				EventRedrawWindow(Form.left,Form.top);
82
				EventRedrawWindow(Form.left,Form.top);
83
				break;
83
				break;
84
					
84
					
85
			case evKey:
85
			case evKey:
86
				GetKeys();
86
				GetKeys();
87
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
87
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
88
				EAX= key_ascii << 8;
88
				EAX= key_ascii << 8;
89
				edit_box_key stdcall (#path_start_ed);	
89
				edit_box_key stdcall (#path_start_ed);	
90
				break;
90
				break;
91
				
91
				
92
			case evReDraw:
92
			case evReDraw:
93
				DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 376, 370+skin_height,0x34,system.color.work,TITLE_SETT,0);
93
				DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 376, 370+skin_height,0x34,system.color.work,TITLE_SETT,0);
94
				DrawSettingsCheckBoxes();
94
				DrawSettingsCheckBoxes();
95
		}
95
		}
96
	}
96
	}
97
}
97
}
98
 
98
 
99
void ExitSettings()
99
void ExitSettings()
100
{
100
{
101
	active_settings = 0;
101
	active_settings = 0;
102
	settings_window = 0;
102
	settings_window = 0;
103
	cmd_free = 4;
103
	cmd_free = 4;
104
	ExitProcess();
104
	ExitProcess();
105
}
105
}
106
 
106
 
107
void DrawSettingsCheckBoxes()
107
void DrawSettingsCheckBoxes()
108
{
108
{
109
	incn y;
109
	incn y;
110
	int x=11, but_x;
110
	int x=11, but_x;
111
	y.n = 0;
111
	y.n = 0;
112
	CheckBox(x, y.inc(14), 20, SHOW_DEVICE_CLASS,  show_dev_name);
112
	CheckBox(x, y.inc(14), 20, SHOW_DEVICE_CLASS,  show_dev_name);
113
	CheckBox(x, y.inc(25), 21, SHOW_REAL_NAMES,  real_files_names_case);
113
	CheckBox(x, y.inc(25), 21, SHOW_REAL_NAMES,  real_files_names_case);
114
	CheckBox(x, y.inc(25), 27, SHOW_STATUS_BAR,  show_status_bar);
114
	CheckBox(x, y.inc(25), 27, SHOW_STATUS_BAR,  show_status_bar);
115
	CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END,  info_after_copy);
115
	CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END,  info_after_copy);
116
	CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS,  show_breadcrumb);
116
	CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS,  show_breadcrumb);
117
	CheckBox(x, y.inc(25), 24, USE_TWO_PANELS,  two_panels);
117
	CheckBox(x, y.inc(25), 24, USE_TWO_PANELS,  two_panels);
118
	MoreLessBox(x, y.inc(31), 30, 31, kfont.size.pt, FONT_SIZE_LABEL);
118
	MoreLessBox(x, y.inc(31), 30, 31, kfont.size.pt, FONT_SIZE_LABEL);
119
	MoreLessBox(x, y.inc(31), 25, 26, files.item_h, LIST_LINE_HEIGHT);
119
	MoreLessBox(x, y.inc(31), 25, 26, files.item_h, LIST_LINE_HEIGHT);
120
	WriteText(6, y.inc(28), 0xD0, system.color.work_text, START_PATH);
120
	WriteText(6, y.inc(28), 0xD0, system.color.work_text, START_PATH);
121
	path_start_ed.top = y.inc(23);
121
	path_start_ed.top = y.inc(23);
122
	path_start_ed.left = x;
122
	path_start_ed.left = x;
123
	DrawEditBox(#path_start_ed);
123
	DrawEditBox(#path_start_ed);
124
	but_x = DrawStandartCaptButton(x-1, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
124
	but_x = DrawStandartCaptButton(x-1, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
125
	DrawStandartCaptButton(x-1+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
125
	DrawStandartCaptButton(x-1+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
126
	DrawStandartCaptButton(x-1, y.inc(38), 5, EDIT_FILE_ASSOCIATIONS);
126
	DrawStandartCaptButton(x-1, y.inc(38), 5, EDIT_FILE_ASSOCIATIONS);
127
}
127
}
128
 
128
 
129
 
129
 
130
void LoadIniSettings()
130
void LoadIniSettings()
131
{
131
{
132
	files.SetFont(6, 9, 10000000b);
132
	files.SetFont(6, 9, 10000000b);
133
	ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowDeviceName",    1); show_dev_name = EAX;
133
	ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowDeviceName",    1); show_dev_name = EAX;
134
	ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowStatusBar",    1); show_status_bar = EAX;
134
	ini_get_int stdcall   (eolite_ini_path, #config_section, "ShowStatusBar",    1); show_status_bar = EAX;
135
	ini_get_int stdcall   (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX;
135
	ini_get_int stdcall   (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX;
136
	ini_get_int stdcall   (eolite_ini_path, #config_section, "InfoAfterCopy",     0); info_after_copy = EAX;
136
	ini_get_int stdcall   (eolite_ini_path, #config_section, "InfoAfterCopy",     0); info_after_copy = EAX;
137
	ini_get_int stdcall   (eolite_ini_path, #config_section, "FontSize",         13); kfont.size.pt = EAX;
137
	ini_get_int stdcall   (eolite_ini_path, #config_section, "FontSize",         13); kfont.size.pt = EAX;
138
	ini_get_int stdcall   (eolite_ini_path, #config_section, "TwoPanels",         0); two_panels = EAX;
138
	ini_get_int stdcall   (eolite_ini_path, #config_section, "TwoPanels",         0); two_panels = EAX;
139
	ini_get_int stdcall   (eolite_ini_path, #config_section, "LineHeight",       19); files.item_h = EAX;
139
	ini_get_int stdcall   (eolite_ini_path, #config_section, "LineHeight",       19); files.item_h = EAX;
140
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
140
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
141
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX;
141
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX;
142
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
142
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
143
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinH", 506); WinH = EAX;
143
	ini_get_int stdcall   (eolite_ini_path, #config_section, "WinH", 506); WinH = EAX;
144
	ini_get_str stdcall   (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1");
144
	ini_get_str stdcall   (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1");
145
	ini_get_str stdcall   (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1");
145
	ini_get_str stdcall   (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1");
146
	path_start_ed.size = strlen(#path_start);
146
	path_start_ed.size = strlen(#path_start);
147
	path_start_ed.pos = strlen(#path_start);
147
	path_start_ed.pos = strlen(#path_start);
148
 
148
 
149
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
149
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
150
	kfont.init(#temp);
150
	kfont.init(#temp);
151
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
151
	ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
152
	if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
152
	if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
153
}
153
}
154
 
154
 
155
 
155
 
156
void SaveIniSettings()
156
void SaveIniSettings()
157
{
157
{
158
	ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
158
	ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name);
159
	ini_set_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", show_status_bar);
159
	ini_set_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", show_status_bar);
160
	ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
160
	ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
161
	ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
161
	ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
162
	ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", kfont.size.pt);
162
	ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", kfont.size.pt);
163
	ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels);
163
	ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels);
164
	ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h);
164
	ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h);
165
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left);
165
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left);
166
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top);
166
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top);
167
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width);
167
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width);
168
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height);
168
	ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height);
169
}
169
}
170
 
170
 
171
 
171
 
172
 
172
 
173
void Write_Error(int error_number)
173
void Write_Error(int error_number)
174
{
174
{
175
	char error_message[500];
175
	char error_message[500];
176
	dword ii;
176
	dword ii;
177
	if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
177
	if (files.cur_y>=0) Line_ReDraw(0xFF0000, files.cur_y);
178
	pause(5);
178
	pause(5);
179
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
179
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
180
	notify(#error_message);	
180
	notify(#error_message);	
181
}
181
}
182
 
182
 
183
 
183
 
184
void SetAppColors()
184
void SetAppColors()
185
{
185
{
186
	system.color.get();
186
	system.color.get();
187
	//system.color.work = 0xE4DFE1;
187
	//system.color.work = 0xE4DFE1;
188
	//system.color.work_text = 0;
188
	//system.color.work_text = 0;
189
	//system.color.work_graph  = 0x7E87A3; //A0A0B8;
189
	//system.color.work_graph  = 0x7E87A3; //A0A0B8;
190
	//system.color.work_button = 0x7E87A3;
190
	//system.color.work_button = 0x7E87A3;
191
	//system.color.work_button_text = 0x000000
191
	//system.color.work_button_text = 0x000000
192
	col_work    = 0xE4DFE1;
192
	col_work    = 0xE4DFE1;
193
	col_padding = 0xC8C9C9;
193
	col_padding = 0xC8C9C9;
194
	col_selec   = 0x94AECE;
194
	col_selec   = 0x94AECE;
195
	col_lpanel  = 0x00699C;
195
	col_lpanel  = 0x00699C;
196
	col_graph   = 0x7E87A3;
196
	col_graph   = 0x7E87A3;
197
}
197
}
198
 
198
 
199
 
199
 
200
void BigFontsChange()
200
void BigFontsChange()
201
{
201
{
202
	files.item_h = kfont.size.pt + 4;
202
	files.item_h = kfont.size.pt + 4;
203
	if (files.item_h<18) files.item_h = 18;
203
	if (files.item_h<18) files.item_h = 18;
204
	files_active.item_h = files_inactive.item_h = files.item_h;
204
	files_active.item_h = files_inactive.item_h = files.item_h;
205
}
205
}