- added "noclipconversion" prefs item

This commit is contained in:
cebix 2000-05-16 17:11:39 +00:00
parent 86b352db07
commit 7cb97f79c1
6 changed files with 61 additions and 15 deletions

View File

@ -1,3 +1,11 @@
V0.8 (snapshot) -
- prefs.cpp: empty string prefs items could be written to prefs file
but not read back correctly
- clip_*.cpp: added prefs item "noclipconversion" for turning off
charset conversion of text clips (only CR->LF gets translated),
[Toshimitsu Tanaka]
- Unix: "--without-mon" configure option now works
V0.8 (snapshot) - 14.Mar.2000 V0.8 (snapshot) - 14.Mar.2000
- Unix/video_x.cpp: new window refresh code [Samuel Lander] - Unix/video_x.cpp: new window refresh code [Samuel Lander]
- Unix/timer_unix.cpp: fixed time zone handling under Linux and SVR4 - Unix/timer_unix.cpp: fixed time zone handling under Linux and SVR4

View File

@ -18,14 +18,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "sysdeps.h"
#include <exec/types.h> #include <exec/types.h>
#include <libraries/iffparse.h> #include <libraries/iffparse.h>
#include <devices/clipboard.h> #include <devices/clipboard.h>
#include <proto/exec.h> #include <proto/exec.h>
#include <proto/iffparse.h> #include <proto/iffparse.h>
#include "sysdeps.h"
#include "clip.h" #include "clip.h"
#include "prefs.h"
#define DEBUG 0 #define DEBUG 0
#include "debug.h" #include "debug.h"
@ -35,6 +37,7 @@
static struct IFFHandle *iffw = NULL; static struct IFFHandle *iffw = NULL;
static struct ClipboardHandle *ch = NULL; static struct ClipboardHandle *ch = NULL;
static bool clipboard_open = false; static bool clipboard_open = false;
static bool no_clip_conversion;
// Conversion tables // Conversion tables
@ -64,6 +67,8 @@ static const uint8 mac2iso[0x80] = {
void ClipInit(void) void ClipInit(void)
{ {
no_clip_conversion = PrefsFindBool("noclipconversion");
// Create clipboard IFF handle // Create clipboard IFF handle
iffw = AllocIFF(); iffw = AllocIFF();
if (iffw) { if (iffw) {
@ -117,7 +122,7 @@ void PutScrap(uint32 type, void *scrap, int32 length)
if (c < 0x80) { if (c < 0x80) {
if (c == 13) // CR -> LF if (c == 13) // CR -> LF
c = 10; c = 10;
} else } else if (!no_clip_conversion)
c = mac2iso[c & 0x7f]; c = mac2iso[c & 0x7f];
*q++ = c; *q++ = c;
} }

View File

@ -18,22 +18,29 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "sysdeps.h"
#include <AppKit.h> #include <AppKit.h>
#include <support/UTF8.h> #include <support/UTF8.h>
#include "sysdeps.h"
#include "clip.h" #include "clip.h"
#include "prefs.h"
#define DEBUG 1 #define DEBUG 1
#include "debug.h" #include "debug.h"
// Flag: Don't convert clipboard text
static bool no_clip_conversion;
/* /*
* Initialization * Initialization
*/ */
void ClipInit(void) void ClipInit(void)
{ {
no_clip_conversion = PrefsFindBool("noclipconversion");
} }
@ -63,20 +70,39 @@ void PutScrap(uint32 type, void *scrap, int32 length)
be_clipboard->Clear(); be_clipboard->Clear();
BMessage *clipper = be_clipboard->Data(); BMessage *clipper = be_clipboard->Data();
// Convert text from Mac charset to UTF-8 if (no_clip_conversion) {
int32 dest_length = length*3;
int32 state = 0; // Only convert CR->LF
char *buf = new char[dest_length]; 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; i<length; i++) {
for (int i=0; i<dest_length; i++) if (i[(char *)scrap] == 13)
if (buf[i] == 13)
buf[i] = 10; buf[i] = 10;
else
buf[i] = i[(char *)scrap];
}
// Add text to Be clipboard // Add text to Be clipboard
clipper->AddData("text/plain", B_MIME_TYPE, buf, dest_length); clipper->AddData("text/plain", B_MIME_TYPE, buf, length);
be_clipboard->Commit(); 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; i<dest_length; i++)
if (buf[i] == 13)
buf[i] = 10;
// Add text to Be clipboard
clipper->AddData("text/plain", B_MIME_TYPE, buf, dest_length);
be_clipboard->Commit();
}
delete[] buf;
} }
delete[] buf;
be_clipboard->Unlock(); be_clipboard->Unlock();
} }
break; break;

