diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 041accb49e6..4722146089f 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -51,7 +51,7 @@ class VIEW3D_HT_header(Header): sub.menu("VIEW3D_MT_select_paint_mask") elif mesh.use_paint_mask_vertex and mode_string == 'PAINT_WEIGHT': sub.menu("VIEW3D_MT_select_paint_mask_vertex") - elif mode_string not in {'EDIT_TEXT', 'SCULPT'}: + elif mode_string not in {'SCULPT'}: sub.menu("VIEW3D_MT_select_%s" % mode_string.lower()) if mode_string == 'OBJECT': @@ -714,6 +714,23 @@ class VIEW3D_MT_select_edit_surface(Menu): layout.operator("curve.select_less") +class VIEW3D_MT_select_edit_text(Menu): + # intentional name mis-match + # select menu for 3d-text doesn't make sense + bl_label = "Edit" + + def draw(self, context): + layout = self.layout + + layout.operator("font.text_copy", text="Copy") + layout.operator("font.text_cut", text="Cut") + layout.operator("font.text_paste", text="Paste") + + layout.separator() + + layout.operator("font.select_all") + + class VIEW3D_MT_select_edit_metaball(Menu): bl_label = "Select" diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 034ad199324..9a56cc5754c 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -346,12 +346,6 @@ class VIEW3D_PT_tools_textedit(View3DPanel, Panel): def draw(self, context): layout = self.layout - col = layout.column(align=True) - col.label(text="Text Edit:") - col.operator("font.text_copy", text="Copy") - col.operator("font.text_cut", text="Cut") - col.operator("font.text_paste", text="Paste") - col = layout.column(align=True) col.label(text="Set Case:") col.operator("font.case_set", text="To Upper").case = 'UPPER' diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index ecadb579fe2..878e0246ad5 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -56,6 +56,8 @@ void FONT_OT_case_set(struct wmOperatorType *ot); void FONT_OT_style_toggle(struct wmOperatorType *ot); void FONT_OT_style_set(struct wmOperatorType *ot); +void FONT_OT_select_all(struct wmOperatorType *ot); + void FONT_OT_text_copy(struct wmOperatorType *ot); void FONT_OT_text_cut(struct wmOperatorType *ot); void FONT_OT_text_paste(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index c2fe87945bf..618644032c0 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -65,6 +65,8 @@ void ED_operatortypes_curve(void) WM_operatortype_append(FONT_OT_style_toggle); WM_operatortype_append(FONT_OT_style_set); + WM_operatortype_append(FONT_OT_select_all); + WM_operatortype_append(FONT_OT_text_copy); WM_operatortype_append(FONT_OT_text_cut); WM_operatortype_append(FONT_OT_text_paste); @@ -208,6 +210,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "FONT_OT_change_character", UPARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "FONT_OT_change_character", DOWNARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1); + WM_keymap_add_item(keymap, "FONT_OT_select_all", AKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "FONT_OT_text_copy", CKEY, KM_PRESS, 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_paste", VKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 1ca97da5f74..59075d44c67 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -675,6 +675,47 @@ void FONT_OT_style_toggle(wmOperatorType *ot) RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to"); } + +/* -------------------------------------------------------------------- */ +/* Select All */ + +static int font_select_all_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + Object *obedit = CTX_data_edit_object(C); + Curve *cu = obedit->data; + + if (cu->len) { + cu->selstart = 1; + cu->selend = cu->len; + cu->pos = cu->len; + + text_update_edited(C, scene, obedit, true, FO_SELCHANGE); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } + +} + +void FONT_OT_select_all(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select All"; + ot->description = "Select all text"; + ot->idname = "FONT_OT_select_all"; + + /* api callbacks */ + ot->exec = font_select_all_exec; + ot->poll = ED_operator_editfont; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + + /******************* copy text operator ********************/ static void copy_selection(Object *obedit)