Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2003-11-20 04:54:34 +0300
committerMartin Poirier <theeth@yahoo.com>2003-11-20 04:54:34 +0300
commit81d309e68ec1a0856d7117de82734ff1b6a95fec (patch)
treef92e951f5d6ec98dcdac866cd6b13ba0d296ad9b /source/blender/src/drawtext.c
parent487fd93a2b9b861ba810c62ec7f17ae3a07fa9ff (diff)
Fix for bug #238 and #435 (same bug difference effect).
I've tested pretty much everything, but please proof read the code, the fonction calls and IFDEF could be used elsewhere (especially the IFDEFs, I wasn't sure if I had to enclose the whole function or whatnot.
Diffstat (limited to 'source/blender/src/drawtext.c')
-rw-r--r--source/blender/src/drawtext.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
index f6935a75373..3a14c323489 100644
--- a/source/blender/src/drawtext.c
+++ b/source/blender/src/drawtext.c
@@ -835,6 +835,59 @@ void txt_copy_selectbuffer (Text *text)
}
+#ifdef _WIN32
+char *unixNewLine(char * buffer) {
+ char * output = NULL;
+ int i = 0, count = 1;
+ int len = strlen(buffer);
+
+ for (i; i<len; i++) {
+ count++;
+ if (buffer[i] == '\r' || buffer[i] == '\0')
+ count--;
+ }
+ output = MEM_callocN(sizeof(char) * count, "output buffer");
+ count = 0;
+ i = 0;
+ for (i; i<len; i++) {
+ if (buffer[i] != '\r' && buffer[i] != '\0') {
+ output[count] = buffer[i];
+ count++;
+ }
+ }
+ output[count] = '\0';
+ return output;
+}
+
+char *winNewLine(char * buffer) {
+ char * output = NULL;
+ int i = 0, count = 1;
+ int len = strlen(buffer);
+
+ for (i; i<len; i++, count++) {
+ if (buffer[i] == '\n')
+ count++;
+ }
+ output = MEM_callocN(sizeof(char) * count, "input buffer");
+ count = 0;
+ i = 0;
+ for (i; i<len; i++, count++) {
+ if (buffer[i] == '\n') {
+ output[count] = '\r';
+ count++;
+ output[count] = '\n';
+ }
+ else {
+ output[count] = buffer[i];
+ }
+ }
+ output[count] = '\0';
+ bufferlength = count;
+ return output;
+}
+#endif
+
+
void txt_paste_clipboard(Text *text) {
#ifdef _WIN32
char * buffer = NULL;
@@ -842,6 +895,7 @@ void txt_paste_clipboard(Text *text) {
if ( OpenClipboard(NULL) ) {
HANDLE hData = GetClipboardData( CF_TEXT );
buffer = (char*)GlobalLock( hData );
+ buffer = unixNewLine(buffer);
txt_insert_buf(text, buffer);
GlobalUnlock( hData );
CloseClipboard();
@@ -857,6 +911,8 @@ void txt_copy_clipboard(Text *text) {
HLOCAL clipbuffer;
char* buffer;
+ copybuffer = winNewLine(copybuffer);
+
EmptyClipboard();
clipbuffer = LocalAlloc(LMEM_FIXED,((bufferlength+1)));
buffer = (char *) LocalLock(clipbuffer);