From 7ce6f6bd287b82fdf538237ea5d764c636e82641 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 2 Nov 2016 14:30:45 +0000 Subject: [PATCH] select_list.h: update API, add SelectList_ProcessMouse() drvinst: use select_list git-svn-id: svn://kolibrios.org@6653 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/appearance/appearance.c | 41 +++---- programs/cmm/clipview/clipview.c | 43 +++---- programs/cmm/drvinst/drvinst.c | 143 ++++++++++++++++++++---- programs/cmm/lib/patterns/select_list.h | 37 ++++-- 4 files changed, 191 insertions(+), 73 deletions(-) diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index df7249b611..bbe7c02d1a 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -66,33 +66,15 @@ void main() { case evMouse: if (!CheckActiveProcess(Form.ID)) break; - mouse.get(); - scrollbar_v_mouse (#scroll1); - if (select_list.first != scroll1.position) - { - select_list.first = scroll1.position; - DrawSelectList(select_list.count); - break; - } - - if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(select_list.count); - - if (mouse.up)&&(mouse_clicked) - { - if (mouse.lkm) && (select_list.ProcessMouse(mouse.x, mouse.y)) EventApply(); - mouse_clicked=false; - } - else if (mouse.down)&&(mouse.lkm) && (select_list.MouseOver(mouse.x, mouse.y)) mouse_clicked=true; + SelectList_ProcessMouse(); if (mouse.down)&&(mouse.pkm) { select_list.ProcessMouse(mouse.x, mouse.y); - DrawSelectList(select_list.count); + SelectList_Draw(); menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 136, "Open file Enter\nDelete Del", 10); } - break; - case evButton: id=GetButtonID(); if (id==1) ExitProcess(); @@ -137,7 +119,13 @@ void DrawWindowContent() { int id; id = select_list.cur_y; - InitSelectList(LIST_PADDING, PANEL_H, Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, Form.cheight-PANEL_H-LIST_PADDING, false); + SelectList_Init( + LIST_PADDING, + PANEL_H, + Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, + Form.cheight-PANEL_H-LIST_PADDING, + false + ); select_list.cur_y = id; DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work); @@ -147,7 +135,7 @@ void DrawWindowContent() if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+select_list.x+21, select_list.y, WALLPAPERS, T_WALLPAPERS); DrawRectangle(select_list.x-1, select_list.y-1, select_list.w+1+scroll1.size_x, select_list.h+1, system.color.work_graph); - DrawSelectList(select_list.count); + SelectList_Draw(); } @@ -171,7 +159,7 @@ void Open_Dir() } } -void DrawSelectList_Line(dword i) +void SelectList_DrawLine(dword i) { int yyy, list_last; @@ -192,6 +180,11 @@ void DrawSelectList_Line(dword i) } } +void SelectList_LineChanged() +{ + EventApply(); +} + //===================================================// // // // EVENTS // @@ -243,7 +236,7 @@ void EventApply() 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); - DrawSelectList(select_list.count); + SelectList_Draw(); } } diff --git a/programs/cmm/clipview/clipview.c b/programs/cmm/clipview/clipview.c index 78ad24d001..d91037701e 100644 --- a/programs/cmm/clipview/clipview.c +++ b/programs/cmm/clipview/clipview.c @@ -2,7 +2,7 @@ ?include "lang.h--" #endif -#define MEMSIZE 0xDFE800 +#define MEMSIZE 4096*20 #include "..\lib\mem.h" #include "..\lib\strings.h" #include "..\lib\list_box.h" @@ -62,18 +62,9 @@ void main() { case evMouse: if (!CheckActiveProcess(Form.ID)) break; - mouse.get(); - scrollbar_v_mouse (#scroll1); - if (select_list.first != scroll1.position) - { - select_list.first = scroll1.position; - DrawSelectList(clipboard.GetSlotCount()); - break; - } - if (mouse.vert) && (select_list.MouseScroll(mouse.vert)) DrawSelectList(clipboard.GetSlotCount()); + SelectList_ProcessMouse(); break; - case evButton: id=GetButtonID(); if (id==1) ExitProcess(); @@ -86,7 +77,7 @@ void main() case evKey: GetKeys(); - if (select_list.ProcessKey(key_scancode)) DrawSelectList(clipboard.GetSlotCount()); + if (select_list.ProcessKey(key_scancode)) ClipViewSelectListDraw(); break; case evReDraw: @@ -96,19 +87,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; } - InitSelectList( + SelectList_Init( 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(); - DrawSelectList(clipboard.GetSlotCount()); + ClipViewSelectListDraw(); break; default: - if (clipboard.GetSlotCount() > select_list.count) DrawSelectList(clipboard.GetSlotCount()); + if (clipboard.GetSlotCount() > select_list.count) ClipViewSelectListDraw(); break; } } @@ -129,7 +120,7 @@ void DrawWindowContent() WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW); } -void DrawSelectList_Line(dword i) +void SelectList_DrawLine(dword i) { int yyy, length, slot_data_type_number; dword line_text[2048]; @@ -178,6 +169,15 @@ int SaveSlotContents(int slot_id) { } } +void ClipViewSelectListDraw() { + select_list.count = clipboard.GetSlotCount(); + SelectList_Draw(); +} + +void SelectList_LineChanged() { + return; +} + //===================================================// // // // EVENTS // @@ -186,19 +186,22 @@ int SaveSlotContents(int slot_id) { void EventDeleteLastSlot() { + int i; + for (i=0; i select_list.visible) list_last = select_list.visible; else list_last = select_list.count; - for (i=0; i