diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-07 17:25:58 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-07 17:25:58 +0300 |
commit | f34bf8a0cd4f3437f03c1894e507e1b8c2125b9d (patch) | |
tree | c2aa098efe8fd9bf6433dca36ae3c5708fedfeb9 /source/blender/src/header_oops.c | |
parent | 008d6987d0d2b0b2d3bc44c649b769c2d32d6f59 (diff) |
Patch #4980, by Joshua Leung (aligorith)
This enables finding data in the Outliner.
Usage: Fkey (partial strings), CTRL+Fkey (partial strings, case sensitive).
SHIFT+Fkey to repeat a search, this cycles around.
Extra changes:
- button popups to enter strings now starts activated.
- outliner either shows for Armature the Bones, or Posechannels or
Editbones, depending the mode. Was needed to make searches meaningful.
Although Joshua did very good work on the key functions, there were a couple
of issues in his code, and problems in Outliner code, that didn't make it
all work nicely. So, this is quite a revised patch. :)
Full review log can be found in the patch tracker.
Diffstat (limited to 'source/blender/src/header_oops.c')
-rw-r--r-- | source/blender/src/header_oops.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index c4ebda76eae..fe1e3b89644 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -348,7 +348,67 @@ static uiBlock *oops_blockmenu(void *arg_unused) return block; } +static void do_oops_searchmenu(void *arg, int event) +{ + int search_flags = OL_FIND, again = 0; + + switch(event) + { + case 0: /* plain new find */ + search_flags = OL_FIND; + break; + case 1: /* case sensitive */ + search_flags = OL_FIND_CASE; + break; + case 2: /* full search */ + search_flags = OL_FIND_COMPLETE; + break; + case 3: /* full case sensitive */ + search_flags = OL_FIND_COMPLETE_CASE; + break; + case 4: /* again */ + again = 1; + break; + default: /* nothing valid */ + return; + } + + /* run search */ + outliner_find_panel(curarea, again, search_flags); +} + +static uiBlock *oops_searchmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "oops_searchmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_oops_searchmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find (Case Sensitive)|Ctrl F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Complete|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Complete (Case Sensitive)|Ctrl Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Again|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} void oops_buttons(void) { @@ -405,6 +465,11 @@ void oops_buttons(void) xco+= xmax; } + else { + xmax= GetButStringLength("Search"); + uiDefPulldownBut(block, oops_searchmenu, NULL, "Search", xco, -2, xmax-3, 24, ""); + xco+= xmax; + } } uiBlockSetEmboss(block, UI_EMBOSS); |