9747cd3910
git-svn-id: svn://kolibrios.org@3997 a494cfbc-eb01-0410-851d-a64ba20cac60
124 lines
3.6 KiB
C
124 lines
3.6 KiB
C
//Leency 2008-2013
|
||
|
||
//pay attension: >200 this is only file actions, not supported by folders
|
||
#ifdef LANG_RUS
|
||
char *file_captions[] = {
|
||
"Žâªàëâì", "Enter",100,
|
||
"Žâªàëâì á ¯®¬®éìî...", "CrlEnt",201,
|
||
"Žâªàëâì ª ª ⥪áâ", "F3",202,
|
||
"Žâªàëâì ª ª HEX", "F4",203,
|
||
"Š®¯¨à®¢ âì", "Crl+C",104,
|
||
"‚ë१ âì", "Crl+X",105,
|
||
"‚áâ ¢¨âì", "Crl+V",106,
|
||
"<EFBFBD>¥à¥¨¬¥®¢ âì", "F2",107,
|
||
"“¤ «¨âì", "Del",108,
|
||
"Ž¡®¢¨âì", "F5",109,
|
||
0, 0, 0};
|
||
#elif LANG_EST
|
||
char *file_captions[] = {
|
||
"Ava", "Enter",100,
|
||
"Ava ...", "CrlEnt",201,
|
||
"Vaata tekstina", "F3",202,
|
||
"Vaata HEX", "F4",203,
|
||
"Kopeeri", "Crl+C",104,
|
||
"Lõika", "Crl+X",105,
|
||
"Aseta", "Crl+V",106,
|
||
"Nimeta ümber", "F2",107,
|
||
"Kustuta", "Del",108,
|
||
"Värskenda", "F5",109,
|
||
0, 0, 0};
|
||
#else
|
||
char *file_captions[] = {
|
||
"Open", "Enter",100,
|
||
"Open with...", "CrlEnt",201,
|
||
"View as text", "F3",202,
|
||
"View as HEX", "F4",203,
|
||
"Copy", "Crl+C",104,
|
||
"Cut", "Crl+X",105,
|
||
"Paste", "Crl+V",106,
|
||
"Rename", "F2",107,
|
||
"Delete", "Del",108,
|
||
"Refresh", "F5",109,
|
||
0, 0, 0};
|
||
#endif
|
||
|
||
|
||
void FileMenu()
|
||
{
|
||
mouse mm;
|
||
word id, key, slot, index, start_y;
|
||
proc_info MenuForm;
|
||
int ccount=0, cur=0, newi, linew=10, lineh=18, texty;
|
||
for (index=0; file_captions[index]!=0; index+=3)
|
||
{
|
||
if (itdir) && (file_captions[index+2]>=200) continue;
|
||
if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]);
|
||
ccount++;
|
||
}
|
||
linew = linew + 3 * 6 + 50;
|
||
texty = lineh/2-4;
|
||
SetEventMask(100111b);
|
||
|
||
goto _MENU_DRAW;
|
||
loop() switch(WaitEvent())
|
||
{
|
||
case evMouse:
|
||
slot = GetProcessSlot(MenuForm.ID);
|
||
if (slot != GetActiveProcess()) ExitProcess();
|
||
mm.get();
|
||
newi = mm.y - 1 / lineh;
|
||
if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
|
||
if (cur<>newi)
|
||
{
|
||
cur=newi;
|
||
goto _ITEMS_DRAW;
|
||
}
|
||
break;
|
||
|
||
case evButton:
|
||
id=GetButtonID();
|
||
if (id==100) Open();
|
||
if (id==201) notify("Not compleated yet");
|
||
if (id==202) FnProcess(3); //F3
|
||
if (id==203) FnProcess(4); //F4
|
||
if (id==104) Copy(#file_path, NOCUT);
|
||
if (id==105) Copy(#file_path, CUT);
|
||
if (id==106) CreateThread(#Paste,#copy_stak);
|
||
if (id==107) FnProcess(2);
|
||
if (id==108) Del_Form();
|
||
if (id==109) FnProcess(5);
|
||
ExitProcess();
|
||
break;
|
||
|
||
case evKey:
|
||
IF (GetKey()==27) ExitProcess();
|
||
break;
|
||
|
||
case evReDraw: _MENU_DRAW:
|
||
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
|
||
GetProcessInfo(#MenuForm, SelfInfo);
|
||
DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
|
||
DrawBar(1,1,linew,1,0xFFFfff);
|
||
DrawPopupShadow(1,1,linew,ccount*lineh,0);
|
||
|
||
_ITEMS_DRAW:
|
||
for (index=0, start_y=0; file_captions[index*3]!=0; index++)
|
||
{
|
||
DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
|
||
if ((itdir) && (file_captions[index*3+2]>=200)) continue;
|
||
DrawBar(1,start_y+2,1,lineh,0xFFFfff);
|
||
if (start_y/lineh==cur)
|
||
{
|
||
DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff);
|
||
}
|
||
else
|
||
{
|
||
DrawBar(2,start_y+2,linew-1,lineh,col_work);
|
||
WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]);
|
||
}
|
||
WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
|
||
WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
|
||
start_y+=lineh;
|
||
}
|
||
}
|
||
} |