Rev 7484 | Rev 7634 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4042 | leency | 1 | //pay attension: >200 this is only file actions, not supported by folders |
2 | #ifdef LANG_RUS |
||
3 | char *file_captions[] = { |
||
4 | "Открыть", "Enter",100, |
||
5 | "Открыть с помощью...", "CrlEnt",201, |
||
6 | "Открыть как текст", "F3",202, |
||
7 | "Открыть как HEX", "F4",203, |
||
8 | "Копировать", "Crl+C",104, |
||
9 | "Вырезать", "Crl+X",105, |
||
10 | "Вставить", "Crl+V",106, |
||
11 | "Переименовать", "F2",207, |
||
12 | "Удалить", "Del",108, |
||
13 | "Обновить папку", "F5",109, |
||
7490 | leency | 14 | "Свойства", "F8",110, |
4042 | leency | 15 | 0, 0, 0}; |
16 | #elif LANG_EST |
||
17 | char *file_captions[] = { |
||
18 | "Ava", "Enter",100, |
||
19 | "Ava ...", "CrlEnt",201, |
||
20 | "Vaata tekstina", "F3",202, |
||
21 | "Vaata HEX", "F4",203, |
||
22 | "Kopeeri", "Crl+C",104, |
||
23 | "Lїika", "Crl+X",105, |
||
24 | "Aseta", "Crl+V",106, |
||
25 | "Nimeta №mber", "F2",207, |
||
26 | "Kustuta", "Del",108, |
||
27 | "Vфrskenda", "F5",109, |
||
7490 | leency | 28 | "Properties", "F8",110, |
4042 | leency | 29 | 0, 0, 0}; |
30 | #else |
||
31 | char *file_captions[] = { |
||
32 | "Open", "Enter",100, |
||
33 | "Open with...", "CrlEnt",201, |
||
34 | "View as text", "F3",202, |
||
35 | "View as HEX", "F4",203, |
||
36 | "Copy", "Crl+C",104, |
||
37 | "Cut", "Crl+X",105, |
||
38 | "Paste", "Crl+V",106, |
||
39 | "Rename", "F2",207, |
||
40 | "Delete", "Del",108, |
||
41 | "Refresh", "F5",109, |
||
7490 | leency | 42 | "Properties", "F8",110, |
4042 | leency | 43 | 0, 0, 0}; |
44 | #endif |
||
45 | |||
6973 | leency | 46 | llist rbmenu; |
4072 | leency | 47 | int cur_action_buf; |
4042 | leency | 48 | |
49 | void FileMenu() |
||
50 | { |
||
51 | proc_info MenuForm; |
||
4072 | leency | 52 | int index; |
4042 | leency | 53 | |
6973 | leency | 54 | rbmenu.ClearList(); |
55 | rbmenu.SetFont(6, 9, 0x80); |
||
56 | rbmenu.SetSizes(0,0,10,0,18); |
||
4042 | leency | 57 | for (index=0; file_captions[index]!=0; index+=3) |
58 | { |
||
7484 | leency | 59 | if (selected_count > 0) { |
60 | //if there are files selected then show only specific menu items |
||
61 | if (file_captions[index+2]>=200) continue; |
||
62 | if (file_captions[index+2]==100) continue; |
||
63 | } |
||
64 | else if (itdir) && (file_captions[index+2]>=200) continue; |
||
6973 | leency | 65 | if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]); |
66 | rbmenu.count++; |
||
67 | rbmenu.visible++; |
||
4042 | leency | 68 | } |
6973 | leency | 69 | rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50; |
70 | rbmenu.h = rbmenu.count * rbmenu.item_h; |
||
7051 | leency | 71 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
4042 | leency | 72 | goto _MENU_DRAW; |
73 | |||
74 | loop() switch(WaitEvent()) |
||
75 | { |
||
76 | case evMouse: |
||
5640 | pavelyakov | 77 | mouse.get(); |
5576 | pavelyakov | 78 | if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();} |
6973 | leency | 79 | else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw(); |
5640 | pavelyakov | 80 | else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
5576 | pavelyakov | 81 | break; |
4042 | leency | 82 | |
83 | case evKey: |
||
5707 | leency | 84 | GetKeys(); |
5811 | leency | 85 | if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();} |
86 | if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
||
6973 | leency | 87 | if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw(); |
4042 | leency | 88 | break; |
89 | |||
90 | case evReDraw: _MENU_DRAW: |
||
7051 | leency | 91 | if (menu_call_mouse) |
92 | DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); |
||
93 | else |
||
94 | DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); |
||
4042 | leency | 95 | GetProcessInfo(#MenuForm, SelfInfo); |
6973 | leency | 96 | DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph); |
97 | DrawBar(1,1,rbmenu.w,1,0xFFFfff); |
||
98 | DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0); |
||
4072 | leency | 99 | MenuListRedraw(); |
100 | } |
||
101 | } |
||
4042 | leency | 102 | |
4072 | leency | 103 | void MenuListRedraw() |
104 | { |
||
105 | int start_y=0; |
||
106 | int index; |
||
7462 | leency | 107 | |
108 | dword m_col_bg; |
||
109 | dword m_col_text; |
||
110 | dword m_col_sh_text; |
||
111 | |||
4072 | leency | 112 | for (index=0; file_captions[index*3]!=0; index++) |
113 | { |
||
7484 | leency | 114 | if (selected_count > 0) { |
115 | if (file_captions[index*3+2]==100) continue; |
||
116 | if (file_captions[index*3+2]>=200) continue; |
||
117 | } |
||
118 | else if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
||
6973 | leency | 119 | DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff); |
120 | if (start_y/rbmenu.item_h==rbmenu.cur_y) |
||
4072 | leency | 121 | { |
122 | cur_action_buf = file_captions[index*3+2]; |
||
7462 | leency | 123 | m_col_bg = 0xFFFfff; |
124 | m_col_sh_text = 0xFAFAFA; |
||
125 | m_col_text = 0; |
||
4072 | leency | 126 | } |
127 | else |
||
128 | { |
||
7462 | leency | 129 | m_col_bg = col_work; |
130 | m_col_text = system.color.work_text; |
||
131 | m_col_sh_text = system.color.work_light; |
||
4072 | leency | 132 | } |
7462 | leency | 133 | DrawBar(2, start_y+2, rbmenu.w-1, rbmenu.item_h, m_col_bg); |
134 | WriteText(8, start_y + rbmenu.text_y + 4, rbmenu.font_type, m_col_sh_text, file_captions[index*3]); |
||
135 | WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, m_col_text, file_captions[index*3]); |
||
6973 | leency | 136 | WriteText(-strlen(file_captions[index*3+1])-1*rbmenu.font_w + rbmenu.w, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0x888888, file_captions[index*3+1]); |
137 | start_y+=rbmenu.item_h; |
||
4072 | leency | 138 | } |
4042 | leency | 139 | } |