Subversion Repositories Kolibri OS

Rev

Rev 5968 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5968 Rev 5970
Line 1... Line 1...
1
// Mouse Configuration Utility ver 1.3
1
// Mouse Configuration Utility ver 1.4
Line 2... Line 2...
2
 
2
 
3
#ifndef AUTOBUILD
3
#ifndef AUTOBUILD
4
#include "lang.h--"
4
#include "lang.h--"
Line 19... Line 19...
19
#ifdef LANG_RUS
19
#ifdef LANG_RUS
20
	?define WINDOW_TITLE "à®¢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
20
	?define WINDOW_TITLE "à®¢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
21
	?define CHECK_MOUSE_1 " ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
21
	?define CHECK_MOUSE_1 " ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
22
	?define CHECK_MOUSE_2 "¤«ï ¯à®¢¥àª¨ ª­®¯®ª ¬ëè¨"
22
	?define CHECK_MOUSE_2 "¤«ï ¯à®¢¥àª¨ ª­®¯®ª ¬ëè¨"
23
	?define POINTER_SPEED "‘ª®à®áâì 㪠§ â¥«ï ¬ëè¨"
23
	?define POINTER_SPEED "‘ª®à®áâì 㪠§ â¥«ï ¬ëè¨"
24
	?define POINTER_DELAY "“᪮७¨¥ 㪠§ â¥«ï ¬ëè¨"
24
	?define ACCELERATION_TEXT "“᪮७¨¥ 㪠§ â¥«ï ¬ëè¨"
-
 
25
	?define DOUBLE_CLICK_TEXT "‡ ¤¥à¦ª  ¤¢®©­®£® ª«¨ª  ¬ëèìî"
25
	?define MOUSE_EMULATION "¬ã«ïæ¨ï ã¯à ¢«¥­¨ï 㪠§ â¥«¥¬ ç¥à¥§ ª« ¢¨ âãàã"
26
	?define MOUSE_EMULATION "¬ã«ïæ¨ï ã¯à ¢«¥­¨ï 㪠§ â¥«¥¬ ç¥à¥§ ª« ¢¨ âãàã"
26
	?define MADMOUSE "‘ª¢®§­ë¥ ¤«ï ªãàá®à  áâ®à®­ë íªà ­ "
27
	?define MADMOUSE "‘ª¢®§­ë¥ ¤«ï ªãàá®à  áâ®à®­ë íªà ­ "
27
#else
28
#else
28
	?define WINDOW_TITLE "Mouse testing and configuration"
29
	?define WINDOW_TITLE "Mouse testing and configuration"
29
	?define CHECK_MOUSE_1 "Click on this area to"
30
	?define CHECK_MOUSE_1 "Click on this area to"
30
	?define CHECK_MOUSE_2 "check your mouse buttons"
31
	?define CHECK_MOUSE_2 "check your mouse buttons"
31
	?define POINTER_SPEED "Mouse pointer speed"
32
	?define POINTER_SPEED "Mouse pointer speed"
32
	?define POINTER_DELAY "Mouse pointer acceleration"
33
	?define ACCELERATION_TEXT "Mouse pointer acceleration"
-
 
34
	?define DOUBLE_CLICK_TEXT "Mouse double click delay"
33
	?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
35
	?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
34
	?define MADMOUSE "Through screen sides for pointer"
36
	?define MADMOUSE "Through screen sides for pointer"
35
	#endif
37
	#endif
Line -... Line 38...
-
 
38
 
36
 
39
proc_info Form;
37
frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc };
40
frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc };
Line 38... Line -...
38
char pos_x = 22;
-
 
39
 
41
char pos_x = 22;
40
 
42
 
-
 
