1 /* ----------- clipbord.c ------------ */
2 #include "dflat32/dflat.h"
5 unsigned ClipboardLength
;
7 void CopyTextToClipboard(char *text
)
9 ClipboardLength
= strlen(text
);
10 Clipboard
= DFrealloc(Clipboard
, ClipboardLength
);
11 memmove(Clipboard
, text
, ClipboardLength
);
14 void CopyToClipboard(DFWINDOW wnd
)
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
);
25 void ClearClipboard(void)
27 if (Clipboard
!= NULL
) {
34 BOOL
PasteText(DFWINDOW wnd
, char *SaveTo
, unsigned len
)
36 if (SaveTo
!= NULL
&& len
> 0) {
37 unsigned plen
= strlen(wnd
->text
) + len
;
39 if (plen
<= wnd
->MaxTextLength
) {
40 if (plen
+1 > wnd
->textlen
) {
41 wnd
->text
= DFrealloc(wnd
->text
, plen
+3);
42 wnd
->textlen
= plen
+1;
44 memmove(CurrChar
+len
, CurrChar
, strlen(CurrChar
)+1);
45 memmove(CurrChar
, SaveTo
, len
);
46 BuildTextPointers(wnd
);
47 wnd
->TextChanged
= TRUE
;