2018-09-15 15:47:34 +03:00
|
|
|
|
// Mouse Configuration Utility ver 1.51
|
2015-10-21 15:54:28 +03:00
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define MEMSIZE 0x23E80
|
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
2018-04-03 16:57:56 +03:00
|
|
|
|
#include "..\lib\fs.h"
|
2015-07-29 18:37:34 +03:00
|
|
|
|
#include "..\lib\gui.h"
|
2017-10-05 01:59:57 +03:00
|
|
|
|
#include "..\lib\obj\libio.h"
|
2015-07-29 18:37:34 +03:00
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2015-10-21 15:54:28 +03:00
|
|
|
|
#include "..\lib\obj\libini.h"
|
2015-07-29 18:37:34 +03:00
|
|
|
|
#include "..\lib\patterns\restart_process.h"
|
|
|
|
|
|
2017-10-05 12:37:50 +03:00
|
|
|
|
// Translatiions
|
2015-07-30 17:54:30 +03:00
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
?define WINDOW_TITLE "<EFBFBD><EFBFBD>ઠ <20> <20><><EFBFBD><EFBFBD>ன<EFBFBD><E0AEA9> <20><>ࠬ<EFBFBD><E0A0AC> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define CHECK_MOUSE_1 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>⮩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define CHECK_MOUSE_2 "<EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>ન <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
2016-02-15 03:35:06 +03:00
|
|
|
|
?define POINTER_SPEED "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥫<EFBFBD> <><E1AAAE><EFBFBD><EFBFBD><EFBFBD> 㪠<><E3AAA0>⥫<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define ACCELERATION_TEXT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢨⥫쭮<EFBFBD><EFBFBD><EFBFBD> 㪠<><E3AAA0>⥫<EFBFBD> <20><><EFBFBD><EFBFBD>"
|
2015-12-16 16:23:57 +03:00
|
|
|
|
?define DOUBLE_CLICK_TEXT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>প<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
2016-02-11 16:46:53 +03:00
|
|
|
|
?define MOUSE_EMULATION "<EFBFBD><EFBFBD>ࠢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㪠<><E3AAA0>⥫<EFBFBD><E2A5AB> <20><><EFBFBD><EFBFBD> <20><>१ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
2015-08-02 22:37:34 +03:00
|
|
|
|
?define MADMOUSE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>࠭<EFBFBD>"
|
2015-07-30 17:54:30 +03:00
|
|
|
|
#else
|
|
|
|
|
?define WINDOW_TITLE "Mouse testing and configuration"
|
|
|
|
|
?define CHECK_MOUSE_1 "Click on this area to"
|
|
|
|
|
?define CHECK_MOUSE_2 "check your mouse buttons"
|
2016-02-15 03:35:06 +03:00
|
|
|
|
?define POINTER_SPEED "Mouse pointer speed divider"
|
|
|
|
|
?define ACCELERATION_TEXT "Mouse pointer sensitivity"
|
2015-12-16 16:23:57 +03:00
|
|
|
|
?define DOUBLE_CLICK_TEXT "Mouse double click delay"
|
2015-07-30 17:54:30 +03:00
|
|
|
|
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
|
|
|
|
|
?define MADMOUSE "Through screen sides for pointer"
|
2018-04-16 01:44:36 +03:00
|
|
|
|
#endif
|
2015-12-16 16:23:57 +03:00
|
|
|
|
proc_info Form;
|
2018-04-16 01:44:36 +03:00
|
|
|
|
|
2018-04-19 23:12:07 +03:00
|
|
|
|
block mouse_frame = { 18, 18, NULL, 130 };
|
2018-04-19 17:16:32 +03:00
|
|
|
|
more_less_box pointer_speed = { NULL, 0, 64, POINTER_SPEED };
|
|
|
|
|
more_less_box acceleration = { NULL, 0, 64, ACCELERATION_TEXT };
|
|
|
|
|
more_less_box double_click_delay = { NULL, 0, 999, DOUBLE_CLICK_TEXT, 8 };
|
2018-04-19 23:12:07 +03:00
|
|
|
|
checkbox emulation = { MOUSE_EMULATION, NULL };
|
|
|
|
|
checkbox madmouse = { MADMOUSE, NULL };
|
|
|
|
|
|
2015-07-30 17:54:30 +03:00
|
|
|
|
unsigned char panels_img_data[] = FROM "mouse_image.raw";
|
|
|
|
|
raw_image panels_img = { 59, 101, #panels_img_data };
|
2015-12-16 16:23:57 +03:00
|
|
|
|
|
2017-10-05 12:37:50 +03:00
|
|
|
|
_ini ini = { "/sys/settings/system.ini", "mouse" };
|
2015-07-29 18:37:34 +03:00
|
|
|
|
|
2018-04-20 23:42:48 +03:00
|
|
|
|
dword click_status;
|
2018-04-19 23:12:07 +03:00
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main() {
|
2018-04-21 00:04:44 +03:00
|
|
|
|
int id;
|
2017-10-05 12:37:50 +03:00
|
|
|
|
|
2015-10-21 15:54:28 +03:00
|
|
|
|
load_dll(libini, #lib_init,1);
|
2015-07-29 23:43:05 +03:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2017-10-05 12:37:50 +03:00
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
LoadCfg();
|
|
|
|
|
|
2017-10-05 12:37:50 +03:00
|
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
|
{
|
2015-07-30 17:54:30 +03:00
|
|
|
|
case evMouse:
|
2015-08-02 01:08:58 +03:00
|
|
|
|
mouse.get();
|
2018-04-19 23:12:07 +03:00
|
|
|
|
if (mouse.down) && (click_status==0) && (mouse_frame.hovered()) {
|
|
|
|
|
if (mouse.key&MOUSE_LEFT) click_status = 1;
|
|
|
|
|
if (mouse.key&MOUSE_RIGHT) click_status = 2;
|
|
|
|
|
if (mouse.key&MOUSE_CENTER) click_status = 3;
|
2018-04-20 23:42:48 +03:00
|
|
|
|
DrawMouseImage();
|
2018-04-16 01:44:36 +03:00
|
|
|
|
}
|
|
|
|
|
if (mouse.up) {
|
2018-04-19 23:12:07 +03:00
|
|
|
|
click_status=0;
|
2018-04-20 23:42:48 +03:00
|
|
|
|
DrawMouseImage();
|
2018-04-16 01:44:36 +03:00
|
|
|
|
}
|
2015-07-30 17:54:30 +03:00
|
|
|
|
break;
|
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
case evButton:
|
2018-04-16 01:44:36 +03:00
|
|
|
|
id = GetButtonID();
|
2018-09-15 15:47:34 +03:00
|
|
|
|
if (1 == id) ExitApp();
|
2018-09-15 15:29:14 +03:00
|
|
|
|
else if (pointer_speed.click(id)) ApplyCfg();
|
|
|
|
|
else if (acceleration.click(id)) ApplyCfg();
|
|
|
|
|
else if (double_click_delay.click(id)) ApplyCfg();
|
|
|
|
|
else if (emulation.click(id)) {
|
|
|
|
|
if (emulation.checked == true) RunProgram("/sys/mousemul", 0);
|
2018-09-15 15:47:34 +03:00
|
|
|
|
else KillProcessByName("/sys/mousemul", SINGLE);
|
2018-09-15 15:29:14 +03:00
|
|
|
|
break;
|
2018-04-19 23:12:07 +03:00
|
|
|
|
}
|
2018-09-15 15:29:14 +03:00
|
|
|
|
else if (madmouse.click(id)) {
|
|
|
|
|
if (madmouse.checked == true) RunProgram("/sys/madmouse", 0);
|
2018-09-15 15:47:34 +03:00
|
|
|
|
else KillProcessByName("/sys/madmouse", SINGLE);
|
2018-09-15 15:29:14 +03:00
|
|
|
|
break;
|
2015-07-30 17:54:30 +03:00
|
|
|
|
}
|
2015-07-29 18:37:34 +03:00
|
|
|
|
break;
|
2017-10-05 12:37:50 +03:00
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
case evKey:
|
2017-10-05 12:37:50 +03:00
|
|
|
|
GetKeys();
|
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) ExitApp();
|
2015-07-29 18:37:34 +03:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-04 17:36:07 +03:00
|
|
|
|
system.color.get();
|
2017-10-05 12:37:50 +03:00
|
|
|
|
DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
|
2015-07-29 18:37:34 +03:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
if (Form.status_window>2) break;
|
2018-04-16 01:44:36 +03:00
|
|
|
|
mouse_frame.w = - mouse_frame.x * 2 + Form.cwidth;
|
|
|
|
|
DefineButton(mouse_frame.x, mouse_frame.y, mouse_frame.w,
|
|
|
|
|
mouse_frame.h, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
|
|
|
|
|
WriteText(mouse_frame.x + 110, mouse_frame.y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
|
|
|
|
|
WriteText(mouse_frame.x + 110, mouse_frame.y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
|
2015-08-02 02:21:13 +03:00
|
|
|
|
DrawMouseImage();
|
|
|
|
|
DrawControls();
|
2015-07-29 18:37:34 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-20 23:42:48 +03:00
|
|
|
|
void DrawMouseImage() {
|
2018-04-16 01:44:36 +03:00
|
|
|
|
_PutImage(mouse_frame.x+30, mouse_frame.y + 15, panels_img.w, panels_img.h,
|
2018-04-20 23:42:48 +03:00
|
|
|
|
click_status * panels_img.w * panels_img.h * 3 + panels_img.data);
|
2015-08-02 02:21:13 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawControls() {
|
2018-04-19 23:12:07 +03:00
|
|
|
|
incn y;
|
|
|
|
|
y.n = mouse_frame.y+115;
|
2018-04-20 23:42:48 +03:00
|
|
|
|
pointer_speed.draw(mouse_frame.x, y.inc(30));
|
|
|
|
|
acceleration.draw(mouse_frame.x, y.inc(30));
|
|
|
|
|
double_click_delay.draw(mouse_frame.x, y.inc(30));
|
|
|
|
|
emulation.draw(mouse_frame.x, y.inc(33));
|
|
|
|
|
madmouse.draw(mouse_frame.x, y.inc(27));
|
2015-07-30 17:54:30 +03:00
|
|
|
|
}
|
2015-07-29 18:37:34 +03:00
|
|
|
|
|
|
|
|
|
void LoadCfg() {
|
2018-04-16 01:44:36 +03:00
|
|
|
|
acceleration.value = ini.GetInt("acceleration", GetMouseAcceleration());
|
|
|
|
|
pointer_speed.value = ini.GetInt("speed", GetMouseSpeed());
|
|
|
|
|
double_click_delay.value = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
|
2018-04-19 23:12:07 +03:00
|
|
|
|
madmouse.checked = CheckProcessExists("MADMOUSE");
|
|
|
|
|
emulation.checked = CheckProcessExists("MOUSEMUL");
|
2015-07-29 18:37:34 +03:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-21 15:54:28 +03:00
|
|
|
|
void ExitApp() {
|
2018-04-16 01:44:36 +03:00
|
|
|
|
ini.SetInt("acceleration", acceleration.value);
|
|
|
|
|
ini.SetInt("speed", pointer_speed.value);
|
|
|
|
|
ini.SetInt("double_click_delay", double_click_delay.value);
|
2015-10-21 15:54:28 +03:00
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 12:37:50 +03:00
|
|
|
|
void ApplyCfg() {
|
2018-04-16 01:44:36 +03:00
|
|
|
|
SetMouseSpeed(pointer_speed.value);
|
|
|
|
|
SetMouseAcceleration(acceleration.value);
|
|
|
|
|
SetMouseDoubleClickDelay(double_click_delay.value);
|
2017-10-05 12:37:50 +03:00
|
|
|
|
}
|
2015-07-30 17:54:30 +03:00
|
|
|
|
|
2015-07-29 18:37:34 +03:00
|
|
|
|
stop:
|