Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7645 → Rev 7646

/programs/cmm/mousecfg/mousecfg.c
1,4 → 1,4
// Mouse Configuration Utility ver 1.61
// Mouse Configuration Utility ver 1.62
 
#ifndef AUTOBUILD
#include "lang.h--"
25,6 → 25,9
?define DOUBLE_CLICK_TEXT "‡ ¤¥à¦ª  ¤¢®©­®£® ª«¨ª  ¬ëèìî"
?define MOUSE_EMULATION "“¯à ¢«¥­¨¥ 㪠§ â¥«¥¬ ¬ëè¨ ç¥à¥§ ª« ¢¨ âãàã"
?define MADMOUSE "‘ª¢®§­ë¥ ¤«ï ªãàá®à  áâ®à®­ë íªà ­ "
?define COMMOUSE "‡ £à㧨âì ¤à ©¢¥à ¬ëè¨ ¤«ï COM-¯®àâ  (F10)"
?define COMMOUSE_LOADED "'„à ©¢¥à ¤«ï COM ¬ëè¨ ¡ë« § £à㦥­' -O"
?define COMMOUSE_CAN_NOT_UNLOAD "'Žáâ ­®¢ª  ¤à ©¢¥à  ­¥¢®§¬®¦­ ' -W"
#else
?define WINDOW_TITLE "Mouse testing and configuration"
?define CHECK_MOUSE_1 "Click on this area to"
34,16 → 37,22
?define DOUBLE_CLICK_TEXT "Mouse double click delay"
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
?define MADMOUSE "Through screen sides for pointer"
?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"
#endif
 
:block mouse_frame = { 18, 18, NULL, 130 };
#define FRAME_X 18
#define FRAME_Y 18
:block mouse_frame = { FRAME_X, FRAME_Y, NULL, 130 };
: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 };
:checkbox com_mouse = { COMMOUSE, NULL };
 
_ini ini = { "/sys/settings/system.ini", "mouse" };
_ini ini = { "/sys/settings/system.ini", "loaded drivers" };
 
void main() {
proc_info Form;
70,33 → 79,37
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)) {
else IF (emulation.click(id)) {
IF (emulation.checked == true) RunProgram("/sys/mousemul", 0);
ELSE KillProcessByName("mousemul", SINGLE);
break;
}
ELSE IF (madmouse.click(id)) {
else IF (madmouse.click(id)) {
IF (madmouse.checked == true) RunProgram("/sys/madmouse", 0);
ELSE KillProcessByName("madmouse", SINGLE);
break;
}
else IF (id == com_mouse.id) {
EventClickComMouse();
}
break;
 
case evKey:
GetKeys();
IF (key_scancode == SCAN_CODE_ESC) ExitApp();
IF (key_scancode == SCAN_CODE_F10) EventClickComMouse();
break;
case evReDraw:
system.color.get();
DefineAndDrawWindow(430, 150, 424, 313+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
DefineAndDrawWindow(430, 150, 424, 343+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
mouse_frame.w = - mouse_frame.x * 2 + Form.cwidth;
DefineButton(mouse_frame.x, mouse_frame.y, mouse_frame.w,
mouse_frame.w = - FRAME_X * 2 + Form.cwidth;
DefineButton(FRAME_X, 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);
WriteText(FRAME_X + 110, FRAME_Y + 25, 0x90, 0x2C343C, CHECK_MOUSE_1);
WriteText(FRAME_X + 110, FRAME_Y + 45, 0x90, 0x2C343C, CHECK_MOUSE_2);
DrawMouseImage(0,0,0,0);
DrawControls();
}
132,26 → 145,26
 
void DrawControls() {
incn y;
y.n = mouse_frame.y+115;
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));
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));
}
 
void LoadCfg() {
acceleration.value = ini.GetInt("acceleration", GetMouseAcceleration());
pointer_speed.value = ini.GetInt("speed", GetMouseSpeed());
double_click_delay.value = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
acceleration.value = GetMouseAcceleration();
pointer_speed.value = GetMouseSpeed();
double_click_delay.value = GetMouseDoubleClickDelay();
com_mouse.checked = ini.GetInt("com_mouse", 0);
madmouse.checked = CheckProcessExists("MADMOUSE");
emulation.checked = CheckProcessExists("MOUSEMUL");
}
 
void ExitApp() {
ini.SetInt("acceleration", acceleration.value);
ini.SetInt("speed", pointer_speed.value);
ini.SetInt("double_click_delay", double_click_delay.value);
ini.SetInt("com_mouse", com_mouse.checked);
ExitProcess();
}
 
161,4 → 174,22
SetMouseDoubleClickDelay(double_click_delay.value);
}
 
void EventClickComMouse()
{
if (!com_mouse.checked)
{
if (RunProgram("/sys/loaddrv", "COMMOUSE")>=0) {
notify(COMMOUSE_LOADED);
com_mouse.click(com_mouse.id);
}
else {
notify("'Error running LOADDRV' -E");
}
}
else
{
notify(COMMOUSE_CAN_NOT_UNLOAD);
}
}
 
stop: