--- BasiliskII/src/BeOS/clip_beos.cpp 1999/10/03 14:16:25 1.1.1.1 +++ BasiliskII/src/BeOS/clip_beos.cpp 2008/01/01 09:40:32 1.10 @@ -1,7 +1,7 @@ /* * clip_beos.cpp - Clipboard handling, BeOS implementation * - * Basilisk II (C) 1997-1999 Christian Bauer + * Basilisk II (C) 1997-2008 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,22 +18,29 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "sysdeps.h" + #include #include -#include "sysdeps.h" #include "clip.h" +#include "prefs.h" #define DEBUG 1 #include "debug.h" +// Flag: Don't convert clipboard text +static bool no_clip_conversion; + + /* * Initialization */ void ClipInit(void) { + no_clip_conversion = PrefsFindBool("noclipconversion"); } @@ -47,6 +54,16 @@ void ClipExit(void) /* + * Mac application reads clipboard + */ + +void GetScrap(void **handle, uint32 type, int32 offset) +{ + D(bug("GetScrap handle %p, type %08x, offset %d\n", handle, type, offset)); +} + + +/* * Mac application wrote to clipboard */ @@ -63,20 +80,39 @@ void PutScrap(uint32 type, void *scrap, be_clipboard->Clear(); BMessage *clipper = be_clipboard->Data(); - // Convert text from Mac charset to UTF-8 - int32 dest_length = length*3; - int32 state = 0; - char *buf = new char[dest_length]; - if (convert_to_utf8(B_MAC_ROMAN_CONVERSION, (char *)scrap, &length, buf, &dest_length, &state) == B_OK) { - for (int i=0; iLF + char *buf = new char[length]; + for (int i=0; iAddData("text/plain", B_MIME_TYPE, buf, dest_length); + clipper->AddData("text/plain", B_MIME_TYPE, buf, length); be_clipboard->Commit(); + delete[] buf; + + } else { + + // Convert text from Mac charset to UTF-8 + int32 dest_length = length*3; + int32 state = 0; + char *buf = new char[dest_length]; + if (convert_to_utf8(B_MAC_ROMAN_CONVERSION, (char *)scrap, &length, buf, &dest_length, &state) == B_OK) { + for (int i=0; iAddData("text/plain", B_MIME_TYPE, buf, dest_length); + be_clipboard->Commit(); + } + delete[] buf; } - delete[] buf; be_clipboard->Unlock(); } break;