Rev 7051 | Rev 7462 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7051 | Rev 7278 | ||
---|---|---|---|
1 | //Leency 2008-2013 |
- | |
2 | - | ||
3 | //pay attension: >200 this is only file actions, not supported by folders |
1 | //pay attension: >200 this is only file actions, not supported by folders |
4 | #ifdef LANG_RUS |
2 | #ifdef LANG_RUS |
5 | char *file_captions[] = { |
3 | char *file_captions[] = { |
6 | "âªàëâì", "Enter",100, |
4 | "âªàëâì", "Enter",100, |
7 | "âªàëâì á ¯®¬®éìî...", "CrlEnt",201, |
5 | "âªàëâì á ¯®¬®éìî...", "CrlEnt",201, |
8 | "âªàëâì ª ª ⥪áâ", "F3",202, |
6 | "âªàëâì ª ª ⥪áâ", "F3",202, |
9 | "âªàëâì ª ª HEX", "F4",203, |
7 | "âªàëâì ª ª HEX", "F4",203, |
10 | "®¯¨à®¢ âì", "Crl+C",104, |
8 | "®¯¨à®¢ âì", "Crl+C",104, |
11 | "ë१ âì", "Crl+X",105, |
9 | "ë१ âì", "Crl+X",105, |
12 | "áâ ¢¨âì", "Crl+V",106, |
10 | "áâ ¢¨âì", "Crl+V",106, |
13 | "¥à¥¨¬¥®¢ âì", "F2",207, |
11 | "¥à¥¨¬¥®¢ âì", "F2",207, |
14 | "¤ «¨âì", "Del",108, |
12 | "¤ «¨âì", "Del",108, |
15 | "¡®¢¨âì ¯ ¯ªã", "F5",109, |
13 | "¡®¢¨âì ¯ ¯ªã", "F5",109, |
16 | "¢®©á⢠", "",110, |
14 | "¢®©á⢠", "",110, |
17 | 0, 0, 0}; |
15 | 0, 0, 0}; |
18 | #elif LANG_EST |
16 | #elif LANG_EST |
19 | char *file_captions[] = { |
17 | char *file_captions[] = { |
20 | "Ava", "Enter",100, |
18 | "Ava", "Enter",100, |
21 | "Ava ...", "CrlEnt",201, |
19 | "Ava ...", "CrlEnt",201, |
22 | "Vaata tekstina", "F3",202, |
20 | "Vaata tekstina", "F3",202, |
23 | "Vaata HEX", "F4",203, |
21 | "Vaata HEX", "F4",203, |
24 | "Kopeeri", "Crl+C",104, |
22 | "Kopeeri", "Crl+C",104, |
25 | "Lõika", "Crl+X",105, |
23 | "Lõika", "Crl+X",105, |
26 | "Aseta", "Crl+V",106, |
24 | "Aseta", "Crl+V",106, |
27 | "Nimeta ümber", "F2",207, |
25 | "Nimeta ümber", "F2",207, |
28 | "Kustuta", "Del",108, |
26 | "Kustuta", "Del",108, |
29 | "Värskenda", "F5",109, |
27 | "Värskenda", "F5",109, |
30 | "Properties", "",110, |
28 | "Properties", "",110, |
31 | 0, 0, 0}; |
29 | 0, 0, 0}; |
32 | #else |
30 | #else |
33 | char *file_captions[] = { |
31 | char *file_captions[] = { |
34 | "Open", "Enter",100, |
32 | "Open", "Enter",100, |
35 | "Open with...", "CrlEnt",201, |
33 | "Open with...", "CrlEnt",201, |
36 | "View as text", "F3",202, |
34 | "View as text", "F3",202, |
37 | "View as HEX", "F4",203, |
35 | "View as HEX", "F4",203, |
38 | "Copy", "Crl+C",104, |
36 | "Copy", "Crl+C",104, |
39 | "Cut", "Crl+X",105, |
37 | "Cut", "Crl+X",105, |
40 | "Paste", "Crl+V",106, |
38 | "Paste", "Crl+V",106, |
41 | "Rename", "F2",207, |
39 | "Rename", "F2",207, |
42 | "Delete", "Del",108, |
40 | "Delete", "Del",108, |
43 | "Refresh", "F5",109, |
41 | "Refresh", "F5",109, |
44 | "Properties", "",110, |
42 | "Properties", "",110, |
45 | 0, 0, 0}; |
43 | 0, 0, 0}; |
46 | #endif |
44 | #endif |
47 | 45 | ||
48 | llist rbmenu; |
46 | llist rbmenu; |
49 | int cur_action_buf; |
47 | int cur_action_buf; |
50 | 48 | ||
51 | void FileMenu() |
49 | void FileMenu() |
52 | { |
50 | { |
53 | proc_info MenuForm; |
51 | proc_info MenuForm; |
54 | int index; |
52 | int index; |
55 | 53 | ||
56 | rbmenu.ClearList(); |
54 | rbmenu.ClearList(); |
57 | rbmenu.SetFont(6, 9, 0x80); |
55 | rbmenu.SetFont(6, 9, 0x80); |
58 | rbmenu.SetSizes(0,0,10,0,18); |
56 | rbmenu.SetSizes(0,0,10,0,18); |
59 | for (index=0; file_captions[index]!=0; index+=3) |
57 | for (index=0; file_captions[index]!=0; index+=3) |
60 | { |
58 | { |
61 | if (itdir) && (file_captions[index+2]>=200) continue; |
59 | if (itdir) && (file_captions[index+2]>=200) continue; |
62 | if (selected_count > 0) && (file_captions[index+2]==100) continue; //do not show "open" for several files |
60 | if (selected_count > 0) && (file_captions[index+2]==100) continue; //do not show "open" for several files |
63 | if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]); |
61 | if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]); |
64 | rbmenu.count++; |
62 | rbmenu.count++; |
65 | rbmenu.visible++; |
63 | rbmenu.visible++; |
66 | } |
64 | } |
67 | rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50; |
65 | rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50; |
68 | rbmenu.h = rbmenu.count * rbmenu.item_h; |
66 | rbmenu.h = rbmenu.count * rbmenu.item_h; |
69 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
67 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
70 | goto _MENU_DRAW; |
68 | goto _MENU_DRAW; |
71 | 69 | ||
72 | loop() switch(WaitEvent()) |
70 | loop() switch(WaitEvent()) |
73 | { |
71 | { |
74 | case evMouse: |
72 | case evMouse: |
75 | mouse.get(); |
73 | mouse.get(); |
76 | if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();} |
74 | if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();} |
77 | else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw(); |
75 | else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw(); |
78 | else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
76 | else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
79 | break; |
77 | break; |
80 | 78 | ||
81 | case evKey: |
79 | case evKey: |
82 | GetKeys(); |
80 | GetKeys(); |
83 | if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();} |
81 | if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();} |
84 | if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
82 | if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
85 | if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw(); |
83 | if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw(); |
86 | break; |
84 | break; |
87 | 85 | ||
88 | case evReDraw: _MENU_DRAW: |
86 | case evReDraw: _MENU_DRAW: |
89 | if (menu_call_mouse) |
87 | if (menu_call_mouse) |
90 | DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); |
88 | DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); |
91 | else |
89 | else |
92 | 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); |
90 | 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); |
93 | GetProcessInfo(#MenuForm, SelfInfo); |
91 | GetProcessInfo(#MenuForm, SelfInfo); |
94 | DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph); |
92 | DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph); |
95 | DrawBar(1,1,rbmenu.w,1,0xFFFfff); |
93 | DrawBar(1,1,rbmenu.w,1,0xFFFfff); |
96 | DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0); |
94 | DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0); |
97 | MenuListRedraw(); |
95 | MenuListRedraw(); |
98 | } |
96 | } |
99 | } |
97 | } |
100 | 98 | ||
101 | void MenuListRedraw() |
99 | void MenuListRedraw() |
102 | { |
100 | { |
103 | int start_y=0; |
101 | int start_y=0; |
104 | int index; |
102 | int index; |
105 | for (index=0; file_captions[index*3]!=0; index++) |
103 | for (index=0; file_captions[index*3]!=0; index++) |
106 | { |
104 | { |
107 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
105 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
108 | if (selected_count > 0) && (file_captions[index+2]==100) continue; |
106 | if (selected_count > 0) && (file_captions[index+2]==100) continue; |
109 | DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff); |
107 | DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff); |
110 | if (start_y/rbmenu.item_h==rbmenu.cur_y) |
108 | if (start_y/rbmenu.item_h==rbmenu.cur_y) |
111 | { |
109 | { |
112 | cur_action_buf = file_captions[index*3+2]; |
110 | cur_action_buf = file_captions[index*3+2]; |
113 | DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,0xFFFfff); |
111 | DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,0xFFFfff); |
114 | } |
112 | } |
115 | else |
113 | else |
116 | { |
114 | { |
117 | DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,col_work); |
115 | DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,col_work); |
118 | WriteText(8,start_y+rbmenu.text_y+4,rbmenu.font_type,0xf2f2f2,file_captions[index*3]); |
116 | WriteText(8,start_y+rbmenu.text_y+4,rbmenu.font_type,0xf2f2f2,file_captions[index*3]); |
119 | } |
117 | } |
120 | WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0, file_captions[index*3]); |
118 | WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0, file_captions[index*3]); |
121 | 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]); |
119 | 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]); |
122 | start_y+=rbmenu.item_h; |
120 | start_y+=rbmenu.item_h; |
123 | } |
121 | } |
124 | } |
122 | } |