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