1 /* ----------- clipbord.c ------------
6 #include <dflat32\dflat.h>
9 unsigned ClipboardLength
;
11 void CopyTextToClipboard(char *text
)
13 ClipboardLength
= strlen(text
);
14 Clipboard
= DFrealloc(Clipboard
, ClipboardLength
);
15 memmove(Clipboard
, text
, ClipboardLength
);
18 void CopyToClipboard(DFWINDOW wnd
)
20 if (TextBlockMarked(wnd
)) {
21 char *bbl
=TextLine(wnd
,wnd
->BlkBegLine
)+wnd
->BlkBegCol
;
22 char *bel
=TextLine(wnd
,wnd
->BlkEndLine
)+wnd
->BlkEndCol
;
23 ClipboardLength
= (int) (bel
- bbl
);
24 Clipboard
= DFrealloc(Clipboard
, ClipboardLength
);
25 memmove(Clipboard
, bbl
, ClipboardLength
);
29 void ClearClipboard(void)
31 if (Clipboard
!= NULL
) {
38 BOOL
PasteText(DFWINDOW wnd
, char *SaveTo
, unsigned len
)
40 if (SaveTo
!= NULL
&& len
> 0) {
41 unsigned plen
= strlen(wnd
->text
) + len
;
43 if (plen
<= wnd
->MaxTextLength
) {
44 if (plen
+1 > wnd
->textlen
) {
45 wnd
->text
= DFrealloc(wnd
->text
, plen
+3);
46 wnd
->textlen
= plen
+1;
48 memmove(CurrChar
+len
, CurrChar
, strlen(CurrChar
)+1);
49 memmove(CurrChar
, SaveTo
, len
);
50 BuildTextPointers(wnd
);
51 wnd
->TextChanged
= TRUE
;