1 /* ----------- clipbord.c ------------ */
5 unsigned DfClipboardLength
;
7 void DfCopyTextToClipboard(char *text
)
9 DfClipboardLength
= strlen(text
);
10 DfClipboard
= DfRealloc(DfClipboard
, DfClipboardLength
);
11 memmove(DfClipboard
, text
, DfClipboardLength
);
14 void DfCopyToClipboard(DFWINDOW wnd
)
16 if (DfTextBlockMarked(wnd
)) {
17 char *bbl
=DfTextLine(wnd
,wnd
->BlkBegLine
)+wnd
->BlkBegCol
;
18 char *bel
=DfTextLine(wnd
,wnd
->BlkEndLine
)+wnd
->BlkEndCol
;
19 DfClipboardLength
= (int) (bel
- bbl
);
20 DfClipboard
= DfRealloc(DfClipboard
, DfClipboardLength
);
21 memmove(DfClipboard
, bbl
, DfClipboardLength
);
25 void DfClearClipboard(void)
27 if (DfClipboard
!= NULL
) {
34 BOOL
DfPasteText(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(DfCurrChar
+len
, DfCurrChar
, strlen(DfCurrChar
)+1);
45 memmove(DfCurrChar
, SaveTo
, len
);
46 DfBuildTextPointers(wnd
);
47 wnd
->TextChanged
= TRUE
;