Eolite 2.0.2: menu keys

git-svn-id: svn://kolibrios.org@4072 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-22 21:34:18 +00:00
parent 0531f80f4d
commit a26384aaa8
3 changed files with 44 additions and 53 deletions

View File

@ -79,8 +79,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v2.0.1" #define TITLE "Eolite File Manager v2.0.2"
#define ABOUT_TITLE "Eolite v2.0.1" #define ABOUT_TITLE "Eolite v2.0.2"
dword col_work = 0xE4DFE1; dword col_work = 0xE4DFE1;
dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; dword col_border = 0x9098B0; //A0A0B8; //0x819FC5;
dword col_padding = 0xC8C9C9; dword col_padding = 0xC8C9C9;

View File

@ -42,14 +42,15 @@ char *file_captions[] = {
0, 0, 0}; 0, 0, 0};
#endif #endif
llist menu;
int cur_action_buf;
void FileMenu() void FileMenu()
{ {
mouse mm; mouse mm;
word slot, index, start_y; word slot, key;
llist menu;
proc_info MenuForm; proc_info MenuForm;
int texty, newi; int index;
menu.ClearList(); menu.ClearList();
menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18); menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18);
@ -58,10 +59,10 @@ void FileMenu()
if (itdir) && (file_captions[index+2]>=200) continue; if (itdir) && (file_captions[index+2]>=200) continue;
if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]); if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
menu.count++; menu.count++;
menu.visible++;
} }
menu.w = menu.w + 3 * 6 + 50; menu.w = menu.w + 3 * 6 + 50;
menu.h = menu.count*menu.line_h; menu.h = menu.count*menu.line_h;
texty = menu.line_h/2-4;
SetEventMask(100111b); SetEventMask(100111b);
goto _MENU_DRAW; goto _MENU_DRAW;
@ -71,22 +72,21 @@ void FileMenu()
slot = GetProcessSlot(MenuForm.ID); slot = GetProcessSlot(MenuForm.ID);
if (slot != GetActiveProcess()) ExitProcess(); if (slot != GetActiveProcess()) ExitProcess();
mm.get(); mm.get();
newi = mm.y - 1 / menu.line_h; menu.current_temp = mm.y - 1 / menu.line_h;
if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) newi=-1; if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) menu.current_temp = -1;
if (menu.current<>newi) if (menu.current<>menu.current_temp)
{ {
menu.current=newi; menu.current=menu.current_temp;
goto _ITEMS_DRAW; MenuListRedraw();
} }
break; if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); }
case evButton:
action_buf = GetButtonID();
ExitProcess();
break; break;
case evKey: case evKey:
if (GetKey()==27) ExitProcess(); key = GetKey();
if (key==27) ExitProcess();
if (key == 13) {action_buf = cur_action_buf; ExitProcess(); }
if (menu.ProcessKey(key)) MenuListRedraw();
break; break;
case evReDraw: _MENU_DRAW: case evReDraw: _MENU_DRAW:
@ -95,25 +95,31 @@ void FileMenu()
DrawRectangle(0,0,menu.w+1,menu.h+2,col_border); DrawRectangle(0,0,menu.w+1,menu.h+2,col_border);
DrawBar(1,1,menu.w,1,0xFFFfff); DrawBar(1,1,menu.w,1,0xFFFfff);
DrawPopupShadow(1,1,menu.w,menu.h,0); DrawPopupShadow(1,1,menu.w,menu.h,0);
MenuListRedraw();
_ITEMS_DRAW: }
for (index=0, start_y=0; file_captions[index*3]!=0; index++) }
{
DefineButton(1,start_y+1,menu.w,menu.line_h-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF); void MenuListRedraw()
if ((itdir) && (file_captions[index*3+2]>=200)) continue; {
DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff); int start_y=0;
if (start_y/menu.line_h==menu.current) int index;
{ int texty = menu.line_h/2-4;
DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff); for (index=0; file_captions[index*3]!=0; index++)
} {
else if ((itdir) && (file_captions[index*3+2]>=200)) continue;
{ DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff);
DrawBar(2,start_y+2,menu.w-1,menu.line_h,col_work); if (start_y/menu.line_h==menu.current)
WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]); {
} cur_action_buf = file_captions[index*3+2];
WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]); DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff);
WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]); }
start_y+=menu.line_h; else
} {
DrawBar(2,start_y+2,menu.w-1,menu.line_h,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+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
start_y+=menu.line_h;
} }
} }

View File

@ -106,22 +106,7 @@ void OpenWith()
key = GetKey(); key = GetKey();
if (key==27) ExitProcess(); if (key==27) ExitProcess();
if (key==13) { RunProgram(#app_paths[app_list.current].item, #file_path); ExitProcess(); } if (key==13) { RunProgram(#app_paths[app_list.current].item, #file_path); ExitProcess(); }
if (key==177) if (app_list.ProcessKey(key)) DrawAppList();
{
if (app_list.KeyDown()) DrawAppList();
}
if (key==178)
{
if (app_list.KeyUp()) DrawAppList();
}
if (key==180)
{
if (app_list.KeyHome()) DrawAppList();
}
if (key==181)
{
if (app_list.KeyEnd()) DrawAppList();
}
break; break;
case evReDraw: _APP_LIST_DRAW: case evReDraw: _APP_LIST_DRAW: