Add oleacc to build
[reactos.git] / rosapps / lib / dflat32 / clipbord.c
1 /* ----------- clipbord.c ------------ */
2 #include "dflat32/dflat.h"
3
4 char *Clipboard;
5 unsigned ClipboardLength;
6
7 void CopyTextToClipboard(char *text)
8 {
9 ClipboardLength = strlen(text);
10 Clipboard = DFrealloc(Clipboard, ClipboardLength);
11 memmove(Clipboard, text, ClipboardLength);
12 }
13
14 void CopyToClipboard(DFWINDOW wnd)
15 {
16 if (TextBlockMarked(wnd)) {
17 char *bbl=TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol;
18 char *bel=TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol;
19 ClipboardLength = (int) (bel - bbl);
20 Clipboard = DFrealloc(Clipboard, ClipboardLength);
21 memmove(Clipboard, bbl, ClipboardLength);
22 }
23 }
24
25 void ClearClipboard(void)
26 {
27 if (Clipboard != NULL) {
28 free(Clipboard);
29 Clipboard = NULL;
30 }
31 }
32
33
34 BOOL PasteText(DFWINDOW wnd, char *SaveTo, unsigned len)
35 {
36 if (SaveTo != NULL && len > 0) {
37 unsigned plen = strlen(wnd->text) + len;
38
39 if (plen <= wnd->MaxTextLength) {
40 if (plen+1 > wnd->textlen) {
41 wnd->text = DFrealloc(wnd->text, plen+3);
42 wnd->textlen = plen+1;
43 }
44 memmove(CurrChar+len, CurrChar, strlen(CurrChar)+1);
45 memmove(CurrChar, SaveTo, len);
46 BuildTextPointers(wnd);
47 wnd->TextChanged = TRUE;
48 return TRUE;
49 }
50 }
51 return FALSE;
52 }
53
54 /* EOF */