2013-03-31 22:25:54 +02:00
|
|
|
|
//Leency 2008-2013
|
|
|
|
|
|
2013-10-10 00:46:17 +02:00
|
|
|
|
//pay attension: >200 this is only file actions, not supported by folders
|
2013-08-04 01:35:59 +02:00
|
|
|
|
#ifdef LANG_RUS
|
2013-10-10 00:46:17 +02:00
|
|
|
|
char *file_captions[] = {
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Enter",100,
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...", "CrlEnt",201,
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ⥪<><E2A5AA>", "F3",202,
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> HEX", "F4",203,
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Crl+C",104,
|
|
|
|
|
"<EFBFBD><EFBFBD>१<EFBFBD><EFBFBD><EFBFBD>", "Crl+X",105,
|
|
|
|
|
"<EFBFBD><EFBFBD>⠢<EFBFBD><EFBFBD><EFBFBD>", "Crl+V",106,
|
2013-10-15 01:16:04 +02:00
|
|
|
|
"<EFBFBD><EFBFBD>२<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "F2",207,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Del",108,
|
2013-10-15 01:16:04 +02:00
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>", "F5",109,
|
2015-02-22 19:42:51 +01:00
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢠", "",110,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
0, 0, 0};
|
2013-09-24 20:50:05 +02:00
|
|
|
|
#elif LANG_EST
|
2013-10-10 00:46:17 +02:00
|
|
|
|
char *file_captions[] = {
|
|
|
|
|
"Ava", "Enter",100,
|
|
|
|
|
"Ava ...", "CrlEnt",201,
|
|
|
|
|
"Vaata tekstina", "F3",202,
|
|
|
|
|
"Vaata HEX", "F4",203,
|
|
|
|
|
"Kopeeri", "Crl+C",104,
|
|
|
|
|
"L<EFBFBD>ika", "Crl+X",105,
|
|
|
|
|
"Aseta", "Crl+V",106,
|
2013-10-15 01:16:04 +02:00
|
|
|
|
"Nimeta <20>mber", "F2",207,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
"Kustuta", "Del",108,
|
|
|
|
|
"V<EFBFBD>rskenda", "F5",109,
|
2015-02-22 19:42:51 +01:00
|
|
|
|
"Properties", "",110,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
0, 0, 0};
|
2013-08-04 01:35:59 +02:00
|
|
|
|
#else
|
2013-10-10 00:46:17 +02:00
|
|
|
|
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,
|
2013-10-15 01:16:04 +02:00
|
|
|
|
"Rename", "F2",207,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
"Delete", "Del",108,
|
|
|
|
|
"Refresh", "F5",109,
|
2015-02-22 19:42:51 +01:00
|
|
|
|
"Properties", "",110,
|
2013-10-10 00:46:17 +02:00
|
|
|
|
0, 0, 0};
|
2013-08-04 01:35:59 +02:00
|
|
|
|
#endif
|
2013-06-22 00:49:43 +02:00
|
|
|
|
|
2017-09-12 17:32:38 +02:00
|
|
|
|
llist rbmenu;
|
2013-10-22 23:34:18 +02:00
|
|
|
|
int cur_action_buf;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
|
|
|
|
|
void FileMenu()
|
|
|
|
|
{
|
2013-10-10 00:46:17 +02:00
|
|
|
|
proc_info MenuForm;
|
2013-10-22 23:34:18 +02:00
|
|
|
|
int index;
|
2013-10-17 01:48:20 +02:00
|
|
|
|
|
2017-09-12 17:32:38 +02:00
|
|
|
|
rbmenu.ClearList();
|
|
|
|
|
rbmenu.SetFont(6, 9, 0x80);
|
|
|
|
|
rbmenu.SetSizes(0,0,10,0,18);
|
2013-10-10 00:46:17 +02:00
|
|
|
|
for (index=0; file_captions[index]!=0; index+=3)
|
2013-03-31 22:25:54 +02:00
|
|
|
|
{
|
2013-10-10 00:46:17 +02:00
|
|
|
|
if (itdir) && (file_captions[index+2]>=200) continue;
|
2017-09-12 17:32:38 +02:00
|
|
|
|
if (selected_count > 0) && (file_captions[index+2]==100) continue; //do not show "open" for several files
|
|
|
|
|
if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]);
|
|
|
|
|
rbmenu.count++;
|
|
|
|
|
rbmenu.visible++;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
}
|
2017-09-12 17:32:38 +02:00
|
|
|
|
rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
|
|
|
|
|
rbmenu.h = rbmenu.count * rbmenu.item_h;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
SetEventMask(100111b);
|
|
|
|
|
goto _MENU_DRAW;
|
2013-10-17 01:48:20 +02:00
|
|
|
|
|
2013-03-31 22:25:54 +02:00
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2015-08-02 00:08:58 +02:00
|
|
|
|
mouse.get();
|
2015-07-16 03:44:30 +02:00
|
|
|
|
if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
|
2017-09-12 17:32:38 +02:00
|
|
|
|
else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
|
2015-08-02 00:08:58 +02:00
|
|
|
|
else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
|
2015-07-16 03:44:30 +02:00
|
|
|
|
break;
|
2013-03-31 22:25:54 +02:00
|
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:55:14 +02:00
|
|
|
|
GetKeys();
|
2015-09-06 14:34:30 +02:00
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
|
|
|
|
|
if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
|
2017-09-12 17:32:38 +02:00
|
|
|
|
if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw();
|
2013-03-31 22:25:54 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw: _MENU_DRAW:
|
2017-09-12 17:32:38 +02:00
|
|
|
|
if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
|
|
|
|
|
else DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
|
2013-03-31 22:25:54 +02:00
|
|
|
|
GetProcessInfo(#MenuForm, SelfInfo);
|
2017-09-12 17:32:38 +02:00
|
|
|
|
DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
|
|
|
|
|
DrawBar(1,1,rbmenu.w,1,0xFFFfff);
|
|
|
|
|
DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0);
|
2013-10-22 23:34:18 +02:00
|
|
|
|
MenuListRedraw();
|
2013-03-31 22:25:54 +02:00
|
|
|
|
}
|
2013-10-22 23:34:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuListRedraw()
|
|
|
|
|
{
|
|
|
|
|
int start_y=0;
|
|
|
|
|
int index;
|
|
|
|
|
for (index=0; file_captions[index*3]!=0; index++)
|
|
|
|
|
{
|
|
|
|
|
if ((itdir) && (file_captions[index*3+2]>=200)) continue;
|
2017-09-12 17:32:38 +02:00
|
|
|
|
if (selected_count > 0) && (file_captions[index+2]==100) continue;
|
|
|
|
|
DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff);
|
|
|
|
|
if (start_y/rbmenu.item_h==rbmenu.cur_y)
|
2013-10-22 23:34:18 +02:00
|
|
|
|
{
|
|
|
|
|
cur_action_buf = file_captions[index*3+2];
|
2017-09-12 17:32:38 +02:00
|
|
|
|
DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,0xFFFfff);
|
2013-10-22 23:34:18 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-09-12 17:32:38 +02:00
|
|
|
|
DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,col_work);
|
|
|
|
|
WriteText(8,start_y+rbmenu.text_y+4,rbmenu.font_type,0xf2f2f2,file_captions[index*3]);
|
2013-10-22 23:34:18 +02:00
|
|
|
|
}
|
2017-09-12 17:32:38 +02:00
|
|
|
|
WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0, file_captions[index*3]);
|
|
|
|
|
WriteText(-strlen(file_captions[index*3+1])-1*rbmenu.font_w + rbmenu.w, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0x888888, file_captions[index*3+1]);
|
|
|
|
|
start_y+=rbmenu.item_h;
|
2013-10-22 23:34:18 +02:00
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
|
}
|