Subversion Repositories Kolibri OS

Rev

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

Rev 5719 Rev 5743
1
//Leency 2008-2015
-
 
2
 
-
 
3
#define EDITOR_PATH     "/sys/tinypad"
-
 
4
 
1
#ifdef LANG_RUS
5
#ifdef LANG_RUS
2
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
6
	?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
3
	?define TITLE_SETT " áâனª¨"
7
	?define TITLE_SETT " áâனª¨"
4
	?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
8
	?define SHOW_DEVICE_CLASS "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
5
	?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
9
	?define SHOW_REAL_NAMES "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
6
	?define FONT_SIZE_LABEL " §¬¥à èà¨äâ "
10
	?define USE_BIG_FONTS "®«ì让 èà¨äâ (⮫쪮  ­£«¨©áª¨¥ ᨬ¢®«ë!)"
7
	?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
11
	?define USE_TWO_PANELS "„¢¥ ¯ ­¥«¨"
8
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
12
	?define LIST_LINE_HEIGHT "‚ëá®â  áâப¨ ¢ ᯨ᪥"
9
	?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
13
	?define NOTIFY_COPY_END "“¢¥¤®¬«ïâì ® § ¢¥à襭¨¨ ª®¯¨à®¢ ­¨ï"
10
	?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª  (¢ á®âëå)"
14
	?define CANCEL_T "Žâ¬¥­ "
-
 
15
	?define APPLY_T "à¨¬¥­¨âì"
-
 
16
	?define T_DOUBLE_CLICK "‚à¥¬ï ¤¢®©­®£® ª«¨ª  (¢ á®âëå)"
11
#else
17
#else
12
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
18
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
13
	?define TITLE_SETT "Settings"
19
	?define TITLE_SETT "Settings"
14
	?define SHOW_DEVICE_CLASS "Show device class name"
20
	?define SHOW_DEVICE_CLASS "Show device class name"
15
	?define SHOW_REAL_NAMES "Show real file names without changing case"
21
	?define SHOW_REAL_NAMES "Show real file names without changing case"
16
	?define FONT_SIZE_LABEL "Font size"
22
	?define USE_BIG_FONTS "Use big fonts (English characters only!)"
17
	?define USE_TWO_PANELS "Two panels"
23
	?define USE_TWO_PANELS "Two panels"
18
	?define LIST_LINE_HEIGHT "List line height"
24
	?define LIST_LINE_HEIGHT "List line height"
19
	?define NOTIFY_COPY_END "Notify when copying finished"
25
	?define NOTIFY_COPY_END "Notify when copying finished"
20
	?define T_DOUBLE_CLICK "Double click time (in hundredths)"
26
	?define CANCEL_T "Cancel"
-
 
27
	?define APPLY_T "Apply"
-
 
28
	?define T_DOUBLE_CLICK "Double click time (in hundredths)"
21
#endif
29
#endif
22
 
30
 
23
char confir_section = "Config";
31
char confir_section = "Config";
24
 
32
 
25
 
33
 
