Rev 4078 | Rev 4136 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4078 | Rev 4081 | ||
---|---|---|---|
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 | 0, 0, 0}; |
16 | 0, 0, 0}; |
17 | #elif LANG_EST |
17 | #elif LANG_EST |
18 | char *file_captions[] = { |
18 | char *file_captions[] = { |
19 | "Ava", "Enter",100, |
19 | "Ava", "Enter",100, |
20 | "Ava ...", "CrlEnt",201, |
20 | "Ava ...", "CrlEnt",201, |
21 | "Vaata tekstina", "F3",202, |
21 | "Vaata tekstina", "F3",202, |
22 | "Vaata HEX", "F4",203, |
22 | "Vaata HEX", "F4",203, |
23 | "Kopeeri", "Crl+C",104, |
23 | "Kopeeri", "Crl+C",104, |
24 | "Lõika", "Crl+X",105, |
24 | "Lõika", "Crl+X",105, |
25 | "Aseta", "Crl+V",106, |
25 | "Aseta", "Crl+V",106, |
26 | "Nimeta ümber", "F2",207, |
26 | "Nimeta ümber", "F2",207, |
27 | "Kustuta", "Del",108, |
27 | "Kustuta", "Del",108, |
28 | "Värskenda", "F5",109, |
28 | "Värskenda", "F5",109, |
29 | 0, 0, 0}; |
29 | 0, 0, 0}; |
30 | #else |
30 | #else |
31 | char *file_captions[] = { |
31 | char *file_captions[] = { |
32 | "Open", "Enter",100, |
32 | "Open", "Enter",100, |
33 | "Open with...", "CrlEnt",201, |
33 | "Open with...", "CrlEnt",201, |
34 | "View as text", "F3",202, |
34 | "View as text", "F3",202, |
35 | "View as HEX", "F4",203, |
35 | "View as HEX", "F4",203, |
36 | "Copy", "Crl+C",104, |
36 | "Copy", "Crl+C",104, |
37 | "Cut", "Crl+X",105, |
37 | "Cut", "Crl+X",105, |
38 | "Paste", "Crl+V",106, |
38 | "Paste", "Crl+V",106, |
39 | "Rename", "F2",207, |
39 | "Rename", "F2",207, |
40 | "Delete", "Del",108, |
40 | "Delete", "Del",108, |
41 | "Refresh", "F5",109, |
41 | "Refresh", "F5",109, |
42 | 0, 0, 0}; |
42 | 0, 0, 0}; |
43 | #endif |
43 | #endif |
44 | 44 | ||
45 | llist menu; |
45 | llist menu; |
46 | int cur_action_buf; |
46 | int cur_action_buf; |
47 | 47 | ||
48 | void FileMenu() |
48 | void FileMenu() |
49 | { |
49 | { |
50 | mouse mm; |
50 | mouse mm; |
51 | word slot, key; |
51 | word key; |
52 | proc_info MenuForm; |
52 | proc_info MenuForm; |
53 | int index; |
53 | int index; |
54 | 54 | ||
55 | menu.ClearList(); |
55 | menu.ClearList(); |
56 | menu.SetSizes(0,0,10,0,0,18); |
56 | menu.SetSizes(0,0,10,0,0,18); |
57 | for (index=0; file_captions[index]!=0; index+=3) |
57 | for (index=0; file_captions[index]!=0; index+=3) |
58 | { |
58 | { |
59 | if (itdir) && (file_captions[index+2]>=200) continue; |
59 | if (itdir) && (file_captions[index+2]>=200) continue; |
60 | if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]); |
60 | if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]); |
61 | menu.count++; |
61 | menu.count++; |
62 | menu.visible++; |
62 | menu.visible++; |
63 | } |
63 | } |
64 | menu.w = menu.w + 3 * 6 + 50; |
64 | menu.w = menu.w + 3 * 6 + 50; |
65 | menu.h = menu.count*menu.line_h; |
65 | menu.h = menu.count*menu.line_h; |
66 | SetEventMask(100111b); |
66 | SetEventMask(100111b); |
67 | goto _MENU_DRAW; |
67 | goto _MENU_DRAW; |
68 | 68 | ||
69 | loop() switch(WaitEvent()) |
69 | loop() switch(WaitEvent()) |
70 | { |
70 | { |
71 | case evMouse: |
71 | case evMouse: |
72 | slot = GetProcessSlot(MenuForm.ID); |
- | |
73 | if (slot != GetActiveProcess()) ExitProcess(); |
72 | if (!CheckActiveProcess(MenuForm.ID)) ExitProcess(); |
74 | mm.get(); |
73 | mm.get(); |
75 | if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw(); |
74 | if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw(); |
76 | if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); } |
75 | if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); } |
77 | break; |
76 | break; |
78 | 77 | ||
79 | case evKey: |
78 | case evKey: |
80 | key = GetKey(); |
79 | key = GetKey(); |
81 | if (key==27) ExitProcess(); |
80 | if (key==27) ExitProcess(); |
82 | if (key == 13) {action_buf = cur_action_buf; ExitProcess(); } |
81 | if (key == 13) {action_buf = cur_action_buf; ExitProcess(); } |
83 | if (menu.ProcessKey(key)) MenuListRedraw(); |
82 | if (menu.ProcessKey(key)) MenuListRedraw(); |
84 | break; |
83 | break; |
85 | 84 | ||
86 | case evReDraw: _MENU_DRAW: |
85 | case evReDraw: _MENU_DRAW: |
87 | DefineAndDrawWindow(m.x+Form.left+5, m.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); |
86 | DefineAndDrawWindow(m.x+Form.left+5, m.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); |
88 | GetProcessInfo(#MenuForm, SelfInfo); |
87 | GetProcessInfo(#MenuForm, SelfInfo); |
89 | DrawRectangle(0,0,menu.w+1,menu.h+2,sc.work_graph); |
88 | DrawRectangle(0,0,menu.w+1,menu.h+2,sc.work_graph); |
90 | DrawBar(1,1,menu.w,1,0xFFFfff); |
89 | DrawBar(1,1,menu.w,1,0xFFFfff); |
91 | DrawPopupShadow(1,1,menu.w,menu.h,0); |
90 | DrawPopupShadow(1,1,menu.w,menu.h,0); |
92 | MenuListRedraw(); |
91 | MenuListRedraw(); |
93 | } |
92 | } |
94 | } |
93 | } |
95 | 94 | ||
96 | void MenuListRedraw() |
95 | void MenuListRedraw() |
97 | { |
96 | { |
98 | int start_y=0; |
97 | int start_y=0; |
99 | int index; |
98 | int index; |
100 | for (index=0; file_captions[index*3]!=0; index++) |
99 | for (index=0; file_captions[index*3]!=0; index++) |
101 | { |
100 | { |
102 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
101 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
103 | DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff); |
102 | DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff); |
104 | if (start_y/menu.line_h==menu.current) |
103 | if (start_y/menu.line_h==menu.current) |
105 | { |
104 | { |
106 | cur_action_buf = file_captions[index*3+2]; |
105 | cur_action_buf = file_captions[index*3+2]; |
107 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff); |
106 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff); |
108 | } |
107 | } |
109 | else |
108 | else |
110 | { |
109 | { |
111 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,sc.work); |
110 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,sc.work); |
112 | WriteText(8,start_y+menu.text_y+3,0x80,0xf2f2f2,file_captions[index*3]); |
111 | WriteText(8,start_y+menu.text_y+3,0x80,0xf2f2f2,file_captions[index*3]); |
113 | } |
112 | } |
114 | WriteText(7,start_y+menu.text_y+2,0x80,sc.work_text,file_captions[index*3]); |
113 | WriteText(7,start_y+menu.text_y+2,0x80,sc.work_text,file_captions[index*3]); |
115 | WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+menu.text_y+2,0x80,0x888888,file_captions[index*3+1]); |
114 | 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 | start_y+=menu.line_h; |
115 | start_y+=menu.line_h; |
117 | } |
116 | } |
118 | } |
117 | } |