Subversion Repositories Kolibri OS

Rev

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

Rev 5674 Rev 5857
Line -... Line 1...
-
 
1
// Mouse Configuration Utility ver 1.3
-
 
2
 
1
#ifndef AUTOBUILD
3
#ifndef AUTOBUILD
2
#include "lang.h--"
4
#include "lang.h--"
3
#endif
5
#endif
Line 4... Line 6...
4
 
6
 
Line 7... Line 9...
7
#include "..\lib\mem.h" 
9
#include "..\lib\mem.h" 
8
#include "..\lib\file_system.h"
10
#include "..\lib\file_system.h"
9
#include "..\lib\gui.h"
11
#include "..\lib\gui.h"
10
#include "..\lib\obj\libio_lib.h"
12
#include "..\lib\obj\libio_lib.h"
11
#include "..\lib\obj\box_lib.h"
13
#include "..\lib\obj\box_lib.h"
-
 
14
#include "..\lib\obj\libini.h"
12
#include "..\lib\patterns\restart_process.h"
15
#include "..\lib\patterns\restart_process.h"
Line 13... Line 16...
13
 
16
 
Line 14... Line 17...
14
#include "kos_mouse_functions.h"
17
#include "kos_mouse_functions.h"
Line 35... Line 38...
35
char pos_x = 22;
38
char pos_x = 22;
Line 36... Line 39...
36
 
39
 
37
 
40
 
-
 
41
unsigned char panels_img_data[] = FROM "mouse_image.raw";
-
 
42
raw_image panels_img = { 59, 101, #panels_img_data };
Line 38... Line 43...
38
unsigned char panels_img_data[] = FROM "mouse_image.raw";
43
char system_ini_path[] = "/sys/settings/system.ini";
Line 39... Line 44...
39
raw_image panels_img = { 59, 101, #panels_img_data };
44
char mouse_category[] = "mouse";
Line 51... Line 56...
51
 
56
 
52
 
57
 
Line -... Line 58...
-
 
58
void main() {
53
void main() {
59
	char id, old_button_clicked;
Line 54... Line 60...
54
	char id, old_button_clicked;
60
 
Line 55... Line 61...
55
 
61
	load_dll(libini, #lib_init,1);
Line 74... Line 80...
74
 
80
 
75
		case evButton: 
81
		case evButton: 
76
				id=GetButtonID();
82
				id=GetButtonID();
77
				if (id==1)
83
				if (id==1)
78
				{
84
				{
79
					ExitProcess();
85
					ExitApp();
80
				}
86
				}
81
				if (id==99) 
87
				if (id==99) 
82
				{
88
				{
83
					mouse_cfg.button_clicked=0;
89
					mouse_cfg.button_clicked=0;
Line 118... Line 124...
118
				}
124
				}
119
				DrawControls();
125
				DrawControls();
120
				break;
126
				break;
Line 121... Line 127...
121
				
127
				
122
		case evKey:
128
		case evKey:
123
				if (GetKey()==27) ExitProcess();
129
				if (GetKey()==27) ExitApp();
Line 124... Line 130...
124
				break;
130
				break;
125
			
131
			
126
		case evReDraw:
132
		case evReDraw:
Line 130... Line 136...
130
				if (Form.status_window>2) break;
136
				if (Form.status_window>2) break;
131
				SetFrameColors();
137
				SetFrameColors();
132
				DefineButton(mouse_frame.start_x+2, mouse_frame.start_y+2, mouse_frame.size_x-4, 
138
				DefineButton(mouse_frame.start_x+2, mouse_frame.start_y+2, mouse_frame.size_x-4, 
133
					mouse_frame.size_y-4, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
139
					mouse_frame.size_y-4, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
134
				frame_draw stdcall (#mouse_frame);
140
				frame_draw stdcall (#mouse_frame);
135
				WriteTextB(pos_x + 110, mouse_frame.start_y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
141
				WriteText(pos_x + 110, mouse_frame.start_y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
136
				WriteTextB(pos_x + 110, mouse_frame.start_y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
142
				WriteText(pos_x + 110, mouse_frame.start_y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
137
				DrawMouseImage();
143
				DrawMouseImage();
138
				DrawControls();
144
				DrawControls();
139
	}
145
	}
140
}
146
}
Line 141... Line 147...
141
 
147
 
142
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
148
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
143
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
149
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
Line 144... Line -...
144
}
-
 
145
 
150
}
146
 
151
 
147
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) {
152
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) {
Line 148... Line 153...
148
	MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text);
153
	MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text);
149
}
154
}
150
 
155
 
151
void DrawMouseImage() {
156
void DrawMouseImage() {
Line 152... Line 157...
152
	_PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15,  panels_img.w, panels_img.h, 
157
	_PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15,  panels_img.w, panels_img.h, 
-
 
158
		mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data);
153
		mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data);
159
}
154
}
160
 
155
 
161
void DrawControls() {
156
void DrawControls() {
162
	DrawBar(pos_x, mouse_frame.start_y + 142, Form.cwidth - pos_x, 120, system.color.work);
157
	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);
Line 166... Line 172...
166
	mouse_frame.font_backgr_color = system.color.work;
172
	mouse_frame.font_backgr_color = system.color.work;
167
	mouse_frame.ext_col = system.color.work_graph;
173
	mouse_frame.ext_col = system.color.work_graph;
168
}
174
}
Line 169... Line 175...
169
 
175
 
170
void LoadCfg() {
176
void LoadCfg() {
171
	mouse_cfg.pointer_delay = GetMouseDelay();
177
	ini_get_int stdcall (#system_ini_path, #mouse_category, "delay", GetMouseDelay());   mouse_cfg.pointer_delay = EAX;
172
	mouse_cfg.pointer_speed = GetMouseSpeed();
178
	ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed());   mouse_cfg.pointer_speed = EAX;
173
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
179
	mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
174
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
180
	mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
Line -... Line 181...
-
 
181
}
-
 
182
 
-
 
183
void ExitApp() {
-
 
184
	ini_set_int stdcall (#system_ini_path, #mouse_category, "delay", mouse_cfg.pointer_delay);
-
 
185
	ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed);
-
 
186
	ExitProcess();
Line 175... Line 187...
175
}
187
}
176
 
188