Ejemplo n.º 1
0
HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
{
	struct bitmap *bm;
	struct gui_window_2 *gwin;
	GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);

	if(browser_window_can_select(gwin->gw->bw)) {
		browser_window_key_press(gwin->gw->bw, NS_KEY_COPY_SELECTION);
		browser_window_key_press(gwin->gw->bw, NS_KEY_CLEAR_SELECTION);
	}
	else if((bm = content_get_bitmap(browser_window_get_content(gwin->gw->bw)))) {
		/** @todo It should be checked that the lifetime of
		 * the objects containing the values returned (and the
		 * constness cast away) is safe.
		 */
		ami_bitmap_set_url(bm, browser_window_get_url(gwin->gw->bw));
		ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
		ami_easy_clipboard_bitmap(bm);
	}
#ifdef WITH_NS_SVG
	else if(ami_mime_compare(browser_window_get_content(gwin->gw->bw), "svg") == true) {
		ami_easy_clipboard_svg(browser_window_get_content(gwin->gw->bw));
	}
#endif
}
Ejemplo n.º 2
0
Archivo: menu.c Proyecto: ysei/NetSurf
static void ami_menu_item_edit_copy(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
	struct bitmap *bm;
	struct gui_window_2 *gwin;
	GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);

	if(content_get_type(gwin->bw->current_content) <= CONTENT_CSS)
	{
		browser_window_key_press(gwin->bw, KEY_COPY_SELECTION);
		browser_window_key_press(gwin->bw, KEY_CLEAR_SELECTION);
	}
	else if(bm = content_get_bitmap(gwin->bw->current_content))
	{
		bm->url = (char *)nsurl_access(hlcache_handle_get_url(gwin->bw->current_content));
		bm->title = (char *)content_get_title(gwin->bw->current_content);
		ami_easy_clipboard_bitmap(bm);
	}
#ifdef WITH_NS_SVG
	else if(ami_mime_compare(gwin->bw->current_content, "svg") == true)
	{
		ami_easy_clipboard_svg(gwin->bw->current_content);
	}
#endif
}