2019-05-06 10:47:59 +02:00
|
|
|
|
// Mouse Configuration Utility ver 1.62
|
2015-10-21 14:54:28 +02:00
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-10-04 22:08:44 +02:00
|
|
|
|
#define MEMSIZE 4096*11
|
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
2018-04-03 15:57:56 +02:00
|
|
|
|
#include "..\lib\fs.h"
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#include "..\lib\gui.h"
|
2015-10-21 14:54:28 +02:00
|
|
|
|
#include "..\lib\obj\libini.h"
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#include "..\lib\patterns\restart_process.h"
|
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
// Translatiions
|
2015-07-30 16:54:30 +02: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 01:35:06 +01: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 14:23:57 +01: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 14:46:53 +01: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 21:37:34 +02:00
|
|
|
|
?define MADMOUSE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>࠭<EFBFBD>"
|
2019-05-06 10:47:59 +02:00
|
|
|
|
?define COMMOUSE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㧨<EFBFBD><EFBFBD> <20>ࠩ<EFBFBD><E0A0A9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> COM-<2D><><EFBFBD><EFBFBD><EFBFBD> (F10)"
|
|
|
|
|
?define COMMOUSE_LOADED "'<27>ࠩ<EFBFBD><E0A0A9><EFBFBD> <20><><EFBFBD> COM <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>㦥<EFBFBD>' -O"
|
|
|
|
|
?define COMMOUSE_CAN_NOT_UNLOAD "'<27><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD> <20>ࠩ<EFBFBD><E0A0A9><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' -W"
|
2015-07-30 16:54:30 +02: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 01:35:06 +01:00
|
|
|
|
?define POINTER_SPEED "Mouse pointer speed divider"
|
|
|
|
|
?define ACCELERATION_TEXT "Mouse pointer sensitivity"
|
2015-12-16 14:23:57 +01:00
|
|
|
|
?define DOUBLE_CLICK_TEXT "Mouse double click delay"
|
2015-07-30 16:54:30 +02:00
|
|
|
|
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
|
|
|
|
|
?define MADMOUSE "Through screen sides for pointer"
|
2019-05-06 10:47:59 +02:00
|
|
|
|
?define COMMOUSE "Load mouse driver for COM-port (F10)"
|
|
|
|
|
?define COMMOUSE_LOADED "'Driver for COM mouse loaded' -O"
|
|
|
|
|
?define COMMOUSE_CAN_NOT_UNLOAD "'Driver stop is impossible' -W"
|
2018-04-16 00:44:36 +02:00
|
|
|
|
#endif
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
2019-05-06 10:47:59 +02:00
|
|
|
|
#define FRAME_X 18
|
|
|
|
|
#define FRAME_Y 18
|
|
|
|
|
:block mouse_frame = { FRAME_X, FRAME_Y, NULL, 130 };
|
2018-10-04 22:08:44 +02: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 };
|
|
|
|
|
:checkbox emulation = { MOUSE_EMULATION, NULL };
|
|
|
|
|
:checkbox madmouse = { MADMOUSE, NULL };
|
2019-05-06 10:47:59 +02:00
|
|
|
|
:checkbox com_mouse = { COMMOUSE, NULL };
|
2015-12-16 14:23:57 +01:00
|
|
|
|
|
2020-05-27 17:19:19 +02:00
|
|
|
|
char ini_path[] = "/sys/settings/system.ini";
|
|
|
|
|
_ini ini_drivers = { #ini_path, "loaded drivers" };
|
|
|
|
|
_ini ini_mouse = { #ini_path, "mouse" };
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
|
|
|
|
void main() {
|
2018-10-04 22:08:44 +02:00
|
|
|
|
proc_info Form;
|
2018-04-20 23:04:44 +02:00
|
|
|
|
int id;
|
2017-10-05 11:37:50 +02:00
|
|
|
|
|
2015-10-21 14:54:28 +02:00
|
|
|
|
load_dll(libini, #lib_init,1);
|
2017-10-05 11:37:50 +02:00
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
LoadCfg();
|
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
|
|
|
|
|
2020-05-27 17:19:19 +02:00
|
|
|
|
loop() switch(@WaitEvent())
|
2015-07-29 17:37:34 +02:00
|
|
|
|
{
|
2015-07-30 16:54:30 +02:00
|
|
|
|
case evMouse:
|
2015-08-02 00:08:58 +02:00
|
|
|
|
mouse.get();
|
2018-10-06 00:10:27 +02:00
|
|
|
|
IF (mouse_frame.hovered()) DrawMouseImage(mouse.lkm,mouse.pkm,mouse.mkm,mouse.vert);
|
2018-10-23 17:29:05 +02:00
|
|
|
|
IF (mouse.click) || (mouse.up) DrawMouseImage(0,0,0,0);
|
2015-07-30 16:54:30 +02:00
|
|
|
|
break;
|
|
|
|
|
|
2018-10-04 22:08:44 +02:00
|
|
|
|
CASE evButton:
|
2020-05-27 17:19:19 +02:00
|
|
|
|
id = @GetButtonID();
|
2018-10-04 22:08:44 +02:00
|
|
|
|
IF (1 == id) ExitApp();
|
|
|
|
|
else IF (pointer_speed.click(id)) ApplyCfg();
|
|
|
|
|
else IF (acceleration.click(id)) ApplyCfg();
|
|
|
|
|
else IF (double_click_delay.click(id)) ApplyCfg();
|
2019-05-06 10:47:59 +02:00
|
|
|
|
else IF (emulation.click(id)) {
|
2018-10-04 22:08:44 +02:00
|
|
|
|
IF (emulation.checked == true) RunProgram("/sys/mousemul", 0);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
ELSE KillProcessByName("mousemul", SINGLE);
|
2018-09-15 14:29:14 +02:00
|
|
|
|
break;
|
2018-04-19 22:12:07 +02:00
|
|
|
|
}
|
2019-05-06 10:47:59 +02:00
|
|
|
|
else IF (madmouse.click(id)) {
|
2018-10-04 22:08:44 +02:00
|
|
|
|
IF (madmouse.checked == true) RunProgram("/sys/madmouse", 0);
|
2019-03-15 15:05:59 +01:00
|
|
|
|
ELSE KillProcessByName("madmouse", SINGLE);
|
2018-09-15 14:29:14 +02:00
|
|
|
|
break;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
}
|
2019-05-06 10:47:59 +02:00
|
|
|
|
else IF (id == com_mouse.id) {
|
|
|
|
|
EventClickComMouse();
|
|
|
|
|
}
|
2015-07-29 17:37:34 +02:00
|
|
|
|
break;
|
2017-10-05 11:37:50 +02:00
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
case evKey:
|
2020-05-27 17:19:19 +02:00
|
|
|
|
@GetKeyScancode();
|
|
|
|
|
IF (AL == SCAN_CODE_ESC) ExitApp();
|
|
|
|
|
IF (AL == SCAN_CODE_F10) EventClickComMouse();
|
2015-07-29 17:37:34 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2020-04-18 01:52:24 +02:00
|
|
|
|
sc.get();
|
|
|
|
|
DefineAndDrawWindow(430, 150, 424, 343+skin_height,0x34,sc.work,WINDOW_TITLE,0);
|
2015-07-29 17:37:34 +02:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2021-06-26 09:59:13 +02:00
|
|
|
|
if (Form.status_window&ROLLED_UP) break;
|
2019-05-06 10:47:59 +02:00
|
|
|
|
mouse_frame.w = - FRAME_X * 2 + Form.cwidth;
|
|
|
|
|
DefineButton(FRAME_X, FRAME_Y, mouse_frame.w,
|
2018-04-16 00:44:36 +02:00
|
|
|
|
mouse_frame.h, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
|
2019-05-06 10:47:59 +02:00
|
|
|
|
WriteText(FRAME_X + 110, FRAME_Y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
|
|
|
|
|
WriteText(FRAME_X + 110, FRAME_Y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
|
2018-10-04 22:08:44 +02:00
|
|
|
|
DrawMouseImage(0,0,0,0);
|
2015-08-02 01:21:13 +02:00
|
|
|
|
DrawControls();
|
2015-07-29 17:37:34 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 22:08:44 +02:00
|
|
|
|
:byte panels_img_data[] = FROM "mouse_image.raw";
|
|
|
|
|
|
|
|
|
|
#define red 0xff0000
|
|
|
|
|
#define yellow 0xfff600
|
|
|
|
|
#define white 0xffffff
|
|
|
|
|
#define dgrey 0x2d353d
|
|
|
|
|
|
2018-10-06 00:10:27 +02:00
|
|
|
|
:struct IMG_PAL{ dword back, shad1, contour, left, right, middle, mwhite; }
|
|
|
|
|
pal = { 0xF0F2F3,0xABB0B2, dgrey, white, white, dgrey, white };
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
2018-10-04 22:08:44 +02:00
|
|
|
|
void DrawMouseImage(dword l,r,m,v) {
|
|
|
|
|
#define IMG_W 59
|
2020-05-27 17:19:19 +02:00
|
|
|
|
#define IMG_H 100
|
2018-10-04 22:08:44 +02:00
|
|
|
|
|
|
|
|
|
IF (l) pal.left = red;
|
|
|
|
|
IF (m) pal.middle = red;
|
|
|
|
|
IF (r) pal.right = red;
|
|
|
|
|
IF (v) pal.middle = yellow;
|
|
|
|
|
|
2020-05-27 17:19:19 +02:00
|
|
|
|
PutPaletteImage(#panels_img_data,IMG_W,IMG_H,18+30,18+16,8,#pal);
|
2018-10-04 22:08:44 +02:00
|
|
|
|
pal.left = pal.right = white;
|
|
|
|
|
pal.middle = dgrey;
|
2018-10-06 00:10:27 +02:00
|
|
|
|
IF (v) {
|
2018-10-04 22:08:44 +02:00
|
|
|
|
pause(10);
|
2018-10-06 00:10:27 +02:00
|
|
|
|
DrawMouseImage(l,r,m,0);
|
2018-10-04 22:08:44 +02:00
|
|
|
|
}
|
2015-08-02 01:21:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawControls() {
|
2018-04-19 22:12:07 +02:00
|
|
|
|
incn y;
|
2019-05-06 10:47:59 +02:00
|
|
|
|
y.n = FRAME_Y+115;
|
|
|
|
|
pointer_speed.draw(FRAME_X, y.inc(30));
|
|
|
|
|
acceleration.draw(FRAME_X, y.inc(30));
|
|
|
|
|
double_click_delay.draw(FRAME_X, y.inc(30));
|
|
|
|
|
emulation.draw(FRAME_X, y.inc(33));
|
|
|
|
|
madmouse.draw(FRAME_X, y.inc(27));
|
|
|
|
|
com_mouse.draw(FRAME_X, y.inc(27));
|
2015-07-30 16:54:30 +02:00
|
|
|
|
}
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
|
|
|
|
void LoadCfg() {
|
2020-05-27 17:19:19 +02:00
|
|
|
|
acceleration.value = @GetMouseAcceleration();
|
|
|
|
|
pointer_speed.value = @GetMouseSpeed();
|
|
|
|
|
double_click_delay.value = @GetMouseDoubleClickDelay();
|
|
|
|
|
com_mouse.checked = ini_drivers.GetInt("com_mouse", 0);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
madmouse.checked = CheckProcessExists("MADMOUSE");
|
|
|
|
|
emulation.checked = CheckProcessExists("MOUSEMUL");
|
2015-07-29 17:37:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-21 14:54:28 +02:00
|
|
|
|
void ExitApp() {
|
2020-05-27 17:19:19 +02:00
|
|
|
|
ini_drivers.SetInt("com_mouse", com_mouse.checked);
|
|
|
|
|
ini_mouse.SetInt("speed", pointer_speed.value);
|
|
|
|
|
ini_mouse.SetInt("acceleration", acceleration.value);
|
|
|
|
|
ini_mouse.SetInt("double_click_delay", double_click_delay.value);
|
|
|
|
|
@ExitProcess();
|
2015-10-21 14:54:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
void ApplyCfg() {
|
2020-05-27 17:19:19 +02:00
|
|
|
|
@SetMouseSpeed(pointer_speed.value);
|
|
|
|
|
@SetMouseAcceleration(acceleration.value);
|
|
|
|
|
@SetMouseDoubleClickDelay(double_click_delay.value);
|
2017-10-05 11:37:50 +02:00
|
|
|
|
}
|
2015-07-30 16:54:30 +02:00
|
|
|
|
|
2019-05-06 10:47:59 +02:00
|
|
|
|
void EventClickComMouse()
|
|
|
|
|
{
|
|
|
|
|
if (!com_mouse.checked)
|
|
|
|
|
{
|
|
|
|
|
if (RunProgram("/sys/loaddrv", "COMMOUSE")>=0) {
|
|
|
|
|
notify(COMMOUSE_LOADED);
|
|
|
|
|
com_mouse.click(com_mouse.id);
|
2020-05-27 17:19:19 +02:00
|
|
|
|
} else {
|
2019-05-06 10:47:59 +02:00
|
|
|
|
notify("'Error running LOADDRV' -E");
|
|
|
|
|
}
|
2020-05-27 17:19:19 +02:00
|
|
|
|
} else {
|
2019-05-06 10:47:59 +02:00
|
|
|
|
notify(COMMOUSE_CAN_NOT_UNLOAD);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 22:08:44 +02:00
|
|
|
|
stop:
|