Revision: 21015
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21015
Author:   chingachgook
Date:     2009-06-19 20:24:16 +0200 (Fri, 19 Jun 2009)

Log Message:
-----------
Merged 2.5 -r 20124:21003

Modified Paths:
--------------
    
branches/soc-2009-chingachgook/source/blender/editors/space_info/info_header.c

Modified: 
branches/soc-2009-chingachgook/source/blender/editors/space_info/info_header.c
===================================================================
--- 
branches/soc-2009-chingachgook/source/blender/editors/space_info/info_header.c  
    2009-06-19 16:43:35 UTC (rev 21014)
+++ 
branches/soc-2009-chingachgook/source/blender/editors/space_info/info_header.c  
    2009-06-19 18:24:16 UTC (rev 21015)
@@ -262,23 +262,22 @@
 static void info_filemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
        
-       uiLayoutContext(layout, WM_OP_EXEC_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_read_homefile"); 
-       uiLayoutContext(layout, WM_OP_INVOKE_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_open_mainfile"); 
 //     uiDefIconTextBlockBut(block, info_openrecentmenu, NULL, 
ICON_RIGHTARROW_THIN, "Open Recent",0, yco-=20, 120, 19, "");
 //     uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recover Last Session",   
                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
        
        uiItemS(layout);
        
-       uiLayoutContext(layout, WM_OP_EXEC_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_EXEC_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_save_mainfile"); 
-       uiLayoutContext(layout, WM_OP_INVOKE_AREA);
+       uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_save_as_mainfile"); 
 
        // XXX: these should move
        uiItemS(layout);
-       uiLayoutContext(layout, WM_OP_INVOKE_AREA);
        uiItemO(layout, NULL, 0, "WM_OT_collada_import"); 
        uiItemO(layout, NULL, 0, "WM_OT_collada_export"); 
 
@@ -393,7 +392,41 @@
        }
 }
 
+static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
+{
+       wmOperatorType *ot= arg2;
+       
+       if(ot)
+               WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, 
NULL);
+}
 
+static void operator_search_cb(const struct bContext *C, void *arg, char *str, 
uiSearchItems *items)
+{
+       wmOperatorType *ot = WM_operatortype_first();
+       
+       for(; ot; ot= ot->next) {
+               
+               if(BLI_strcasestr(ot->name, str)) {
+                       if(ot->poll==NULL || ot->poll((bContext *)C)) {
+                               char name[256];
+                               int len= strlen(ot->name);
+                               
+                               /* display name for menu, can hold hotkey */
+                               BLI_strncpy(name, ot->name, 256);
+                               
+                               /* check for hotkey */
+                               if(len < 256-6) {
+                                       if(WM_key_event_operator_string(C, 
ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1))
+                                               name[len]= '|';
+                               }
+                               
+                               if(0==uiSearchItemAdd(items, name, ot))
+                                       break;
+                       }
+               }
+       }
+}
+
 void info_header_buttons(const bContext *C, ARegion *ar)
 {
        wmWindow *win= CTX_wm_window(C);
@@ -459,6 +492,16 @@
                xco+= 90;
        }
        
+       {
+               static char search[256]= "";
+               uiBut *but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 
256, xco+5, yco, 120, 19, "");
+               
+               uiButSetSearchFunc(but, operator_search_cb, NULL, 
operator_call_cb);
+
+               xco+= 125;
+       }
+
+       
        /* always as last  */
        UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, 
ar->v2d.tot.ymax-ar->v2d.tot.ymin);
        


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to