2015-12-16 14:23:57 +01:00
|
|
|
|
// Mouse Configuration Utility ver 1.4
|
2015-10-21 14:54:28 +02:00
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define MEMSIZE 0x23E80
|
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\file_system.h"
|
|
|
|
|
#include "..\lib\gui.h"
|
2017-10-05 00:59:57 +02:00
|
|
|
|
#include "..\lib\obj\libio.h"
|
2015-07-29 17:37:34 +02:00
|
|
|
|
#include "..\lib\obj\box_lib.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>"
|
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"
|
2015-08-04 16:36:07 +02:00
|
|
|
|
#endif
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
2015-12-16 14:23:57 +01:00
|
|
|
|
proc_info Form;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc };
|
2015-08-02 01:21:13 +02:00
|
|
|
|
char pos_x = 22;
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
2015-07-30 16:54:30 +02:00
|
|
|
|
unsigned char panels_img_data[] = FROM "mouse_image.raw";
|
|
|
|
|
raw_image panels_img = { 59, 101, #panels_img_data };
|
2015-12-16 14:23:57 +01:00
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
_ini ini = { "/sys/settings/system.ini", "mouse" };
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
2015-12-16 14:23:57 +01:00
|
|
|
|
struct _mouse_cfg {
|
2015-07-30 16:54:30 +02:00
|
|
|
|
char pointer_speed,
|
2015-12-16 14:23:57 +01:00
|
|
|
|
acceleration,
|
2015-07-30 16:54:30 +02:00
|
|
|
|
emulation,
|
|
|
|
|
madmouse,
|
|
|
|
|
button_clicked;
|
2015-12-16 14:23:57 +01:00
|
|
|
|
word double_click_delay;
|
2015-07-29 17:37:34 +02:00
|
|
|
|
} mouse_cfg;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main() {
|
2015-07-30 16:54:30 +02:00
|
|
|
|
char id, old_button_clicked;
|
2017-10-05 11:37:50 +02:00
|
|
|
|
|
2015-10-21 14:54:28 +02:00
|
|
|
|
load_dll(libini, #lib_init,1);
|
2015-07-29 22:43:05 +02:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
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);
|
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
|
{
|
2015-07-30 16:54:30 +02:00
|
|
|
|
case evMouse:
|
2015-08-02 00:08:58 +02:00
|
|
|
|
mouse.get();
|
|
|
|
|
if (mouse.y <= mouse_frame.start_y) || (mouse.y >= mouse_frame.start_y + mouse_frame.size_y)
|
|
|
|
|
|| (mouse.x >= mouse_frame.start_x + mouse_frame.size_x) || (mouse.x <= mouse_frame.start_x) break;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
old_button_clicked = mouse_cfg.button_clicked;
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.lkm) mouse_cfg.button_clicked=1;
|
|
|
|
|
else if (mouse.pkm) mouse_cfg.button_clicked=2;
|
|
|
|
|
else if (mouse.mkm) mouse_cfg.button_clicked=3;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
else mouse_cfg.button_clicked=0;
|
|
|
|
|
if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage();
|
|
|
|
|
break;
|
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
2017-10-05 11:37:50 +02:00
|
|
|
|
switch (id) {
|
|
|
|
|
case 1:
|
|
|
|
|
ExitApp();
|
|
|
|
|
break;
|
|
|
|
|
case 99:
|
|
|
|
|
mouse_cfg.button_clicked=0;
|
|
|
|
|
DrawMouseImage();
|
|
|
|
|
break;
|
|
|
|
|
case 100:
|
|
|
|
|
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
|
|
|
|
|
else RunProgram("/sys/mousemul", 0);
|
|
|
|
|
mouse_cfg.emulation ^= 1;
|
|
|
|
|
break;
|
|
|
|
|
case 101:
|
|
|
|
|
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
|
|
|
|
|
else RunProgram("/sys/madmouse", 0);
|
|
|
|
|
mouse_cfg.madmouse ^= 1;
|
|
|
|
|
break;
|
|
|
|
|
case 120: mouse_cfg.pointer_speed++; break;
|
|
|
|
|
case 121: if (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--; break;
|
|
|
|
|
case 122: mouse_cfg.acceleration++; break;
|
|
|
|
|
case 123: if (mouse_cfg.acceleration>0) mouse_cfg.acceleration--; break;
|
|
|
|
|
case 124: mouse_cfg.double_click_delay+=8; break;
|
|
|
|
|
case 125: if (mouse_cfg.double_click_delay>0) mouse_cfg.double_click_delay-=8; break;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
}
|
2015-08-02 01:21:13 +02:00
|
|
|
|
DrawControls();
|
2017-10-05 11:37:50 +02:00
|
|
|
|
ApplyCfg();
|
|
|
|
|
|
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:
|
2017-10-05 11:37:50 +02:00
|
|
|
|
GetKeys();
|
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) ExitApp();
|
2015-07-29 17:37:34 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-04 16:36:07 +02:00
|
|
|
|
system.color.get();
|
2017-10-05 11:37:50 +02:00
|
|
|
|
DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
|
2015-07-29 17:37:34 +02:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
if (Form.status_window>2) break;
|
2015-08-02 01:21:13 +02:00
|
|
|
|
SetFrameColors();
|
|
|
|
|
DefineButton(mouse_frame.start_x+2, mouse_frame.start_y+2, mouse_frame.size_x-4,
|
|
|
|
|
mouse_frame.size_y-4, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
|
|
|
|
|
frame_draw stdcall (#mouse_frame);
|
2015-10-21 14:54:28 +02:00
|
|
|
|
WriteText(pos_x + 110, mouse_frame.start_y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
|
|
|
|
|
WriteText(pos_x + 110, mouse_frame.start_y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
|
2015-08-02 01:21:13 +02:00
|
|
|
|
DrawMouseImage();
|
|
|
|
|
DrawControls();
|
2015-07-29 17:37:34 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-07-30 16:54:30 +02:00
|
|
|
|
void DrawMouseImage() {
|
2015-08-02 01:21:13 +02:00
|
|
|
|
_PutImage(mouse_frame.start_x+30, mouse_frame.start_y + 15, panels_img.w, panels_img.h,
|
|
|
|
|
mouse_cfg.button_clicked * panels_img.w * panels_img.h * 3 + panels_img.data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DrawControls() {
|
2016-02-09 02:43:58 +01:00
|
|
|
|
MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
|
2016-02-11 14:46:53 +01:00
|
|
|
|
MoreLessBox(pos_x, mouse_frame.start_y + 172, 122, 123, mouse_cfg.acceleration, ACCELERATION_TEXT);
|
|
|
|
|
MoreLessBox(pos_x, mouse_frame.start_y + 202, 124, 125, mouse_cfg.double_click_delay, DOUBLE_CLICK_TEXT);
|
|
|
|
|
CheckBox(pos_x, mouse_frame.start_y + 236, 100, MOUSE_EMULATION, mouse_cfg.emulation);
|
|
|
|
|
CheckBox(pos_x, mouse_frame.start_y + 262, 101, MADMOUSE, mouse_cfg.madmouse);
|
2015-08-02 01:21:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetFrameColors() {
|
|
|
|
|
mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth;
|
2015-08-04 16:36:07 +02:00
|
|
|
|
mouse_frame.font_color = system.color.work_text;
|
|
|
|
|
mouse_frame.font_backgr_color = system.color.work;
|
|
|
|
|
mouse_frame.ext_col = system.color.work_graph;
|
2015-07-30 16:54:30 +02:00
|
|
|
|
}
|
2015-07-29 17:37:34 +02:00
|
|
|
|
|
|
|
|
|
void LoadCfg() {
|
2017-10-05 11:37:50 +02:00
|
|
|
|
mouse_cfg.acceleration = ini.GetInt("acceleration", GetMouseAcceleration());
|
|
|
|
|
mouse_cfg.pointer_speed = ini.GetInt("speed", GetMouseSpeed());
|
|
|
|
|
mouse_cfg.double_click_delay = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
|
2015-07-30 16:54:30 +02:00
|
|
|
|
mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
|
|
|
|
|
mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
|
2015-07-29 17:37:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-21 14:54:28 +02:00
|
|
|
|
void ExitApp() {
|
2017-10-05 11:37:50 +02:00
|
|
|
|
ini.SetInt("acceleration", mouse_cfg.acceleration);
|
|
|
|
|
ini.SetInt("speed", mouse_cfg.pointer_speed);
|
|
|
|
|
ini.SetInt("double_click_delay", mouse_cfg.double_click_delay);
|
2015-10-21 14:54:28 +02:00
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
void ApplyCfg() {
|
|
|
|
|
SetMouseSpeed(mouse_cfg.pointer_speed);
|
|
|
|
|
SetMouseAcceleration(mouse_cfg.acceleration);
|
|
|
|
|
SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
|
|
|
|
|
}
|
2015-07-30 16:54:30 +02:00
|
|
|
|
|
2015-07-29 17:37:34 +02:00
|
|
|
|
stop:
|