Rev 7219 | Rev 7243 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7219 | Rev 7227 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | // Mouse Configuration Utility ver 1.4 |
1 | // Mouse Configuration Utility ver 1.5 |
Line 2... | Line 2... | ||
2 | 2 | ||
3 | #ifndef AUTOBUILD |
3 | #ifndef AUTOBUILD |
4 | #include "lang.h--" |
4 | #include "lang.h--" |
Line 31... | Line 31... | ||
31 | ?define POINTER_SPEED "Mouse pointer speed divider" |
31 | ?define POINTER_SPEED "Mouse pointer speed divider" |
32 | ?define ACCELERATION_TEXT "Mouse pointer sensitivity" |
32 | ?define ACCELERATION_TEXT "Mouse pointer sensitivity" |
33 | ?define DOUBLE_CLICK_TEXT "Mouse double click delay" |
33 | ?define DOUBLE_CLICK_TEXT "Mouse double click delay" |
34 | ?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad" |
34 | ?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad" |
35 | ?define MADMOUSE "Through screen sides for pointer" |
35 | ?define MADMOUSE "Through screen sides for pointer" |
36 | #endif |
36 | #endif |
Line 37... | Line 37... | ||
37 | 37 | ||
- | 38 | proc_info Form; |
|
- | 39 | ||
- | 40 | #define PD 18 //padding |
|
- | 41 | block mouse_frame = { PD, PD, NULL, 130 }; |
|
38 | proc_info Form; |
42 | |
39 | frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc }; |
43 | more_less_box pointer_speed = { PD, PD+142, NULL, 0, 64, 120, 121, POINTER_SPEED }; |
- | 44 | more_less_box acceleration = { PD, PD+172, NULL, 0, 64, 122, 123, ACCELERATION_TEXT }; |
|
Line 40... | Line 45... | ||
40 | char pos_x = 22; |
45 | more_less_box double_click_delay = { PD, PD+202, NULL, 0, 999,124, 125, DOUBLE_CLICK_TEXT, 8 }; |
41 | 46 | ||
Line 42... | Line 47... | ||
42 | unsigned char panels_img_data[] = FROM "mouse_image.raw"; |
47 | unsigned char panels_img_data[] = FROM "mouse_image.raw"; |
Line 43... | Line 48... | ||
43 | raw_image panels_img = { 59, 101, #panels_img_data }; |
48 | raw_image panels_img = { 59, 101, #panels_img_data }; |
44 | - | ||
45 | _ini ini = { "/sys/settings/system.ini", "mouse" }; |
- | |
46 | 49 | ||
47 | struct _mouse_cfg { |
50 | _ini ini = { "/sys/settings/system.ini", "mouse" }; |
48 | char pointer_speed, |
51 | |
49 | acceleration, |
- | |
50 | emulation, |
52 | struct _mouse_cfg { |
Line 51... | Line 53... | ||
51 | madmouse, |
53 | bool emulation; |
52 | button_clicked; |
54 | bool madmouse; |
Line 53... | Line 55... | ||
53 | word double_click_delay; |
55 | int click_status; |
54 | } mouse_cfg; |
56 | } mouse_cfg; |
Line 55... | Line 57... | ||
55 | 57 | ||
Line 66... | Line 68... | ||
66 | 68 | ||
67 | loop() switch(WaitEvent()) |
69 | loop() switch(WaitEvent()) |
68 | { |
70 | { |
69 | case evMouse: |
71 | case evMouse: |
70 | mouse.get(); |
72 | mouse.get(); |
71 | if (mouse.y <= mouse_frame.start_y) || (mouse.y >= mouse_frame.start_y + mouse_frame.size_y) |
73 | if (mouse.down) && (mouse_cfg.click_status==0) && (mouse_frame.hovered()) { |
72 | || (mouse.x >= mouse_frame.start_x + mouse_frame.size_x) || (mouse.x <= mouse_frame.start_x) break; |
74 | if (mouse.key&MOUSE_LEFT) mouse_cfg.click_status = 1; |
73 | old_button_clicked = mouse_cfg.button_clicked; |
75 | if (mouse.key&MOUSE_RIGHT) mouse_cfg.click_status = 2; |
74 | if (mouse.lkm) mouse_cfg.button_clicked=1; |
76 | if (mouse.key&MOUSE_CENTER) mouse_cfg.click_status = 3; |
- | 77 | DrawMouseImage(); |
|
75 | else if (mouse.pkm) mouse_cfg.button_clicked=2; |
78 | } |
76 | else if (mouse.mkm) mouse_cfg.button_clicked=3; |
79 | if (mouse.up) { |
77 | else mouse_cfg.button_clicked=0; |
80 | mouse_cfg.click_status=0; |
- | 81 | DrawMouseImage(); |
|
78 | if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage(); |
82 | } |
Line 79... | Line 83... | ||
79 | break; |
83 | break; |
80 | 84 | ||
81 | case evButton: |
85 | case evButton: |
82 | id=GetButtonID(); |
86 | id = GetButtonID(); |
83 | switch (id) { |
87 | switch (id) { |
84 | case 1: |
88 | case 1: |
85 | ExitApp(); |
- | |
86 | break; |
- | |
87 | case 99: |
- | |
88 | mouse_cfg.button_clicked=0; |
- | |
89 | DrawMouseImage(); |
89 | ExitApp(); |
90 | break; |
90 | break; |
91 | case 100: |
91 | case 100: |
92 | if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE); |
92 | if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE); |
- | 93 | else RunProgram("/sys/mousemul", 0); |
|
93 | else RunProgram("/sys/mousemul", 0); |
94 | mouse_cfg.emulation ^= 1; |
94 | mouse_cfg.emulation ^= 1; |
95 | DrawControls(); |
95 | break; |
96 | break; |
96 | case 101: |
97 | case 101: |
97 | if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE); |
98 | if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE); |
- | 99 | else RunProgram("/sys/madmouse", 0); |
|
98 | else RunProgram("/sys/madmouse", 0); |
100 | mouse_cfg.madmouse ^= 1; |
99 | mouse_cfg.madmouse ^= 1; |
101 | DrawControls(); |
100 | break; |
102 | break; |
101 | case 120: mouse_cfg.pointer_speed++; break; |
103 | default: |
102 | case 121: if (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--; break; |
- | |
103 | case 122: mouse_cfg.acceleration++; break; |
104 | if (pointer_speed.click(id)) ApplyCfg();; |
104 | case 123: if (mouse_cfg.acceleration>0) mouse_cfg.acceleration--; break; |
- | |
105 | case 124: mouse_cfg.double_click_delay+=8; break; |
105 | if (acceleration.click(id)) ApplyCfg();; |
106 | case 125: if (mouse_cfg.double_click_delay>0) mouse_cfg.double_click_delay-=8; break; |
- | |
107 | } |
- | |
108 | DrawControls(); |
- | |
109 | ApplyCfg(); |
106 | if (double_click_delay.click(id)) ApplyCfg();; |
Line 110... | Line 107... | ||
110 | 107 | } |
|
111 | break; |
108 | break; |
112 | 109 | ||
Line 118... | Line 115... | ||
118 | case evReDraw: |
115 | case evReDraw: |
119 | system.color.get(); |
116 | system.color.get(); |
120 | DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0); |
117 | DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0); |
121 | GetProcessInfo(#Form, SelfInfo); |
118 | GetProcessInfo(#Form, SelfInfo); |
122 | if (Form.status_window>2) break; |
119 | if (Form.status_window>2) break; |
123 | SetFrameColors(); |
120 | mouse_frame.w = - mouse_frame.x * 2 + Form.cwidth; |
124 | DefineButton(mouse_frame.start_x+2, mouse_frame.start_y+2, mouse_frame.size_x-4, |
121 | DefineButton(mouse_frame.x, mouse_frame.y, mouse_frame.w, |
125 | mouse_frame.size_y-4, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image |
122 | mouse_frame.h, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image |
126 | frame_draw stdcall (#mouse_frame); |
- | |
127 | WriteText(pos_x + 110, mouse_frame.start_y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1); |
123 | WriteText(mouse_frame.x + 110, mouse_frame.y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1); |
128 | WriteText(pos_x + 110, mouse_frame.start_y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2); |
124 | WriteText(mouse_frame.x + 110, mouse_frame.y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2); |
129 | DrawMouseImage(); |
125 | DrawMouseImage(); |
130 | DrawControls(); |
126 | DrawControls(); |
131 | } |
127 | } |
132 | } |
128 | } |
Line 133... | Line 129... | ||
133 | 129 | ||
134 | 130 | ||
135 | void DrawMouseImage() { |
131 | void DrawMouseImage() { |
136 | _PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15, panels_img.w, panels_img.h, |
132 | _PutImage(mouse_frame.x+30, mouse_frame.y + 15, panels_img.w, panels_img.h, |
Line 137... | Line 133... | ||
137 | mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data); |
133 | mouse_cfg.click_status * panels_img.w * panels_img.h * 3 + panels_img.data); |
138 | } |
134 | } |
139 | 135 | ||
140 | void DrawControls() { |
136 | void DrawControls() { |
141 | MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED); |
137 | pointer_speed.draw(); |
142 | MoreLessBox(pos_x, mouse_frame.start_y + 172, 122, 123, mouse_cfg.acceleration, ACCELERATION_TEXT); |
138 | acceleration.draw(); |
143 | MoreLessBox(pos_x, mouse_frame.start_y + 202, 124, 125, mouse_cfg.double_click_delay, DOUBLE_CLICK_TEXT); |
- | |
144 | CheckBox(pos_x, mouse_frame.start_y + 236, 100, MOUSE_EMULATION, mouse_cfg.emulation); |
- | |
145 | CheckBox(pos_x, mouse_frame.start_y + 262, 101, MADMOUSE, mouse_cfg.madmouse); |
- | |
146 | } |
- | |
147 | - | ||
148 | void SetFrameColors() { |
- | |
149 | mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth; |
- | |
150 | mouse_frame.font_color = system.color.work_text; |
139 | double_click_delay.draw(); |
Line 151... | Line 140... | ||
151 | mouse_frame.font_backgr_color = system.color.work; |
140 | CheckBox(mouse_frame.x, mouse_frame.y + 236, 100, MOUSE_EMULATION, mouse_cfg.emulation); |
152 | mouse_frame.ext_col = system.color.work_graph; |
141 | CheckBox(mouse_frame.x, mouse_frame.y + 262, 101, MADMOUSE, mouse_cfg.madmouse); |
153 | } |
142 | } |
154 | 143 | ||
155 | void LoadCfg() { |
144 | void LoadCfg() { |
156 | mouse_cfg.acceleration = ini.GetInt("acceleration", GetMouseAcceleration()); |
145 | acceleration.value = ini.GetInt("acceleration", GetMouseAcceleration()); |
157 | mouse_cfg.pointer_speed = ini.GetInt("speed", GetMouseSpeed()); |
146 | pointer_speed.value = ini.GetInt("speed", GetMouseSpeed()); |
Line 158... | Line 147... | ||
158 | mouse_cfg.double_click_delay = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay()); |
147 | double_click_delay.value = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay()); |
159 | mouse_cfg.madmouse = CheckProcessExists("MADMOUSE"); |
148 | mouse_cfg.madmouse = CheckProcessExists("MADMOUSE"); |
160 | mouse_cfg.emulation = CheckProcessExists("MOUSEMUL"); |
149 | mouse_cfg.emulation = CheckProcessExists("MOUSEMUL"); |
161 | } |
150 | } |
162 | 151 | ||
163 | void ExitApp() { |
152 | void ExitApp() { |
Line 164... | Line 153... | ||
164 | ini.SetInt("acceleration", mouse_cfg.acceleration); |
153 | ini.SetInt("acceleration", acceleration.value); |
165 | ini.SetInt("speed", mouse_cfg.pointer_speed); |
154 | ini.SetInt("speed", pointer_speed.value); |
166 | ini.SetInt("double_click_delay", mouse_cfg.double_click_delay); |
155 | ini.SetInt("double_click_delay", double_click_delay.value); |
167 | ExitProcess(); |
156 | ExitProcess(); |
168 | } |
157 | } |
Line 169... | Line 158... | ||
169 | 158 | ||
170 | void ApplyCfg() { |
159 | void ApplyCfg() { |