26
void settings_dialog()
34
void settings_dialog()
27
{   
35
{   
28
	byte id;
36
	byte id;
29
	
37
	proc_info settings_form;
-
 
38
	
-
 
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;
-
 
40
	
-
 
41
	if (active_settings){
-
 
42
		EXIT_SETTING: 
-
 
43
		
-
 
44
		show_dev_name         = save_show_dev_name;
-
 
45
		real_files_names_case = save_real_files_names_case;
-
 
46
		info_after_copy       = save_info_after_copy;
-
 
47
		use_big_fonts         = save_use_big_fonts;
-
 
48
		two_panels            = save_two_panels;
-
 
49
		files.line_h          = save_files_h;
-
 
50
		MOUSE_TIME            = save_DBLTime;
-
 
51
		
-
 
52
		cmd_free = 4;
-
 
53
		
-
 
54
		ExitProcess();
-
 
55
	}
-
 
56
	active_settings=1;
-
 
57
	
-
 
58
	save_show_dev_name         = show_dev_name;
-
 
59
	save_real_files_names_case = real_files_names_case;
-
 
60
	save_info_after_copy       = info_after_copy;
-
 
61
	save_use_big_fonts         = use_big_fonts;
-
 
62
	two_panels                 = two_panels;
-
 
63
	save_files_h               = files.line_h;
-
 
64
	save_DBLTime               = MOUSE_TIME;
-
 
65
	
30
	loop(){
66
	loop(){
31
		switch(WaitEvent())
67
		switch(WaitEvent())
32
		{
68
		{
33
			case evButton: 
69
			case evButton: 
34
				id=GetButtonID();
70
				id=GetButtonID();
35
				if (id==1) ExitSettings();
71
				if (id==10)
-
 
72
				{
-
 
73
					SaveIniSettings();
36
				else if (id==5)
74
					active_settings=0;
-
 
75
					action_buf = 300;
-
 
76
					cmd_free = 4;
-
 
77
					ExitProcess();
-
 
78
				}					
-
 
79
				else if (id==1) || (id==11) 
-
 
80
				{
-
 
81
					active_settings=0;
-
 
82
					goto EXIT_SETTING;
-
 
83
				}
-
 
84
				else if (id==5)
37
				{
85
				{
38
					RunProgram("tinypad", "/sys/settings/assoc.ini");
86
					RunProgram("tinypad", "/sys/settings/assoc.ini");
39
					break;
87
					break;
40
				}
88
				}
41
				else if (id==20) show_dev_name ^= 1;
89
				else if (id==20) show_dev_name ^= 1;
42
				else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
90
				else if (id==21) real_files_names_case ^= 1;
43
				else if (id==22) info_after_copy ^= 1;
91
				else if (id==22) info_after_copy ^= 1;
44
				else if (id==24) two_panels ^= 1;
92
				else if (id==23) { use_big_fonts ^= 1; BigFontsChange(); }
-
 
93
				else if (id==24) two_panels ^= 1;
45
				else if (id==25) files.line_h++;
94
				else if (id==25) files.line_h++;
46
				else if (id==26) && (files.line_h>18) files.line_h--;
95
				else if (id==26) && (files.line_h>14) files.line_h--;
47
				else if (id==27) MOUSE_TIME++;
96
				else if (id==27) MOUSE_TIME++;
48
				else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
97
				else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
49
				else if (id==30) && (font_size<30) { font_size++; BigFontsChange(); }
-
 
50
				else if (id==31) && (font_size>10) { font_size--; BigFontsChange(); }
-
 
51
				SaveIniSettings();
-
 
52
				EventRedrawWindow(Form.left,Form.top);
98
				EventRedrawWindow(Form.left,Form.top);
53
				DrawSettingsCheckBoxes();
99
				DrawSettingsCheckBoxes();
54
			break;
100
			break;
55
					
101
					
56
			case evKey:
102
			case evKey:
57
				GetKeys();
103
				GetKeys();
58
				if (key_scancode==SCAN_CODE_ESC) ExitSettings();
104
				if (key_scancode==SCAN_CODE_ESC)
59
				break;
105
				{
-
 
106
					active_settings = 0;
-
 
107
					action_buf = 300;
-
 
108
					goto EXIT_SETTING;
-
 
109
				}
-
 
110
				break;
60
				
111
				
61
			case evReDraw:
112
			case evReDraw:
62
				DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 226+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
113
				DefineAndDrawWindow(Form.left + Form.width/2-10, Form.top + Form.height/2 - 75, 300, 254+GetSkinHeight(),0x34,system.color.work,TITLE_SETT);
63
				DrawSettingsCheckBoxes();
114
				GetProcessInfo(#settings_form, SelfInfo);
-
 
115
				DrawSettingsCheckBoxes();
64
				DrawFlatButton(9, 186, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
116
				DrawFlatButton(9, 186, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
65
		}
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);
-
 
119
		}
66
	}
120
	}
67
}
121
}
68
 
-
 
69
void ExitSettings()
-
 
70
{
-
 
71
	settings_window = 0;
-
 
72
	cmd_free = 4;
-
 
73
	SaveIniSettings();
-
 
74
	ExitProcess();
-
 
75
}
-
 
76
 
122
 
77
void DrawSettingsCheckBoxes()
123
void DrawSettingsCheckBoxes()
78
{
124
{
79
	CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
125
	CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
80
	CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
126
	CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
81
	CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
127
	CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
82
	CheckBox2(10, 77, 24, USE_TWO_PANELS,  two_panels); 
128
	CheckBox2(10, 77, 23, USE_BIG_FONTS,  use_big_fonts); 
83
	MoreLessBox(10, 103, 18, 30, 31, #system.color, font_size, FONT_SIZE_LABEL);
129
	CheckBox2(10, 99, 24, USE_TWO_PANELS,  two_panels); 
84
	MoreLessBox(10, 130, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
130
	MoreLessBox(10, 124, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
85
	MoreLessBox(10, 157, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
131
	MoreLessBox(10, 154, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
86
}
132
}
87
 
133
 
88
 
134
 
89
void LoadIniSettings()
135
void LoadIniSettings()
90
{
136
{
91
	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); col_selec = EAX;
137
	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); col_selec = EAX;
92
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
138
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
93
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
139
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
94
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
140
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
95
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "FontSize",          9); font_size = EAX;
141
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "UseBigFonts",       0); use_big_fonts = EAX;
96
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "TwoPanels",         0); two_panels = EAX;
142
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "TwoPanels",         0); two_panels = EAX;
97
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
143
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
98
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "TimeDoubleClick",  50); MOUSE_TIME = EAX;
144
	ini_get_int stdcall   (eolite_ini_path, #confir_section, "TimeDoubleClick",  50); MOUSE_TIME = EAX;
99
	BigFontsChange();
145
	BigFontsChange();
100
}
146
}
101
 
147
 
102
 
148
 
103
void SaveIniSettings()
149
void SaveIniSettings()
104
{
150
{
105
	ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
151
	ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
106
	ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
152
	ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
107
	ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
153
	ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
108
	ini_set_int stdcall (eolite_ini_path, #confir_section, "FontSize", font_size);
154
	ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
109
	ini_set_int stdcall (eolite_ini_path, #confir_section, "TwoPanels", two_panels);
155
	ini_set_int stdcall (eolite_ini_path, #confir_section, "TwoPanels", two_panels);
110
	ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
156
	ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
111
	ini_set_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", MOUSE_TIME);
157
	ini_set_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", MOUSE_TIME);
112
}
158
}
113
 
159
 
114
 
160
 
115
 
161
 
116
void Write_Error(int error_number)
162
void Write_Error(int error_number)
117
{
163
{
118
	char error_message[500];
164
	char error_message[500];
119
	dword ii;
165
	dword ii;
120
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
166
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
121
	pause(5);
167
	pause(5);
122
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
168
	sprintf(#error_message,"\"%s\n%s\" -%s","Eolite",get_error(error_number),"tE");
123
	notify(#error_message);	
169
	notify(#error_message);	
124
}
170
}
125
 
171
 
126
 
172
 
127
void SetAppColors()
173
void SetAppColors()
128
{
174
{
129
	system.color.work = 0xE4DFE1;
175
	system.color.work = 0xE4DFE1;
130
	system.color.work_text = 0;
176
	system.color.work_text = 0;
131
	system.color.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
177
	system.color.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
132
	system.color.work_button = 0xD2D3D3;
178
	system.color.work_button = 0xD2D3D3;
133
	system.color.work_button_text = 0x000000;
179
	system.color.work_button_text = 0x000000;
134
	col_padding = 0xC8C9C9;
180
	col_padding = 0xC8C9C9;
135
	//col_selec   = 0x94AECE;
181
	//col_selec   = 0x94AECE;
136
	col_lpanel  = 0x00699C;
182
	col_lpanel  = 0x00699C;
137
}
183
}
138
 
184
 
139
 
185
 
140
void BigFontsChange()
186
void BigFontsChange()
141
{
187
{
142
	files.line_h = font.height + 4;
-
 
143
	if (files.line_h<18) files.line_h = 18;
-
 
144
 
-
 
145
	if (font_size!=9) 
188
	if (use_big_fonts) 
146
	{
189
	{
147
		files.SetFont(8, 14, 10110000b);
190
		files.SetFont(8, 14, 10110000b);
148
		FileShow.font_size_x = files.font_w;
191
		FileShow.font_size_x = files.font_w;
149
		FileShow.font_number = 3;
192
		FileShow.font_number = 3;
150
	}
193
	}
151
	else
194
	else
152
	{
195
	{
153
		files.SetFont(6, 6, 10000000b);
196
		files.SetFont(6, 6, 10000000b);
154
		FileShow.font_size_x = files.font_w;
197
		FileShow.font_size_x = files.font_w;
155
		FileShow.font_number = 0;
198
		FileShow.font_number = 0;
156
	} 
199
	} 
157
}
200
}
158
 
201
 
159
 
202
 
160
void CheckBox2(dword x, y, id, text, byte value) {
203
void CheckBox2(dword x, y, id, text, byte value) {
161
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
204
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
162
}
205
}
-