From 12249cc996cbcc13ad3daf13804459fd4bcd2c8a Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 23 Oct 2013 19:03:10 +0000 Subject: [PATCH] CMM: list_box library mouse events, change programs to use them git-svn-id: svn://kolibrios.org@4077 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/include/menu_rmb.h | 23 +++++++---------------- programs/cmm/eolite/include/menu.h | 12 +++--------- programs/cmm/eolite/include/open_with.h | 23 +++++------------------ programs/cmm/lib/list_box.h | 22 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 43 deletions(-) diff --git a/programs/cmm/browser/include/menu_rmb.h b/programs/cmm/browser/include/menu_rmb.h index 63659f8668..c16ad89f34 100644 --- a/programs/cmm/browser/include/menu_rmb.h +++ b/programs/cmm/browser/include/menu_rmb.h @@ -24,10 +24,11 @@ void menu_rmb() dword col_work = 0xE4DFE1; dword col_border = 0x9098B0; - menu.w = 165; - menu.line_h = 19; - menu.first = 0; + menu.first = menu.current = 0; while (ITEMS_LIST[menu.count*2]) {menu.count++; menu.visible++;} + menu.line_h = 19; + menu.w = 165; + menu.h = menu.count * menu.line_h; SetEventMask(100111b); loop() switch(WaitEvent()) @@ -37,19 +38,9 @@ void menu_rmb() N=GetProcessSlot(MenuForm.ID); if (N<>GetActiveProcess()) ExitProcess(); - mm.get(); - overid=mm.y/menu.line_h; - if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break; - if (mm.lkm) || (mm.pkm) - { - action_buf = ITEMS_LIST[menu.current*2+1]; - ExitProcess(); - } - if (menu.current<>overid) - { - menu.current=overid; - goto _ITEMS_DRAW; - } + mm.get(); + if (menu.ProcessMouse(mm.x, mm.y)) goto _ITEMS_DRAW; + if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); } break; case evKey: diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index 484e3eb7b3..4464fc99be 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -53,7 +53,7 @@ void FileMenu() int index; menu.ClearList(); - menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18); + menu.SetSizes(0,0,10,0,0,18); for (index=0; file_captions[index]!=0; index+=3) { if (itdir) && (file_captions[index+2]>=200) continue; @@ -72,13 +72,7 @@ void FileMenu() slot = GetProcessSlot(MenuForm.ID); if (slot != GetActiveProcess()) ExitProcess(); mm.get(); - menu.current_temp = mm.y - 1 / menu.line_h; - if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) menu.current_temp = -1; - if (menu.current<>menu.current_temp) - { - menu.current=menu.current_temp; - MenuListRedraw(); - } + if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw(); if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); } break; @@ -90,7 +84,7 @@ void FileMenu() break; case evReDraw: _MENU_DRAW: - DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); + DefineAndDrawWindow(m.x+Form.left+5, m.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); GetProcessInfo(#MenuForm, SelfInfo); DrawRectangle(0,0,menu.w+1,menu.h+2,sc.work_graph); DrawBar(1,1,menu.w,1,0xFFFfff); diff --git a/programs/cmm/eolite/include/open_with.h b/programs/cmm/eolite/include/open_with.h index a0e15dc56e..0125554249 100644 --- a/programs/cmm/eolite/include/open_with.h +++ b/programs/cmm/eolite/include/open_with.h @@ -79,25 +79,12 @@ void OpenWith() slot = GetProcessSlot(MenuForm.ID); if (slot != GetActiveProcess()) ExitProcess(); mm.get(); - //if (mm.lkm) ExitProcess(); - if (mm.vert) + if (mm.vert) && (app_list.MouseScroll(mm.vert)) DrawAppList(); + if (app_list.ProcessMouse(mm.x, mm.y)) DrawAppList(); + if (app_list.MouseOver(mm.x, mm.y)) && (mm.lkm) { - app_list.MouseScroll(mm.vert); - DrawAppList(); - } - if (mm.x>app_list.x) && (mm.xapp_list.y) && (mm.yx) && (xxy) && (yy