diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index d5abf2ab8c..90578dd7d7 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -48,9 +48,14 @@ int files_mas[400]; int cur; proc_info Form; +block skp; _tabs tabs = { LP, LP, NULL, NULL, SKINS }; +checkbox checkbox1 = { "Checkbox", true }; + +#define MENU_LIST "Open file Enter\nDelete Del" + //===================================================// // // // CODE // @@ -70,10 +75,10 @@ void main() if (!CheckActiveProcess(Form.ID)) break; SelectList_ProcessMouse(); - if (mouse.down)&&(mouse.pkm) { + if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) { select_list.ProcessMouse(mouse.x, mouse.y); SelectList_Draw(); - menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, "Open file Enter\nDelete Del", 10); + menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, MENU_LIST, 10); } break; @@ -82,6 +87,7 @@ void main() if (id==1) ExitProcess(); if (id==SKINS) EventTabClick(SKINS); if (id==WALLPAPERS) EventTabClick(WALLPAPERS); + checkbox1.click(id); break; case evKey: @@ -107,7 +113,7 @@ void main() case evReDraw: system.color.get(); - DefineAndDrawWindow(screen.width-400/2,80,400,404+skin_height,0x73,0xE4DFE1,WINDOW_HEADER,0); + DefineAndDrawWindow(screen.width-600/2,80,600,404+skin_height,0x73,0xE4DFE1,WINDOW_HEADER,0); GetProcessInfo(#Form, SelfInfo); IF (Form.status_window>=2) break; DrawWindowContent(); @@ -119,6 +125,7 @@ void main() } } + void DrawWindowContent() { int id; @@ -136,13 +143,31 @@ void DrawWindowContent() SelectList_Init( tabs.x+TAB_PADDING, tabs.y+TAB_HEIGHT+TAB_PADDING, - tabs.w - TAB_PADDING - TAB_PADDING - scroll1.size_x, + 250, tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, false ); select_list.cur_y = id; + + skp.set_size( + select_list.x + select_list.w + TAB_PADDING + scroll1.size_x, + select_list.y, + 250, + 250 + ); + SelectList_Draw(); SelectList_DrawBorder(); + + if (tabs.active_tab == SKINS) + { + DrawBar(skp.x, skp.y, skp.w, skp.h, system.color.work); + DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); + WriteText(skp.x+20, skp.y+30, 0x90, system.color.work_text, "Lorem ipsum"); + checkbox1.draw(skp.x+20, skp.y+70); + DrawStandartCaptButton(skp.x+20, skp.y+skp.h-40, GetFreeButtonId(), "Apply"); + DrawStandartCaptButton(skp.x+120, skp.y+skp.h-40, GetFreeButtonId(), "Close"); + } } diff --git a/programs/cmm/easyshot/easyshot.c b/programs/cmm/easyshot/easyshot.c index d80d726d9c..294ce563d4 100644 --- a/programs/cmm/easyshot/easyshot.c +++ b/programs/cmm/easyshot/easyshot.c @@ -13,7 +13,7 @@ /* === TRANSLATIONS === */ -#define T_WTITLE "EasyShot v0.75" +#define T_WTITLE "EasyShot v0.76" #ifdef LANG_RUS ?define T_TAKE_SCREENSHOT " Сделать скриншот" @@ -35,11 +35,15 @@ enum { #define PD 18 //padding -struct _settings { - bool minimise; - int delay; - char save_path[4096]; -} settings = { true, 1, "/tmp0/1" }; + +char save_path[4096] = "/tmp0/1"; +dword mouse_dd1; +edit_box edit_box_path = {270,10,70,0xffffff,0x94AECE,0xFFFfff,0xffffff, + 0x10000000,sizeof(save_path),#save_path,#mouse_dd1, 0b}; + +more_less_box delay = { 1, 0, 64, "Delay in seconds" }; +checkbox minimise = { "Minimize window", true }; + /* === CODE === */ @@ -52,10 +56,8 @@ void main() load_dll(boxlib, #box_lib_init,0); Libimg_LoadImage(#skin, "/sys/icons16.png"); - screenshot_length = screen.width * screen.height * 3; - - screenshot = malloc(screenshot_length); + screenshot = malloc(screenshot_length); loop() switch(WaitEvent()) { @@ -63,7 +65,7 @@ void main() id = GetButtonID(); if (id == CLOSE_BTN) ExitProcess(); if (id == BTN_MAKE_SCREENSHOT) EventTakeScreenshot(); - if (id == BTN_SETTINGS) EventShowSettings(); + if (id == BTN_SETTINGS) CreateThread(#SettingsWindow,#settings_stak+4092); break; case evKey: @@ -89,11 +91,11 @@ void DrawMainContent() } void EventTakeScreenshot() { - if (settings.minimise) MinimizeWindow(); - pause(settings.delay*100); + if (minimise.checked) MinimizeWindow(); + pause(delay.value*100); CopyScreen(screenshot, 0, 0, screen.width, screen.height); ActivateWindow(GetProcessSlot(Form.ID)); - if (!settings.minimise) DrawMainContent(); + if (!minimise.checked) DrawMainContent(); EventSaveImageFile(); } @@ -103,21 +105,11 @@ void EventSaveImageFile() char save_file_name[4096]; do { i++; - sprintf(#save_file_name, "%s/screen_%i.png", #settings.save_path, i); + sprintf(#save_file_name, "%s/screen_%i.png", #save_path, i); } while (file_exists(#save_file_name)); save_image(screenshot, screen.width, screen.height, #save_file_name); } -void EventShowSettings() -{ - CreateThread(#SettingsWindow,#settings_stak+4092); -} - -char path_tmp[4096]; -dword mouse_dd1; -edit_box edit_box_path = {270,10,70,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(path_tmp),#path_tmp,#mouse_dd1, 0b}; - -more_less_box delay = { 1, 0, 64, "Delay in seconds" }; void SettingsWindow() { @@ -136,26 +128,20 @@ void SettingsWindow() case evButton: id = GetButtonID(); - delay.click(id); if (CLOSE_BTN == id) ExitProcess(); - if (12 == id) { settings.minimise ^= 1; goto _DRAW_CONTENT; } + delay.click(id); + minimise.click(id); break; case evReDraw: DefineAndDrawWindow(Form.left+100, Form.top-40, 330, 170, 0x34, system.color.work, "Settings",0); _DRAW_CONTENT: - CheckBox(15, 10, 12, "Minimize window", settings.minimise); + minimise.draw(15, 10); delay.draw(15, 40); //DrawEditBox(#edit_box_path); } } -inline byte calc_rgb(dword B, item_h) -{ - return calc(ESBYTE[B+3] + ESBYTE[B] + ESBYTE[B-3] - + ESBYTE[B-item_h] + ESBYTE[B+item_h] / 5); -} - int DrawIconButton(dword x, y, id, text, icon) { int btwidth; diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index c314dbd5fc..9142d8f2e8 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -96,17 +96,8 @@ int j, i; int action_buf; int rand_n; -//struct t_settings { char sort_num=2; -bool show_dev_name=true, - real_files_names_case=true, - info_after_copy=false, - two_panels=false, - show_breadcrumb=false, - show_status_bar=true, - active_panel=1, - big_icons=false; -//} settings; +int active_panel=1; libimg_image icons16_default; libimg_image icons16_selected; @@ -310,7 +301,7 @@ void main() break; } - if (two_panels) && (mouse.y > files.y) && (mouse.down) { + if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) { if (mouse.x2) return; @@ -597,14 +588,14 @@ void DrawList() if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19"); DrawBar(files.x+files.w,files.y,1,files.h,col_graph); - if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph); + if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph); } void DrawStatusBar() { char status_bar_str[80]; int go_up_folder_exists=0; - if (!show_status_bar) return; + if (!show_status_bar.checked) return; if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; DrawBar(1, Form.cheight - status_bar_h-1, Form.cwidth-2, status_bar_h, system.color.work); sprintf(#status_bar_str, STATUS_STR, files.count-go_up_folder_exists, count_dir-go_up_folder_exists, files.count-count_dir, selected_count); @@ -614,7 +605,7 @@ void DrawStatusBar() void DrawFilePanels() { int files_y; - if (!two_panels) + if (!two_panels.checked) { DrawDeviceAndActionsLeftPanel(); files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h); @@ -801,7 +792,7 @@ void Open_Dir(dword dir_path, redraw){ } if (files.count!=-1) { - if(!_not_draw) if (show_breadcrumb) DrawBreadCrumbs(); else DrawPathBar(); + if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar(); history.add(#path); SystemDiscs.Draw(); files.visible = files.h / files.item_h; @@ -831,7 +822,7 @@ inline Sorting() } for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders { - if (!real_files_names_case) strttl(file_off+40); + if (!show_real_names.checked) strttl(file_off+40); if (TestBit(ESDWORD[file_off],4)) //directory? { file_mas[k]=j; @@ -893,7 +884,7 @@ void SelectFileByName(dword that_file) int ind; files.KeyHome(); Open_Dir(#path,ONLY_OPEN); - if (!real_files_names_case) strttl(that_file); + if (!show_real_names.checked) strttl(that_file); for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } files.cur_y = ind - 1; files.KeyDown(); @@ -1079,7 +1070,7 @@ void FnProcess(byte N) if (!itdir) RunProgram("/sys/develop/heed", #file_path); break; case 5: //refresh cur dir & devs - if (two_panels) + if (two_panels.checked) { DrawFilePanels(); } diff --git a/programs/cmm/eolite/include/about.h b/programs/cmm/eolite/include/about.h index 44957ab13b..5cd4522dab 100644 --- a/programs/cmm/eolite/include/about.h +++ b/programs/cmm/eolite/include/about.h @@ -4,7 +4,7 @@ void about_dialog() { - byte id; + int id; proc_info about_form; int about_x; diff --git a/programs/cmm/eolite/include/copy.h b/programs/cmm/eolite/include/copy.h index 476d62583f..8b452455b2 100644 --- a/programs/cmm/eolite/include/copy.h +++ b/programs/cmm/eolite/include/copy.h @@ -117,7 +117,7 @@ void PasteThread() path_offset += strlen(path_offset) + 1; } cut_active=false; - if (info_after_copy) notify(INFO_AFTER_COPY); + if (info_after_copy.checked) notify(INFO_AFTER_COPY); DialogExit(); } diff --git a/programs/cmm/eolite/include/icons.h b/programs/cmm/eolite/include/icons.h index 3eb4ad1440..1ac4b3dcda 100644 --- a/programs/cmm/eolite/include/icons.h +++ b/programs/cmm/eolite/include/icons.h @@ -9,7 +9,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) dword selected_image; dword default_image; - if (big_icons) { + if (big_icons.checked) { icons_ini.section = "icons32"; selected_image = icons32_selected.image; default_image = icons32_default.image; @@ -35,7 +35,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) if (fairing_color==col_selec) { img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size); - if (!big_icons) IconFairing(icon_n, xx, yy, fairing_color); + if (big_icons.checked==false) IconFairing(icon_n, xx, yy, fairing_color); } else { diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h index c90c9fec32..022e31a1e6 100644 --- a/programs/cmm/eolite/include/left_panel.h +++ b/programs/cmm/eolite/include/left_panel.h @@ -128,15 +128,15 @@ void _SystemDiscs::Draw() for (i=0; i<30; i++) DeleteButton(100+i); - if ( two_panels) { draw_y = 41; draw_x = 2; draw_h = 21; } - if (!two_panels) { draw_y = 74; draw_x = 17; draw_h = 16; } + if ( two_panels.checked) { draw_y = 41; draw_x = 2; draw_h = 21; } + if (!two_panels.checked) { draw_y = 74; draw_x = 17; draw_h = 16; } for (i=0;i attributes_frame.y + ch_read_only.draw(24, y.inc(18)); + ch_hidden.draw(24, y.inc(24)); + ch_system.draw(24, y.inc(24)); } void PropertiesDrawIcon(dword file_path, extension) @@ -382,12 +372,3 @@ void PropertiesDrawIcon(dword file_path, extension) DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff); DrawIconByExtension(file_path, extension, 20, 30, system.color.work_light); } - -void DrawPropertiesCheckBoxes() -{ - incn y; - y.n = 212; //212 => 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 2c16e13bb7..fe92905344 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -38,13 +38,20 @@ 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}; -more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL }; +more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL }; more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT }; +checkbox show_dev_name = { SHOW_DEVICE_CLASS }; +checkbox show_real_names = { SHOW_REAL_NAMES }; +checkbox show_status_bar = { SHOW_STATUS_BAR }; +checkbox info_after_copy = { NOTIFY_COPY_END }; +checkbox show_breadcrumb = { SHOW_BREADCRUMBS }; +checkbox big_icons = { BIG_ICONS }; +checkbox two_panels = { USE_TWO_PANELS }; void settings_dialog() { - byte id; + int id; active_settings=1; font_size.value = kfont.size.pt; line_height.value = files.item_h; @@ -58,7 +65,7 @@ void settings_dialog() case evButton: id=GetButtonID(); - if (id==1) { ExitSettings(); break; } + if (1==id) { ExitSettings(); break; } else if (id==5) { RunProgram("tinypad", "/sys/settings/assoc.ini"); @@ -78,40 +85,19 @@ void settings_dialog() ini.SetString("DefaultPath", #path_start,strlen(#path_start)); break; } - else if (id==20) show_dev_name ^= 1; - else if (id==21) { action_buf=109; real_files_names_case ^= 1; } - else if (id==22) info_after_copy ^= 1; - else if (id==24) two_panels ^= true; - else if (id==32) show_breadcrumb ^= true; - else if (id==27) show_status_bar ^= 1; - else if (font_size.click(id)) { + show_dev_name.click(id); + if (show_real_names.click(id)) action_buf=109; + info_after_copy.click(id); + two_panels.click(id); + show_breadcrumb.click(id); + show_status_bar.click(id); + if (font_size.click(id)) { kfont.size.pt = font_size.value; kfont.changeSIZE(); BigFontsChange(); } - else if (line_height.click(id)) { - files.item_h = line_height.value; - } - else if (id==33) { - big_icons ^= 1; - if (big_icons) { - icon_size=32; - files.item_h = line_height.value = 34; - if (!icons32_default.image) - { - Libimg_LoadImage(#icons32_default, "/sys/icons32.png"); - Libimg_LoadImage(#icons32_selected, "/sys/icons32.png"); - Libimg_ReplaceColor(icons32_default.image, icons32_selected.w, - icons32_selected.h, 0x00000000, 0xffFFFfff); - Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, - icons32_selected.h, 0x00000000, col_selec); - } - } - else { - icon_size=16; - files.item_h = line_height.value = 18; - } - } + if (line_height.click(id)) files.item_h = line_height.value; + if (big_icons.click(id)) BigIconsSwitch(); EventRedrawWindow(Form.left,Form.top); break; @@ -143,13 +129,13 @@ void DrawSettingsCheckBoxes() incn y; 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); - CheckBox(x, y.inc(25), 27, SHOW_STATUS_BAR, show_status_bar); - CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END, info_after_copy); - CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS, show_breadcrumb); - CheckBox(x, y.inc(25), 33, BIG_ICONS, big_icons); - CheckBox(x, y.inc(25), 24, USE_TWO_PANELS, two_panels); + show_dev_name.draw(x, y.inc(14)); + show_real_names.draw(x, y.inc(25)); + show_status_bar.draw(x, y.inc(25)); + info_after_copy.draw(x, y.inc(25)); + show_breadcrumb.draw(x, y.inc(25)); + big_icons.draw(x, y.inc(25)); + two_panels.draw(x, y.inc(25)); font_size.draw(x, y.inc(31)); line_height.draw(x, y.inc(31)); @@ -172,12 +158,12 @@ void LoadIniSettings() ini.section = "Config"; files.SetFont(6, 9, 10000000b); - real_files_names_case = ini.GetInt("RealFileNamesCase", 1); - show_dev_name = ini.GetInt("ShowDeviceName", 1); - show_status_bar = ini.GetInt("ShowStatusBar", 1); - info_after_copy = ini.GetInt("InfoAfterCopy", 0); + show_real_names.checked = ini.GetInt("RealFileNamesCase", true); + show_dev_name.checked = ini.GetInt("ShowDeviceName", true); + show_status_bar.checked = ini.GetInt("ShowStatusBar", true); + info_after_copy.checked = ini.GetInt("InfoAfterCopy", false); + two_panels.checked = ini.GetInt("TwoPanels", false); kfont.size.pt = ini.GetInt("FontSize", 13); - two_panels = ini.GetInt("TwoPanels", 0); files.item_h = ini.GetInt("LineHeight", 19); WinX = ini.GetInt("WinX", 200); WinY = ini.GetInt("WinY", 50); @@ -197,12 +183,12 @@ void LoadIniSettings() void SaveIniSettings() { - ini.SetInt("ShowDeviceName", show_dev_name); - ini.SetInt("ShowStatusBar", show_status_bar); - ini.SetInt("RealFileNamesCase", real_files_names_case); - ini.SetInt("InfoAfterCopy", info_after_copy); + ini.SetInt("ShowDeviceName", show_dev_name.checked); + ini.SetInt("ShowStatusBar", show_status_bar.checked); + ini.SetInt("RealFileNamesCase", show_real_names.checked); + ini.SetInt("InfoAfterCopy", info_after_copy.checked); ini.SetInt("FontSize", kfont.size.pt); - ini.SetInt("TwoPanels", two_panels); + ini.SetInt("TwoPanels", two_panels.checked); ini.SetInt("LineHeight", files.item_h); ini.SetInt("WinX", Form.left); ini.SetInt("WinY", Form.top); @@ -245,3 +231,25 @@ void BigFontsChange() if (files.item_h<18) files.item_h = 18; files_active.item_h = files_inactive.item_h = files.item_h; } + +void BigIconsSwitch() +{ + if (big_icons.checked) + { + icon_size=32; + files.item_h = line_height.value = 34; + if (!icons32_default.image) + { + Libimg_LoadImage(#icons32_default, "/sys/icons32.png"); + Libimg_LoadImage(#icons32_selected, "/sys/icons32.png"); + Libimg_ReplaceColor(icons32_default.image, icons32_selected.w, + icons32_selected.h, 0x00000000, 0xffFFFfff); + Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, + icons32_selected.h, 0x00000000, col_selec); + } + } + else { + icon_size=16; + files.item_h = line_height.value = 18; + } +} diff --git a/programs/cmm/examples/rgb.c b/programs/cmm/examples/rgb.c index b36f9010a4..502652c327 100644 --- a/programs/cmm/examples/rgb.c +++ b/programs/cmm/examples/rgb.c @@ -29,7 +29,7 @@ enum { ========================================================*/ void main() -byte id; +int id; { loop() switch(WaitEvent()) { diff --git a/programs/cmm/kf_font_viewer/font_viewer.c b/programs/cmm/kf_font_viewer/font_viewer.c index 043401e1a5..466986e654 100644 --- a/programs/cmm/kf_font_viewer/font_viewer.c +++ b/programs/cmm/kf_font_viewer/font_viewer.c @@ -9,14 +9,14 @@ proc_info Form; enum { - STRONG_BTN=10, SMOOTH_BTN, PHRASE_TAB=20, CHARS_TAB }; _tabs tabs = { 0,0, WIN_W, WIN_H, PHRASE_TAB}; block preview = { 0, PANELH, WIN_W, WIN_H - PANELH }; - +checkbox bold = { "Bold", false }; +checkbox smooth = { "Smooth", true }; void main() { @@ -31,8 +31,8 @@ void main() case evButton: btn = GetButtonID(); if (btn==1) ExitProcess(); - if (btn==STRONG_BTN) kfont.bold ^=1; - if (btn==SMOOTH_BTN) kfont.smooth ^=1; + if (bold.click(btn)) kfont.bold = bold.checked; + if (smooth.click(btn)) kfont.smooth = smooth.checked; if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn); goto _DRAW_WINDOW_CONTENT; case evReDraw: @@ -44,8 +44,8 @@ void main() DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work); DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph); - CheckBox(10, 8, STRONG_BTN, "Bold", kfont.bold); - CheckBox(83,8, SMOOTH_BTN, "Smooth", kfont.smooth); + bold.draw(10, 8); + smooth.draw(83,8); tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase"); tabs.draw_button(Form.cwidth-60, CHARS_TAB, "Chars"); diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index f6131bfccb..6681837551 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -21,7 +21,7 @@ #include "../lib/gui/more_less_box.h" #include "../lib/gui/checkbox.h" -int last_free_button_id = 1000; +:int last_free_button_id = 1000; :int GetFreeButtonId() { last_free_button_id++; diff --git a/programs/cmm/lib/gui/checkbox.h b/programs/cmm/lib/gui/checkbox.h index 26258172ef..fca19b145f 100644 --- a/programs/cmm/lib/gui/checkbox.h +++ b/programs/cmm/lib/gui/checkbox.h @@ -33,27 +33,57 @@ 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04 }; -:void CheckBox(dword x,y,bt_id, text, is_checked) +struct checkbox { - byte w=14, h=14; - DefineButton(x-1, y-1, strlen(text)*8 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0); + dword text; + bool checked; + bool disabled; + dword x,y, id; + bool click(); + void draw(); + void redraw(); +}; + +:bool checkbox::click(dword _id) +{ + if (disabled) return 0; + if (_id == id) { + checked^=1; + redraw(); + return 1; + } + return 0; +} + +:void checkbox::draw(dword _x,_y) +{ + #define SIZE 14 + if (!id) id = GetFreeButtonId(); + x=_x; y=_y; + + DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0); EDI = system.color.work; - WriteText(x+w+8, h / 2 + y -7, 0xD0, system.color.work_text, text); - DrawRectangle(x, y, w, h, system.color.work_graph); - if (is_checked == 0) + WriteText(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text); + DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph); + if (checked == 0) { - DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff); - DrawBar(x+2, y+2, w-3, h-3, 0xffffff); + DrawRectangle3D(x+1, y+1, SIZE-2, SIZE-2, 0xDDDddd, 0xffffff); + DrawBar(x+2, y+2, SIZE-3, SIZE-3, 0xffffff); } - else if (is_checked == 1) + else if (checked == 1) { - DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); + DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff); _PutImage(x+1, y+1, 13, 13, #checkbox_flag); } - else if (is_checked == 2) //not active + else if (checked == 2) //not active { - DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff); - DrawBar(x+3, y+3, w-5, h-5, 0x888888); + DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff); + DrawBar(x+3, y+3, SIZE-5, SIZE-5, 0x888888); } - DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light); + DrawRectangle3D(x-1,y-1,SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light); +} + +:void checkbox::redraw() +{ + draw(x,y); } diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index b83d25dbcf..70e87d6d25 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -613,14 +613,9 @@ inline fastcall dword GetStartTime() :dword X_EventRedrawWindow,Y_EventRedrawWindow; :void _EventRedrawWindow() { - loop()switch(WaitEvent()) - { - case evReDraw: - DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,0x34,0xFFFFFF,NULL,0); - pause(10); - ExitProcess(); - break; - } + DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0); + //pause(10); + ExitProcess(); } :char REDRAW_BUFF_EVENT_[4096]; :void EventRedrawWindow(dword x,y) diff --git a/programs/cmm/liza/login.c b/programs/cmm/liza/login.c index 675a16a7b7..e2db6705f4 100644 --- a/programs/cmm/liza/login.c +++ b/programs/cmm/liza/login.c @@ -206,13 +206,13 @@ void GetSettings() strcpy(#login, #email_text); ESBYTE[strchr(#login,'@')] = NULL; - if (checked[CUSTOM]) + if (automatic.checked) { strcpy(#POP_server_path, "pop."); strcat(#POP_server_path, strchr(#email_text,'@')+1); POP_server_port = DEFAULT_POP_PORT; } - if (checked[MANUAL]) + else { strcpy(#POP_server_path, #POP_server1); POP_server_port = atoi(#POP_server_port1); diff --git a/programs/cmm/liza/settings.c b/programs/cmm/liza/settings.c index ef0e6826c8..668e6d139a 100644 --- a/programs/cmm/liza/settings.c +++ b/programs/cmm/liza/settings.c @@ -1,9 +1,5 @@ //Leency & SoUrcerer, LGPL -#define CUSTOM 0 -#define MANUAL 1 -char checked[3] = { 1, 0 }; - char *text1[] = {"POP server adress:", "POP server port:", "SMTP server adress:", "SMTP server port:", '\0'}; dword mouse_opt; @@ -16,6 +12,7 @@ edit_box POP_server_port_box = {210,230,160,0xffffff,0x94AECE,0xffc90E,0xCACAC edit_box SMTP_server_box = {210,230,195,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server1),#SMTP_server1,#mouse_opt,100000000000b}; edit_box SMTP_server_port_box = {210,230,230,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,5,#SMTP_server_port1,#mouse_opt,100000000000b}; +checkbox automatic = { "Automatic configuration", true }; void SettingsDialog() { @@ -44,29 +41,27 @@ void SettingsDialog() id = GetButtonID(); if (id==1) SaveAndExit(); if (id==19) LoginBoxLoop(); - if (id==17) || (id==18) + if (automatic.click(id)) { - if (checked[id-17]==1) break; - checked[0]>=100) && (id<200) - { - if (id==100) tbAttachment ^= 1; - if (id==105) tbSoftenUp ^= 1; - if (id==106) tbSoftenDown ^= 1; - if (id==107) tbMinLeftButton ^= 1; - if (id==108) tbMinRightButton ^= 1; - if (id==109) tbRunApplButton ^= 1; - if (id==110) tbClnDeskButton ^= 1; - if (id==111) tbClock ^= 1; - if (id==112) tbCpuUsage ^= 1; - if (id==113) tbChangeLang ^= 1; - if (id==114) tbMenuButton ^= 1; - tbPanelHeight.click(id); - tbSoftenHeight.click(id); - tbButtonOffset.click(id); - DrawWindowContent(TASKBAR); - SaveCfg(TASKBAR); - RestartProcess(TASKBAR); + if (BTN_TB_ATTACHEMENT == id) { + tbAttachment ^= 1; + DrawWindowContent(); + SaveSettingsAndRestartProcess(TASKBAR); } - //docky buttons - if (id>=200) - { - if (id==200) - { - dkLocation++; - if (dkLocation>3) dkLocation=1; - } - if (id==201) dkFsize ^= 1; - if (id==202) dkAshow ^= 1; - DrawWindowContent(DOCKY); - SaveCfg(DOCKY); - RestartProcess(DOCKY); + + if (tbSoftenUp.click(id)) || (tbSoftenDown.click(id)) + || (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id)) + || (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) { + SaveSettingsAndRestartProcess(TASKBAR); } + + if (tbClock.click(id)) || (tbCpuUsage.click(id)) + || (tbChangeLang.click(id)) || (tbMenuButton.click(id)) + || (tbPanelHeight.click(id)) || (tbSoftenHeight.click(id)) + || (tbButtonOffset.click(id)) { + SaveSettingsAndRestartProcess(TASKBAR); + } + //docky buttons + if (id==200) { + dkLocation++; + if (dkLocation>3) dkLocation=1; + DrawWindowContent(); + SaveSettingsAndRestartProcess(DOCKY); + } + if (dkFsize.click(id)) SaveSettingsAndRestartProcess(DOCKY); + if (dkAshow.click(id)) SaveSettingsAndRestartProcess(DOCKY); break; case evKey: @@ -142,84 +143,79 @@ 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; - DrawWindowContent(ALL); + DrawWindowContent(); } } -void DrawWindowContent(byte panel_type) +void DrawWindowContent() { #define PD 10 dword frame_y; word win_center_x = Form.cwidth / 2 + 20; incn y; - if (panel_type==ALL) || (panel_type==TASKBAR) - { - 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); - CheckBox(22, y.inc(35), 105, SOFTEN_UP, tbSoftenUp); - CheckBox(win_center_x, y.n, 111, CLOCK, tbClock); - CheckBox(22, y.inc(24), 106, SOFTEN_DOWN, tbSoftenDown); - CheckBox(win_center_x, y.n, 112, CPU_USAGE, tbCpuUsage); - CheckBox(22, y.inc(24), 107, MIN_LEFT_BUTTON, tbMinLeftButton); - CheckBox(win_center_x, y.n, 113, CHANGE_LANG, tbChangeLang); - CheckBox(22, y.inc(24), 108, MIN_RIGHT_BUTTON, tbMinRightButton); - CheckBox(win_center_x, y.n, 114, MENU_BUTTON, tbMenuButton); - tbPanelHeight.draw(22, y.inc(28)); - tbSoftenHeight.draw(22, y.inc(32)); - tbButtonOffset.draw(22, y.inc(32)); - DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T); - } - if (panel_type==ALL) || (panel_type==DOCKY) - { - 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); - DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T); - } + 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); + tbSoftenUp.draw(22, y.inc(35)); + tbClock.draw(win_center_x, y.n); + tbSoftenDown.draw(22, y.inc(24)); + tbCpuUsage.draw(win_center_x, y.n); + tbMinLeftButton.draw(22, y.inc(24)); + tbChangeLang.draw(win_center_x, y.n); + tbMinRightButton.draw(22, y.inc(24)); + tbMenuButton.draw(win_center_x, y.n); + tbPanelHeight.draw(22, y.inc(28)); + tbSoftenHeight.draw(22, y.inc(32)); + tbButtonOffset.draw(22, y.inc(32)); + DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T); + //DOCKY + 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); + dkFsize.draw(22, y.inc(35)); + dkAshow.draw(win_center_x, y.n); + DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T); } void LoadCfg() { - tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1); - tbSoftenUp = taskbar_flags_ini.GetInt("SoftenUp", 1); - tbSoftenDown = taskbar_flags_ini.GetInt("SoftenDown", 1); - tbMinLeftButton = taskbar_flags_ini.GetInt("MinLeftButton", 1); - tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1); - tbClock = taskbar_flags_ini.GetInt("Clock", 1); - tbCpuUsage = taskbar_flags_ini.GetInt("CpuUsage", 1); - tbChangeLang = taskbar_flags_ini.GetInt("ChangeLang", 1); - tbMenuButton = taskbar_flags_ini.GetInt("MenuButton", 1); + tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1); + tbSoftenUp.checked = taskbar_flags_ini.GetInt("SoftenUp", 1); + tbSoftenDown.checked = taskbar_flags_ini.GetInt("SoftenDown", 1); + tbMinLeftButton.checked = taskbar_flags_ini.GetInt("MinLeftButton", 1); + tbMinRightButton.checked = taskbar_flags_ini.GetInt("MinRightButton", 1); + tbClock.checked = taskbar_flags_ini.GetInt("Clock", 1); + tbCpuUsage.checked = taskbar_flags_ini.GetInt("CpuUsage", 1); + tbChangeLang.checked = taskbar_flags_ini.GetInt("ChangeLang", 1); + tbMenuButton.checked = taskbar_flags_ini.GetInt("MenuButton", 1); tbPanelHeight.value = taskbar_vars_ini.GetInt("PanelHeight", 28); tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4); tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3); tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3); dkLocation = docky_ini.GetInt("location", 0); - dkFsize = docky_ini.GetInt("fsize", 0); - dkAshow = docky_ini.GetInt("ashow", 0); + dkFsize.checked = docky_ini.GetInt("fsize", 0); + dkAshow.checked = docky_ini.GetInt("ashow", 0); } -void SaveCfg(byte panel_type) +void SaveSettingsAndRestartProcess(byte panel_type) { if (panel_type==TASKBAR) { taskbar_flags_ini.SetInt("Attachment", tbAttachment); - taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp); - taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown); - taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton); - taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton); - taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton); - taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton); - taskbar_flags_ini.SetInt("Clock", tbClock); - taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage); - taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang); - taskbar_flags_ini.SetInt("MenuButton", tbMenuButton); + taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp.checked); + taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown.checked); + taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton.checked); + taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton.checked); + taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton.checked); + taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton.checked); + taskbar_flags_ini.SetInt("Clock", tbClock.checked); + taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage.checked); + taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang.checked); + taskbar_flags_ini.SetInt("MenuButton", tbMenuButton.checked); taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value); taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value); taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value); @@ -227,9 +223,10 @@ void SaveCfg(byte panel_type) } if (panel_type==DOCKY) { docky_ini.SetInt("location", dkLocation); - docky_ini.SetInt("fsize", dkFsize); - docky_ini.SetInt("ashow", dkAshow); + docky_ini.SetInt("fsize", dkFsize.checked); + docky_ini.SetInt("ashow", dkAshow.checked); } + RestartProcess(panel_type); } void RestartProcess(byte panel_type) diff --git a/programs/cmm/process/process.c b/programs/cmm/process/process.c index 3405e1c070..507c4e6aa2 100644 --- a/programs/cmm/process/process.c +++ b/programs/cmm/process/process.c @@ -36,10 +36,11 @@ enum { }; int current_process_id = 0; -int show_system; unsigned maxcpu; int proc_list[256]; +checkbox show_system = { T_SHOW_SYSTEM_PROCESSES, false }; + //===================================================// // // // CODE // @@ -55,7 +56,7 @@ void GetCpuFrequency() { void main() { - byte btn; + int btn; load_dll(boxlib, #box_lib_init,0); SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); GetCpuFrequency(); @@ -78,10 +79,8 @@ void main() { ExitProcess(); } - if (BTN_ID_SHOW_SYSTEM_PROCESSES == btn) - { - show_system ^= 1; - Draw_ShowSystemProcessesCheckbox(); + if (show_system.click(btn)) + { SelectList_LineChanged(); } if (BTN_ID_KILL_PROCESS == btn) @@ -114,7 +113,7 @@ void main() select_list.y+select_list.h+5, 110,25,BTN_ID_SHOW_PROCESS_INFO, system.color.work_button, system.color.work_button_text, T_DETAILS); - Draw_ShowSystemProcessesCheckbox(); + show_system.draw(select_list.x + 3, select_list.y+select_list.h+10); default: SelectList_LineChanged(); } @@ -138,7 +137,7 @@ void GetProcessList() if (Process.name) { for (j=0; j<11; j++) if (Process.name[j]!=' ') { - if (show_system==false) { + if (show_system.checked==false) { //do not show system process if (Process.name[0]=='@') break; if (!strcmp(#Process.name, "IDLE")) break; @@ -174,11 +173,6 @@ void SelectList_DrawLine(dword i) } -void Draw_ShowSystemProcessesCheckbox() { - CheckBox(select_list.x + 3, select_list.y+select_list.h+10, 20, - T_SHOW_SYSTEM_PROCESSES, show_system); -} - diff --git a/programs/cmm/taskbar2/taskbar2.c b/programs/cmm/taskbar2/taskbar2.c index 0c7d3a75cf..973d703da4 100644 --- a/programs/cmm/taskbar2/taskbar2.c +++ b/programs/cmm/taskbar2/taskbar2.c @@ -59,7 +59,7 @@ dword COLOR_TEXT = 0xFFFfff; void main() { - byte btn; + int btn; load_dll(libio, #libio_init,1); load_dll(libimg, #libimg_init,1); load_dll(libini, #lib_init,1);