From 1392a1c5198018c87d3b16b89c759c894d15793c Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 15 Apr 2018 22:44:36 +0000 Subject: [PATCH] CMM: general refactoring git-svn-id: svn://kolibrios.org@7227 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/aelia/aelia.c | 2 +- programs/cmm/app_installer/installer.c | 35 +------ programs/cmm/browser/WebView.c | 2 +- programs/cmm/browser/download_manager.h | 2 +- programs/cmm/clipview/clipview.c | 2 +- programs/cmm/diff/diff_gui.h | 2 +- programs/cmm/eolite/Eolite.c | 2 +- programs/cmm/eolite/include/breadcrumbs.h | 2 +- programs/cmm/eolite/include/properties.h | 43 ++------ programs/cmm/eolite/include/settings.h | 28 +++--- programs/cmm/iconedit/iconedit.c | 14 +-- programs/cmm/kf_font_viewer/font_viewer.c | 7 +- programs/cmm/lib/fs.h | 30 ++++-- programs/cmm/lib/gui.h | 22 +++++ programs/cmm/lib/gui/more_less_box.h | 6 +- programs/cmm/lib/kolibri.h | 14 --- programs/cmm/lib/list_box.h | 42 ++++---- programs/cmm/lib/obj/box_lib.h | 21 +++- programs/cmm/lib/obj/libimg.h | 2 +- programs/cmm/lib/window.h | 2 +- programs/cmm/liza/liza.c | 2 +- programs/cmm/liza/mail_box.c | 2 +- programs/cmm/mousecfg/mousecfg.c | 113 ++++++++++------------ programs/cmm/panels_cfg/panels_cfg.c | 24 ++--- programs/cmm/pipet/pipet.c | 2 +- programs/cmm/pixie/pixie.c | 2 +- programs/cmm/process/process.c | 2 +- programs/cmm/txtread/txtread.c | 2 +- 28 files changed, 194 insertions(+), 235 deletions(-) diff --git a/programs/cmm/aelia/aelia.c b/programs/cmm/aelia/aelia.c index 75c1e75758..4a404d494f 100644 --- a/programs/cmm/aelia/aelia.c +++ b/programs/cmm/aelia/aelia.c @@ -351,7 +351,7 @@ void EventRunEdit() } else { //io.write(strlen(io.buffer_data), io.buffer_data, DEFAULT_PREVIEW_PATH); // <--- doesn't work, smth odd, need to check - WriteFile(strlen(io.buffer_data), io.buffer_data, DEFAULT_PREVIEW_PATH); + CreateFile(strlen(io.buffer_data), io.buffer_data, DEFAULT_PREVIEW_PATH); io.run(DEFAULT_EDITOR, DEFAULT_PREVIEW_PATH); } } diff --git a/programs/cmm/app_installer/installer.c b/programs/cmm/app_installer/installer.c index 30f49c98f0..c1a1e5c1ba 100644 --- a/programs/cmm/app_installer/installer.c +++ b/programs/cmm/app_installer/installer.c @@ -17,10 +17,10 @@ char app_name[] = "KingsBounty"; void main() { -if (dir_exists("/kolibrios")==false) { - die( - "'/kolibrios/ folder is not mounted!\nPlease run APP+ on desktop.\nYou must use ISO distro.'E"); -} +if (dir_exists("/kolibrios")==false) +die("'/kolibrios/ folder is not mounted! +Please run APP+ on desktop. +You must use ISO distro.'E"); CreateDir("/tmp0/1/DOS"); CreateDir(sprintf(#param, "/tmp0/1/DOS/%s", #app_name)); @@ -29,32 +29,7 @@ if (EAX!=0) { die("'/tmp0/1/ is not mounted!\nPlease run TMPDISK to add it.'E"); } -WriteFile(sizeof(file0), #file0, makepath("/tmp0/1/DOS/", FILE_NAME_0)); -WriteFile(sizeof(file1), #file1, makepath("/tmp0/1/DOS/", FILE_NAME_1)); -#ifdef FILE_NAME_2 -WriteFile(sizeof(file2), #file2, makepath("/tmp0/1/DOS/", FILE_NAME_2)); -#endif -#ifdef FILE_NAME_3 -WriteFile(sizeof(file3), #file3, makepath("/tmp0/1/DOS/", FILE_NAME_3)); -#endif -#ifdef FILE_NAME_4 -WriteFile(sizeof(file4), #file4, makepath("/tmp0/1/DOS/", FILE_NAME_4)); -#endif -#ifdef FILE_NAME_5 -WriteFile(sizeof(file5), #file5, makepath("/tmp0/1/DOS/", FILE_NAME_5)); -#endif -#ifdef FILE_NAME_6 -WriteFile(sizeof(file6), #file6, makepath("/tmp0/1/DOS/", FILE_NAME_6)); -#endif -#ifdef FILE_NAME_7 -WriteFile(sizeof(file7), #file7, makepath("/tmp0/1/DOS/", FILE_NAME_7)); -#endif -#ifdef FILE_NAME_8 -WriteFile(sizeof(file8), #file8, makepath("/tmp0/1/DOS/", FILE_NAME_8)); -#endif -#ifdef FILE_NAME_9 -WriteFile(sizeof(file9), #file9, makepath("/tmp0/1/DOS/", FILE_NAME_9)); -#endif +CreateFile(sizeof(file0), #file0, makepath("/tmp0/1/DOS/", FILE_NAME_0)); notify(sprintf(#param, "'%s\nInstalled to /tmp0/1/DOS/\nEnjoy the game!'tO", #app_name)); RunProgram("/sys/@open", sprintf(#param, "/tmp0/1/DOS/%s/PLAY.sh", #app_name)); diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 010e1868f5..4336d58abe 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -357,7 +357,7 @@ void ProcessEvent(dword id__) case EDIT_SOURCE: if (!strncmp(#URL,"http:",5)) { - WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); + CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); } else RunProgram("/rd/1/tinypad", #URL); diff --git a/programs/cmm/browser/download_manager.h b/programs/cmm/browser/download_manager.h index 9907461e21..e49f31527b 100644 --- a/programs/cmm/browser/download_manager.h +++ b/programs/cmm/browser/download_manager.h @@ -99,7 +99,7 @@ void Downloader() for (i=0; i attributes_frame.y CheckBox(24, y.inc(18), 20, PR_T_ONLY_READ, atr_readonly); CheckBox(24, y.inc(24), 21, PR_T_HIDDEN, atr_hidden); CheckBox(24, y.inc(24), 22, PR_T_SYSTEM, atr_system); diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 6fdb35289a..5abb90a036 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -12,7 +12,7 @@ ?define SAVE_PATH_AS_DEFAULT "Текущий путь" ?define SAVE_START_PATH_AS_DEFAULT "Введенный путь" ?define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов" - ?define START_PATH "Стартовый путь:" + ?define START_PATH " Стартовый путь: " #else ?define TITLE_SETT "Settings" ?define SHOW_DEVICE_CLASS "Show device class name" @@ -26,14 +26,15 @@ ?define SAVE_PATH_AS_DEFAULT "Сurrent path" ?define SAVE_START_PATH_AS_DEFAULT "Typed path" ?define EDIT_FILE_ASSOCIATIONS "Edit file associations" - ?define START_PATH "Start path:" + ?define START_PATH " Start path: " #endif int WinX, WinY, WinW, WinH; dword set_mouse_dd; char path_start[4096]="\0"; -edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,#path_start,#set_mouse_dd, 100000000000010b,0,0}; +edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098, + #path_start,#set_mouse_dd, 100000000000010b,0,0}; void settings_dialog() { @@ -90,7 +91,8 @@ void settings_dialog() break; case evReDraw: - DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 376, 370+skin_height,0x34,system.color.work,TITLE_SETT,0); + DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 380, + 390+skin_height,0x34,system.color.work,TITLE_SETT,0); DrawSettingsCheckBoxes(); } } @@ -107,7 +109,7 @@ void ExitSettings() void DrawSettingsCheckBoxes() { incn y; - int x=11, but_x; + int x=11, frx=26, but_x; y.n = 0; CheckBox(x, y.inc(14), 20, SHOW_DEVICE_CLASS, show_dev_name); CheckBox(x, y.inc(25), 21, SHOW_REAL_NAMES, real_files_names_case); @@ -117,13 +119,17 @@ void DrawSettingsCheckBoxes() CheckBox(x, y.inc(25), 24, USE_TWO_PANELS, two_panels); MoreLessBox(x, y.inc(31), 30, 31, kfont.size.pt, FONT_SIZE_LABEL); MoreLessBox(x, y.inc(31), 25, 26, files.item_h, LIST_LINE_HEIGHT); - WriteText(6, y.inc(28), 0xD0, system.color.work_text, START_PATH); - path_start_ed.top = y.inc(23); - path_start_ed.left = x; + + DrawFrame(x, y.inc(37), 340, 95, START_PATH); + // START_PATH { + path_start_ed.top = y.inc(21); + path_start_ed.left = frx; DrawEditBox(#path_start_ed); - but_x = DrawStandartCaptButton(x-1, y.inc(34), 6, SAVE_PATH_AS_DEFAULT); - DrawStandartCaptButton(x-1+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT); - DrawStandartCaptButton(x-1, y.inc(38), 5, EDIT_FILE_ASSOCIATIONS); + but_x = DrawStandartCaptButton(frx, y.inc(34), 6, SAVE_PATH_AS_DEFAULT); + DrawStandartCaptButton(frx+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT); + // } START_PATH + + DrawStandartCaptButton(x, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS); } diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 954462446a..c6081f4dd6 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -39,18 +39,6 @@ pipet aside color view #define COLSIZE 18 #define RIGHT_BAR_W PAL_ITEMS_X_COUNT*COLSIZE -struct block { - int x,y,w,h; - bool hovered(); -}; - -bool block::hovered() { - if ((mouse.x>x) && (mouse.y>y) - && (mouse.yWriteFile"); + if (error = CreateFile(size, cbuf, copyTo)) debugln("Error: CopyFileAtOnce->CreateFile"); } free(cbuf); return error; @@ -364,20 +364,34 @@ int error; dword cbuf; int error=-1; dword offpos=0; -int block_size=1024*1024*4; //copy by 4 MiBs +int block_size=1024*1024*4; //copy by 4 MiB { + if (GetFreeRAM()>1024*78) { + //Set block size 32 MiB + block_size <<= 3; + } cbuf = malloc(block_size); - WriteFile(0, 0, copyTo); //create file + if (error = CreateFile(0, 0, copyTo)) + { + debugln("Error: CopyFileByBlocks->CreateFile"); + size = -1; + } while(offpos < size) { error = ReadFile(offpos, block_size, cbuf, copyFrom); if (error = 6) { //File ended before last byte was readed block_size = EBX; - error=0; + if (block_size+offpos>=size) error=0; } else - if (error!=0) break; - if (error = WriteFileWithOffset(offpos, block_size, cbuf, copyTo)) break; + if (error!=0) { + debugln("Error: CopyFileByBlocks->ReadFile"); + break; + } + if (error = WriteFile(offpos, block_size, cbuf, copyTo)) { + debugln("Error: CopyFileByBlocks->WriteFile"); + break; + } offpos += block_size; } free(cbuf); diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index 91836494b6..b6e809f06a 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -346,6 +346,28 @@ TODO: scroll return n; } +//block with hover +struct block { + int x,y,w,h; + bool hovered(); + void set_size(); +}; + +:bool block::hovered() { + if ((mouse.x>x) && (mouse.y>y) + && (mouse.yx) && (xxy) && (yy count) first = count - visible; if (first < 0) first = 0; @@ -239,7 +239,7 @@ void llist::CheckDoesValuesOkey() if (cur_x < 0) cur_x = 0; } -int llist::KeyRight() +:int llist::KeyRight() { if (cur_x < column_max) { @@ -253,7 +253,7 @@ int llist::KeyRight() return 1; } -int llist::KeyLeft() +:int llist::KeyLeft() { if (cur_x > 0) { @@ -268,7 +268,7 @@ int llist::KeyLeft() } -void llist_copy(dword dest, src) +:void llist_copy(dword dest, src) { EDI = dest; ESI = src; diff --git a/programs/cmm/lib/obj/box_lib.h b/programs/cmm/lib/obj/box_lib.h index 27f97a8a2f..fc1fbf4a6c 100644 --- a/programs/cmm/lib/obj/box_lib.h +++ b/programs/cmm/lib/obj/box_lib.h @@ -155,7 +155,7 @@ struct progress_bar struct frame { dword type; - word size_x; + word size_x; //start_x, size_x => Mario, WTF? Is this so complex to use x/y/w/h ? word start_x; word size_y; word start_y; @@ -168,6 +168,23 @@ struct frame dword font_size_y; dword font_color; dword font_backgr_color; -}; +}; + +:frame frame123 = { 0, 260, 10, 60, 16, NULL, 0xFFFfff, 1, NULL, 0, 1, 12, 0x000111, 0xCCCccc }; +:void DrawFrame(dword x,y,w,h,text) +{ + frame123.font_color = system.color.work_text; + frame123.ext_col = system.color.work_graph; + frame123.int_col = system.color.work_light; + frame123.font_backgr_color = system.color.work; + + frame123.start_x = x; + frame123.start_y = y; + frame123.size_x = w; + frame123.size_y = h; + frame123.text_pointer = text; + frame_draw stdcall (#frame123); +} + #endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/libimg.h b/programs/cmm/lib/obj/libimg.h index 48bb06fe2d..2fe46c5a3c 100644 --- a/programs/cmm/lib/obj/libimg.h +++ b/programs/cmm/lib/obj/libimg.h @@ -218,7 +218,7 @@ struct _Image notify("'Error saving file, incorrect data!' -E"); } else { - if (WriteFile(encoded_size, encoded_data, _path) == 0) { + if (CreateFile(encoded_size, encoded_data, _path) == 0) { sprintf(#save_success_message, "'File saved as %s' -O", _path); notify(#save_success_message); } diff --git a/programs/cmm/lib/window.h b/programs/cmm/lib/window.h index 3c7808a7f8..83d4d6ac11 100644 --- a/programs/cmm/lib/window.h +++ b/programs/cmm/lib/window.h @@ -13,7 +13,7 @@ proc_info Form; }; -void window::create() +:void window::create() { word id=0; IF(!caption)caption = "Window"; diff --git a/programs/cmm/liza/liza.c b/programs/cmm/liza/liza.c index 87176ccf79..ff9baf39b1 100644 --- a/programs/cmm/liza/liza.c +++ b/programs/cmm/liza/liza.c @@ -155,7 +155,7 @@ void SaveAndExit() { chrcat(#write_data, '\n'); base64_encode stdcall (#pass_text, #pass_b64, strlen(#pass_text)); strcat(#write_data, #pass_b64); - WriteFile(strlen(#write_data)+1, #write_data, "/sys/network/mail.dat"); + CreateFile(strlen(#write_data)+1, #write_data, "/sys/network/mail.dat"); ExitProcess(); } diff --git a/programs/cmm/liza/mail_box.c b/programs/cmm/liza/mail_box.c index ade4d8cd09..9900fa89c3 100644 --- a/programs/cmm/liza/mail_box.c +++ b/programs/cmm/liza/mail_box.c @@ -216,7 +216,7 @@ void MailBoxLoop() { if (id==SAVE_LETTER) { if (!mailstart) break; - WriteFile(strlen(mailstart), mailstart, "mail.txt"); + CreateFile(strlen(mailstart), mailstart, "mail.txt"); pause(10); RunProgram("tinypad", "mail.txt"); } diff --git a/programs/cmm/mousecfg/mousecfg.c b/programs/cmm/mousecfg/mousecfg.c index 7c518bd97b..f7b4802708 100644 --- a/programs/cmm/mousecfg/mousecfg.c +++ b/programs/cmm/mousecfg/mousecfg.c @@ -1,4 +1,4 @@ -// Mouse Configuration Utility ver 1.4 +// Mouse Configuration Utility ver 1.5 #ifndef AUTOBUILD #include "lang.h--" @@ -33,11 +33,16 @@ ?define DOUBLE_CLICK_TEXT "Mouse double click delay" ?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad" ?define MADMOUSE "Through screen sides for pointer" - #endif +#endif proc_info Form; -frame mouse_frame = { 0, 000, 14, 130, 14, 0x000111, 0xFFFfff, 0, 0, 0, 0, 6, 0x000111, 0xCCCccc }; -char pos_x = 22; + +#define PD 18 //padding +block mouse_frame = { PD, PD, NULL, 130 }; + +more_less_box pointer_speed = { PD, PD+142, NULL, 0, 64, 120, 121, POINTER_SPEED }; +more_less_box acceleration = { PD, PD+172, NULL, 0, 64, 122, 123, ACCELERATION_TEXT }; +more_less_box double_click_delay = { PD, PD+202, NULL, 0, 999,124, 125, DOUBLE_CLICK_TEXT, 8 }; unsigned char panels_img_data[] = FROM "mouse_image.raw"; raw_image panels_img = { 59, 101, #panels_img_data }; @@ -45,17 +50,14 @@ raw_image panels_img = { 59, 101, #panels_img_data }; _ini ini = { "/sys/settings/system.ini", "mouse" }; struct _mouse_cfg { - char pointer_speed, - acceleration, - emulation, - madmouse, - button_clicked; - word double_click_delay; + bool emulation; + bool madmouse; + int click_status; } mouse_cfg; void main() { - char id, old_button_clicked; + char id; load_dll(libini, #lib_init,1); load_dll(boxlib, #box_lib_init,0); @@ -68,46 +70,41 @@ void main() { { case evMouse: 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; - old_button_clicked = mouse_cfg.button_clicked; - 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; - else mouse_cfg.button_clicked=0; - if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage(); + if (mouse.down) && (mouse_cfg.click_status==0) && (mouse_frame.hovered()) { + if (mouse.key&MOUSE_LEFT) mouse_cfg.click_status = 1; + if (mouse.key&MOUSE_RIGHT) mouse_cfg.click_status = 2; + if (mouse.key&MOUSE_CENTER) mouse_cfg.click_status = 3; + DrawMouseImage(); + } + if (mouse.up) { + mouse_cfg.click_status=0; + DrawMouseImage(); + } break; case evButton: - id=GetButtonID(); + id = GetButtonID(); 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; + DrawControls(); break; case 101: if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE); else RunProgram("/sys/madmouse", 0); mouse_cfg.madmouse ^= 1; + DrawControls(); 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; + default: + if (pointer_speed.click(id)) ApplyCfg();; + if (acceleration.click(id)) ApplyCfg();; + if (double_click_delay.click(id)) ApplyCfg();; } - DrawControls(); - ApplyCfg(); - break; case evKey: @@ -120,12 +117,11 @@ void main() { DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; - 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); - 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); + mouse_frame.w = - mouse_frame.x * 2 + Form.cwidth; + DefineButton(mouse_frame.x, mouse_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); DrawMouseImage(); DrawControls(); } @@ -133,44 +129,37 @@ void main() { void DrawMouseImage() { - _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); + _PutImage(mouse_frame.x+30, mouse_frame.y + 15, panels_img.w, panels_img.h, + mouse_cfg.click_status * panels_img.w * panels_img.h * 3 + panels_img.data); } void DrawControls() { - MoreLessBox(pos_x, mouse_frame.start_y + 142, 120, 121, mouse_cfg.pointer_speed, POINTER_SPEED); - 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); -} - -void SetFrameColors() { - mouse_frame.size_x = - mouse_frame.start_x * 2 + Form.cwidth; - mouse_frame.font_color = system.color.work_text; - mouse_frame.font_backgr_color = system.color.work; - mouse_frame.ext_col = system.color.work_graph; + pointer_speed.draw(); + acceleration.draw(); + double_click_delay.draw(); + CheckBox(mouse_frame.x, mouse_frame.y + 236, 100, MOUSE_EMULATION, mouse_cfg.emulation); + CheckBox(mouse_frame.x, mouse_frame.y + 262, 101, MADMOUSE, mouse_cfg.madmouse); } void LoadCfg() { - 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()); + acceleration.value = ini.GetInt("acceleration", GetMouseAcceleration()); + pointer_speed.value = ini.GetInt("speed", GetMouseSpeed()); + double_click_delay.value = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay()); mouse_cfg.madmouse = CheckProcessExists("MADMOUSE"); mouse_cfg.emulation = CheckProcessExists("MOUSEMUL"); } void ExitApp() { - ini.SetInt("acceleration", mouse_cfg.acceleration); - ini.SetInt("speed", mouse_cfg.pointer_speed); - ini.SetInt("double_click_delay", mouse_cfg.double_click_delay); + ini.SetInt("acceleration", acceleration.value); + ini.SetInt("speed", pointer_speed.value); + ini.SetInt("double_click_delay", double_click_delay.value); ExitProcess(); } void ApplyCfg() { - SetMouseSpeed(mouse_cfg.pointer_speed); - SetMouseAcceleration(mouse_cfg.acceleration); - SetMouseDoubleClickDelay(mouse_cfg.double_click_delay); + SetMouseSpeed(pointer_speed.value); + SetMouseAcceleration(acceleration.value); + SetMouseDoubleClickDelay(double_click_delay.value); } stop: \ No newline at end of file diff --git a/programs/cmm/panels_cfg/panels_cfg.c b/programs/cmm/panels_cfg/panels_cfg.c index a495bbb0d4..ff3c544aeb 100644 --- a/programs/cmm/panels_cfg/panels_cfg.c +++ b/programs/cmm/panels_cfg/panels_cfg.c @@ -54,10 +54,6 @@ ?define CHANGE_POS "Click on image to change position" #endif - -frame taskbar_frame = { 0, NULL, 10, NULL, 16, NULL, 0xFFFfff, 1, TASK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc }; -frame docky_frame = { 0, NULL, 10, NULL, NULL, NULL, 0xFFFfff, 1, DOCK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc }; - char taskbar_ini_path[] = "/sys/settings/taskbar.ini"; _ini taskbar_flags_ini = { #taskbar_ini_path, "Flags" }; _ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" }; @@ -147,10 +143,6 @@ void main() DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0); GetProcessInfo(#Form, SelfInfo); if (Form.status_window>2) break; - taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth; - taskbar_frame.font_color = docky_frame.font_color = system.color.work_text; - taskbar_frame.font_backgr_color = docky_frame.font_backgr_color = system.color.work; - taskbar_frame.ext_col = docky_frame.ext_col = system.color.work_graph; DrawWindowContent(ALL); } } @@ -158,12 +150,15 @@ void main() void DrawWindowContent(byte panel_type) { + #define PD 10 + dword frame_y; word win_center_x = Form.cwidth / 2 + 20; incn y; if (panel_type==ALL) || (panel_type==TASKBAR) { - y.n = taskbar_frame.start_y; + frame_y = 15; + y.n = frame_y; DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0); _PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data); WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS); @@ -178,22 +173,17 @@ void DrawWindowContent(byte panel_type) MoreLessBox(22, y.inc(28), 120, 121, tbPanelHeight, PANEL_HEIGHT); MoreLessBox(22, y.inc(32), 122, 123, tbSoftenHeight, SOFTEN_HEIGHT); MoreLessBox(22, y.inc(32), 124, 125, tbButtonOffset, BUTTON_OFFSET); - taskbar_frame.size_y = y.inc(32) - taskbar_frame.start_y; + DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T); } if (panel_type==ALL) || (panel_type==DOCKY) { - docky_frame.start_y = y.inc(20); + frame_y = calc(y.inc(20)); DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0); _PutImage(22, y.n, 37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data); WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS); CheckBox(22, y.inc(35), 201, FSIZE, dkFsize); CheckBox(win_center_x, y.n, 202, ASHOW, dkAshow); - docky_frame.size_y = y.inc(30) - docky_frame.start_y; - } - if (panel_type==ALL) - { - frame_draw stdcall (#taskbar_frame); - frame_draw stdcall (#docky_frame); + DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T); } } diff --git a/programs/cmm/pipet/pipet.c b/programs/cmm/pipet/pipet.c index afa55e857c..448b864a8c 100644 --- a/programs/cmm/pipet/pipet.c +++ b/programs/cmm/pipet/pipet.c @@ -32,7 +32,7 @@ char picked_color_string[11]; void main() { int btn; - SetEventMask(000100111b); + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); SetWindowLayerBehaviour(-1, ZPOS_ALWAYS_TOP); loop() switch(WaitEvent()) { diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index 9e8ca3f9e7..e6b15aa56b 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -113,7 +113,7 @@ void main() LoadIniConfig(); CheckDefaultForTheFirstStart(); OpenFolder(#param); - SetEventMask(0100111b); + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); loop() { WaitEventTimeout(10); diff --git a/programs/cmm/process/process.c b/programs/cmm/process/process.c index 92f916289d..3405e1c070 100644 --- a/programs/cmm/process/process.c +++ b/programs/cmm/process/process.c @@ -57,7 +57,7 @@ void main() { byte btn; load_dll(boxlib, #box_lib_init,0); - SetEventMask(10000000000000000000000001100111b); + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); GetCpuFrequency(); loop() { diff --git a/programs/cmm/txtread/txtread.c b/programs/cmm/txtread/txtread.c index 600e0de964..0c54206597 100644 --- a/programs/cmm/txtread/txtread.c +++ b/programs/cmm/txtread/txtread.c @@ -82,7 +82,7 @@ void main() LoadIniSettings(); OpenFile(#param); list.no_selection = true; - SetEventMask(10000000000000000000000001100111b); + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); loop() { switch(WaitEvent())