View File

@ -23,6 +23,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "clip.h" #include "clip.h"
#include "prefs.h"
#define DEBUG 0 #define DEBUG 0
#include "debug.h" #include "debug.h"
@ -52,6 +53,9 @@ static const uint8 mac2iso[0x80] = {
0xaf, 0x20, 0xb7, 0xb0, 0xb8, 0x22, 0xb8, 0x20 0xaf, 0x20, 0xb7, 0xb0, 0xb8, 0x22, 0xb8, 0x20
}; };
// Flag: Don't convert clipboard text
static bool no_clip_conversion;
/* /*
* Initialization * Initialization
@ -59,6 +63,7 @@ static const uint8 mac2iso[0x80] = {
void ClipInit(void) void ClipInit(void)
{ {
no_clip_conversion = PrefsFindBool("noclipconversion");
} }
@ -94,7 +99,7 @@ void PutScrap(uint32 type, void *scrap, int32 length)
if (c < 0x80) { if (c < 0x80) {
if (c == 13) // CR -> LF if (c == 13) // CR -> LF
c = 10; c = 10;
} else } else if (!no_clip_conversion)
c = mac2iso[c & 0x7f]; c = mac2iso[c & 0x7f];
*q++ = c; *q++ = c;
} }

View File

@ -1,5 +1,5 @@
/* /*
* extfs.cpp - MacOS file system for access native file system access * extfs.cpp - MacOS file system for native file system access
* *
* Basilisk II (C) 1997-2000 Christian Bauer * Basilisk II (C) 1997-2000 Christian Bauer
* *

View File

@ -58,6 +58,7 @@ prefs_desc common_prefs_items[] = {
{"fpu", TYPE_BOOLEAN, false}, // Enable FPU emulation (main.cpp) {"fpu", TYPE_BOOLEAN, false}, // Enable FPU emulation (main.cpp)
{"nocdrom", TYPE_BOOLEAN, false}, // Don't install CD-ROM driver (cdrom.cpp/rom_patches.cpp) {"nocdrom", TYPE_BOOLEAN, false}, // Don't install CD-ROM driver (cdrom.cpp/rom_patches.cpp)
{"nosound", TYPE_BOOLEAN, false}, // Don't enable sound output (audio_*.cpp) {"nosound", TYPE_BOOLEAN, false}, // Don't enable sound output (audio_*.cpp)
{"noclipconversion", TYPE_BOOLEAN, false}, // Don't convert clipboard contents (clip_*.cpp)
{"nogui", TYPE_BOOLEAN, false}, // Disable GUI (main_*.cpp) {"nogui", TYPE_BOOLEAN, false}, // Disable GUI (main_*.cpp)
{NULL, TYPE_END, false} // End of list {NULL, TYPE_END, false} // End of list
}; };
@ -95,6 +96,7 @@ void PrefsInit(void)
PrefsAddBool("fpu", false); PrefsAddBool("fpu", false);
PrefsAddBool("nocdrom", false); PrefsAddBool("nocdrom", false);
PrefsAddBool("nosound", false); PrefsAddBool("nosound", false);
PrefsAddBool("noclipconversion", false);
PrefsAddBool("nogui", false); PrefsAddBool("nogui", false);
AddPlatformPrefsDefaults(); AddPlatformPrefsDefaults();