Subversion Repositories Kolibri OS

Rev

Rev 7049 | Rev 7227 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7049 Rev 7051
Line 12... Line 12...
12
#include "..\lib\obj\libio.h"
12
#include "..\lib\obj\libio.h"
13
#include "..\lib\obj\box_lib.h"
13
#include "..\lib\obj\box_lib.h"
14
#include "..\lib\obj\libini.h"
14
#include "..\lib\obj\libini.h"
15
#include "..\lib\patterns\restart_process.h"
15
#include "..\lib\patterns\restart_process.h"
Line -... Line 16...
-
 
16
 
16
 
17
// Translatiions
17
#ifdef LANG_RUS
18
#ifdef LANG_RUS
18
	?define WINDOW_TITLE "à®¢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
19
	?define WINDOW_TITLE "à®¢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
19
	?define CHECK_MOUSE_1 " ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
20
	?define CHECK_MOUSE_1 " ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
20
	?define CHECK_MOUSE_2 "¤«ï ¯à®¢¥àª¨ ª­®¯®ª ¬ëè¨"
21
	?define CHECK_MOUSE_2 "¤«ï ¯à®¢¥àª¨ ª­®¯®ª ¬ëè¨"
Line 39... Line 40...
39
char pos_x = 22;
40
char pos_x = 22;
Line 40... Line 41...
40
 
41
 
