1,133 → 1,128 |
//pay attension: >200 this is only file actions, not supported by folders |
#ifdef LANG_RUS |
char *file_captions[] = { |
"âªàëâì", "Enter",100, |
"âªàëâì á ¯®¬®éìî...", "CrlEnt",201, |
"®¯¨à®¢ âì", "Crl+C",104, |
"ë१ âì", "Crl+X",105, |
"áâ ¢¨âì", "Crl+V",106, |
"¥à¥¨¬¥®¢ âì", "F2",207, |
"¤ «¨âì", "Del",108, |
"¡®¢¨âì ¯ ¯ªã", "F5",109, |
"¢®©á⢠", "F8",110, |
0, 0, 0}; |
|
char file_actions[]= |
"âªàëâì |Enter |
âªàëâì á ¯®¬®éìî |CrlEnt |
®¯¨à®¢ âì |Crl+C |
ë१ âì |Crl+X |
áâ ¢¨âì |Crl+V |
¥à¥¨¬¥®¢ âì |F2 |
¤ «¨âì |Del |
¢®©á⢠|F8"; |
char folder_actions[]= |
"âªàëâì |Enter |
®¯¨à®¢ âì |Crl+C |
ë१ âì |Crl+X |
áâ ¢¨âì |Crl+V |
¤ «¨âì |Del |
¢®©á⢠|F8"; |
char empty_folder_actions[]= |
"áâ ¢¨âì |Crl+V"; |
|
#elif LANG_EST |
char *file_captions[] = { |
"Ava", "Enter",100, |
"Ava ...", "CrlEnt",201, |
"Kopeeri", "Crl+C",104, |
"Lõika", "Crl+X",105, |
"Aseta", "Crl+V",106, |
"Nimeta ümber", "F2",207, |
"Kustuta", "Del",108, |
"Värskenda", "F5",109, |
"Properties", "F8",110, |
0, 0, 0}; |
char file_actions[]= |
"Ava |Enter |
Ava ... |CrlEnt |
Kopeeri |Crl+C |
Lõika |Crl+X |
Aseta |Crl+V |
Nimeta ümber |F2 |
Kustuta |Del |
Properties |F8"; |
char folder_actions[]= |
"Ava |Enter |
Kopeeri |Crl+C |
Lõika |Crl+X |
Aseta |Crl+V |
Kustuta |Del |
Properties |F8"; |
char empty_folder_actions[]= |
"Aseta |Crl+V"; |
|
#else |
char *file_captions[] = { |
"Open", "Enter",100, |
"Open with...", "CrlEnt",201, |
"Copy", "Crl+C",104, |
"Cut", "Crl+X",105, |
"Paste", "Crl+V",106, |
"Rename", "F2",207, |
"Delete", "Del",108, |
"Refresh", "F5",109, |
"Properties", "F8",110, |
0, 0, 0}; |
char file_actions[]= |
"Open |Enter |
Open with... |CrlEnt |
Copy |Crl+C |
Cut |Crl+X |
Paste |Crl+V |
Rename |F2 |
Delete |Del |
Properties |F8"; |
char folder_actions[]= |
"Open |Enter |
Copy |Crl+C |
Cut |Crl+X |
Paste |Crl+V |
Delete |Del |
Properties |F8"; |
char empty_folder_actions[]= |
"Paste |Crl+V"; |
|
#endif |
|
llist rbmenu; |
int cur_action_buf; |
//¡®¢¨âì ¯ ¯ªã |F5 |
//Värskenda |F5 |
//Refresh |F5 |
|
void FileMenu() |
{ |
proc_info MenuForm; |
int index; |
enum { MENU_DIR=1, MENU_FILE, MENU_NO_FILE, MENU_BURGER }; |
|
rbmenu.ClearList(); |
rbmenu.SetFont(6, 9, 0x80); |
rbmenu.SetSizes(0,0,10,0,18); |
for (index=0; file_captions[index]!=0; index+=3) |
bool active_menu = false; |
|
void EventMenuClick(dword _id) |
{ |
if (selected_count > 0) { |
//if there are files selected then show only specific menu items |
if (file_captions[index+2]>=200) continue; |
if (file_captions[index+2]==100) continue; |
if (active_menu == MENU_NO_FILE) switch(_id) { |
case 1: Paste(); break; |
} |
else if (itdir) && (file_captions[index+2]>=200) continue; |
if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]); |
rbmenu.count++; |
rbmenu.visible++; |
if (active_menu == MENU_FILE) switch(_id) { |
case 1: Open(0); break; |
case 2: ShowOpenWithDialog(); break; |
case 3: Copy(#file_path, NOCUT); break; |
case 4: Copy(#file_path, CUT); break; |
case 5: Paste(); break; |
case 6: FnProcess(2); break; |
case 7: Del_Form(); break; |
case 8: FnProcess(8); break; |
} |
rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50; |
rbmenu.h = rbmenu.count * rbmenu.item_h; |
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE); |
goto _MENU_DRAW; |
if (active_menu == MENU_DIR) switch(_id) { |
case 1: Open(0); break; |
case 2: Copy(#file_path, NOCUT); break; |
case 3: Copy(#file_path, CUT); break; |
case 4: Paste(); break; |
case 5: Del_Form(); break; |
case 6: FnProcess(8); break; |
} |
active_menu = NULL; |
} |
|
loop() switch(WaitEvent()) |
void EventShowListMenu() |
{ |
case evMouse: |
mouse.get(); |
if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();} |
else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw(); |
else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); } |
break; |
dword text; |
|
case evKey: |
GetKeys(); |
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(); } |
if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw(); |
break; |
pause(3); |
|
case evReDraw: _MENU_DRAW: |
if (menu_call_mouse) |
DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,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); |
GetProcessInfo(#MenuForm, SelfInfo); |
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); |
MenuListRedraw(); |
if (!files.count) { |
text = #empty_folder_actions; |
active_menu = MENU_NO_FILE; |
} else if (itdir) { |
text = #folder_actions; |
active_menu = MENU_DIR; |
} else { |
text = #file_actions; |
active_menu = MENU_FILE; |
} |
open_lmenu(mouse.x+Form.left+5, mouse.y+Form.top+3+skin_height, 1, 0, text); |
} |
|
void MenuListRedraw() |
bool GetMenuClick() |
{ |
int start_y=0; |
int index; |
dword chick_id; |
if (active_menu) && (chick_id = get_menu_click()) { |
EventMenuClick(chick_id); |
return false; |
} |
return true; |
|
dword m_col_bg; |
dword m_col_text; |
dword m_col_sh_text; |
|
for (index=0; file_captions[index*3]!=0; index++) |
{ |
if (selected_count > 0) { |
if (file_captions[index*3+2]==100) continue; |
if (file_captions[index*3+2]>=200) continue; |
} |
else if ((itdir) && (file_captions[index*3+2]>=200)) continue; |
DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff); |
if (start_y/rbmenu.item_h==rbmenu.cur_y) |
{ |
cur_action_buf = file_captions[index*3+2]; |
m_col_bg = 0xFFFfff; |
m_col_sh_text = 0xFAFAFA; |
m_col_text = 0; |
} |
else |
{ |
m_col_bg = col.work; |
m_col_text = system.color.work_text; |
m_col_sh_text = system.color.work_light; |
} |
DrawBar(2, start_y+2, rbmenu.w-1, rbmenu.item_h, m_col_bg); |
WriteText(8, start_y + rbmenu.text_y + 4, rbmenu.font_type, m_col_sh_text, file_captions[index*3]); |
WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, m_col_text, 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; |
} |
} |
|