2008-10-25 23:22:34 +00:00
|
|
|
/*
|
2012-02-12 17:56:25 +00:00
|
|
|
* Copyright 2008-2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
2008-10-25 23:22:34 +00:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-02-01 22:17:36 +00:00
|
|
|
#include <proto/iffparse.h>
|
|
|
|
#include <proto/intuition.h>
|
|
|
|
#include <proto/exec.h>
|
|
|
|
#include <proto/datatypes.h>
|
|
|
|
#include <proto/diskfont.h>
|
|
|
|
|
|
|
|
#include <diskfont/diskfonttag.h>
|
|
|
|
#include <datatypes/textclass.h>
|
|
|
|
#include <datatypes/pictureclass.h>
|
|
|
|
|
|
|
|
#include "utils/nsoption.h"
|
|
|
|
#include "utils/utf8.h"
|
2014-10-17 23:18:58 +01:00
|
|
|
#include "desktop/browser.h"
|
2012-08-13 14:43:04 +01:00
|
|
|
#include "desktop/plotters.h"
|
2010-07-24 19:57:27 +00:00
|
|
|
#include "desktop/textinput.h"
|
2014-10-16 09:55:01 +01:00
|
|
|
#include "desktop/gui_window.h"
|
|
|
|
#include "desktop/gui_clipboard.h"
|
2010-07-24 16:39:37 +00:00
|
|
|
|
2011-07-23 14:06:13 +00:00
|
|
|
#include "amiga/bitmap.h"
|
2011-04-29 18:15:20 +00:00
|
|
|
#include "amiga/clipboard.h"
|
2014-11-09 00:48:04 +00:00
|
|
|
#include "amiga/drag.h"
|
2011-07-23 14:06:13 +00:00
|
|
|
#include "amiga/filetype.h"
|
2008-10-25 23:22:34 +00:00
|
|
|
#include "amiga/gui.h"
|
2011-07-23 14:06:13 +00:00
|
|
|
#include "amiga/iff_cset.h"
|
2009-05-19 07:23:56 +00:00
|
|
|
#include "amiga/iff_dr2d.h"
|
2010-07-24 16:39:37 +00:00
|
|
|
#include "amiga/menu.h"
|
2015-01-10 23:10:05 +00:00
|
|
|
#include "amiga/misc.h"
|
2011-07-23 14:06:13 +00:00
|
|
|
#include "amiga/utf8.h"
|
2010-07-24 16:39:37 +00:00
|
|
|
|
2012-08-03 18:33:49 +01:00
|
|
|
#define ID_UTF8 MAKE_ID('U','T','F','8')
|
|
|
|
|
2008-10-25 23:22:34 +00:00
|
|
|
struct IFFHandle *iffh = NULL;
|
|
|
|
|
2014-10-16 09:55:01 +01:00
|
|
|
static struct IFFHandle *ami_clipboard_init_internal(int unit)
|
2008-10-25 23:22:34 +00:00
|
|
|
{
|
2010-10-24 18:07:11 +00:00
|
|
|
struct IFFHandle *iffhandle = NULL;
|
|
|
|
|
2014-10-16 09:55:01 +01:00
|
|
|
if((iffhandle = AllocIFF()))
|
2008-10-25 23:22:34 +00:00
|
|
|
{
|
2014-11-09 00:48:04 +00:00
|
|
|
if((iffhandle->iff_Stream = (ULONG)OpenClipboard(unit)))
|
2008-10-25 23:22:34 +00:00
|
|
|
{
|
2010-10-24 18:07:11 +00:00
|
|
|
InitIFFasClip(iffhandle);
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-24 18:07:11 +00:00
|
|
|
|
|
|
|
return iffhandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_clipboard_init(void)
|
|
|
|
{
|
|
|
|
iffh = ami_clipboard_init_internal(0);
|
|
|
|
}
|
|
|
|
|
2014-10-16 09:55:01 +01:00
|
|
|
static void ami_clipboard_free_internal(struct IFFHandle *iffhandle)
|
2010-10-24 18:07:11 +00:00
|
|
|
{
|
2013-04-09 00:02:11 +01:00
|
|
|
if(iffhandle == NULL) return;
|
2010-10-24 18:07:11 +00:00
|
|
|
if(iffhandle->iff_Stream) CloseClipboard((struct ClipboardHandle *)iffhandle->iff_Stream);
|
2013-04-09 00:02:11 +01:00
|
|
|
FreeIFF(iffhandle);
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ami_clipboard_free(void)
|
|
|
|
{
|
2010-10-24 18:07:11 +00:00
|
|
|
ami_clipboard_free_internal(iffh);
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_start_selection(struct gui_window *g)
|
|
|
|
{
|
2010-07-24 16:39:37 +00:00
|
|
|
if(!g) return;
|
|
|
|
if(!g->shared->win) return;
|
2012-03-22 09:34:34 +00:00
|
|
|
if(nsoption_bool(kiosk_mode) == true) return;
|
2010-07-24 16:39:37 +00:00
|
|
|
|
|
|
|
OnMenu(g->shared->win, AMI_MENU_CLEAR);
|
|
|
|
OnMenu(g->shared->win, AMI_MENU_COPY);
|
|
|
|
|
2014-11-16 14:49:42 +00:00
|
|
|
if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_CUT)
|
2010-07-24 16:39:37 +00:00
|
|
|
OnMenu(g->shared->win, AMI_MENU_CUT);
|
|
|
|
}
|
|
|
|
|
2014-10-16 09:55:01 +01:00
|
|
|
static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size_t *text_length)
|
2013-01-08 23:44:13 +00:00
|
|
|
{
|
2014-11-09 00:48:04 +00:00
|
|
|
struct CollectionItem *ci_new = NULL, *ci_next = NULL, *ci_curr = ci;
|
2013-01-08 23:44:13 +00:00
|
|
|
size_t len = 0;
|
2013-01-09 23:42:14 +00:00
|
|
|
char *text = NULL, *p;
|
2013-01-08 23:44:13 +00:00
|
|
|
|
2013-01-09 18:41:53 +00:00
|
|
|
/* Scan the collected chunks to find out the total size.
|
|
|
|
* If they are not in UTF-8, convert the chunks first and create a new CollectionItem list.
|
|
|
|
*/
|
2013-01-08 23:44:13 +00:00
|
|
|
do {
|
|
|
|
switch(codeset) {
|
|
|
|
case 106:
|
2013-01-09 18:41:53 +00:00
|
|
|
len += ci_curr->ci_Size;
|
2013-01-08 23:44:13 +00:00
|
|
|
break;
|
2013-01-09 18:41:53 +00:00
|
|
|
|
2013-01-08 23:44:13 +00:00
|
|
|
case 0:
|
2013-01-09 18:41:53 +00:00
|
|
|
if(ci_new) {
|
2015-01-10 23:10:05 +00:00
|
|
|
ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next = ci_next->ci_Next;
|
|
|
|
} else {
|
2015-01-10 23:10:05 +00:00
|
|
|
ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next = ci_new;
|
|
|
|
}
|
|
|
|
|
2013-01-09 23:42:14 +00:00
|
|
|
utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, (char **)&ci_next->ci_Data);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next->ci_Size = strlen(ci_next->ci_Data);
|
|
|
|
len += ci_next->ci_Size;
|
2013-01-08 23:44:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-01-09 18:41:53 +00:00
|
|
|
if(ci_new) {
|
2015-01-10 23:10:05 +00:00
|
|
|
ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next = ci_next->ci_Next;
|
|
|
|
} else {
|
2015-01-10 23:10:05 +00:00
|
|
|
ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next = ci_new;
|
|
|
|
}
|
|
|
|
|
2013-01-08 23:44:13 +00:00
|
|
|
utf8_from_enc(ci_curr->ci_Data,
|
|
|
|
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
|
|
|
|
codeset, DFCS_MIMENAME),
|
2013-10-25 20:58:19 +01:00
|
|
|
ci_curr->ci_Size, (char **)&ci_next->ci_Data, NULL);
|
2013-01-09 18:41:53 +00:00
|
|
|
ci_next->ci_Size = strlen(ci_next->ci_Data);
|
|
|
|
len += ci_next->ci_Size;
|
2013-01-08 23:44:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-11-09 00:48:04 +00:00
|
|
|
} while ((ci_curr = ci_curr->ci_Next));
|
2013-01-08 23:44:13 +00:00
|
|
|
|
2013-01-09 18:41:53 +00:00
|
|
|
text = malloc(len);
|
|
|
|
|
|
|
|
if(text == NULL) return NULL;
|
|
|
|
|
|
|
|
/* p points to the end of the buffer. This is because the chunks are
|
|
|
|
* in the list in reverse order. */
|
|
|
|
p = text + len;
|
|
|
|
|
|
|
|
if(ci_new) {
|
|
|
|
ci_curr = ci_new;
|
2013-01-10 00:00:51 +00:00
|
|
|
} else {
|
|
|
|
ci_curr = ci;
|
2013-01-09 18:41:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
p -= ci_curr->ci_Size;
|
|
|
|
memcpy(p, ci_curr->ci_Data, ci_curr->ci_Size);
|
|
|
|
ci_next = ci_curr->ci_Next;
|
|
|
|
|
|
|
|
if(ci_new) {
|
|
|
|
free(ci_curr->ci_Data);
|
|
|
|
FreeVec(ci_curr);
|
|
|
|
}
|
2014-11-09 00:48:04 +00:00
|
|
|
} while ((ci_curr = ci_next));
|
2013-01-09 18:41:53 +00:00
|
|
|
|
2013-01-08 23:44:13 +00:00
|
|
|
*text_length = len;
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
2014-10-16 09:55:01 +01:00
|
|
|
static void gui_get_clipboard(char **buffer, size_t *length)
|
2008-10-25 23:22:34 +00:00
|
|
|
{
|
2013-01-08 23:44:13 +00:00
|
|
|
struct CollectionItem *ci = NULL;
|
2013-01-09 23:42:14 +00:00
|
|
|
struct StoredProperty *sp = NULL;
|
2014-10-16 09:55:01 +01:00
|
|
|
ULONG error;
|
2013-01-09 23:42:14 +00:00
|
|
|
struct CSet *cset;
|
2008-10-25 23:22:34 +00:00
|
|
|
|
|
|
|
if(OpenIFF(iffh,IFFF_READ)) return;
|
2012-08-03 19:19:04 +01:00
|
|
|
|
2013-01-08 23:44:13 +00:00
|
|
|
if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return;
|
2013-01-09 23:42:14 +00:00
|
|
|
if(PropChunk(iffh,ID_FTXT,ID_CSET)) return;
|
2013-01-08 23:44:13 +00:00
|
|
|
if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return;
|
2013-01-10 00:00:51 +00:00
|
|
|
if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return;
|
2012-08-03 19:19:04 +01:00
|
|
|
|
2013-01-09 23:42:14 +00:00
|
|
|
error = ParseIFF(iffh,IFFPARSE_SCAN);
|
2008-10-25 23:22:34 +00:00
|
|
|
|
2014-11-09 00:48:04 +00:00
|
|
|
if((ci = FindCollection(iffh, ID_FTXT, ID_UTF8))) {
|
2013-01-08 23:44:13 +00:00
|
|
|
*buffer = ami_clipboard_cat_collection(ci, 106, length);
|
2014-11-09 00:48:04 +00:00
|
|
|
} else if((ci = FindCollection(iffh, ID_FTXT, ID_CHRS))) {
|
2014-04-05 23:34:51 +01:00
|
|
|
LONG codeset = 0;
|
2014-11-09 00:48:04 +00:00
|
|
|
if((sp = FindProp(iffh, ID_FTXT, ID_CSET))) {
|
2013-01-09 23:42:14 +00:00
|
|
|
cset = (struct CSet *)sp->sp_Data;
|
|
|
|
codeset = cset->CodeSet;
|
|
|
|
}
|
2013-01-08 23:44:13 +00:00
|
|
|
*buffer = ami_clipboard_cat_collection(ci, codeset, length);
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
2013-01-08 23:44:13 +00:00
|
|
|
|
2008-10-25 23:22:34 +00:00
|
|
|
CloseIFF(iffh);
|
|
|
|
}
|
|
|
|
|
2014-01-16 14:43:48 +00:00
|
|
|
static void gui_set_clipboard(const char *buffer, size_t length,
|
2013-01-08 19:58:44 +00:00
|
|
|
nsclipboard_styles styles[], int n_styles)
|
2008-10-25 23:22:34 +00:00
|
|
|
{
|
2013-01-08 19:58:44 +00:00
|
|
|
char *text;
|
2014-11-09 00:48:04 +00:00
|
|
|
struct CSet cset = {0, {0}};
|
2010-07-24 19:57:27 +00:00
|
|
|
|
2013-01-08 19:58:44 +00:00
|
|
|
if(buffer == NULL) return;
|
|
|
|
|
|
|
|
if(!(OpenIFF(iffh, IFFF_WRITE)))
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
2013-01-08 19:58:44 +00:00
|
|
|
if(!(PushChunk(iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN)))
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
2013-05-28 16:44:46 +01:00
|
|
|
if(nsoption_bool(clipboard_write_utf8))
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
2013-01-08 19:58:44 +00:00
|
|
|
if(!(PushChunk(iffh, 0, ID_CSET, 32)))
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
|
|
|
cset.CodeSet = 106; // UTF-8
|
2013-01-08 19:58:44 +00:00
|
|
|
WriteChunkBytes(iffh, &cset, 32);
|
2010-07-24 19:57:27 +00:00
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
2011-04-30 10:54:02 +00:00
|
|
|
|
2013-01-08 19:58:44 +00:00
|
|
|
if(!(PushChunk(iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) {
|
2013-05-28 16:44:46 +01:00
|
|
|
if(nsoption_bool(clipboard_write_utf8)) {
|
2013-01-08 19:58:44 +00:00
|
|
|
WriteChunkBytes(iffh, buffer, length);
|
|
|
|
} else {
|
2014-01-28 21:40:13 +00:00
|
|
|
if(utf8_to_local_encoding(buffer, length, &text) == NSERROR_OK) {
|
2013-01-08 19:58:44 +00:00
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = text;
|
|
|
|
|
|
|
|
while(*p != '\0') {
|
|
|
|
if(*p == 0xa0) *p = 0x20;
|
|
|
|
p++;
|
|
|
|
}
|
2013-01-08 20:07:46 +00:00
|
|
|
WriteChunkBytes(iffh, text, strlen(text));
|
2013-01-08 19:58:44 +00:00
|
|
|
ami_utf8_free(text);
|
2012-08-03 18:15:16 +01:00
|
|
|
}
|
2011-04-30 10:54:02 +00:00
|
|
|
}
|
2008-10-25 23:22:34 +00:00
|
|
|
|
2013-01-08 19:58:44 +00:00
|
|
|
PopChunk(iffh);
|
|
|
|
} else {
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
2012-08-03 18:33:49 +01:00
|
|
|
|
2013-01-08 19:58:44 +00:00
|
|
|
if(!(PushChunk(iffh, 0, ID_UTF8, IFFSIZE_UNKNOWN))) {
|
|
|
|
WriteChunkBytes(iffh, buffer, length);
|
|
|
|
PopChunk(iffh);
|
|
|
|
} else {
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
|
|
|
CloseIFF(iffh);
|
2012-08-03 18:33:49 +01:00
|
|
|
}
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
|
|
|
|
2013-02-22 19:02:58 +00:00
|
|
|
void ami_drag_selection(struct gui_window *g)
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
2011-04-29 18:15:20 +00:00
|
|
|
int x;
|
|
|
|
int y;
|
2011-04-30 11:11:34 +00:00
|
|
|
char *utf8text;
|
2013-02-22 19:02:58 +00:00
|
|
|
char *sel;
|
2010-10-24 18:07:11 +00:00
|
|
|
struct IFFHandle *old_iffh = iffh;
|
2011-12-02 13:24:40 +00:00
|
|
|
struct gui_window_2 *gwin = ami_window_at_pointer(AMINS_WINDOW);
|
2013-02-22 19:02:58 +00:00
|
|
|
|
|
|
|
/* NB: 'gwin' is at the drop point, 'g' is where the selection was dragged from.
|
|
|
|
* These may be different if the selection has been dragged between windows. */
|
|
|
|
|
2010-07-27 21:41:21 +00:00
|
|
|
if(!gwin)
|
|
|
|
{
|
|
|
|
DisplayBeep(scrn);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = gwin->win->MouseX;
|
|
|
|
y = gwin->win->MouseY;
|
|
|
|
|
2012-08-20 22:03:59 +01:00
|
|
|
if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
|
2010-07-24 19:57:27 +00:00
|
|
|
{
|
2010-10-24 18:07:11 +00:00
|
|
|
iffh = ami_clipboard_init_internal(1);
|
2013-01-08 23:01:57 +00:00
|
|
|
|
2014-11-16 14:49:42 +00:00
|
|
|
browser_window_key_press(g->bw, KEY_COPY_SELECTION);
|
|
|
|
browser_window_mouse_click(gwin->gw->bw, BROWSER_MOUSE_PRESS_1, x, y);
|
|
|
|
browser_window_key_press(gwin->gw->bw, KEY_PASTE);
|
2013-01-08 23:01:57 +00:00
|
|
|
|
2010-10-24 18:07:11 +00:00
|
|
|
ami_clipboard_free_internal(iffh);
|
|
|
|
iffh = old_iffh;
|
2010-07-24 19:57:27 +00:00
|
|
|
}
|
2010-07-27 21:41:21 +00:00
|
|
|
else
|
|
|
|
{
|
2011-04-29 18:15:20 +00:00
|
|
|
x = gwin->win->MouseX;
|
|
|
|
y = gwin->win->MouseY;
|
|
|
|
|
|
|
|
if(ami_gadget_hit(gwin->objects[GID_URL], x, y))
|
|
|
|
{
|
2014-11-16 14:49:42 +00:00
|
|
|
if((sel = browser_window_get_selection(g->bw)))
|
2011-04-29 18:15:20 +00:00
|
|
|
{
|
2013-02-22 19:02:58 +00:00
|
|
|
utf8text = ami_utf8_easy(sel);
|
2011-04-29 18:15:20 +00:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
|
2011-04-30 11:11:34 +00:00
|
|
|
gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
|
2013-02-22 19:02:58 +00:00
|
|
|
free(sel);
|
2011-04-30 11:11:34 +00:00
|
|
|
ami_utf8_free(utf8text);
|
2011-04-29 18:15:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(ami_gadget_hit(gwin->objects[GID_SEARCHSTRING], x, y))
|
|
|
|
{
|
2014-11-16 14:49:42 +00:00
|
|
|
if((sel = browser_window_get_selection(g->bw)))
|
2011-04-29 18:15:20 +00:00
|
|
|
{
|
2013-02-22 19:02:58 +00:00
|
|
|
utf8text = ami_utf8_easy(sel);
|
2011-04-29 18:15:20 +00:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING],
|
2011-04-30 11:11:34 +00:00
|
|
|
gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
|
2013-02-22 19:02:58 +00:00
|
|
|
free(sel);
|
2011-04-30 11:11:34 +00:00
|
|
|
ami_utf8_free(utf8text);
|
2011-04-29 18:15:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayBeep(scrn);
|
|
|
|
}
|
2010-07-27 21:41:21 +00:00
|
|
|
}
|
2010-07-24 19:57:27 +00:00
|
|
|
}
|
|
|
|
|
2008-10-25 23:22:34 +00:00
|
|
|
bool ami_easy_clipboard(char *text)
|
|
|
|
{
|
2013-01-08 19:58:44 +00:00
|
|
|
gui_set_clipboard(text, strlen(text), NULL, 0);
|
2010-07-24 20:18:56 +00:00
|
|
|
return true;
|
2008-10-25 23:22:34 +00:00
|
|
|
}
|
2009-05-16 14:50:30 +00:00
|
|
|
|
2009-05-16 17:04:28 +00:00
|
|
|
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
|
2009-05-16 14:50:30 +00:00
|
|
|
{
|
2009-05-16 17:04:28 +00:00
|
|
|
Object *dto = NULL;
|
2009-05-16 14:50:30 +00:00
|
|
|
|
2014-11-09 00:48:04 +00:00
|
|
|
if((dto = ami_datatype_object_from_bitmap(bitmap)))
|
2009-05-16 14:50:30 +00:00
|
|
|
{
|
2009-05-16 17:04:28 +00:00
|
|
|
DoDTMethod(dto,NULL,NULL,DTM_COPY,NULL);
|
|
|
|
DisposeDTObject(dto);
|
2009-05-16 14:50:30 +00:00
|
|
|
}
|
2014-10-16 09:55:01 +01:00
|
|
|
return true;
|
2009-05-16 14:50:30 +00:00
|
|
|
}
|
2009-05-19 07:23:56 +00:00
|
|
|
|
2009-05-19 07:30:00 +00:00
|
|
|
#ifdef WITH_NS_SVG
|
2010-03-28 15:51:05 +00:00
|
|
|
bool ami_easy_clipboard_svg(struct hlcache_handle *c)
|
2009-05-19 07:23:56 +00:00
|
|
|
{
|
2011-07-23 14:06:13 +00:00
|
|
|
const char *source_data;
|
2010-03-28 15:51:05 +00:00
|
|
|
ULONG source_size;
|
|
|
|
|
2011-05-06 20:40:09 +00:00
|
|
|
if(ami_mime_compare(c, "svg") == false) return false;
|
2010-03-28 15:51:05 +00:00
|
|
|
if((source_data = content_get_source_data(c, &source_size)) == NULL) return false;
|
2009-05-19 07:23:56 +00:00
|
|
|
|
|
|
|
if(!(OpenIFF(iffh,IFFF_WRITE)))
|
|
|
|
{
|
2011-12-04 14:55:23 +00:00
|
|
|
ami_svg_to_dr2d(iffh, source_data, source_size, nsurl_access(hlcache_handle_get_url(c)));
|
2009-05-19 07:23:56 +00:00
|
|
|
CloseIFF(iffh);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-19 07:30:00 +00:00
|
|
|
#endif
|
2014-01-16 14:43:48 +00:00
|
|
|
|
|
|
|
static struct gui_clipboard_table clipboard_table = {
|
|
|
|
.get = gui_get_clipboard,
|
|
|
|
.set = gui_set_clipboard,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gui_clipboard_table *amiga_clipboard_table = &clipboard_table;
|