Add copy and select all items

svn path=/trunk/netsurf/; revision=6092
This commit is contained in:
Chris Young 2009-01-16 19:13:07 +00:00
parent 8d76373d23
commit af7f83b9a5
2 changed files with 37 additions and 0 deletions

View File

@ -47,8 +47,12 @@ void ami_context_menu_init(void)
ctxmenulab[CMID_URLOPENWIN] = ami_utf8_easy((char *)messages_get("LinkNewWin"));
ctxmenulab[CMID_URLOPENTAB] = ami_utf8_easy((char *)messages_get("LinkNewTab"));
ctxmenulab[CMID_SELCOPY] = ami_utf8_easy((char *)messages_get("CopyNS"));
ctxmenulab[CMID_SELALL] = ami_utf8_easy((char *)messages_get("SelectAllNS"));
ctxmenulab[CMSUB_OBJECT] = ami_utf8_easy((char *)messages_get("Object"));
ctxmenulab[CMSUB_URL] = ami_utf8_easy((char *)messages_get("Link"));
ctxmenulab[CMSUB_SEL] = ami_utf8_easy((char *)messages_get("Selection"));
}
void ami_context_menu_free(void)
@ -135,6 +139,27 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
~0);
}
if(curbox->text)
{
IDoMethod(gwin->objects[OID_MENU],PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMSUB_SEL],
PMSIMPLESUB,
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_SELCOPY],
PMIA_ID,CMID_SELCOPY,
//PMIA_UserData,curbox->href,
TAG_DONE),
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_SELALL],
PMIA_ID,CMID_SELALL,
//PMIA_UserData,curbox->href,
TAG_DONE),
TAG_DONE),
TAG_DONE),
~0);
}
if (curbox->gadget)
{
switch (curbox->gadget->type)
@ -241,6 +266,15 @@ uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved)
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
}
break;
case CMID_SELCOPY:
gui_copy_to_clipboard(gwin->bw->sel);
browser_window_key_press(gwin->bw, 26);
break;
case CMID_SELALL:
browser_window_key_press(gwin->bw, 1);
break;
}
}

View File

@ -28,8 +28,11 @@ enum {
CMID_SHOWOBJ,
CMID_COPYOBJ,
CMID_SAVEOBJ,
CMID_SELALL,
CMID_SELCOPY,
CMSUB_OBJECT,
CMSUB_URL,
CMSUB_SEL,
CMID_LAST
};