forked from KolibriOS/kolibrios
Mouse_cfg v1.0: Mouse configuration tool
Fix panels_cfg git-svn-id: svn://kolibrios.org@5630 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
21df034c87
commit
00fcd51abd
@ -816,7 +816,7 @@ inline fastcall void DeleteButton( EDX)
|
|||||||
{
|
{
|
||||||
EAX = 8;
|
EAX = 8;
|
||||||
EDX += BT_DEL;
|
EDX += BT_DEL;
|
||||||
$int 0x40;
|
$int 0x40
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fastcall dword GetStartTime()
|
inline fastcall dword GetStartTime()
|
||||||
|
28
programs/cmm/mouse_cfg/kos_mouse_functions.h
Normal file
28
programs/cmm/mouse_cfg/kos_mouse_functions.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
inline fastcall int GetMouseSpeed() {
|
||||||
|
$mov eax,18
|
||||||
|
$mov ebx,19
|
||||||
|
$mov ecx,0
|
||||||
|
$int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fastcall void SetMouseSpeed(EDX) {
|
||||||
|
$mov eax,18
|
||||||
|
$mov ebx,19
|
||||||
|
$mov ecx,1
|
||||||
|
$int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fastcall int GetMouseDelay() {
|
||||||
|
$mov eax,18
|
||||||
|
$mov ebx,19
|
||||||
|
$mov ecx,2
|
||||||
|
$int 0x40
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fastcall void SetMouseDelay(EDX) {
|
||||||
|
$mov eax,18
|
||||||
|
$mov ebx,19
|
||||||
|
$mov ecx,3
|
||||||
|
$int 0x40
|
||||||
|
}
|
@ -13,63 +13,116 @@
|
|||||||
#include "..\lib\obj\box_lib.h"
|
#include "..\lib\obj\box_lib.h"
|
||||||
#include "..\lib\patterns\restart_process.h"
|
#include "..\lib\patterns\restart_process.h"
|
||||||
|
|
||||||
?define WINDOW_TITLE "Mouse configuration"
|
#include "kos_mouse_functions.h"
|
||||||
?define MOUSE_FRAME_T " Mouse "
|
|
||||||
?define KEYBOARD_FRAME_T " Keyboard "
|
|
||||||
?define CHECK_MOUSE "Click to check mouse"
|
|
||||||
?define POINTER_SPEED "Mouse pointer speed"
|
|
||||||
?define POINTER_DELAY "Mouse pointer delay"
|
|
||||||
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
|
|
||||||
?define MADMOUSE "When cursor reaches screen side switch it to inverce side"
|
|
||||||
|
|
||||||
frame mouse_frame = { 0, 000, 10, 160, 14, 0x000111, 0xFFFfff, 1, MOUSE_FRAME_T, 0, 0, 6, 0x000111, 0xCCCccc };
|
#ifdef LANG_RUS
|
||||||
frame keyboard_frame = { 0, 000, 10, 73, 217, 0x000111, 0xFFFfff, 1, KEYBOARD_FRAME_T, 0, 0, 6, 0x000111, 0xCCCccc };
|
?define WINDOW_TITLE "<EFBFBD>஢¥àª ¨ áâனª ¯ à ¬¥â஢ ¬ëè¨"
|
||||||
|
?define CHECK_MOUSE_1 "<EFBFBD> ¦¬¨â¥ í⮩ ®¡« áâ¨"
|
||||||
|
?define CHECK_MOUSE_2 "¤«ï ¯à®¢¥àª¨ ª®¯®ª ¬ëè¨"
|
||||||
|
?define POINTER_SPEED "‘ª®à®áâì 㪠§ â¥«ï ¬ëè¨"
|
||||||
|
?define POINTER_DELAY "‡ ¤¥à¦ª 㪠§ â¥«ï ¬ëè¨"
|
||||||
|
?define MOUSE_EMULATION "<EFBFBD>¬ã«ïæ¨ï ã¯à ¢«¥¨ï 㪠§ ⥫¥¬ ç¥à¥§ ª« ¢¨ âãàã"
|
||||||
|
?define MADMOUSE "‘ªà®§ë¥ ¤«ï ªãàá®à áâ®à®ë íªà "
|
||||||
|
//?define MADMOUSE_DESCRIPTION "'When cursor reaches screen side switch it to inverce side' -I"
|
||||||
|
#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"
|
||||||
|
?define POINTER_SPEED "Mouse pointer speed"
|
||||||
|
?define POINTER_DELAY "Mouse pointer delay"
|
||||||
|
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
|
||||||
|
?define MADMOUSE "Through screen sides for pointer"
|
||||||
|
//?define MADMOUSE_DESCRIPTION "'When cursor reaches screen side switch it to inverce side' -I"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc };
|
||||||
|
|
||||||
|
|
||||||
unsigned char panels_img_data[] = FROM "panels_image.raw";
|
unsigned char panels_img_data[] = FROM "mouse_image.raw";
|
||||||
raw_image panels_img = { 37, 27, #panels_img_data };
|
raw_image panels_img = { 59, 101, #panels_img_data };
|
||||||
|
|
||||||
system_colors sc;
|
system_colors sc;
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
|
|
||||||
struct mouse_cfg1 {
|
struct mouse_cfg1 {
|
||||||
byte pointer_speed, pointer_delay, emulation, madmouse;
|
char pointer_speed,
|
||||||
|
pointer_delay,
|
||||||
|
emulation,
|
||||||
|
madmouse,
|
||||||
|
button_clicked;
|
||||||
} mouse_cfg;
|
} mouse_cfg;
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
dword id;
|
char id, old_button_clicked;
|
||||||
|
mouse m;
|
||||||
|
|
||||||
mem_Init();
|
mem_Init();
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
|
|
||||||
LoadCfg();
|
LoadCfg();
|
||||||
|
|
||||||
|
SetEventMask(0x27);
|
||||||
loop() switch(WaitEvent())
|
loop() switch(WaitEvent())
|
||||||
{
|
{
|
||||||
|
case evMouse:
|
||||||
|
m.get();
|
||||||
|
if (m.y <= mouse_frame.start_y) || (m.y >= mouse_frame.start_y + mouse_frame.size_y)
|
||||||
|
|| (m.x >= mouse_frame.start_x + mouse_frame.size_x) || (m.x <= mouse_frame.start_x) break;
|
||||||
|
old_button_clicked = mouse_cfg.button_clicked;
|
||||||
|
if (m.lkm) mouse_cfg.button_clicked=1;
|
||||||
|
else if (m.pkm) mouse_cfg.button_clicked=2;
|
||||||
|
else if (m.mkm) mouse_cfg.button_clicked=3;
|
||||||
|
else mouse_cfg.button_clicked=0;
|
||||||
|
if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage();
|
||||||
|
break;
|
||||||
|
|
||||||
case evButton:
|
case evButton:
|
||||||
id=GetButtonID();
|
id=GetButtonID();
|
||||||
if (id==1) ExitProcess();
|
if (id==1)
|
||||||
|
|
||||||
if (id>=100) && (id<200)
|
|
||||||
{
|
{
|
||||||
if (id==100) {
|
ExitProcess();
|
||||||
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
|
|
||||||
else RunProgram("/sys/mousemul", 0);
|
|
||||||
mouse_cfg.emulation ^= 1;
|
|
||||||
}
|
|
||||||
if (id==101) {
|
|
||||||
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
|
|
||||||
else RunProgram("/sys/madmouse", 0);
|
|
||||||
mouse_cfg.madmouse ^= 1;
|
|
||||||
}
|
|
||||||
if (id==120) mouse_cfg.pointer_speed++;
|
|
||||||
if (id==121) && (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--;
|
|
||||||
if (id==122) mouse_cfg.pointer_delay++;
|
|
||||||
if (id==123) && (mouse_cfg.pointer_delay>0) mouse_cfg.pointer_delay--;
|
|
||||||
DrawWindowContent();
|
|
||||||
}
|
}
|
||||||
|
if (id==99)
|
||||||
|
{
|
||||||
|
mouse_cfg.button_clicked=0;
|
||||||
|
DrawMouseImage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (id==100)
|
||||||
|
{
|
||||||
|
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
|
||||||
|
else RunProgram("/sys/mousemul", 0);
|
||||||
|
mouse_cfg.emulation ^= 1;
|
||||||
|
}
|
||||||
|
if (id==101)
|
||||||
|
{
|
||||||
|
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
|
||||||
|
else RunProgram("/sys/madmouse", 0);
|
||||||
|
mouse_cfg.madmouse ^= 1;
|
||||||
|
}
|
||||||
|
if (id==120)
|
||||||
|
{
|
||||||
|
mouse_cfg.pointer_speed++;
|
||||||
|
SetMouseSpeed(mouse_cfg.pointer_speed);
|
||||||
|
}
|
||||||
|
if (id==121) && (mouse_cfg.pointer_speed>0)
|
||||||
|
{
|
||||||
|
mouse_cfg.pointer_speed--;
|
||||||
|
SetMouseSpeed(mouse_cfg.pointer_speed);
|
||||||
|
}
|
||||||
|
if (id==122)
|
||||||
|
{
|
||||||
|
mouse_cfg.pointer_delay++;
|
||||||
|
SetMouseDelay(mouse_cfg.pointer_delay);
|
||||||
|
}
|
||||||
|
if (id==123) && (mouse_cfg.pointer_delay>0)
|
||||||
|
{
|
||||||
|
mouse_cfg.pointer_delay--;
|
||||||
|
SetMouseDelay(mouse_cfg.pointer_delay);
|
||||||
|
}
|
||||||
|
DrawWindowContent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
@ -78,13 +131,13 @@ void main() {
|
|||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
sc.get();
|
sc.get();
|
||||||
DefineAndDrawWindow(130, 150, 430, 200+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE);
|
DefineAndDrawWindow(430, 150, 360, 280+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window>2) break;
|
if (Form.status_window>2) break;
|
||||||
mouse_frame.size_x = keyboard_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth;
|
mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth;
|
||||||
mouse_frame.font_color = keyboard_frame.font_color = sc.work_text;
|
mouse_frame.font_color = sc.work_text;
|
||||||
mouse_frame.font_backgr_color = keyboard_frame.font_backgr_color = sc.work;
|
mouse_frame.font_backgr_color = sc.work;
|
||||||
mouse_frame.ext_col = keyboard_frame.ext_col = sc.work_graph;
|
mouse_frame.ext_col = sc.work_graph;
|
||||||
DrawWindowContent();
|
DrawWindowContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,17 +146,17 @@ void main() {
|
|||||||
void DrawWindowContent() {
|
void DrawWindowContent() {
|
||||||
char pos_x = 22;
|
char pos_x = 22;
|
||||||
|
|
||||||
|
DefineButton(mouse_frame.start_x, mouse_frame.start_y, mouse_frame.size_x, mouse_frame.size_y, 99+BT_NOFRAME, 0xF0F2F3); //needed to handle mouse_up and refresh mouse image
|
||||||
frame_draw stdcall (#mouse_frame);
|
frame_draw stdcall (#mouse_frame);
|
||||||
|
DrawMouseImage();
|
||||||
|
WriteTextB(pos_x + 110, mouse_frame.start_y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
|
||||||
|
WriteTextB(pos_x + 110, mouse_frame.start_y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
|
||||||
|
|
||||||
DefineButton(pos_x, mouse_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
|
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
|
||||||
_PutImage(pos_x, mouse_frame.start_y + 12, 37, 27, 0 * 37 * 27 * 3 + panels_img.data);
|
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.pointer_delay, POINTER_DELAY);
|
||||||
WriteText(pos_x + 46, mouse_frame.start_y + 20, 0x80, sc.work_text, CHECK_MOUSE);
|
|
||||||
|
|
||||||
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 50, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED);
|
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 202, 100, MOUSE_EMULATION, mouse_cfg.emulation);
|
||||||
PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 80, 122, 123, mouse_cfg.pointer_delay, POINTER_DELAY);
|
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 226, 101, MADMOUSE, mouse_cfg.madmouse);
|
||||||
|
|
||||||
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 108, 100, MOUSE_EMULATION, mouse_cfg.emulation);
|
|
||||||
PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 130, 101, MADMOUSE, mouse_cfg.madmouse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,14 +169,17 @@ void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text)
|
|||||||
MoreLessBox(x, y, 18, id_more, id_less, #sc, value, text);
|
MoreLessBox(x, y, 18, id_more, id_less, #sc, value, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawMouseImage() {
|
||||||
void LoadCfg() {
|
_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);
|
||||||
mouse_cfg.pointer_delay = 10;
|
|
||||||
mouse_cfg.pointer_speed = 2;
|
|
||||||
//CheckProcessExists("MADMOUSE");
|
|
||||||
mouse_cfg.madmouse = 0;
|
|
||||||
//CheckProcessExists("MOUSEMUL");
|
|
||||||
mouse_cfg.emulation = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadCfg() {
|
||||||
|
mouse_cfg.pointer_delay = GetMouseDelay();
|
||||||
|
mouse_cfg.pointer_speed = GetMouseSpeed();
|
||||||
|
mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
|
||||||
|
mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stop:
|
stop:
|
BIN
programs/cmm/mouse_cfg/mouse_image.png
Normal file
BIN
programs/cmm/mouse_cfg/mouse_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
1
programs/cmm/mouse_cfg/mouse_image.raw
Normal file
1
programs/cmm/mouse_cfg/mouse_image.raw
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 758 B |
Binary file not shown.
@ -93,7 +93,7 @@ void main()
|
|||||||
dword id, key;
|
dword id, key;
|
||||||
|
|
||||||
mem_Init();
|
mem_Init();
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(libini, #lib_init,1);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
|
|
||||||
LoadCfg();
|
LoadCfg();
|
||||||
|
Loading…
Reference in New Issue
Block a user