From e35a30e7cddad2d418d900b635c840a86b46d586 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 2 Nov 2016 12:19:15 +0000 Subject: [PATCH] CMM: create pattern select_list (Yeah!), use in clipview, appearance; Blueberries skin small fixes git-svn-id: svn://kolibrios.org@6651 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/appearance/appearance.c | 135 ++++++++++------------- programs/cmm/clipview/clipview.c | 136 +++++++++--------------- programs/cmm/drvinst/drvinst.c | 45 ++++++-- programs/cmm/lib/gui.h | 3 +- programs/cmm/lib/kolibri.h | 2 +- programs/cmm/lib/patterns/select_list.h | 54 ++++++++++ skins/Leency/Blueberries/default.asm | 2 +- skins/Leency/Blueberries/right1.bmp | Bin 4566 -> 4566 bytes skins/Leency/Blueberries/right2.bmp | Bin 4566 -> 4566 bytes 9 files changed, 200 insertions(+), 177 deletions(-) create mode 100644 programs/cmm/lib/patterns/select_list.h diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 784e3bd00c..df7249b611 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -13,6 +13,7 @@ #include "..\lib\menu.h" #include "..\lib\gui.h" #include "..\lib\obj\box_lib.h" +#include "..\lib\patterns\select_list.h" //===================================================// @@ -36,7 +37,6 @@ #define SKINS_STANDART_PATH "/kolibrios/res/skins" #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" -llist list; signed int active_skin=-1, active_wallpaper=-1; enum { SKINS=2, WALLPAPERS }; @@ -49,9 +49,6 @@ int cur; proc_info Form; -scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; - - //===================================================// // // // CODE // @@ -71,25 +68,25 @@ void main() if (!CheckActiveProcess(Form.ID)) break; mouse.get(); scrollbar_v_mouse (#scroll1); - if (list.first != scroll1.position) + if (select_list.first != scroll1.position) { - list.first = scroll1.position; - Draw_List(); + select_list.first = scroll1.position; + DrawSelectList(select_list.count); break; } - if (mouse.vert) && (list.MouseScroll(mouse.vert)) Draw_List(); + if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(select_list.count); if (mouse.up)&&(mouse_clicked) { - if (mouse.lkm) && (list.ProcessMouse(mouse.x, mouse.y)) EventApply(); + if (mouse.lkm) && (select_list.ProcessMouse(mouse.x, mouse.y)) EventApply(); mouse_clicked=false; } - else if (mouse.down)&&(mouse.lkm) && (list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true; + else if (mouse.down)&&(mouse.lkm) && (select_list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true; if (mouse.down)&&(mouse.pkm) { - list.ProcessMouse(mouse.x, mouse.y); - Draw_List(); + select_list.ProcessMouse(mouse.x, mouse.y); + DrawSelectList(select_list.count); menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 136, "Open file Enter\nDelete Del", 10); } @@ -105,17 +102,17 @@ void main() case evKey: GetKeys(); - if (list.ProcessKey(key_scancode)) EventApply(); + if (select_list.ProcessKey(key_scancode)) EventApply(); if (key_scancode==SCAN_CODE_ENTER) EventOpenFile(); if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS); if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); - for (id=list.cur_y+1; id list.visible) list_last = list.visible; else list_last = list.count; - - for (i=0; (ilist.visible) list.first=list.cur_y; list.CheckDoesValuesOkey(); - if (list.w) DrawWindowContent(); + if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); + if (select_list.w) DrawWindowContent(); } void EventDeleteFile() @@ -261,16 +234,16 @@ void EventApply() { if (tabs.active_tab==SKINS) { - cur = list.cur_y; + cur = select_list.cur_y; sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); SetSystemSkin(#cur_file_path); } if (tabs.active_tab==WALLPAPERS) { - cur = list.cur_y; + cur = select_list.cur_y; sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur])); RunProgram("/sys/media/kiv", #cur_file_path); - Draw_List(); + DrawSelectList(select_list.count); } } diff --git a/programs/cmm/clipview/clipview.c b/programs/cmm/clipview/clipview.c index 77144c516b..78ad24d001 100644 --- a/programs/cmm/clipview/clipview.c +++ b/programs/cmm/clipview/clipview.c @@ -10,6 +10,8 @@ #include "..\lib\gui.h" #include "..\lib\obj\box_lib.h" +#include "..\lib\patterns\select_list.h" + //===================================================// // // @@ -24,7 +26,6 @@ ?define T_COLUMNS_TITLE "# | Data size | Data type | Contents" ?define T_COLUMN_VIEW "View" ?define T_VIEW_OPTIONS "TEXT HEX" -?define T_CLIPBOARD_IS_EMPTY "Clipboard is empty" ?define DEFAULT_SAVE_PATH "/tmp0/1/clipview.tmp" char *data_type[] = { "Text", "Image", "RAW", "Unknown" }; @@ -34,19 +35,14 @@ enum { BT_UNLOCK }; - #define PANEL_TOP_H 20 #define PANEL_BOTTOM_H 30 #define LIST_PADDING 12 -llist list; - proc_info Form; Clipboard clipboard; -scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; - //===================================================// // // @@ -57,9 +53,6 @@ scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0 void main() { int id; - - list.SetFont(8, 14, 0x90); - list.no_selection = true; SetEventMask(0x27); load_dll(boxlib, #box_lib_init,0); loop() @@ -71,13 +64,13 @@ void main() if (!CheckActiveProcess(Form.ID)) break; mouse.get(); scrollbar_v_mouse (#scroll1); - if (list.first != scroll1.position) + if (select_list.first != scroll1.position) { - list.first = scroll1.position; - Draw_List(); + select_list.first = scroll1.position; + DrawSelectList(clipboard.GetSlotCount()); break; } - if (mouse.vert) && (list.MouseScroll(mouse.vert)) Draw_List(); + if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(clipboard.GetSlotCount()); break; @@ -93,7 +86,7 @@ void main() case evKey: GetKeys(); - if (list.ProcessKey(key_scancode)) Draw_List(); + if (select_list.ProcessKey(key_scancode)) DrawSelectList(clipboard.GetSlotCount()); break; case evReDraw: @@ -103,14 +96,19 @@ void main() IF (Form.status_window>=2) break; if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; } if (Form.width < 570) { MoveSize(OLD,OLD,570,OLD); break; } - list.SetSizes(LIST_PADDING, LIST_PADDING+PANEL_TOP_H, Form.cwidth-LIST_PADDING-LIST_PADDING-scroll1.size_x, - Form.cheight-PANEL_BOTTOM_H-PANEL_TOP_H-LIST_PADDING-LIST_PADDING, 20); + InitSelectList( + LIST_PADDING, + LIST_PADDING+PANEL_TOP_H, + Form.cwidth-LIST_PADDING-LIST_PADDING-scroll1.size_x, + Form.cheight-PANEL_BOTTOM_H-PANEL_TOP_H-LIST_PADDING-LIST_PADDING, + true + ); DrawWindowContent(); - Draw_List(); + DrawSelectList(clipboard.GetSlotCount()); break; default: - if (clipboard.GetSlotCount() > list.count) Draw_List(); + if (clipboard.GetSlotCount() > select_list.count) DrawSelectList(clipboard.GetSlotCount()); break; } } @@ -118,37 +116,47 @@ void main() void DrawWindowContent() { - int button_x = list.x; + int button_x = select_list.x; DrawBar(0,0, Form.cwidth, PANEL_TOP_H, system.color.work); DrawBar(0,Form.cheight-PANEL_BOTTOM_H, Form.cwidth, PANEL_BOTTOM_H, system.color.work); - DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light); - DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work); - button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_LAST_SLOT, T_DELETE_LAST_SLOT); - button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_DELETE_ALL_SLOTS, T_DELETE_ALL_SLOTS); - button_x += DrawStandartCaptButton(button_x, list.y + list.h + 8, BT_UNLOCK, T_RESET_BUFFER_LOCK); - DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph); - WriteText(list.x+12, list.y - 23, list.font_type, system.color.work_text, T_COLUMNS_TITLE); - WriteText(list.x+list.w-68, list.y - 23, list.font_type, system.color.work_text, T_COLUMN_VIEW); + DrawRectangle3D(select_list.x-2, select_list.y-2, select_list.w+3+scroll1.size_x, select_list.h+3, system.color.work_dark, system.color.work_light); + DrawWideRectangle(select_list.x-LIST_PADDING, select_list.y-LIST_PADDING, LIST_PADDING*2+select_list.w+scroll1.size_x, LIST_PADDING*2+select_list.h, LIST_PADDING-2, system.color.work); + button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_DELETE_LAST_SLOT, T_DELETE_LAST_SLOT); + button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_DELETE_ALL_SLOTS, T_DELETE_ALL_SLOTS); + button_x += DrawStandartCaptButton(button_x, select_list.y + select_list.h + 8, BT_UNLOCK, T_RESET_BUFFER_LOCK); + DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, system.color.work_graph); + WriteText(select_list.x+12, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMNS_TITLE); + WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW); } -void DrawScroller() +void DrawSelectList_Line(dword i) { - scroll1.bckg_col = MixColors(system.color.work, 0xBBBbbb, 80); - scroll1.frnt_col = MixColors(system.color.work,0xFFFfff,120); - scroll1.line_col = system.color.work_graph; + int yyy, length, slot_data_type_number; + dword line_text[2048]; + dword size_kb; + dword text_color = 0; - scroll1.max_area = list.count; - scroll1.cur_area = list.visible; - scroll1.position = list.first; + clipboard.GetSlotData(select_list.first + i); + yyy = i*select_list.item_h+select_list.y; + WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i)); + //WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, itoa(clipboard.slot_data.size)); + size_kb = ConvertSizeToKb(clipboard.slot_data.size); + WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb); + slot_data_type_number = clipboard.slot_data.type; + WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]); + WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS); + DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL); + DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL); - scroll1.all_redraw=1; - scroll1.start_x = list.x + list.w; - scroll1.start_y = list.y-1; - scroll1.size_y = list.h+2; - - scrollbar_v_draw(#scroll1); + length = select_list.w-236 - 95 / select_list.font_w - 2; + if (clipboard.slot_data.size-8 < length) length = clipboard.slot_data.size-8; + memmov(#line_text, clipboard.slot_data.content, length); + replace_char(#line_text, 0, 31, length); // 31 is a dot + WriteText(select_list.x+236, yyy+select_list.text_y, select_list.font_type, text_color, #line_text); } + + replace_char(dword in_str, char from_char, to_char, int length) { int i; for (i=0; i list.visible) list_last = list.visible; else list_last = list.count; - - for (i=0; i select_list.visible) list_last = select_list.visible; else list_last = select_list.count; + + for (i=0; i;pO=dbNTsibv$vb0hqK-68Pg{BcTVW*nEa4caq@Ela>2> zTRU4CJe+KS>ioT2!CL%0U4U9VUF>&m-!^mF!*MRVGhh zEmEG`-(6i^>fvMyRO9dE3Rdpt=>k;l=jnQI|Gt^iCQqKoraL)^O_A;J!TmF)^nm;kY=Iod5AUBnW5S%7lOM1-Pp)E@Vh;3n+dQ4!o(lkMIZ9Um diff --git a/skins/Leency/Blueberries/right2.bmp b/skins/Leency/Blueberries/right2.bmp index 7ed4e1b2537dfa7ab10af6556493c4b21a5bf236..fa7da9ec0a390652106c3c6c948b037a69e8d616 100644 GIT binary patch delta 141 zcmcbnd`)@73uZPq2Wudj{Em6P0)*-9?&$03Y;9r8z~JNI>vy7yHTbY&)5K+#Dz0hR~a*v)gk40Mv&ryZ`_I delta 143 zcmcbnd`)@73uZP?S9^D7+sW^k=PP))*a3Oo?vB2m&ej&j3=BRVPF`*fK