Rev 3458 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3434 | leency | 1 | //Leency 2008-2013 |
2 | |||
3 | char *captions[] = { |
||
4 | "Open", "Enter", |
||
3439 | leency | 5 | "Open with...", "CrlEnt", |
3434 | leency | 6 | "View as text", "F3", |
7 | "View as HEX", "F4", |
||
3695 | leency | 8 | // |
9 | "Copy", "Crl+C", |
||
10 | "Cut", "Crl+X", |
||
11 | "Paste", "Crl+V", |
||
3434 | leency | 12 | "Rename", "F2", |
13 | "Delete", "Del", |
||
3440 | leency | 14 | //"Refresh", "F5", |
3695 | leency | 15 | 0, 0}; |
3434 | leency | 16 | |
3695 | leency | 17 | proc_info MenuForm; |
18 | |||
3434 | leency | 19 | void FileMenu() |
20 | { |
||
3439 | leency | 21 | mouse mm; |
3695 | leency | 22 | word id, key, slot, index; |
3439 | leency | 23 | int ccount=0, cur, newi, linew=10, lineh=18, texty; |
3695 | leency | 24 | for (index=0; captions[index]!=0; index+=2) |
3434 | leency | 25 | { |
26 | ccount++; |
||
3695 | leency | 27 | if (strlen(captions[index])>linew) linew = strlen(captions[index]); |
3434 | leency | 28 | } |
3439 | leency | 29 | linew = linew + 3 * 6 + 50; |
3434 | leency | 30 | texty = lineh/2-4; |
31 | SetEventMask(100111b); |
||
32 | |||
33 | goto _MENU_DRAW; |
||
34 | loop() switch(WaitEvent()) |
||
35 | { |
||
36 | case evMouse: |
||
37 | slot = GetProcessSlot(MenuForm.ID); |
||
38 | if (slot != GetActiveProcess()) ExitProcess(); |
||
3439 | leency | 39 | mm.get(); |
40 | newi = mm.y - 1 / lineh; |
||
3440 | leency | 41 | if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; |
3439 | leency | 42 | if (cur<>newi) |
43 | { |
||
44 | cur=newi; |
||
45 | goto _ITEMS_DRAW; |
||
46 | } |
||
3434 | leency | 47 | break; |
48 | |||
49 | case evButton: |
||
50 | id=GetButtonID(); |
||
51 | if (id==100) Open(); |
||
52 | if (id==101) notify("Not compleated yet"); |
||
3695 | leency | 53 | if (id==102) FnProcess(3); //F3 |
54 | if (id==103) FnProcess(4); //F4 |
||
55 | if (id==104) Copy(#file_path, NOCUT); |
||
56 | if (id==105) Copy(#file_path, CUT); |
||
57 | if (id==106) CreateThread(#Paste,#copy_stak); |
||
58 | if (id==107) FnProcess(2); |
||
59 | if (id==108) Del_Form(); |
||
60 | if (id==109) FnProcess(5); |
||
3434 | leency | 61 | ExitProcess(); |
62 | break; |
||
63 | |||
64 | case evKey: |
||
65 | IF (GetKey()==27) ExitProcess(); |
||
66 | break; |
||
67 | |||
68 | case evReDraw: _MENU_DRAW: |
||
3444 | leency | 69 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF); |
3434 | leency | 70 | GetProcessInfo(#MenuForm, SelfInfo); |
3439 | leency | 71 | DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); |
72 | DrawBar(1,1,linew,1,0xFFFfff); |
||
3444 | leency | 73 | PutShadow(linew+2,1,1,ccount*lineh+2,0,2); |
74 | PutShadow(linew+3,2,1,ccount*lineh+2,0,1); |
||
75 | PutShadow(1,ccount*lineh+3,linew+2,1,0,2); |
||
76 | PutShadow(2,ccount*lineh+4,linew+1,1,0,1); |
||
3434 | leency | 77 | |
3439 | leency | 78 | _ITEMS_DRAW: |
3695 | leency | 79 | for (index=0; captions[index*2]!=0; index++) |
3434 | leency | 80 | { |
3695 | leency | 81 | DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
82 | DrawBar(1,index*lineh+2,1,lineh,0xFFFfff); |
||
83 | if (index==cur) |
||
84 | { |
||
85 | DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff); |
||
86 | } |
||
87 | else |
||
88 | { |
||
89 | DrawBar(2,index*lineh+2,linew-1,lineh,col_work); |
||
90 | WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]); |
||
91 | } |
||
92 | WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]); |
||
93 | WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]); |
||
3434 | leency | 94 | } |
95 | } |
||
96 | }>0)>=0)> |