2008-10-26 02:22:34 +03:00
|
|
|
/*
|
2012-02-12 21:56:25 +04:00
|
|
|
* Copyright 2008-2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
2008-10-26 02:22:34 +03: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-02 02:17:36 +04: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"
|
2008-10-26 02:22:34 +03:00
|
|
|
#include "desktop/gui.h"
|
2012-08-13 17:43:04 +04:00
|
|
|
#include "desktop/plotters.h"
|
2010-07-24 23:57:27 +04:00
|
|
|
#include "desktop/textinput.h"
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2011-07-23 18:06:13 +04:00
|
|
|
#include "amiga/bitmap.h"
|
2011-04-29 22:15:20 +04:00
|
|
|
#include "amiga/clipboard.h"
|
2011-07-23 18:06:13 +04:00
|
|
|
#include "amiga/drag.h"
|
|
|
|
#include "amiga/filetype.h"
|
2008-10-26 02:22:34 +03:00
|
|
|
#include "amiga/gui.h"
|
2011-07-23 18:06:13 +04:00
|
|
|
#include "amiga/iff_cset.h"
|
2009-05-19 11:23:56 +04:00
|
|
|
#include "amiga/iff_dr2d.h"
|
2010-07-24 20:39:37 +04:00
|
|
|
#include "amiga/menu.h"
|
2011-07-23 18:06:13 +04:00
|
|
|
#include "amiga/utf8.h"
|
2010-07-24 20:39:37 +04:00
|
|
|
|
2012-08-03 21:33:49 +04:00
|
|
|
#define ID_UTF8 MAKE_ID('U','T','F','8')
|
|
|
|
|
2008-10-26 02:22:34 +03:00
|
|
|
struct IFFHandle *iffh = NULL;
|
|
|
|
|
2012-08-04 00:02:29 +04:00
|
|
|
static LONG ami_clipboard_iffp_do_nothing(struct Hook *hook, void *object, LONG *cmd)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ami_clipboard_iffp_clear_stopchunk(struct IFFHandle *iffh, ULONG iff_type, ULONG iff_chunk)
|
|
|
|
{
|
|
|
|
static struct Hook entry_hook;
|
|
|
|
|
|
|
|
entry_hook.h_Entry = (void *)ami_clipboard_iffp_do_nothing;
|
|
|
|
entry_hook.h_Data = 0;
|
|
|
|
|
|
|
|
EntryHandler(iffh, iff_type, iff_chunk, IFFSLI_TOP, &entry_hook, NULL);
|
|
|
|
}
|
|
|
|
|
2010-10-24 22:07:11 +04:00
|
|
|
struct IFFHandle *ami_clipboard_init_internal(int unit)
|
2008-10-26 02:22:34 +03:00
|
|
|
{
|
2010-10-24 22:07:11 +04:00
|
|
|
struct IFFHandle *iffhandle = NULL;
|
|
|
|
|
|
|
|
if(iffhandle = AllocIFF())
|
2008-10-26 02:22:34 +03:00
|
|
|
{
|
2010-10-24 22:07:11 +04:00
|
|
|
if(iffhandle->iff_Stream = (ULONG)OpenClipboard(unit))
|
2008-10-26 02:22:34 +03:00
|
|
|
{
|
2010-10-24 22:07:11 +04:00
|
|
|
InitIFFasClip(iffhandle);
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
|
|
|
}
|
2010-10-24 22:07:11 +04:00
|
|
|
|
|
|
|
return iffhandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_clipboard_init(void)
|
|
|
|
{
|
|
|
|
iffh = ami_clipboard_init_internal(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_clipboard_free_internal(struct IFFHandle *iffhandle)
|
|
|
|
{
|
2013-04-09 03:02:11 +04:00
|
|
|
if(iffhandle == NULL) return;
|
2010-10-24 22:07:11 +04:00
|
|
|
if(iffhandle->iff_Stream) CloseClipboard((struct ClipboardHandle *)iffhandle->iff_Stream);
|
2013-04-09 03:02:11 +04:00
|
|
|
FreeIFF(iffhandle);
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ami_clipboard_free(void)
|
|
|
|
{
|
2010-10-24 22:07:11 +04:00
|
|
|
ami_clipboard_free_internal(iffh);
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_start_selection(struct gui_window *g)
|
|
|
|
{
|
2010-07-24 20:39:37 +04:00
|
|
|
if(!g) return;
|
|
|
|
if(!g->shared->win) return;
|
2012-03-22 13:34:34 +04:00
|
|
|
if(nsoption_bool(kiosk_mode) == true) return;
|
2010-07-24 20:39:37 +04:00
|
|
|
|
|
|
|
OnMenu(g->shared->win, AMI_MENU_CLEAR);
|
|
|
|
OnMenu(g->shared->win, AMI_MENU_COPY);
|
|
|
|
|
2013-02-22 17:37:11 +04:00
|
|
|
if (browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT)
|
2010-07-24 20:39:37 +04:00
|
|
|
OnMenu(g->shared->win, AMI_MENU_CUT);
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size_t *text_length)
|
|
|
|
{
|
2013-01-09 22:41:53 +04:00
|
|
|
struct CollectionItem *ci_new = NULL, *ci_next, *ci_curr = ci;
|
2013-01-09 03:44:13 +04:00
|
|
|
size_t len = 0;
|
2013-01-10 03:42:14 +04:00
|
|
|
char *text = NULL, *p;
|
2013-01-09 03:44:13 +04:00
|
|
|
|
2013-01-09 22:41:53 +04: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-09 03:44:13 +04:00
|
|
|
do {
|
|
|
|
switch(codeset) {
|
|
|
|
case 106:
|
2013-01-09 22:41:53 +04:00
|
|
|
len += ci_curr->ci_Size;
|
2013-01-09 03:44:13 +04:00
|
|
|
break;
|
2013-01-09 22:41:53 +04:00
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
case 0:
|
2013-01-09 22:41:53 +04:00
|
|
|
if(ci_new) {
|
2013-10-12 16:11:13 +04:00
|
|
|
ci_next->ci_Next = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next = ci_next->ci_Next;
|
|
|
|
} else {
|
2013-10-12 16:11:13 +04:00
|
|
|
ci_new = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next = ci_new;
|
|
|
|
}
|
|
|
|
|
2013-01-10 03:42:14 +04:00
|
|
|
utf8_from_local_encoding(ci_curr->ci_Data, ci_curr->ci_Size, (char **)&ci_next->ci_Data);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next->ci_Size = strlen(ci_next->ci_Data);
|
|
|
|
len += ci_next->ci_Size;
|
2013-01-09 03:44:13 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-01-09 22:41:53 +04:00
|
|
|
if(ci_new) {
|
2013-10-12 16:11:13 +04:00
|
|
|
ci_next->ci_Next = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next = ci_next->ci_Next;
|
|
|
|
} else {
|
2013-10-12 16:11:13 +04:00
|
|
|
ci_new = AllocVecTags(sizeof(struct CollectionItem), AVT_ClearWithValue, 0, TAG_DONE);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next = ci_new;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
utf8_from_enc(ci_curr->ci_Data,
|
|
|
|
(const char *)ObtainCharsetInfo(DFCS_NUMBER,
|
|
|
|
codeset, DFCS_MIMENAME),
|
2013-10-25 23:58:19 +04:00
|
|
|
ci_curr->ci_Size, (char **)&ci_next->ci_Data, NULL);
|
2013-01-09 22:41:53 +04:00
|
|
|
ci_next->ci_Size = strlen(ci_next->ci_Data);
|
|
|
|
len += ci_next->ci_Size;
|
2013-01-09 03:44:13 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (ci_curr = ci_curr->ci_Next);
|
|
|
|
|
2013-01-09 22:41:53 +04: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 04:00:51 +04:00
|
|
|
} else {
|
|
|
|
ci_curr = ci;
|
2013-01-09 22:41:53 +04: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);
|
|
|
|
}
|
|
|
|
} while (ci_curr = ci_next);
|
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
*text_length = len;
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
2013-01-08 23:58:44 +04:00
|
|
|
void gui_get_clipboard(char **buffer, size_t *length)
|
2008-10-26 02:22:34 +03:00
|
|
|
{
|
|
|
|
struct ContextNode *cn;
|
2013-01-09 03:44:13 +04:00
|
|
|
struct CollectionItem *ci = NULL;
|
2013-01-10 03:42:14 +04:00
|
|
|
struct StoredProperty *sp = NULL;
|
2008-10-26 02:22:34 +03:00
|
|
|
ULONG rlen=0,error;
|
2013-01-10 03:42:14 +04:00
|
|
|
struct CSet *cset;
|
2012-01-15 19:58:26 +04:00
|
|
|
LONG codeset = 0;
|
2008-10-26 02:22:34 +03:00
|
|
|
|
|
|
|
if(OpenIFF(iffh,IFFF_READ)) return;
|
2012-08-03 22:19:04 +04:00
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
if(CollectionChunk(iffh,ID_FTXT,ID_CHRS)) return;
|
2013-01-10 03:42:14 +04:00
|
|
|
if(PropChunk(iffh,ID_FTXT,ID_CSET)) return;
|
2013-01-09 03:44:13 +04:00
|
|
|
if(CollectionChunk(iffh,ID_FTXT,ID_UTF8)) return;
|
2013-01-10 04:00:51 +04:00
|
|
|
if(StopOnExit(iffh, ID_FTXT, ID_FORM)) return;
|
2012-08-03 22:19:04 +04:00
|
|
|
|
2013-01-10 03:42:14 +04:00
|
|
|
error = ParseIFF(iffh,IFFPARSE_SCAN);
|
2008-10-26 02:22:34 +03:00
|
|
|
|
2013-01-09 03:44:13 +04:00
|
|
|
if(ci = FindCollection(iffh, ID_FTXT, ID_UTF8)) {
|
|
|
|
*buffer = ami_clipboard_cat_collection(ci, 106, length);
|
|
|
|
} else if(ci = FindCollection(iffh, ID_FTXT, ID_CHRS)) {
|
2013-01-10 03:42:14 +04:00
|
|
|
if(sp = FindProp(iffh, ID_FTXT, ID_CSET)) {
|
|
|
|
cset = (struct CSet *)sp->sp_Data;
|
|
|
|
codeset = cset->CodeSet;
|
|
|
|
}
|
2013-01-09 03:44:13 +04:00
|
|
|
*buffer = ami_clipboard_cat_collection(ci, codeset, length);
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
2013-01-09 03:44:13 +04:00
|
|
|
|
2008-10-26 02:22:34 +03:00
|
|
|
CloseIFF(iffh);
|
|
|
|
}
|
|
|
|
|
2014-01-16 18:43:48 +04:00
|
|
|
static void gui_set_clipboard(const char *buffer, size_t length,
|
2013-01-08 23:58:44 +04:00
|
|
|
nsclipboard_styles styles[], int n_styles)
|
2008-10-26 02:22:34 +03:00
|
|
|
{
|
2013-01-08 23:58:44 +04:00
|
|
|
char *text;
|
2010-07-24 23:57:27 +04:00
|
|
|
struct CSet cset = {0};
|
|
|
|
|
2013-01-08 23:58:44 +04:00
|
|
|
if(buffer == NULL) return;
|
|
|
|
|
|
|
|
if(!(OpenIFF(iffh, IFFF_WRITE)))
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
2013-01-08 23:58:44 +04:00
|
|
|
if(!(PushChunk(iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN)))
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
2013-05-28 19:44:46 +04:00
|
|
|
if(nsoption_bool(clipboard_write_utf8))
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
2013-01-08 23:58:44 +04:00
|
|
|
if(!(PushChunk(iffh, 0, ID_CSET, 32)))
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
|
|
|
cset.CodeSet = 106; // UTF-8
|
2013-01-08 23:58:44 +04:00
|
|
|
WriteChunkBytes(iffh, &cset, 32);
|
2010-07-24 23:57:27 +04:00
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
2011-04-30 14:54:02 +04:00
|
|
|
|
2013-01-08 23:58:44 +04:00
|
|
|
if(!(PushChunk(iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) {
|
2013-05-28 19:44:46 +04:00
|
|
|
if(nsoption_bool(clipboard_write_utf8)) {
|
2013-01-08 23:58:44 +04:00
|
|
|
WriteChunkBytes(iffh, buffer, length);
|
|
|
|
} else {
|
2014-01-29 01:40:13 +04:00
|
|
|
if(utf8_to_local_encoding(buffer, length, &text) == NSERROR_OK) {
|
2013-01-08 23:58:44 +04:00
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = text;
|
|
|
|
|
|
|
|
while(*p != '\0') {
|
|
|
|
if(*p == 0xa0) *p = 0x20;
|
|
|
|
p++;
|
|
|
|
}
|
2013-01-09 00:07:46 +04:00
|
|
|
WriteChunkBytes(iffh, text, strlen(text));
|
2013-01-08 23:58:44 +04:00
|
|
|
ami_utf8_free(text);
|
2012-08-03 21:15:16 +04:00
|
|
|
}
|
2011-04-30 14:54:02 +04:00
|
|
|
}
|
2008-10-26 02:22:34 +03:00
|
|
|
|
2013-01-08 23:58:44 +04:00
|
|
|
PopChunk(iffh);
|
|
|
|
} else {
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
2012-08-03 21:33:49 +04:00
|
|
|
|
2013-01-08 23:58:44 +04:00
|
|
|
if(!(PushChunk(iffh, 0, ID_UTF8, IFFSIZE_UNKNOWN))) {
|
|
|
|
WriteChunkBytes(iffh, buffer, length);
|
|
|
|
PopChunk(iffh);
|
|
|
|
} else {
|
|
|
|
PopChunk(iffh);
|
|
|
|
}
|
|
|
|
CloseIFF(iffh);
|
2012-08-03 21:33:49 +04:00
|
|
|
}
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
|
|
|
|
2013-02-22 23:02:58 +04:00
|
|
|
void ami_drag_selection(struct gui_window *g)
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
2011-04-29 22:15:20 +04:00
|
|
|
int x;
|
|
|
|
int y;
|
2011-04-30 15:11:34 +04:00
|
|
|
char *utf8text;
|
2013-02-22 23:02:58 +04:00
|
|
|
char *sel;
|
2010-10-24 22:07:11 +04:00
|
|
|
struct IFFHandle *old_iffh = iffh;
|
2011-12-02 17:24:40 +04:00
|
|
|
struct gui_window_2 *gwin = ami_window_at_pointer(AMINS_WINDOW);
|
2013-02-22 23:02:58 +04: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-28 01:41:21 +04:00
|
|
|
if(!gwin)
|
|
|
|
{
|
|
|
|
DisplayBeep(scrn);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = gwin->win->MouseX;
|
|
|
|
y = gwin->win->MouseY;
|
|
|
|
|
2012-08-21 01:03:59 +04:00
|
|
|
if(ami_text_box_at_point(gwin, (ULONG *)&x, (ULONG *)&y))
|
2010-07-24 23:57:27 +04:00
|
|
|
{
|
2010-10-24 22:07:11 +04:00
|
|
|
iffh = ami_clipboard_init_internal(1);
|
2013-01-09 03:01:57 +04:00
|
|
|
|
2013-02-22 23:02:58 +04:00
|
|
|
browser_window_key_press(g->shared->bw, KEY_COPY_SELECTION);
|
|
|
|
browser_window_mouse_click(gwin->bw, BROWSER_MOUSE_PRESS_1, x, y);
|
|
|
|
browser_window_key_press(gwin->bw, KEY_PASTE);
|
2013-01-09 03:01:57 +04:00
|
|
|
|
2010-10-24 22:07:11 +04:00
|
|
|
ami_clipboard_free_internal(iffh);
|
|
|
|
iffh = old_iffh;
|
2010-07-24 23:57:27 +04:00
|
|
|
}
|
2010-07-28 01:41:21 +04:00
|
|
|
else
|
|
|
|
{
|
2011-04-29 22:15:20 +04:00
|
|
|
x = gwin->win->MouseX;
|
|
|
|
y = gwin->win->MouseY;
|
|
|
|
|
|
|
|
if(ami_gadget_hit(gwin->objects[GID_URL], x, y))
|
|
|
|
{
|
2013-02-22 23:02:58 +04:00
|
|
|
if(sel = browser_window_get_selection(g->shared->bw))
|
2011-04-29 22:15:20 +04:00
|
|
|
{
|
2013-02-22 23:02:58 +04:00
|
|
|
utf8text = ami_utf8_easy(sel);
|
2011-04-29 22:15:20 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
|
2011-04-30 15:11:34 +04:00
|
|
|
gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
|
2013-02-22 23:02:58 +04:00
|
|
|
free(sel);
|
2011-04-30 15:11:34 +04:00
|
|
|
ami_utf8_free(utf8text);
|
2011-04-29 22:15:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(ami_gadget_hit(gwin->objects[GID_SEARCHSTRING], x, y))
|
|
|
|
{
|
2013-02-22 23:02:58 +04:00
|
|
|
if(sel = browser_window_get_selection(g->shared->bw))
|
2011-04-29 22:15:20 +04:00
|
|
|
{
|
2013-02-22 23:02:58 +04:00
|
|
|
utf8text = ami_utf8_easy(sel);
|
2011-04-29 22:15:20 +04:00
|
|
|
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_SEARCHSTRING],
|
2011-04-30 15:11:34 +04:00
|
|
|
gwin->win, NULL, STRINGA_TextVal, utf8text, TAG_DONE);
|
2013-02-22 23:02:58 +04:00
|
|
|
free(sel);
|
2011-04-30 15:11:34 +04:00
|
|
|
ami_utf8_free(utf8text);
|
2011-04-29 22:15:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayBeep(scrn);
|
|
|
|
}
|
2010-07-28 01:41:21 +04:00
|
|
|
}
|
2010-07-24 23:57:27 +04:00
|
|
|
}
|
|
|
|
|
2008-10-26 02:22:34 +03:00
|
|
|
bool ami_easy_clipboard(char *text)
|
|
|
|
{
|
2013-01-08 23:58:44 +04:00
|
|
|
gui_set_clipboard(text, strlen(text), NULL, 0);
|
2010-07-25 00:18:56 +04:00
|
|
|
return true;
|
2008-10-26 02:22:34 +03:00
|
|
|
}
|
2009-05-16 18:50:30 +04:00
|
|
|
|
2009-05-16 21:04:28 +04:00
|
|
|
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
|
2009-05-16 18:50:30 +04:00
|
|
|
{
|
2009-05-16 21:04:28 +04:00
|
|
|
Object *dto = NULL;
|
2009-05-16 18:50:30 +04:00
|
|
|
|
2009-05-16 21:04:28 +04:00
|
|
|
if(dto = ami_datatype_object_from_bitmap(bitmap))
|
2009-05-16 18:50:30 +04:00
|
|
|
{
|
2009-05-16 21:04:28 +04:00
|
|
|
DoDTMethod(dto,NULL,NULL,DTM_COPY,NULL);
|
|
|
|
DisposeDTObject(dto);
|
2009-05-16 18:50:30 +04:00
|
|
|
}
|
|
|
|
}
|
2009-05-19 11:23:56 +04:00
|
|
|
|
2009-05-19 11:30:00 +04:00
|
|
|
#ifdef WITH_NS_SVG
|
2010-03-28 19:51:05 +04:00
|
|
|
bool ami_easy_clipboard_svg(struct hlcache_handle *c)
|
2009-05-19 11:23:56 +04:00
|
|
|
{
|
2011-07-23 18:06:13 +04:00
|
|
|
const char *source_data;
|
2010-03-28 19:51:05 +04:00
|
|
|
ULONG source_size;
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
if(ami_mime_compare(c, "svg") == false) return false;
|
2010-03-28 19:51:05 +04:00
|
|
|
if((source_data = content_get_source_data(c, &source_size)) == NULL) return false;
|
2009-05-19 11:23:56 +04:00
|
|
|
|
|
|
|
if(!(OpenIFF(iffh,IFFF_WRITE)))
|
|
|
|
{
|
2011-12-04 18:55:23 +04:00
|
|
|
ami_svg_to_dr2d(iffh, source_data, source_size, nsurl_access(hlcache_handle_get_url(c)));
|
2009-05-19 11:23:56 +04:00
|
|
|
CloseIFF(iffh);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-19 11:30:00 +04:00
|
|
|
#endif
|
2014-01-16 18:43:48 +04: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;
|