2013-03-31 22:25:54 +02:00
|
|
|
|
//Leency 2008-2013
|
|
|
|
|
|
|
|
|
|
char *captions[] = {
|
|
|
|
|
"Open", "Enter",
|
2013-04-01 17:41:17 +02:00
|
|
|
|
"Open with...", "CrlEnt",
|
2013-03-31 22:25:54 +02:00
|
|
|
|
"View as text", "F3",
|
|
|
|
|
"View as HEX", "F4",
|
|
|
|
|
"Rename", "F2",
|
|
|
|
|
"Delete", "Del",
|
2013-04-02 15:33:32 +02:00
|
|
|
|
//"Refresh", "F5",
|
2013-03-31 22:25:54 +02:00
|
|
|
|
0};
|
|
|
|
|
|
|
|
|
|
void FileMenu()
|
|
|
|
|
{
|
|
|
|
|
proc_info MenuForm;
|
2013-04-01 17:41:17 +02:00
|
|
|
|
mouse mm;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
word id, key, slot;
|
2013-04-01 17:41:17 +02:00
|
|
|
|
int ccount=0, cur, newi, linew=10, lineh=18, texty;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
for (i=0; captions[i]!=0; i+=2)
|
|
|
|
|
{
|
|
|
|
|
ccount++;
|
|
|
|
|
if (strlen(captions[i])>linew) linew = strlen(captions[i]);
|
|
|
|
|
}
|
2013-04-01 17:41:17 +02:00
|
|
|
|
linew = linew + 3 * 6 + 50;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
texty = lineh/2-4;
|
|
|
|
|
SetEventMask(100111b);
|
|
|
|
|
|
|
|
|
|
goto _MENU_DRAW;
|
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
|
|
|
|
slot = GetProcessSlot(MenuForm.ID);
|
|
|
|
|
if (slot != GetActiveProcess()) ExitProcess();
|
2013-04-01 17:41:17 +02:00
|
|
|
|
mm.get();
|
|
|
|
|
newi = mm.y - 1 / lineh;
|
2013-04-02 15:33:32 +02:00
|
|
|
|
if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
|
2013-04-01 17:41:17 +02:00
|
|
|
|
if (cur<>newi)
|
|
|
|
|
{
|
|
|
|
|
cur=newi;
|
|
|
|
|
goto _ITEMS_DRAW;
|
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
if (id==100) Open();
|
|
|
|
|
if (id==101) notify("Not compleated yet");
|
2013-04-04 19:07:38 +02:00
|
|
|
|
if (id==102) FnProcess(3);
|
|
|
|
|
if (id==103) FnProcess(4);
|
|
|
|
|
if (id==104) FnProcess(2);
|
2013-03-31 22:25:54 +02:00
|
|
|
|
if (id==105) Del_Form();
|
2013-04-04 19:07:38 +02:00
|
|
|
|
if (id==106) FnProcess(5);
|
2013-04-08 15:21:32 +02:00
|
|
|
|
SwitchToAnotherThread();
|
2013-03-31 22:25:54 +02:00
|
|
|
|
ExitProcess();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
|
|
|
|
IF (GetKey()==27) ExitProcess();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw: _MENU_DRAW:
|
2013-04-04 19:07:38 +02:00
|
|
|
|
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
|
2013-03-31 22:25:54 +02:00
|
|
|
|
GetProcessInfo(#MenuForm, SelfInfo);
|
|
|
|
|
/* _PutImage(1,23, 16,44, #factions); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2013-04-01 17:41:17 +02:00
|
|
|
|
DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
|
|
|
|
|
DrawBar(1,1,linew,1,0xFFFfff);
|
2013-04-04 19:07:38 +02:00
|
|
|
|
PutShadow(linew+2,1,1,ccount*lineh+2,0,2);
|
|
|
|
|
PutShadow(linew+3,2,1,ccount*lineh+2,0,1);
|
|
|
|
|
PutShadow(1,ccount*lineh+3,linew+2,1,0,2);
|
|
|
|
|
PutShadow(2,ccount*lineh+4,linew+1,1,0,1);
|
2013-03-31 22:25:54 +02:00
|
|
|
|
|
2013-04-01 17:41:17 +02:00
|
|
|
|
_ITEMS_DRAW:
|
2013-03-31 22:25:54 +02:00
|
|
|
|
for (i=0; captions[i*2]!=0; i++)
|
|
|
|
|
{
|
2013-04-01 17:41:17 +02:00
|
|
|
|
DefineButton(1,i*lineh+1,linew,lineh-1,i+100+BT_HIDE+BT_NOFRAME,0xFFFFFF);
|
|
|
|
|
DrawBar(1,i*lineh+2,1,lineh,0xFFFfff);
|
|
|
|
|
if (i==cur) DrawBar(2,i*lineh+2,linew-1,lineh,0xFFFfff); else DrawBar(2,i*lineh+2,linew-1,lineh,col_work);
|
|
|
|
|
WriteText(7,i*lineh+texty+2,0x80,0x000000,captions[i*2]);
|
|
|
|
|
WriteText(-strlen(captions[i*2+1])*6-6+linew,i*lineh+texty+2,0x80,0x999999,captions[i*2+1]);
|
2013-03-31 22:25:54 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|