41
unsigned char panels_img_data[] = FROM "mouse_image.raw";
42
unsigned char panels_img_data[] = FROM "mouse_image.raw";
Line 42... Line 43...
42
raw_image panels_img = { 59, 101, #panels_img_data };
43
raw_image panels_img = { 59, 101, #panels_img_data };
43
 
-
 
44
char system_ini_path[] = "/sys/settings/system.ini";
-
 
Line 45... Line 44...
45
char mouse_category[] = "mouse";
44
 
46
 
45
_ini ini = { "/sys/settings/system.ini", "mouse" };
47
 
46
 
48
struct _mouse_cfg {
47
struct _mouse_cfg {
Line 61... Line 60...
61
	load_dll(libini, #lib_init,1);
60
	load_dll(libini, #lib_init,1);
62
	load_dll(boxlib, #box_lib_init,0);
61
	load_dll(boxlib, #box_lib_init,0);
Line 63... Line 62...
63
 
62
	
Line 64... Line 63...
64
	LoadCfg();
63
	LoadCfg();
-
 
64
 
65
 
65
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);	
66
	SetEventMask(0x27);
66
 
67
	loop() switch(WaitEvent())
67
	loop() switch(WaitEvent())
68
	{
68
	{
69
		case evMouse:
69
		case evMouse:
Line 78... Line 78...
78
				if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage();
78
				if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage();
79
				break;
79
				break;
Line 80... Line 80...
80
 
80
 
81
		case evButton: 
81
		case evButton: 
82
				id=GetButtonID();
82
				id=GetButtonID();
83
				if (id==1)
83
				switch (id) {
84
				{
84
					case 1:
85
					ExitApp();
85
						ExitApp();
86
				}
86
						break;
87
				if (id==99) 
-
 
88
				{
87
					case 99:
89
					mouse_cfg.button_clicked=0;
88
						mouse_cfg.button_clicked=0;
90
					DrawMouseImage();
89
						DrawMouseImage();
91
					break;
-
 
92
				}
90
						break;
93
				if (id==100)
-
 
94
				{
91
					case 100:
95
					if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
92
						if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
96
					else RunProgram("/sys/mousemul", 0);
93
						else RunProgram("/sys/mousemul", 0);
97
					mouse_cfg.emulation ^= 1;
94
						mouse_cfg.emulation ^= 1;
98
				}
95
						break;
99
				if (id==101) 
-
 
100
				{
96
					case 101: 
101
					if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
97
						if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
102
					else RunProgram("/sys/madmouse", 0);
98
						else RunProgram("/sys/madmouse", 0);
103
					mouse_cfg.madmouse ^= 1;
-
 
104
				}
99
						mouse_cfg.madmouse ^= 1;
105
				if (id==120) 
-
 
106
				{
100
						break;
107
					mouse_cfg.pointer_speed++;
-
 
108
					SetMouseSpeed(mouse_cfg.pointer_speed);
-
 
109
				}
-
 
110
				if (id==121) && (mouse_cfg.pointer_speed>0)
-
 
111
				{
-
 
112
					mouse_cfg.pointer_speed--;
101
					case 120: mouse_cfg.pointer_speed++; break;
113
					SetMouseSpeed(mouse_cfg.pointer_speed);
-
 
114
				}
-
 
115
				if (id==122)
-
 
116
				{
102
					case 121: if (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--; break;
117
					mouse_cfg.acceleration++;
-
 
118
					SetMouseAcceleration(mouse_cfg.acceleration);
-
 
119
				}
-
 
120
				if (id==123) && (mouse_cfg.acceleration>0)
-
 
121
				{
-
 
122
					mouse_cfg.acceleration--;
103
					case 122: mouse_cfg.acceleration++; break;
123
					SetMouseAcceleration(mouse_cfg.acceleration);
-
 
124
				}
-
 
125
				if (id==124)
-
 
126
				{
104
					case 123: if (mouse_cfg.acceleration>0) mouse_cfg.acceleration--; break;
127
					mouse_cfg.double_click_delay+=8;
-
 
128
					SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
-
 
129
				}
-
 
130
				if (id==125) && (mouse_cfg.double_click_delay>0)
-
 
131
				{
-
 
132
					mouse_cfg.double_click_delay-=8;
105
					case 124: mouse_cfg.double_click_delay+=8; break;
133
					SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
106
					case 125: if (mouse_cfg.double_click_delay>0) mouse_cfg.double_click_delay-=8; break;					
134
				}
107
				}
-
 
108
				DrawControls();
-
 
109
				ApplyCfg();
135
				DrawControls();
110
 
Line 136... Line 111...
136
				break;
111
				break;
-
 
112
 
137
				
113
		case evKey:
138
		case evKey:
114
				GetKeys();
Line 139... Line 115...
139
				if (GetKey()==27) ExitApp();
115
				if (key_scancode == SCAN_CODE_ESC) ExitApp();
140
				break;
116
				break;
141
			
117
			
142
		case evReDraw:
118
		case evReDraw:
143
				system.color.get();
119
				system.color.get();
144
				DefineAndDrawWindow(430, 150, 424, 310+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE,0);
120
				DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
145
				GetProcessInfo(#Form, SelfInfo);
121
				GetProcessInfo(#Form, SelfInfo);
146
				if (Form.status_window>2) break;
122
				if (Form.status_window>2) break;
Line 175... Line 151...
175
	mouse_frame.font_backgr_color = system.color.work;
151
	mouse_frame.font_backgr_color = system.color.work;
176
	mouse_frame.ext_col = system.color.work_graph;
152
	mouse_frame.ext_col = system.color.work_graph;
177
}
153
}
Line 178... Line 154...
178
 
154
 
179
void LoadCfg() {
155
void LoadCfg() {
180
	ini_get_int stdcall (#system_ini_path, #mouse_category, "acceleration", GetMouseAcceleration());   mouse_cfg.acceleration = EAX;
156
	mouse_cfg.acceleration = ini.GetInt("acceleration", GetMouseAcceleration());
181
	ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed());   mouse_cfg.pointer_speed = EAX;
157
	mouse_cfg.pointer_speed = ini.GetInt("speed", GetMouseSpeed());
182
	ini_get_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", GetMouseDoubleClickDelay());   mouse_cfg.double_click_delay = EAX;
158
	mouse_cfg.double_click_delay = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
183
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
159
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
184
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
160
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
Line 185... Line 161...
185
}
161
}
186
 
162
 
187
void ExitApp() {
163
void ExitApp() {
188
	ini_set_int stdcall (#system_ini_path, #mouse_category, "acceleration", mouse_cfg.acceleration);
164
	ini.SetInt("acceleration", mouse_cfg.acceleration);
189
	ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed);
165
	ini.SetInt("speed", mouse_cfg.pointer_speed);
190
	ini_set_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", mouse_cfg.double_click_delay);
166
	ini.SetInt("double_click_delay", mouse_cfg.double_click_delay);
Line -... Line 167...
-
 
167
	ExitProcess();
-
 
168
}
-
 
169
 
-
 
170
void ApplyCfg() {
191
	ExitProcess();
171
	SetMouseSpeed(mouse_cfg.pointer_speed);
Line 192... Line 172...
192
}
172
	SetMouseAcceleration(mouse_cfg.acceleration);
193
 
173
	SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);