[Bf-blender-cvs] [41349c7] tmp_text_copy_paste: FONT_OT_text_cut_to_clipboard
Dalai Felinto
noreply at git.blender.org
Thu Feb 11 15:44:16 CET 2016
Commit: 41349c7a7cd4e32816cb8cabb598a49786ddd7d9
Author: Dalai Felinto
Date: Thu Feb 11 12:35:36 2016 -0200
Branches: tmp_text_copy_paste
https://developer.blender.org/rB41349c7a7cd4e32816cb8cabb598a49786ddd7d9
FONT_OT_text_cut_to_clipboard
===================================================================
M source/blender/editors/curve/curve_intern.h
M source/blender/editors/curve/curve_ops.c
M source/blender/editors/curve/editfont.c
===================================================================
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index a522837..6987aa3 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -78,6 +78,7 @@ void FONT_OT_select_all(struct wmOperatorType *ot);
void FONT_OT_text_copy(struct wmOperatorType *ot);
void FONT_OT_text_copy_to_clipboard(struct wmOperatorType *ot);
void FONT_OT_text_cut(struct wmOperatorType *ot);
+void FONT_OT_text_cut_to_clipboard(struct wmOperatorType *ot);
void FONT_OT_text_paste(struct wmOperatorType *ot);
void FONT_OT_text_paste_from_file(struct wmOperatorType *ot);
void FONT_OT_text_paste_from_clipboard(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index f9edfb6..ad44c61 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -65,6 +65,7 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(FONT_OT_text_copy);
WM_operatortype_append(FONT_OT_text_copy_to_clipboard);
WM_operatortype_append(FONT_OT_text_cut);
+ WM_operatortype_append(FONT_OT_text_cut_to_clipboard);
WM_operatortype_append(FONT_OT_text_paste);
WM_operatortype_append(FONT_OT_text_paste_from_file);
WM_operatortype_append(FONT_OT_text_paste_from_clipboard);
@@ -214,12 +215,14 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "FONT_OT_text_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_copy_to_clipboard", CKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_cut", XKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "FONT_OT_text_cut_to_clipboard", XKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_paste", VKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_paste_from_clipboard", VKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
#ifdef __APPLE__
WM_keymap_add_item(keymap, "FONT_OT_text_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_copy_to_clipboard", CKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_cut", XKEY, KM_PRESS, KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "FONT_OT_text_cut_to_clipboard", XKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "FONT_OT_text_paste_from_clipboard", VKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
#endif
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 49e4c45..34969fc 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -865,6 +865,39 @@ void FONT_OT_text_cut(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/* Cut To Clipboard */
+
+static int cut_to_clipboard_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *obedit = CTX_data_edit_object(C);
+ int selstart, selend;
+
+ if (!BKE_vfont_select_get(obedit, &selstart, &selend))
+ return OPERATOR_CANCELLED;
+
+ copy_selection_to_clipboard(obedit);
+ kill_selection(obedit, 0);
+
+ text_update_edited(C, obedit, FO_EDIT);
+
+ return OPERATOR_FINISHED;
+}
+
+void FONT_OT_text_cut_to_clipboard(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Cut Text";
+ ot->description = "Cut selected text to system clipboard";
+ ot->idname = "FONT_OT_text_cut_to_clipboard";
+
+ /* api callbacks */
+ ot->exec = cut_to_clipboard_exec;
+ ot->poll = ED_operator_editfont;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/******************* paste text operator ********************/
static bool paste_selection(Object *obedit, ReportList *reports)
More information about the Bf-blender-cvs
mailing list