summaryrefslogtreecommitdiff
path: root/src/os/os2/os2.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2009-10-04 21:08:38 +0000
committermichi_cc <michi_cc@openttd.org>2009-10-04 21:08:38 +0000
commit049d62b35cd48dffa2a661bf82452f3694ffaaa2 (patch)
treebdf2863b4473660e3c4da9a5c44c0c621f23a1b1 /src/os/os2/os2.cpp
parenta831143f4541926ac0eaec8289e442cba60cc75f (diff)
downloadopenttd-049d62b35cd48dffa2a661bf82452f3694ffaaa2.tar.xz
(svn r17708) -Feature [FS#2053]: [OSX] Implement clipboard support for OS X.
Diffstat (limited to 'src/os/os2/os2.cpp')
-rw-r--r--src/os/os2/os2.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/os/os2/os2.cpp b/src/os/os2/os2.cpp
index 06508b361..ead6f78c3 100644
--- a/src/os/os2/os2.cpp
+++ b/src/os/os2/os2.cpp
@@ -176,14 +176,7 @@ int CDECL main(int argc, char *argv[])
return ttd_main(argc, argv);
}
-/**
- * Insert a chunk of text from the clipboard onto the textbuffer. Get TEXT clipboard
- * and append this up to the maximum length (either absolute or screenlength). If maxlength
- * is zero, we don't care about the screenlength but only about the physical length of the string
- * @param tb Textbuf type to be changed
- * @return Return true on successful change of Textbuf, or false otherwise
- */
-bool InsertTextBufferClipboard(Textbuf *tb)
+bool GetClipboardContents(char *buffer, size_t buff_len)
{
/* XXX -- Currently no clipboard support implemented with GCC */
#ifndef __INNOTEK_LIBC__
@@ -195,30 +188,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (text != NULL)
{
- uint length = 0;
- uint width = 0;
- const char *i;
-
- for (i = text; IsValidAsciiChar(*i); i++)
- {
- uint w;
-
- if (tb->size + length + 1 > tb->maxsize) break;
-
- w = GetCharacterWidth(FS_NORMAL, (byte)*i);
- if (tb->maxwidth != 0 && width + tb->width + w > tb->maxwidth) break;
-
- width += w;
- length++;
- }
-
- memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->size - tb->caretpos);
- memcpy(tb->buf + tb->caretpos, text, length);
- tb->width += width;
- tb->caretxoffs += width;
- tb->size += length;
- tb->caretpos += length;
-
+ ttd_strlcpy(buffer, text, buff_len);
WinCloseClipbrd(hab);
return true;
}