Rev 3444 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3444 | Rev 3458 | ||
---|---|---|---|
1 | //Leency 2008-2013 |
1 | //Leency 2008-2013 |
2 | 2 | ||
3 | char *captions[] = { |
3 | char *captions[] = { |
4 | "Open", "Enter", |
4 | "Open", "Enter", |
5 | "Open with...", "CrlEnt", |
5 | "Open with...", "CrlEnt", |
6 | "View as text", "F3", |
6 | "View as text", "F3", |
7 | "View as HEX", "F4", |
7 | "View as HEX", "F4", |
8 | "Rename", "F2", |
8 | "Rename", "F2", |
9 | "Delete", "Del", |
9 | "Delete", "Del", |
10 | //"Refresh", "F5", |
10 | //"Refresh", "F5", |
11 | 0}; |
11 | 0}; |
12 | 12 | ||
13 | void FileMenu() |
13 | void FileMenu() |
14 | { |
14 | { |
15 | proc_info MenuForm; |
15 | proc_info MenuForm; |
16 | mouse mm; |
16 | mouse mm; |
17 | word id, key, slot; |
17 | word id, key, slot; |
18 | int ccount=0, cur, newi, linew=10, lineh=18, texty; |
18 | int ccount=0, cur, newi, linew=10, lineh=18, texty; |
19 | for (i=0; captions[i]!=0; i+=2) |
19 | for (i=0; captions[i]!=0; i+=2) |
20 | { |
20 | { |
21 | ccount++; |
21 | ccount++; |
22 | if (strlen(captions[i])>linew) linew = strlen(captions[i]); |
22 | if (strlen(captions[i])>linew) linew = strlen(captions[i]); |
23 | } |
23 | } |
24 | linew = linew + 3 * 6 + 50; |
24 | linew = linew + 3 * 6 + 50; |
25 | texty = lineh/2-4; |
25 | texty = lineh/2-4; |
26 | SetEventMask(100111b); |
26 | SetEventMask(100111b); |
27 | 27 | ||
28 | goto _MENU_DRAW; |
28 | goto _MENU_DRAW; |
29 | loop() switch(WaitEvent()) |
29 | loop() switch(WaitEvent()) |
30 | { |
30 | { |
31 | case evMouse: |
31 | case evMouse: |
32 | slot = GetProcessSlot(MenuForm.ID); |
32 | slot = GetProcessSlot(MenuForm.ID); |
33 | if (slot != GetActiveProcess()) ExitProcess(); |
33 | if (slot != GetActiveProcess()) ExitProcess(); |
34 | mm.get(); |
34 | mm.get(); |
35 | newi = mm.y - 1 / lineh; |
35 | newi = mm.y - 1 / lineh; |
36 | if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; |
36 | if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; |
37 | if (cur<>newi) |
37 | if (cur<>newi) |
38 | { |
38 | { |
39 | cur=newi; |
39 | cur=newi; |
40 | goto _ITEMS_DRAW; |
40 | goto _ITEMS_DRAW; |
41 | } |
41 | } |
42 | break; |
42 | break; |
43 | 43 | ||
44 | case evButton: |
44 | case evButton: |
45 | id=GetButtonID(); |
45 | id=GetButtonID(); |
46 | if (id==100) Open(); |
46 | if (id==100) Open(); |
47 | if (id==101) notify("Not compleated yet"); |
47 | if (id==101) notify("Not compleated yet"); |
48 | if (id==102) FnProcess(3); |
48 | if (id==102) FnProcess(3); |
49 | if (id==103) FnProcess(4); |
49 | if (id==103) FnProcess(4); |
50 | if (id==104) FnProcess(2); |
50 | if (id==104) FnProcess(2); |
51 | if (id==105) Del_Form(); |
51 | if (id==105) Del_Form(); |
52 | if (id==106) FnProcess(5); |
52 | if (id==106) FnProcess(5); |
- | 53 | SwitchToAnotherThread(); |
|
53 | ExitProcess(); |
54 | ExitProcess(); |
54 | break; |
55 | break; |
55 | 56 | ||
56 | case evKey: |
57 | case evKey: |
57 | IF (GetKey()==27) ExitProcess(); |
58 | IF (GetKey()==27) ExitProcess(); |
58 | break; |
59 | break; |
59 | 60 | ||
60 | case evReDraw: _MENU_DRAW: |
61 | case evReDraw: _MENU_DRAW: |
61 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF); |
62 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF); |
62 | GetProcessInfo(#MenuForm, SelfInfo); |
63 | GetProcessInfo(#MenuForm, SelfInfo); |
63 | /* _PutImage(1,23, 16,44, #factions); //èêîíêè */ |
64 | /* _PutImage(1,23, 16,44, #factions); //èêîíêè */ |
64 | DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); |
65 | DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); |
65 | DrawBar(1,1,linew,1,0xFFFfff); |
66 | DrawBar(1,1,linew,1,0xFFFfff); |
66 | PutShadow(linew+2,1,1,ccount*lineh+2,0,2); |
67 | PutShadow(linew+2,1,1,ccount*lineh+2,0,2); |
67 | PutShadow(linew+3,2,1,ccount*lineh+2,0,1); |
68 | PutShadow(linew+3,2,1,ccount*lineh+2,0,1); |
68 | PutShadow(1,ccount*lineh+3,linew+2,1,0,2); |
69 | PutShadow(1,ccount*lineh+3,linew+2,1,0,2); |
69 | PutShadow(2,ccount*lineh+4,linew+1,1,0,1); |
70 | PutShadow(2,ccount*lineh+4,linew+1,1,0,1); |
70 | 71 | ||
71 | _ITEMS_DRAW: |
72 | _ITEMS_DRAW: |
72 | for (i=0; captions[i*2]!=0; i++) |
73 | for (i=0; captions[i*2]!=0; i++) |
73 | { |
74 | { |
74 | DefineButton(1,i*lineh+1,linew,lineh-1,i+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
75 | DefineButton(1,i*lineh+1,linew,lineh-1,i+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
75 | DrawBar(1,i*lineh+2,1,lineh,0xFFFfff); |
76 | DrawBar(1,i*lineh+2,1,lineh,0xFFFfff); |
76 | if (i==cur) DrawBar(2,i*lineh+2,linew-1,lineh,0xFFFfff); else DrawBar(2,i*lineh+2,linew-1,lineh,col_work); |
77 | if (i==cur) DrawBar(2,i*lineh+2,linew-1,lineh,0xFFFfff); else DrawBar(2,i*lineh+2,linew-1,lineh,col_work); |
77 | WriteText(7,i*lineh+texty+2,0x80,0x000000,captions[i*2]); |
78 | WriteText(7,i*lineh+texty+2,0x80,0x000000,captions[i*2]); |
78 | WriteText(-strlen(captions[i*2+1])*6-6+linew,i*lineh+texty+2,0x80,0x999999,captions[i*2+1]); |
79 | WriteText(-strlen(captions[i*2+1])*6-6+linew,i*lineh+texty+2,0x80,0x999999,captions[i*2+1]); |
79 | } |
80 | } |
80 | } |
81 | } |
81 | }>0)>=0)> |
82 | }>0)>=0)> |