43
unsigned char panels_img_data[] = FROM "mouse_image.raw";
41
unsigned char panels_img_data[] = FROM "mouse_image.raw";
44
raw_image panels_img = { 59, 101, #panels_img_data };
42
raw_image panels_img = { 59, 101, #panels_img_data };
45
 
Line 43... Line -...
43
char system_ini_path[] = "/sys/settings/system.ini";
-
 
44
char mouse_category[] = "mouse";
-
 
Line 45... Line 46...
45
 
46
char system_ini_path[] = "/sys/settings/system.ini";
46
proc_info Form;
47
char mouse_category[] = "mouse";
47
 
48
 
48
 
49
 
49
struct mouse_cfg1 {
50
struct _mouse_cfg {
50
	char pointer_speed, 
51
	char pointer_speed, 
-
 
52
	acceleration,
51
	pointer_delay,
53
	emulation, 
Line 52... Line 54...
52
	emulation, 
54
	madmouse, 
53
	madmouse, 
55
	button_clicked;
Line 110... Line 112...
110
				if (id==121) && (mouse_cfg.pointer_speed>1)
112
				if (id==121) && (mouse_cfg.pointer_speed>1)
111
				{
113
				{
112
					mouse_cfg.pointer_speed--;
114
					mouse_cfg.pointer_speed--;
113
					SetMouseSpeed(mouse_cfg.pointer_speed);
115
					SetMouseSpeed(mouse_cfg.pointer_speed);
114
				}
116
				}
115
				if (id==122) && (mouse_cfg.pointer_delay<3)
117
				if (id==122) && (mouse_cfg.acceleration<3)
-
 
118
				{
-
 
119
					mouse_cfg.acceleration++;
-
 
120
					SetMouseAcceleration(mouse_cfg.acceleration);
-
 
121
				}
-
 
122
				if (id==123) && (mouse_cfg.acceleration>0)
-
 
123
				{
-
 
124
					mouse_cfg.acceleration--;
-
 
125
					SetMouseAcceleration(mouse_cfg.acceleration);
-
 
126
				}
-
 
127
				if (id==124)
116
				{
128
				{
117
					mouse_cfg.pointer_delay++;
129
					mouse_cfg.double_click_delay+=10;
118
					SetMouseDelay(mouse_cfg.pointer_delay);
130
					SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
119
				}
131
				}
120
				if (id==123) && (mouse_cfg.pointer_delay>0)
132
				if (id==125) && (mouse_cfg.double_click_delay>0)
121
				{
133
				{
122
					mouse_cfg.pointer_delay--;
134
					mouse_cfg.double_click_delay-=10;
123
					SetMouseDelay(mouse_cfg.pointer_delay);
135
					SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
124
				}
136
				}
125
				DrawControls();
137
				DrawControls();
126
				break;
138
				break;
Line 127... Line 139...
127
				
139
				
128
		case evKey:
140
		case evKey:
129
				if (GetKey()==27) ExitApp();
141
				if (GetKey()==27) ExitApp();
Line 130... Line 142...
130
				break;
142
				break;
131
			
143
			
132
		case evReDraw:
144
		case evReDraw:
133
				system.color.get();
145
				system.color.get();
134
				DefineAndDrawWindow(430, 150, 360, 280+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE);
146
				DefineAndDrawWindow(430, 150, 360, 300+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE);
135
				GetProcessInfo(#Form, SelfInfo);
147
				GetProcessInfo(#Form, SelfInfo);
136
				if (Form.status_window>2) break;
148
				if (Form.status_window>2) break;
137
				SetFrameColors();
149
				SetFrameColors();
Line 143... Line 155...
143
				DrawMouseImage();
155
				DrawMouseImage();
144
				DrawControls();
156
				DrawControls();
145
	}
157
	}
146
}
158
}
Line 147... Line -...
147
 
-
 
148
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
-
 
149
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
-
 
150
}
-
 
151
 
-
 
152
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) {
-
 
153
	MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text);
-
 
Line 154... Line 159...
154
}
159
 
155
 
160
 
156
void DrawMouseImage() {
161
void DrawMouseImage() {
157
	_PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15,  panels_img.w, panels_img.h, 
162
	_PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15,  panels_img.w, panels_img.h, 
Line 158... Line 163...
158
		mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data);
163
		mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data);
159
}
164
}
160
 
165
 
161
void DrawControls() {
166
void DrawControls() {
-
 
167
	DrawBar(pos_x, mouse_frame.start_y + 142, Form.cwidth - pos_x, 120, system.color.work);
162
	DrawBar(pos_x, mouse_frame.start_y + 142, Form.cwidth - pos_x, 120, system.color.work);
168
	PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
163
	PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
169
	PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.acceleration, ACCELERATION_TEXT);
164
	PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.pointer_delay, POINTER_DELAY);
170
	PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 198, 124, 125, mouse_cfg.double_click_delay, DOUBLE_CLICK_TEXT);
Line 165... Line 171...
165
	PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 202, 100, MOUSE_EMULATION, mouse_cfg.emulation);
171
	PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 230, 100, MOUSE_EMULATION, mouse_cfg.emulation);
166
	PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 226, 101, MADMOUSE, mouse_cfg.madmouse);
172
	PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 254, 101, MADMOUSE, mouse_cfg.madmouse);
167
}
173
}
168
 
174
 
169
void SetFrameColors() {
175
void SetFrameColors() {
170
	mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth;
176
	mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth;
Line 171... Line 177...
171
	mouse_frame.font_color = system.color.work_text;
177
	mouse_frame.font_color = system.color.work_text;
172
	mouse_frame.font_backgr_color = system.color.work;
178
	mouse_frame.font_backgr_color = system.color.work;
173
	mouse_frame.ext_col = system.color.work_graph;
179
	mouse_frame.ext_col = system.color.work_graph;
-
 
180
}
174
}
181
 
175
 
182
void LoadCfg() {
176
void LoadCfg() {
183
	ini_get_int stdcall (#system_ini_path, #mouse_category, "acceleration", GetMouseAcceleration());   mouse_cfg.acceleration = EAX;
Line 177... Line 184...
177
	ini_get_int stdcall (#system_ini_path, #mouse_category, "delay", GetMouseDelay());   mouse_cfg.pointer_delay = EAX;
184
	ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed());   mouse_cfg.pointer_speed = EAX;
178
	ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed());   mouse_cfg.pointer_speed = EAX;
185
	ini_get_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", GetMouseDoubleClickDelay());   mouse_cfg.double_click_delay = EAX;
179
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
186
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
-
 
187
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
180
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
188
}
181
}
189
 
Line -... Line 190...
-
 
190
void ExitApp() {
-
 
191
	ini_set_int stdcall (#system_ini_path, #mouse_category, "acceleration", mouse_cfg.acceleration);
-
 
192
	ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed);
-
 
193
	ini_set_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", mouse_cfg.double_click_delay);
-
 
194
	ExitProcess();
-
 
195
}
-
 
196
 
-
 
197
 
-
 
198
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
-
 
199
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
Line 182... Line 200...
182
 
200
}
183
void ExitApp() {
201