21#include <proto/iffparse.h>
22#include <proto/intuition.h>
23#include <proto/exec.h>
24#include <proto/datatypes.h>
25#include <proto/diskfont.h>
27#include <diskfont/diskfonttag.h>
28#include <datatypes/textclass.h>
29#include <datatypes/pictureclass.h>
51#define ID_UTF8 MAKE_ID('U','T','F','8')
53static struct IFFHandle *
iffh = NULL;
57 struct IFFHandle *iffhandle = NULL;
59 if((iffhandle = AllocIFF()))
61 if((iffhandle->iff_Stream = (ULONG)OpenClipboard(unit)))
63 InitIFFasClip(iffhandle);
77 if(iffhandle == NULL)
return;
78 if(iffhandle->iff_Stream) CloseClipboard((
struct ClipboardHandle *)iffhandle->iff_Stream);
102 struct CollectionItem *ci_new = NULL, *ci_next = NULL, *ci_curr = ci;
104 char *
text = NULL, *p;
112 len += ci_curr->ci_Size;
117 ci_next->ci_Next = calloc(1,
sizeof(
struct CollectionItem));
118 ci_next = ci_next->ci_Next;
120 ci_new = calloc(1,
sizeof(
struct CollectionItem));
125 ci_next->ci_Size = strlen(ci_next->ci_Data);
126 len += ci_next->ci_Size;
131 ci_next->ci_Next = calloc(1,
sizeof(
struct CollectionItem));
132 ci_next = ci_next->ci_Next;
134 ci_new = calloc(1,
sizeof(
struct CollectionItem));
140 codeset, DFCS_MIMENAME),
141 ci_curr->ci_Size, (
char **)&ci_next->ci_Data, NULL);
142 ci_next->ci_Size = strlen(ci_next->ci_Data);
143 len += ci_next->ci_Size;
146 }
while ((ci_curr = ci_curr->ci_Next));
150 if(
text == NULL)
return NULL;
163 p -= ci_curr->ci_Size;
164 memcpy(p, ci_curr->ci_Data, ci_curr->ci_Size);
165 ci_next = ci_curr->ci_Next;
168 free(ci_curr->ci_Data);
171 }
while ((ci_curr = ci_next));
179 struct CollectionItem *ci = NULL;
180 struct StoredProperty *sp = NULL;
183 if(OpenIFF(
iffh,IFFF_READ))
return;
185 if(CollectionChunk(
iffh,ID_FTXT,ID_CHRS))
return;
188 if(StopOnExit(
iffh, ID_FTXT, ID_FORM))
return;
190 ParseIFF(
iffh,IFFPARSE_SCAN);
192 if((ci = FindCollection(
iffh, ID_FTXT,
ID_UTF8))) {
194 }
else if((ci = FindCollection(
iffh, ID_FTXT, ID_CHRS))) {
197 cset = (
struct CSet *)sp->sp_Data;
210 struct CSet cset = {0, {0}};
212 if(
buffer == NULL)
return;
214 if(!(OpenIFF(
iffh, IFFF_WRITE)))
216 if(!(PushChunk(
iffh, ID_FTXT, ID_FORM, IFFSIZE_UNKNOWN)))
223 WriteChunkBytes(
iffh, &cset, 32);
233 if(!(PushChunk(
iffh, 0, ID_CHRS, IFFSIZE_UNKNOWN))) {
243 if(*p == 0xa0) *p = 0x20;
256 if(!(PushChunk(
iffh, 0,
ID_UTF8, IFFSIZE_UNKNOWN))) {
272 struct IFFHandle *old_iffh =
iffh;
344 DoDTMethod(dto,NULL,NULL,DTM_COPY,NULL);
345 DisposeDTObject(dto);
353 const uint8_t *source_data;
360 if (source_data == NULL) {
364 if (!(OpenIFF(
iffh,IFFF_WRITE))) {
365 ami_svg_to_dr2d(
iffh,
366 (
const char *)source_data,
static void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
void ami_clipboard_free(void)
static struct IFFHandle * iffh
static void gui_get_clipboard(char **buffer, size_t *length)
bool ami_easy_clipboard(const char *text)
void ami_drag_selection(struct gui_window *g)
void ami_clipboard_init(void)
struct gui_clipboard_table * amiga_clipboard_table
static struct gui_clipboard_table clipboard_table
static struct IFFHandle * ami_clipboard_init_internal(int unit)
void gui_start_selection(struct gui_window *g)
static char * ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codeset, size_t *text_length)
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap)
static void ami_clipboard_free_internal(struct IFFHandle *iffhandle)
bool ami_mime_compare(struct hlcache_handle *c, const char *type)
Compare the MIME type of an hlcache_handle to a DefIcons type.
struct Window * ami_gui_get_window(struct gui_window *gw)
Get window from gui_window.
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y)
void * ami_window_at_pointer(int type)
undocumented, or internal, or documented elsewhere
struct Menu * ami_gui_get_menu(struct gui_window *gw)
Get imenu from gui_window.
struct browser_window * ami_gui2_get_browser_window(struct gui_window_2 *gwin)
Get browser window from gui_window_2.
Object * ami_gui2_get_object(struct gui_window_2 *gwin, int object_type)
Get object from gui_window.
void ami_gui_beep(void)
Beep.
struct Window * ami_gui2_get_window(struct gui_window_2 *gwin)
Get window from gui_window_2.
struct browser_window * ami_gui_get_browser_window(struct gui_window *gw)
Get browser window from gui_window.
BOOL ami_gadget_hit(Object *obj, int x, int y)
Browser window creation and manipulation interface.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
@ BW_EDITOR_CAN_CUT
Selection not read-only.
char * browser_window_get_selection(struct browser_window *bw)
Get the current selection from a root browser window, ownership passed to caller, who must free() it.
browser_editor_flags browser_window_get_editor_flags(struct browser_window *bw)
Check whether browser window can accept a cut/copy/paste, or has a selection that could be saved.
static osspriteop_area * buffer
The buffer characteristics.
Object * ami_datatype_object_from_bitmap(struct bitmap *bitmap)
void ami_utf8_free(char *ptr)
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
char * ami_utf8_easy(const char *string)
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
Interface to platform-specific clipboard operations.
Public content interface.
struct nsurl * hlcache_handle_get_url(const struct hlcache_handle *handle)
Retrieve the URL associated with a high level cache handle.
const uint8_t * content_get_source_data(struct hlcache_handle *h, size_t *size)
Retrieve source of content.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
Target independent plotting interface.
Interface to platform-specific graphical user interface window operations.
Interface to key press operations.
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
NetSurf URL handling (interface).
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1,...)
#define ObtainCharsetInfo(A, B, C)
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
function table for clipboard operations.
void(* get)(char **buffer, size_t *length)
Core asks front end for clipboard contents.
first entry in window list
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
nserror utf8_from_enc(const char *string, const char *encname, size_t len, char **result, size_t *result_len)
Convert a string in the named encoding into a UTF-8 string.
UTF-8 manipulation functions (interface).
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.