From 1165236f69f0ca792df05919a48ae4058746d9bd Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 24 Mar 2013 13:43:40 +0000 Subject: 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 --- source/blender/editors/space_text/text_header.c | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source/blender/editors/space_text/text_header.c') 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 -- cgit v1.2.3