Rev 4072 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4042 | leency | 1 | //Leency 2008-2013 |
2 | |||
3 | //pay attension: >200 this is only file actions, not supported by folders |
||
4 | #ifdef LANG_RUS |
||
5 | char *file_captions[] = { |
||
6 | "Открыть", "Enter",100, |
||
7 | "Открыть с помощью...", "CrlEnt",201, |
||
8 | "Открыть как текст", "F3",202, |
||
9 | "Открыть как HEX", "F4",203, |
||
10 | "Копировать", "Crl+C",104, |
||
11 | "Вырезать", "Crl+X",105, |
||
12 | "Вставить", "Crl+V",106, |
||
13 | "Переименовать", "F2",207, |
||
14 | "Удалить", "Del",108, |
||
15 | "Обновить папку", "F5",109, |
||
16 | 0, 0, 0}; |
||
17 | #elif LANG_EST |
||
18 | char *file_captions[] = { |
||
19 | "Ava", "Enter",100, |
||
20 | "Ava ...", "CrlEnt",201, |
||
21 | "Vaata tekstina", "F3",202, |
||
22 | "Vaata HEX", "F4",203, |
||
23 | "Kopeeri", "Crl+C",104, |
||
24 | "Lїika", "Crl+X",105, |
||
25 | "Aseta", "Crl+V",106, |
||
26 | "Nimeta №mber", "F2",207, |
||
27 | "Kustuta", "Del",108, |
||
28 | "Vфrskenda", "F5",109, |
||
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, |
||
42 | 0, 0, 0}; |
||
43 | #endif |
||
44 | |||
45 | |||
46 | void FileMenu() |
||
47 | { |
||
48 | mouse mm; |
||
49 | word slot, index, start_y; |
||
50 | llist menu; |
||
51 | proc_info MenuForm; |
||
52 | int texty, newi; |
||
53 | |||
54 | menu.ClearList(); |
||
55 | menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18); |
||
56 | for (index=0; file_captions[index]!=0; index+=3) |
||
57 | { |
||
58 | if (itdir) && (file_captions[index+2]>=200) continue; |
||
59 | if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]); |
||
60 | menu.count++; |
||
61 | } |
||
62 | menu.w = menu.w + 3 * 6 + 50; |
||
63 | menu.h = menu.count*menu.line_h; |
||
64 | texty = menu.line_h/2-4; |
||
65 | SetEventMask(100111b); |
||
66 | goto _MENU_DRAW; |
||
67 | |||
68 | loop() switch(WaitEvent()) |
||
69 | { |
||
70 | case evMouse: |
||
71 | slot = GetProcessSlot(MenuForm.ID); |
||
72 | if (slot != GetActiveProcess()) ExitProcess(); |
||
73 | mm.get(); |
||
74 | newi = mm.y - 1 / menu.line_h; |
||
75 | if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) newi=-1; |
||
76 | if (menu.current<>newi) |
||
77 | { |
||
78 | menu.current=newi; |
||
79 | goto _ITEMS_DRAW; |
||
80 | } |
||
81 | break; |
||
82 | |||
83 | case evButton: |
||
84 | action_buf = GetButtonID(); |
||
85 | ExitProcess(); |
||
86 | break; |
||
87 | |||
88 | case evKey: |
||
89 | if (GetKey()==27) ExitProcess(); |
||
90 | break; |
||
91 | |||
92 | case evReDraw: _MENU_DRAW: |
||
93 | DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF); |
||
94 | GetProcessInfo(#MenuForm, SelfInfo); |
||
95 | DrawRectangle(0,0,menu.w+1,menu.h+2,col_border); |
||
96 | DrawBar(1,1,menu.w,1,0xFFFfff); |
||
97 | DrawPopupShadow(1,1,menu.w,menu.h,0); |
||
98 | |||
99 | _ITEMS_DRAW: |
||
100 | for (index=0, start_y=0; file_captions[index*3]!=0; index++) |
||
101 | { |
||
102 | DefineButton(1,start_y+1,menu.w,menu.line_h-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
||
103 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
||
104 | DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff); |
||
105 | if (start_y/menu.line_h==menu.current) |
||
106 | { |
||
107 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff); |
||
108 | } |
||
109 | else |
||
110 | { |
||
111 | DrawBar(2,start_y+2,menu.w-1,menu.line_h,col_work); |
||
112 | WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]); |
||
113 | } |
||
114 | WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]); |
||
115 | WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]); |
||
116 | start_y+=menu.line_h; |
||
117 | } |
||
118 | } |
||
119 | }>0)>=0)> |