[Bf-blender-cvs] [4e73506] tmp_text_copy_paste: Integrate font objects copy/paste with system clipboard
Dalai Felinto
noreply at git.blender.org
Thu Feb 11 19:48:09 CET 2016
Commit: 4e73506e81f894a830fe6a3af3b15666436093d3
Author: Dalai Felinto
Date: Thu Feb 11 16:36:29 2016 -0200
Branches: tmp_text_copy_paste
https://developer.blender.org/rB4e73506e81f894a830fe6a3af3b15666436093d3
Integrate font objects copy/paste with system clipboard
When pasting, the style (bold, material, ...) is maintained, if it was originally copied from Blender.
@brecht, @severin told me that you had thought ideas for this functionality. Let me know if it is along those lines.
TODO: update Blender manual once this get merged
Reviewers: Severin, campbellbarton, brecht
Subscribers: brecht, Severin
Differential Revision: https://developer.blender.org/D1789
===================================================================
M source/blender/editors/curve/editfont.c
===================================================================
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 9b01cf1..1c4174b 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -709,15 +709,15 @@ static void copy_selection(Object *obedit)
len = selend - selstart + 1;
/* internal clipboard (for style) */
- memcpy(&G.copybuf[0], ef->textbuf + selstart, len * sizeof(wchar_t));
+ memcpy(G.copybuf, ef->textbuf + selstart, len * sizeof(wchar_t));
G.copybuf[len] = 0;
- memcpy(&G.copybufinfo[0], ef->textbufinfo + selstart, len * sizeof(CharInfo));
+ memcpy(G.copybufinfo, ef->textbufinfo + selstart, len * sizeof(CharInfo));
- len = BLI_wstrlen_utf8(&G.copybuf[0]);
+ len = BLI_wstrlen_utf8(G.copybuf);
/* system clipboard */
buf = MEM_mallocN(len + sizeof(wchar_t), __func__);
- BLI_strncpy_wchar_as_utf8(buf, &G.copybuf[0], len);
+ BLI_strncpy_wchar_as_utf8(buf, G.copybuf, len);
WM_clipboard_text_set(buf, false);
}
@@ -784,9 +784,9 @@ void FONT_OT_text_cut(wmOperatorType *ot)
static bool paste_selection(Object *obedit, ReportList *reports)
{
- int len = wcslen(&G.copybuf[0]);
+ int len = wcslen(G.copybuf);
- if (font_paste_wchar(obedit, &G.copybuf[0], len, &G.copybufinfo[0])) {
+ if (font_paste_wchar(obedit, G.copybuf, len, G.copybufinfo)) {
return true;
}
else {
@@ -811,9 +811,9 @@ static int paste_text_exec(bContext *C, wmOperator *op)
}
/* get text from internal buffer */
- len_utf8 = BLI_wstrlen_utf8(&G.copybuf[0]);
+ len_utf8 = BLI_wstrlen_utf8(G.copybuf);
buf = MEM_mallocN(len_utf8 + sizeof(wchar_t), __func__);
- BLI_strncpy_wchar_as_utf8(buf, &G.copybuf[0], len_utf8 + 1);
+ BLI_strncpy_wchar_as_utf8(buf, G.copybuf, len_utf8 + 1);
if (STREQ(strp, buf)) {
/* get textinfo from internal buffer */
More information about the Bf-blender-cvs
mailing list