Rev 3991 | 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 | |||
3997 | leency | 3 | //pay attension: >200 this is only file actions, not supported by folders |
3848 | punk_joker | 4 | #ifdef LANG_RUS |
3997 | leency | 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",107, |
||
14 | "Удалить", "Del",108, |
||
15 | "Обновить", "F5",109, |
||
16 | 0, 0, 0}; |
||
3933 | kaitz | 17 | #elif LANG_EST |
3997 | leency | 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",107, |
||
27 | "Kustuta", "Del",108, |
||
28 | "Vфrskenda", "F5",109, |
||
29 | 0, 0, 0}; |
||
3848 | punk_joker | 30 | #else |
3997 | leency | 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",107, |
||
40 | "Delete", "Del",108, |
||
41 | "Refresh", "F5",109, |
||
42 | 0, 0, 0}; |
||
3848 | punk_joker | 43 | #endif |
3434 | leency | 44 | |
3695 | leency | 45 | |
3434 | leency | 46 | void FileMenu() |
47 | { |
||
3439 | leency | 48 | mouse mm; |
3997 | leency | 49 | word id, key, slot, index, start_y; |
50 | proc_info MenuForm; |
||
51 | int ccount=0, cur=0, newi, linew=10, lineh=18, texty; |
||
52 | for (index=0; file_captions[index]!=0; index+=3) |
||
3434 | leency | 53 | { |
3997 | leency | 54 | if (itdir) && (file_captions[index+2]>=200) continue; |
55 | if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]); |
||
3434 | leency | 56 | ccount++; |
57 | } |
||
3439 | leency | 58 | linew = linew + 3 * 6 + 50; |
3434 | leency | 59 | texty = lineh/2-4; |
60 | SetEventMask(100111b); |
||
61 | |||
62 | goto _MENU_DRAW; |
||
63 | loop() switch(WaitEvent()) |
||
64 | { |
||
65 | case evMouse: |
||
66 | slot = GetProcessSlot(MenuForm.ID); |
||
67 | if (slot != GetActiveProcess()) ExitProcess(); |
||
3439 | leency | 68 | mm.get(); |
69 | newi = mm.y - 1 / lineh; |
||
3440 | leency | 70 | if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; |
3439 | leency | 71 | if (cur<>newi) |
72 | { |
||
73 | cur=newi; |
||
74 | goto _ITEMS_DRAW; |
||
75 | } |
||
3434 | leency | 76 | break; |
77 | |||
78 | case evButton: |
||
79 | id=GetButtonID(); |
||
80 | if (id==100) Open(); |
||
3997 | leency | 81 | if (id==201) notify("Not compleated yet"); |
82 | if (id==202) FnProcess(3); //F3 |
||
83 | if (id==203) FnProcess(4); //F4 |
||
3695 | leency | 84 | if (id==104) Copy(#file_path, NOCUT); |
85 | if (id==105) Copy(#file_path, CUT); |
||
86 | if (id==106) CreateThread(#Paste,#copy_stak); |
||
87 | if (id==107) FnProcess(2); |
||
88 | if (id==108) Del_Form(); |
||
89 | if (id==109) FnProcess(5); |
||
3434 | leency | 90 | ExitProcess(); |
91 | break; |
||
92 | |||
93 | case evKey: |
||
94 | IF (GetKey()==27) ExitProcess(); |
||
95 | break; |
||
96 | |||
97 | case evReDraw: _MENU_DRAW: |
||
3444 | leency | 98 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF); |
3434 | leency | 99 | GetProcessInfo(#MenuForm, SelfInfo); |
3439 | leency | 100 | DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); |
101 | DrawBar(1,1,linew,1,0xFFFfff); |
||
3991 | leency | 102 | DrawPopupShadow(1,1,linew,ccount*lineh,0); |
3434 | leency | 103 | |
3439 | leency | 104 | _ITEMS_DRAW: |
3997 | leency | 105 | for (index=0, start_y=0; file_captions[index*3]!=0; index++) |
3434 | leency | 106 | { |
3997 | leency | 107 | DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
108 | if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
||
109 | DrawBar(1,start_y+2,1,lineh,0xFFFfff); |
||
110 | if (start_y/lineh==cur) |
||
3695 | leency | 111 | { |
3997 | leency | 112 | DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff); |
3695 | leency | 113 | } |
114 | else |
||
115 | { |
||
3997 | leency | 116 | DrawBar(2,start_y+2,linew-1,lineh,col_work); |
117 | WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]); |
||
3695 | leency | 118 | } |
3997 | leency | 119 | WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]); |
120 | WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]); |
||
121 | start_y+=lineh; |
||
3434 | leency | 122 | } |
123 | } |
||
124 | }>0)>=0)> |