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