diff options
author | Ton Roosendaal <ton@blender.org> | 2013-03-24 17:43:40 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-03-24 17:43:40 +0400 |
commit | 1165236f69f0ca792df05919a48ae4058746d9bd (patch) | |
tree | 80bbebc880ca7bea68b0239672c3debde0ce0628 /source/blender/editors/space_text/text_header.c | |
parent | c4ae6f2c3653faed47644713382ae78a49ef074e (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/text_header.c')
-rw-r--r-- | source/blender/editors/space_text/text_header.c | 32 |
1 files changed, 32 insertions, 0 deletions
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 |