From 869f0667e0ea023586a5fb4a94815d7ad4fd4c57 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 15 Apr 2020 17:00:34 +0000 Subject: [PATCH] separators in menus git-svn-id: svn://kolibrios.org@7796 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/WebView.c | 4 +- programs/cmm/browser/texts.h | 4 ++ programs/cmm/eolite/include/menu.h | 12 +++++ programs/cmm/menu/menu.c | 84 +++++++++++++++++++++++------- 4 files changed, 83 insertions(+), 21 deletions(-) diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index dbf241ca4d..74a473bbda 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -435,9 +435,9 @@ void ProcessEvent(dword id__) open_new_tab = false; return; case IN_NEW_WINDOW: - open_new_tab = true; + open_new_window = true; EventClickLink(PageLinks.GetURL(PageLinks.active)); - open_new_tab = false; + open_new_window = false; return; case COPY_LINK_URL: Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); diff --git a/programs/cmm/browser/texts.h b/programs/cmm/browser/texts.h index 34867b8d64..0915a4e3ba 100644 --- a/programs/cmm/browser/texts.h +++ b/programs/cmm/browser/texts.h @@ -11,6 +11,7 @@ char rmb_menu[] = char main_menu[] = "Открыть файл|Ctrl+O Новое окно|Ctrl+N +- История|Ctrl+H Менеджер загрузок|Ctrl+J Очистить кэш @@ -18,6 +19,7 @@ char main_menu[] = char link_menu[] = "Открыть в новой вкладке Открыть в новом окне +- Копировать ссылку Скачать содержимое ссылки"; char loading_text[] = "Загрузка..."; @@ -39,6 +41,7 @@ Edit source"; char main_menu[] = "Open local file|Ctrl+O New window|Ctrl+N +- History|Ctrl+H Download Manager|Ctrl+J Clear cache @@ -46,6 +49,7 @@ Update browser"; char link_menu[] = "Open in new tab Open in new window +- Copy link Download link contents"; char loading_text[] = "Loading..."; diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index 2d62e312c8..5792208fab 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -3,17 +3,21 @@ char file_actions[]= "Открыть |Enter Открыть с помощью |CrlEnt +- Копировать |Crl+C Вырезать |Crl+X Вставить |Crl+V +- Переименовать |F2 Удалить |Del Свойства |F8"; char folder_actions[]= "Открыть |Enter +- Копировать |Crl+C Вырезать |Crl+X Вставить |Crl+V +- Удалить |Del Свойства |F8"; char empty_folder_actions[]= @@ -23,17 +27,21 @@ char empty_folder_actions[]= char file_actions[]= "Ava |Enter Ava ... |CrlEnt +- Kopeeri |Crl+C Lїika |Crl+X Aseta |Crl+V +- Nimeta №mber |F2 Kustuta |Del Properties |F8"; char folder_actions[]= "Ava |Enter +- Kopeeri |Crl+C Lїika |Crl+X Aseta |Crl+V +- Kustuta |Del Properties |F8"; char empty_folder_actions[]= @@ -43,17 +51,21 @@ char empty_folder_actions[]= char file_actions[]= "Open |Enter Open with... |CrlEnt +- Copy |Crl+C Cut |Crl+X Paste |Crl+V +- Rename |F2 Delete |Del Properties |F8"; char folder_actions[]= "Open |Enter +- Copy |Crl+C Cut |Crl+X Paste |Crl+V +- Delete |Del Properties |F8"; char empty_folder_actions[]= diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index 12e0eec29d..02d73d61ec 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -7,6 +7,7 @@ #include "../lib/fs.h" #define ITEM_H 19 +#define SEP_H 4 llist menu1; collection names; @@ -16,6 +17,7 @@ int selected, win_x, win_y; int max_name_len; int max_hotkey_len; +int menu_w, menu_h; void GetWindowPosition() { @@ -70,6 +72,33 @@ void GetMenuItems(dword current_name) if (next_name) GetMenuItems(next_name+2); } +int GetSeparatorsCount() +{ + int i, count=0; + for (i=0; i= item_y) && (_mouse_y < item_y + ITEM_H) { + return item_i * ITEM_H + menu1.y; + } + } +} + void main() { proc_info Form; @@ -79,9 +108,13 @@ void main() GetMenuItems(#param); GetMenuWidths(); + menu_w = max_name_len + max_hotkey_len + 23; + menu_h = GetSeparatorsCount() * SEP_H + + calc(names.count - GetSeparatorsCount() * ITEM_H); + menu1.count = names.count; menu1.SetFont(6, 9, 0x80); - menu1.SetSizes(2,2, max_name_len + max_hotkey_len + 23, menu1.count*ITEM_H, ITEM_H); + menu1.SetSizes(2,2, menu_w, menu_h, ITEM_H); menu1.cur_y = -1; GetWindowPosition(); @@ -93,8 +126,11 @@ void main() GetProcessInfo(#Form, SelfInfo); if (!CheckActiveProcess(Form.ID)) exit(); mouse.get(); - if (menu1.ProcessMouse(mouse.x, mouse.y)) draw_list(); - if (mouse.lkm)&&(mouse.up) click(); + if (menu1.MouseOver(mouse.x, mouse.y)) { + mouse.y = MoveMouseToHandleSeparators(mouse.y); + if (menu1.ProcessMouse(mouse.x, mouse.y)) draw_list(); + if (mouse.lkm)&&(mouse.up) click(); + } break; case evKey: @@ -121,7 +157,8 @@ void ProcessKeys() click(); case SCAN_CODE_DOWN: - if (!menu1.KeyDown()) menu1.KeyHome(); + if (!menu1.KeyDown()) + || (menu1.count - menu1.cur_y - GetSeparatorsCount() -1 < 0) menu1.KeyHome(); draw_list(); break; @@ -137,7 +174,7 @@ void ProcessKeys() void draw_list() { - int i, item_y; + int i, item_y=menu1.y, item_i=0; dword name_color; dword hotkey_color; @@ -159,22 +196,31 @@ void draw_list() for (i=0; i