Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2013-03-24 17:43:40 +0400
committerTon Roosendaal <ton@blender.org>2013-03-24 17:43:40 +0400
commit1165236f69f0ca792df05919a48ae4058746d9bd (patch)
tree80bbebc880ca7bea68b0239672c3debde0ce0628 /source/blender/editors/space_text
parentc4ae6f2c3653faed47644713382ae78a49ef074e (diff)
Usablity:
In text editor, the CTRL+F find now opens property region (or keeps it) and activates the search button for input. That's already nice! But next step should be to do a search on exit of the button (or while typing). That's stuff I need Campbell to help with though. Notes: - Probably Py api for property buttons could get an "operator=" arg? - The warning menu "not found" should go away - I also suggest to make "wrap" search default for new editors
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c15
-rw-r--r--source/blender/editors/space_text/text_header.c32
-rw-r--r--source/blender/editors/space_text/text_intern.h4
-rw-r--r--source/blender/editors/space_text/text_ops.c2
4 files changed, 50 insertions, 3 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 58e45bc766f..600cbdb326b 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -220,6 +220,8 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_replace);
WM_operatortype_append(TEXT_OT_replace_set_selected);
+ WM_operatortype_append(TEXT_OT_start_find);
+
WM_operatortype_append(TEXT_OT_to_3d_object);
WM_operatortype_append(TEXT_OT_resolve_conflict);
@@ -233,9 +235,9 @@ static void text_keymap(struct wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
keymap = WM_keymap_find(keyconf, "Text Generic", SPACE_TEXT, 0);
- WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
- WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_OSKEY, 0);
#endif
keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
@@ -515,7 +517,16 @@ static void text_properties_area_init(wmWindowManager *wm, ARegion *ar)
static void text_properties_area_draw(const bContext *C, ARegion *ar)
{
+ SpaceText *st = CTX_wm_space_text(C);
+
ED_region_panels(C, ar, 1, NULL, -1);
+
+ /* this flag trick is make sure buttons have been added already */
+ if (st->flags & ST_FIND_ACTIVATE) {
+
+ UI_textbutton_activate_event(C, ar, st, "find_text");
+ st->flags &= ~ST_FIND_ACTIVATE;
+ }
}
/********************* registration ********************/
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 605a08e587a..aaeea40c1a5 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -113,6 +113,38 @@ void TEXT_OT_properties(wmOperatorType *ot)
ot->poll = text_properties_poll;
}
+static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = text_has_properties_region(sa);
+ SpaceText *st = CTX_wm_space_text(C);
+
+ if (ar) {
+ if (ar->flag & RGN_FLAG_HIDDEN)
+ ED_region_toggle_hidden(C, ar);
+
+ /* cannot send a button activate yet for case when region wasn't visible yet */
+ /* flag gets checked and cleared in main draw callback */
+ st->flags |= ST_FIND_ACTIVATE;
+
+ ED_region_tag_redraw(ar);
+ }
+ return OPERATOR_FINISHED;
+}
+
+
+void TEXT_OT_start_find(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Find";
+ ot->description = "Start searching text";
+ ot->idname = "TEXT_OT_start_find";
+
+ /* api callbacks */
+ ot->exec = text_text_search_exec;
+ ot->poll = text_properties_poll;
+}
+
/******************** XXX popup menus *******************/
#if 0
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 799bc49b624..371ccfd9bd9 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -134,11 +134,15 @@ void TEXT_OT_line_number(struct wmOperatorType *ot);
void TEXT_OT_properties(struct wmOperatorType *ot);
+/* find = find indicated text */
void TEXT_OT_find(struct wmOperatorType *ot);
void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
void TEXT_OT_replace(struct wmOperatorType *ot);
void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
+/* text_find = open properties, activate search button */
+void TEXT_OT_start_find(struct wmOperatorType *ot);
+
void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index cdbb3e7c600..b4dc4f55368 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2966,7 +2966,7 @@ static int text_find_exec(bContext *C, wmOperator *op)
void TEXT_OT_find(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Find";
+ ot->name = "Find Next";
ot->idname = "TEXT_OT_find";
ot->description = "Find specified text";