diff --git a/programs/cmm/mouse_cfg/mouse_cfg.c b/programs/cmm/mouse_cfg/mouse_cfg.c index fac4f7b314..53cc6b2e2d 100644 --- a/programs/cmm/mouse_cfg/mouse_cfg.c +++ b/programs/cmm/mouse_cfg/mouse_cfg.c @@ -1,3 +1,5 @@ +// Mouse Configuration Utility ver 1.3 + #ifndef AUTOBUILD #include "lang.h--" #endif @@ -9,6 +11,7 @@ #include "..\lib\gui.h" #include "..\lib\obj\libio_lib.h" #include "..\lib\obj\box_lib.h" +#include "..\lib\obj\libini.h" #include "..\lib\patterns\restart_process.h" #include "kos_mouse_functions.h" @@ -37,6 +40,8 @@ char pos_x = 22; unsigned char panels_img_data[] = FROM "mouse_image.raw"; raw_image panels_img = { 59, 101, #panels_img_data }; +char system_ini_path[] = "/sys/settings/system.ini"; +char mouse_category[] = "mouse"; proc_info Form; @@ -53,6 +58,7 @@ struct mouse_cfg1 { void main() { char id, old_button_clicked; + load_dll(libini, #lib_init,1); load_dll(boxlib, #box_lib_init,0); LoadCfg(); @@ -76,7 +82,7 @@ void main() { id=GetButtonID(); if (id==1) { - ExitProcess(); + ExitApp(); } if (id==99) { @@ -120,7 +126,7 @@ void main() { break; case evKey: - if (GetKey()==27) ExitProcess(); + if (GetKey()==27) ExitApp(); break; case evReDraw: @@ -132,8 +138,8 @@ void main() { 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); - 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); + 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); DrawMouseImage(); DrawControls(); } @@ -143,7 +149,6 @@ void PanelCfg_CheckBox(dword x, y, id, text, byte value) { CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value); } - void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) { MoreLessBox(x, y, 18, id_more, id_less, #system.color, value, text); } @@ -154,6 +159,7 @@ void DrawMouseImage() { } void DrawControls() { + DrawBar(pos_x, mouse_frame.start_y + 142, Form.cwidth - pos_x, 120, system.color.work); PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED); PanelCfg_MoreLessBox(pos_x, mouse_frame.start_y + 170, 122, 123, mouse_cfg.pointer_delay, POINTER_DELAY); PanelCfg_CheckBox(pos_x, mouse_frame.start_y + 202, 100, MOUSE_EMULATION, mouse_cfg.emulation); @@ -168,12 +174,18 @@ void SetFrameColors() { } void LoadCfg() { - mouse_cfg.pointer_delay = GetMouseDelay(); - mouse_cfg.pointer_speed = GetMouseSpeed(); + ini_get_int stdcall (#system_ini_path, #mouse_category, "delay", GetMouseDelay()); mouse_cfg.pointer_delay = EAX; + ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed()); mouse_cfg.pointer_speed = EAX; mouse_cfg.madmouse = CheckProcessExists("MADMOUSE"); mouse_cfg.emulation = CheckProcessExists("MOUSEMUL"); } +void ExitApp() { + ini_set_int stdcall (#system_ini_path, #mouse_category, "delay", mouse_cfg.pointer_delay); + ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed); + ExitProcess(); +} + stop: \ No newline at end of file