Subversion Repositories Kolibri OS

Rev

Rev 5582 | Rev 5606 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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