forked from KolibriOS/kolibrios
separators in menus
git-svn-id: svn://kolibrios.org@7796 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
604a9d71a7
commit
869f0667e0
@ -435,9 +435,9 @@ void ProcessEvent(dword id__)
|
|||||||
open_new_tab = false;
|
open_new_tab = false;
|
||||||
return;
|
return;
|
||||||
case IN_NEW_WINDOW:
|
case IN_NEW_WINDOW:
|
||||||
open_new_tab = true;
|
open_new_window = true;
|
||||||
EventClickLink(PageLinks.GetURL(PageLinks.active));
|
EventClickLink(PageLinks.GetURL(PageLinks.active));
|
||||||
open_new_tab = false;
|
open_new_window = false;
|
||||||
return;
|
return;
|
||||||
case COPY_LINK_URL:
|
case COPY_LINK_URL:
|
||||||
Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
|
Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
|
||||||
|
@ -11,6 +11,7 @@ char rmb_menu[] =
|
|||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Žâªàëâì ä ©«|Ctrl+O
|
"Žâªàëâì ä ©«|Ctrl+O
|
||||||
<EFBFBD>®¢®¥ ®ª®|Ctrl+N
|
<EFBFBD>®¢®¥ ®ª®|Ctrl+N
|
||||||
|
-
|
||||||
ˆáâ®à¨ï|Ctrl+H
|
ˆáâ®à¨ï|Ctrl+H
|
||||||
Œ¥¥¤¦¥à § £à㧮ª|Ctrl+J
|
Œ¥¥¤¦¥à § £à㧮ª|Ctrl+J
|
||||||
Žç¨áâ¨âì ªíè
|
Žç¨áâ¨âì ªíè
|
||||||
@ -18,6 +19,7 @@ char main_menu[] =
|
|||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
"Žâªàëâì ¢ ®¢®© ¢ª« ¤ª¥
|
"Žâªàëâì ¢ ®¢®© ¢ª« ¤ª¥
|
||||||
Žâªàëâì ¢ ®¢®¬ ®ª¥
|
Žâªàëâì ¢ ®¢®¬ ®ª¥
|
||||||
|
-
|
||||||
Š®¯¨à®¢ âì áá뫪ã
|
Š®¯¨à®¢ âì áá뫪ã
|
||||||
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
||||||
char loading_text[] = "‡ £à㧪 ...";
|
char loading_text[] = "‡ £à㧪 ...";
|
||||||
@ -39,6 +41,7 @@ Edit source";
|
|||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Open local file|Ctrl+O
|
"Open local file|Ctrl+O
|
||||||
New window|Ctrl+N
|
New window|Ctrl+N
|
||||||
|
-
|
||||||
History|Ctrl+H
|
History|Ctrl+H
|
||||||
Download Manager|Ctrl+J
|
Download Manager|Ctrl+J
|
||||||
Clear cache
|
Clear cache
|
||||||
@ -46,6 +49,7 @@ Update browser";
|
|||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
"Open in new tab
|
"Open in new tab
|
||||||
Open in new window
|
Open in new window
|
||||||
|
-
|
||||||
Copy link
|
Copy link
|
||||||
Download link contents";
|
Download link contents";
|
||||||
char loading_text[] = "Loading...";
|
char loading_text[] = "Loading...";
|
||||||
|
@ -3,17 +3,21 @@
|
|||||||
char file_actions[]=
|
char file_actions[]=
|
||||||
"Žâªàëâì |Enter
|
"Žâªàëâì |Enter
|
||||||
Žâªàëâì á ¯®¬®éìî |CrlEnt
|
Žâªàëâì á ¯®¬®éìî |CrlEnt
|
||||||
|
-
|
||||||
Š®¯¨à®¢ âì |Crl+C
|
Š®¯¨à®¢ âì |Crl+C
|
||||||
‚ë१ âì |Crl+X
|
‚ë१ âì |Crl+X
|
||||||
‚áâ ¢¨âì |Crl+V
|
‚áâ ¢¨âì |Crl+V
|
||||||
|
-
|
||||||
<EFBFBD>¥à¥¨¬¥®¢ âì |F2
|
<EFBFBD>¥à¥¨¬¥®¢ âì |F2
|
||||||
“¤ «¨âì |Del
|
“¤ «¨âì |Del
|
||||||
‘¢®©á⢠|F8";
|
‘¢®©á⢠|F8";
|
||||||
char folder_actions[]=
|
char folder_actions[]=
|
||||||
"Žâªàëâì |Enter
|
"Žâªàëâì |Enter
|
||||||
|
-
|
||||||
Š®¯¨à®¢ âì |Crl+C
|
Š®¯¨à®¢ âì |Crl+C
|
||||||
‚ë१ âì |Crl+X
|
‚ë१ âì |Crl+X
|
||||||
‚áâ ¢¨âì |Crl+V
|
‚áâ ¢¨âì |Crl+V
|
||||||
|
-
|
||||||
“¤ «¨âì |Del
|
“¤ «¨âì |Del
|
||||||
‘¢®©á⢠|F8";
|
‘¢®©á⢠|F8";
|
||||||
char empty_folder_actions[]=
|
char empty_folder_actions[]=
|
||||||
@ -23,17 +27,21 @@ char empty_folder_actions[]=
|
|||||||
char file_actions[]=
|
char file_actions[]=
|
||||||
"Ava |Enter
|
"Ava |Enter
|
||||||
Ava ... |CrlEnt
|
Ava ... |CrlEnt
|
||||||
|
-
|
||||||
Kopeeri |Crl+C
|
Kopeeri |Crl+C
|
||||||
Lõika |Crl+X
|
Lõika |Crl+X
|
||||||
Aseta |Crl+V
|
Aseta |Crl+V
|
||||||
|
-
|
||||||
Nimeta ümber |F2
|
Nimeta ümber |F2
|
||||||
Kustuta |Del
|
Kustuta |Del
|
||||||
Properties |F8";
|
Properties |F8";
|
||||||
char folder_actions[]=
|
char folder_actions[]=
|
||||||
"Ava |Enter
|
"Ava |Enter
|
||||||
|
-
|
||||||
Kopeeri |Crl+C
|
Kopeeri |Crl+C
|
||||||
Lõika |Crl+X
|
Lõika |Crl+X
|
||||||
Aseta |Crl+V
|
Aseta |Crl+V
|
||||||
|
-
|
||||||
Kustuta |Del
|
Kustuta |Del
|
||||||
Properties |F8";
|
Properties |F8";
|
||||||
char empty_folder_actions[]=
|
char empty_folder_actions[]=
|
||||||
@ -43,17 +51,21 @@ char empty_folder_actions[]=
|
|||||||
char file_actions[]=
|
char file_actions[]=
|
||||||
"Open |Enter
|
"Open |Enter
|
||||||
Open with... |CrlEnt
|
Open with... |CrlEnt
|
||||||
|
-
|
||||||
Copy |Crl+C
|
Copy |Crl+C
|
||||||
Cut |Crl+X
|
Cut |Crl+X
|
||||||
Paste |Crl+V
|
Paste |Crl+V
|
||||||
|
-
|
||||||
Rename |F2
|
Rename |F2
|
||||||
Delete |Del
|
Delete |Del
|
||||||
Properties |F8";
|
Properties |F8";
|
||||||
char folder_actions[]=
|
char folder_actions[]=
|
||||||
"Open |Enter
|
"Open |Enter
|
||||||
|
-
|
||||||
Copy |Crl+C
|
Copy |Crl+C
|
||||||
Cut |Crl+X
|
Cut |Crl+X
|
||||||
Paste |Crl+V
|
Paste |Crl+V
|
||||||
|
-
|
||||||
Delete |Del
|
Delete |Del
|
||||||
Properties |F8";
|
Properties |F8";
|
||||||
char empty_folder_actions[]=
|
char empty_folder_actions[]=
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "../lib/fs.h"
|
#include "../lib/fs.h"
|
||||||
|
|
||||||
#define ITEM_H 19
|
#define ITEM_H 19
|
||||||
|
#define SEP_H 4
|
||||||
|
|
||||||
llist menu1;
|
llist menu1;
|
||||||
collection names;
|
collection names;
|
||||||
@ -16,6 +17,7 @@ int selected, win_x, win_y;
|
|||||||
|
|
||||||
int max_name_len;
|
int max_name_len;
|
||||||
int max_hotkey_len;
|
int max_hotkey_len;
|
||||||
|
int menu_w, menu_h;
|
||||||
|
|
||||||
void GetWindowPosition()
|
void GetWindowPosition()
|
||||||
{
|
{
|
||||||
@ -70,6 +72,33 @@ void GetMenuItems(dword current_name)
|
|||||||
if (next_name) GetMenuItems(next_name+2);
|
if (next_name) GetMenuItems(next_name+2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetSeparatorsCount()
|
||||||
|
{
|
||||||
|
int i, count=0;
|
||||||
|
for (i=0; i<names.count; i++) {
|
||||||
|
if (streq(names.get(i), "-")) count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MoveMouseToHandleSeparators(int _mouse_y)
|
||||||
|
{
|
||||||
|
int i, item_y=menu1.y;
|
||||||
|
int item_i=0;
|
||||||
|
for (i=0; i<menu1.count; i++;)
|
||||||
|
{
|
||||||
|
if (streq(names.get(i), "-")) {
|
||||||
|
item_y += SEP_H;
|
||||||
|
} else {
|
||||||
|
item_y += ITEM_H;
|
||||||
|
item_i++;
|
||||||
|
}
|
||||||
|
if (_mouse_y >= item_y) && (_mouse_y < item_y + ITEM_H) {
|
||||||
|
return item_i * ITEM_H + menu1.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
@ -79,9 +108,13 @@ void main()
|
|||||||
GetMenuItems(#param);
|
GetMenuItems(#param);
|
||||||
GetMenuWidths();
|
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.count = names.count;
|
||||||
menu1.SetFont(6, 9, 0x80);
|
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;
|
menu1.cur_y = -1;
|
||||||
|
|
||||||
GetWindowPosition();
|
GetWindowPosition();
|
||||||
@ -93,8 +126,11 @@ void main()
|
|||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (!CheckActiveProcess(Form.ID)) exit();
|
if (!CheckActiveProcess(Form.ID)) exit();
|
||||||
mouse.get();
|
mouse.get();
|
||||||
|
if (menu1.MouseOver(mouse.x, mouse.y)) {
|
||||||
|
mouse.y = MoveMouseToHandleSeparators(mouse.y);
|
||||||
if (menu1.ProcessMouse(mouse.x, mouse.y)) draw_list();
|
if (menu1.ProcessMouse(mouse.x, mouse.y)) draw_list();
|
||||||
if (mouse.lkm)&&(mouse.up) click();
|
if (mouse.lkm)&&(mouse.up) click();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
@ -121,7 +157,8 @@ void ProcessKeys()
|
|||||||
click();
|
click();
|
||||||
|
|
||||||
case SCAN_CODE_DOWN:
|
case SCAN_CODE_DOWN:
|
||||||
if (!menu1.KeyDown()) menu1.KeyHome();
|
if (!menu1.KeyDown())
|
||||||
|
|| (menu1.count - menu1.cur_y - GetSeparatorsCount() -1 < 0) menu1.KeyHome();
|
||||||
draw_list();
|
draw_list();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -137,7 +174,7 @@ void ProcessKeys()
|
|||||||
|
|
||||||
void draw_list()
|
void draw_list()
|
||||||
{
|
{
|
||||||
int i, item_y;
|
int i, item_y=menu1.y, item_i=0;
|
||||||
dword name_color;
|
dword name_color;
|
||||||
dword hotkey_color;
|
dword hotkey_color;
|
||||||
|
|
||||||
@ -159,8 +196,14 @@ void draw_list()
|
|||||||
|
|
||||||
for (i=0; i<menu1.count; i++;)
|
for (i=0; i<menu1.count; i++;)
|
||||||
{
|
{
|
||||||
item_y = i*ITEM_H+menu1.y;
|
if (streq(names.get(i), "-")) {
|
||||||
if (i==menu1.cur_y) {
|
DrawBar(menu1.x, item_y+0, menu1.w, 1, inactive_background_color);
|
||||||
|
DrawBar(menu1.x, item_y+1, menu1.w, 1, system.color.work_dark);
|
||||||
|
DrawBar(menu1.x, item_y+2, menu1.w, 1, system.color.work_light);
|
||||||
|
DrawBar(menu1.x, item_y+3, menu1.w, 1, inactive_background_color);
|
||||||
|
item_y += SEP_H;
|
||||||
|
} else {
|
||||||
|
if (item_i==menu1.cur_y) {
|
||||||
hotkey_color = name_color = system.color.work_button_text;
|
hotkey_color = name_color = system.color.work_button_text;
|
||||||
DrawBar(menu1.x, item_y+1, menu1.w, ITEM_H-2, active_background_color);
|
DrawBar(menu1.x, item_y+1, menu1.w, ITEM_H-2, active_background_color);
|
||||||
DrawBar(menu1.x, item_y, menu1.w, 1, active_top_border_color);
|
DrawBar(menu1.x, item_y, menu1.w, 1, active_top_border_color);
|
||||||
@ -175,6 +218,9 @@ void draw_list()
|
|||||||
WriteText(-strlen(hotkeys.get(i))*6 + 13 + max_name_len + max_hotkey_len,
|
WriteText(-strlen(hotkeys.get(i))*6 + 13 + max_name_len + max_hotkey_len,
|
||||||
item_y + menu1.text_y, 0x80, hotkey_color, hotkeys.get(i));
|
item_y + menu1.text_y, 0x80, hotkey_color, hotkeys.get(i));
|
||||||
WriteText(13, item_y + menu1.text_y, 0x80, name_color, names.get(i));
|
WriteText(13, item_y + menu1.text_y, 0x80, name_color, names.get(i));
|
||||||
|
item_y += ITEM_H;
|
||||||
|
item_i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (selected) WriteText(5, selected-1*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
|
if (selected) WriteText(5, selected-1*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user