Merge from trunk -r 25003:25745.
[blender.git] / source / blender / windowmanager / intern / wm_operators.c
index 9e24b6a..e08bf22 100644 (file)
@@ -193,6 +193,7 @@ static int wm_macro_end(wmOperator *op, int retval)
        if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED)) {
                if (op->customdata) {
                        MEM_freeN(op->customdata);
+                       op->customdata = NULL;
                }
        }
 
@@ -353,6 +354,28 @@ wmOperatorType *WM_operatortype_append_macro(char *idname, char *name, int flag)
        return ot;
 }
 
+void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), void *userdata)
+{
+       wmOperatorType *ot;
+
+       ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
+       ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+
+       ot->flag= OPTYPE_MACRO;
+       ot->exec= wm_macro_exec;
+       ot->invoke= wm_macro_invoke;
+       ot->modal= wm_macro_modal;
+       ot->cancel= wm_macro_cancel;
+       ot->poll= NULL;
+
+       opfunc(ot, userdata);
+
+       RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)");
+       RNA_def_struct_identifier(ot->srna, ot->idname);
+
+       BLI_addtail(&global_ops, ot);
+}
+
 wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
 {
        wmOperatorTypeMacro *otmacro= MEM_callocN(sizeof(wmOperatorTypeMacro), "wmOperatorTypeMacro");
@@ -594,10 +617,13 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
        else if (RNA_property_type(prop) != PROP_ENUM) {
                printf("WM_menu_invoke: %s \"type\" is not an enum property\n", op->type->idname);
        }
+       else if (RNA_property_is_set(op->ptr, RNA_property_identifier(prop))) {
+               return op->type->exec(C, op);
+       }
        else {
                pup= uiPupMenuBegin(C, op->type->name, 0);
                layout= uiPupMenuLayout(pup);
-               uiItemsEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop));
+               uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
                uiPupMenuEnd(C, pup);
        }
 
@@ -609,10 +635,16 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, char *message)
 {
        uiPopupMenu *pup;
        uiLayout *layout;
+       IDProperty *properties= op->ptr->data;
+
+       if(properties && properties->len)
+               properties= IDP_CopyProperty(op->ptr->data);
+       else
+               properties= NULL;
 
        pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION);
        layout= uiPupMenuLayout(pup);
-       uiItemO(layout, message, 0, op->type->idname);
+       uiItemFullO(layout, message, 0, op->type->idname, properties, WM_OP_EXEC_REGION_WIN, 0);
        uiPupMenuEnd(C, pup);
        
        return OPERATOR_CANCELLED;
@@ -659,6 +691,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type)
        RNA_def_property_flag(prop, PROP_HIDDEN);
        prop= RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), "Filter text files", "");
        RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_btx", (filter & BTXFILE), "Filter btx files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
        prop= RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), "Filter folders", "");
        RNA_def_property_flag(prop, PROP_HIDDEN);
 
@@ -668,6 +702,18 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type)
        RNA_def_property_flag(prop, PROP_HIDDEN);
 }
 
+void WM_operator_properties_select_all(wmOperatorType *ot) {
+       static EnumPropertyItem select_all_actions[] = {
+                       {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
+                       {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
+                       {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
+                       {SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
+                       {0, NULL, 0, NULL, NULL}
+       };
+
+       RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, "Action", "Selection action to execute");
+}
+
 void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
 {
        RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
@@ -677,7 +723,7 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
        RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
 
        if(extend)
-               RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
+               RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first.");
 }
 
 
@@ -730,8 +776,11 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
        layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, 20, style);
        uiItemL(layout, op->type->name, 0);
 
-       if(op->type->ui)
-               op->type->ui((bContext*)C, op, layout);
+       if(op->type->ui) {
+               op->layout= layout;
+               op->type->ui((bContext*)C, op);
+               op->layout= NULL;
+       }
        else
                uiDefAutoButsRNA(C, layout, &ptr, columns);
 
@@ -741,6 +790,41 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
        return block;
 }
 
+
+static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData)
+{
+       struct { wmOperator *op; int width; int height; } * data = userData;
+       wmWindowManager *wm= CTX_wm_manager(C);
+       wmOperator *op= data->op;
+       PointerRNA ptr;
+       uiBlock *block;
+       uiLayout *layout;
+       uiStyle *style= U.uistyles.first;
+
+       block= uiBeginBlock(C, ar, "opui_popup", UI_EMBOSS);
+       uiBlockClearFlag(block, UI_BLOCK_LOOP);
+       uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
+
+       if(!op->properties) {
+               IDPropertyTemplate val = {0};
+               op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties");
+       }
+
+       RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
+       layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
+
+       if(op->type->ui) {
+               op->layout= layout;
+               op->type->ui((bContext*)C, op);
+               op->layout= NULL;
+       }
+
+       uiPopupBoundsBlock(block, 4.0f, 0, 0);
+       uiEndBlock(C, block);
+
+       return block;
+}
+
 int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
 {
        int retval= OPERATOR_CANCELLED;
@@ -754,6 +838,15 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
        return retval;
 }
 
+void WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
+{
+       struct { wmOperator *op; int width; int height; } data;
+       data.op = op;
+       data.width = width;
+       data.height = height;
+       uiPupBlock(C, wm_operator_create_ui, &data);
+}
+
 int WM_operator_redo_popup(bContext *C, wmOperator *op)
 {
        uiPupBlock(C, wm_block_create_redo, op);
@@ -778,8 +871,11 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
        layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 300, 20, style);
        uiItemL(layout, op->type->name, 0);
 
-       if(op->type->ui)
-               op->type->ui(C, op, layout);
+       if(op->type->ui) {
+               op->layout= layout;
+               op->type->ui(C, op);
+               op->layout= NULL;
+       }
        else
                uiDefAutoButsRNA(C, layout, op->ptr, 2);
        
@@ -836,6 +932,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
        uiBut *but;
        uiLayout *layout, *split, *col;
        uiStyle *style= U.uistyles.first;
+       struct RecentFile *recent;
+       int i;
        
        block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
        uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
@@ -849,7 +947,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
 
        uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
        
-       split = uiLayoutSplit(layout, 0);
+       split = uiLayoutSplit(layout, 0, 0);
        col = uiLayoutColumn(split, 0);
        uiItemL(col, "Links", 0);
        uiItemO(col, NULL, ICON_URL, "HELP_OT_release_logs");
@@ -861,7 +959,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
        
        col = uiLayoutColumn(split, 0);
        uiItemL(col, "Recent", 0);
-       uiItemsEnumO(col, "WM_OT_open_recentfile_splash", "file");
+       for(recent = G.recent_files.first, i=0; (i<6) && (recent); recent = recent->next, i++) {
+               char *display_name= BLI_last_slash(recent->filename);
+               if(display_name)        display_name++; /* skip the slash */
+               else                            display_name= recent->filename;
+               uiItemStringO(col, display_name, ICON_FILE_BLEND, "WM_OT_open_mainfile", "path", recent->filename);
+       }
+
        uiItemS(col);
 
        uiCenteredBoundsBlock(block, 0.0f);
@@ -935,7 +1039,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
        block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
        uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
        
-       but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, "");
+       but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, 0, 0, "");
        uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
        
        /* fake button, it holds space for search items */
@@ -1005,7 +1109,7 @@ static void WM_OT_call_menu(wmOperatorType *ot)
 
        ot->invoke= wm_call_menu_invoke;
 
-       RNA_def_string(ot->srna, "name", "", BKE_ST_MAXNAME, "Name", "Name of the new sequence strip");
+       RNA_def_string(ot->srna, "name", "", BKE_ST_MAXNAME, "Name", "Name of the menu");
 }
 
 /* ************ window / screen operator definitions ************** */
@@ -1044,126 +1148,6 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "factory", 0, "Factory Settings", "");
 }
 
-
-/* ********* recent file *********** */
-
-static int recentfile_exec(bContext *C, wmOperator *op)
-{
-       int event= RNA_enum_get(op->ptr, "file");
-
-       // XXX wm in context is not set correctly after WM_read_file -> crash
-       // do it before for now, but is this correct with multiple windows?
-
-       if(event>0) {
-               if (G.sce[0] && (event==1)) {
-                       WM_event_add_notifier(C, NC_WINDOW, NULL);
-                       WM_read_file(C, G.sce, op->reports);
-               }
-               else {
-                       struct RecentFile *recent = BLI_findlink(&(G.recent_files), event-1);
-                       if(recent) {
-                               WM_event_add_notifier(C, NC_WINDOW, NULL);
-                               WM_read_file(C, recent->filename, op->reports);
-                       }
-               }
-       }
-       return 0;
-}
-
-static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-       uiPopupMenu *pup;
-       uiLayout *layout;
-
-       pup= uiPupMenuBegin(C, "Open Recent", 0);
-       layout= uiPupMenuLayout(pup);
-       uiItemsEnumO(layout, op->type->idname, "file");
-       uiPupMenuEnd(C, pup);
-       
-       return OPERATOR_CANCELLED;
-}
-
-static EnumPropertyItem *open_recentfile_itemf(bContext *C, PointerRNA *ptr, int *free)
-{
-       EnumPropertyItem tmp = {0, "", 0, "", ""};
-       EnumPropertyItem *item= NULL;
-       struct RecentFile *recent;
-       int totitem= 0, i;
-
-       /* dynamically construct enum */
-       for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
-               tmp.value= i+1;
-               tmp.icon= ICON_FILE_BLEND;
-               tmp.identifier= recent->filename;
-               tmp.name= BLI_short_filename(recent->filename);
-               RNA_enum_item_add(&item, &totitem, &tmp);
-       }
-
-       RNA_enum_item_end(&item, &totitem);
-       *free= 1;
-
-       return item;
-}
-
-static void WM_OT_open_recentfile(wmOperatorType *ot)
-{
-       PropertyRNA *prop;
-       static EnumPropertyItem file_items[]= {
-               {0, NULL, 0, NULL, NULL}};
-
-       ot->name= "Open Recent File";
-       ot->idname= "WM_OT_open_recentfile";
-       ot->description="Open recent files list.";
-       
-       ot->invoke= wm_recentfile_invoke;
-       ot->exec= recentfile_exec;
-       ot->poll= WM_operator_winactive;
-       
-       prop= RNA_def_enum(ot->srna, "file", file_items, 1, "File", "");
-       RNA_def_enum_funcs(prop, open_recentfile_itemf);
-}
-
-static EnumPropertyItem *open_recentfile_splash_itemf(bContext *C, PointerRNA *ptr, int *free)
-{
-       EnumPropertyItem tmp = {0, "", 0, "", ""};
-       EnumPropertyItem *item= NULL;
-       struct RecentFile *recent;
-       int totitem= 0, i;
-       
-       /* dynamically construct enum */
-       for(recent = G.recent_files.first, i=0; (i<6) && (recent); recent = recent->next, i++) {
-               tmp.value= i+1;
-               tmp.icon= ICON_FILE_BLEND;
-               tmp.identifier= recent->filename;
-               tmp.name= BLI_last_slash(recent->filename);
-               if(tmp.name) tmp.name += 1;
-               else tmp.name = recent->filename;
-               RNA_enum_item_add(&item, &totitem, &tmp);
-       }
-       
-       RNA_enum_item_end(&item, &totitem);
-       *free= 1;
-       
-       return item;
-}
-
-static void WM_OT_open_recentfile_splash(wmOperatorType *ot)
-{
-       PropertyRNA *prop;
-       static EnumPropertyItem file_items[]= {
-               {0, NULL, 0, NULL, NULL}};
-       
-       ot->name= "Open Recent File";
-       ot->idname= "WM_OT_open_recentfile_splash";
-       ot->description="Open recent files list.";
-       
-       ot->exec= recentfile_exec;
-       ot->poll= WM_operator_winactive;
-       
-       prop= RNA_def_enum(ot->srna, "file", file_items, 1, "File", "");
-       RNA_def_enum_funcs(prop, open_recentfile_splash_itemf);
-}
-
 /* *************** open file **************** */
 
 static void open_set_load_ui(wmOperator *op)
@@ -1544,6 +1528,10 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        char name[FILE_MAX];
 
+       /* cancel if no active window */
+       if (CTX_wm_window(C) == NULL)
+               return OPERATOR_CANCELLED;
+
        save_set_compress(op);
        
        BLI_strncpy(name, G.sce, FILE_MAX);
@@ -1566,7 +1554,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
        
        ot->invoke= wm_save_mainfile_invoke;
        ot->exec= wm_save_as_mainfile_exec;
-       ot->poll= WM_operator_winactive;
+       ot->poll= NULL;
        
        WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER);
        RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file.");
@@ -1944,7 +1932,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
                case GESTURE_MODAL_CANCEL:
                case GESTURE_MODAL_CONFIRM:
                        wm_gesture_end(C, op);
-                       return OPERATOR_CANCELLED;
+                       return OPERATOR_FINISHED; /* use finish or we dont get an undo */
                }
        }
 //     // Allow view navigation???
@@ -2301,7 +2289,7 @@ int WM_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
                
                if(event->ctrl) {
                        if(mode == WM_RADIALCONTROL_STRENGTH)
-                               new_value = ((int)(new_value * 100) / 10*10) / 100.0f;
+                               new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
                        else
                                new_value = ((int)new_value + 5) / 10*10;
                }
@@ -2469,8 +2457,10 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
                                CTX_wm_area_set(C, sa);
 
                                for(ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next) {
-                                       CTX_wm_region_set(C, ar_iter);
-                                       ED_region_do_draw(C, ar_iter);
+                                       if(ar_iter->swinid) {
+                                               CTX_wm_region_set(C, ar_iter);
+                                               ED_region_do_draw(C, ar_iter);
+                                       }
                                }
                        }
 
@@ -2566,9 +2556,13 @@ void wm_operatortype_free(void)
 {
        wmOperatorType *ot;
        
-       for(ot= global_ops.first; ot; ot= ot->next)
+       for(ot= global_ops.first; ot; ot= ot->next) {
                if(ot->macro.first)
                        wm_operatortype_free_macro(ot);
+
+               if(ot->ext.srna) /* python operator, allocs own string */
+                       MEM_freeN(ot->idname);
+       }
        
        BLI_freelistN(&global_ops);
 }
@@ -2581,8 +2575,6 @@ void wm_operatortype_init(void)
        WM_operatortype_append(WM_OT_save_homefile);
        WM_operatortype_append(WM_OT_window_fullscreen_toggle);
        WM_operatortype_append(WM_OT_exit_blender);
-       WM_operatortype_append(WM_OT_open_recentfile);
-       WM_operatortype_append(WM_OT_open_recentfile_splash);
        WM_operatortype_append(WM_OT_open_mainfile);
        WM_operatortype_append(WM_OT_link_append);
        WM_operatortype_append(WM_OT_recover_last_session);
@@ -2713,13 +2705,13 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
 void wm_window_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
-       wmKeyMapItem *km;
+       wmKeyMapItem *kmi;
        
        /* note, this doesn't replace existing keymap items */
        WM_keymap_verify_item(keymap, "WM_OT_window_duplicate", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
        #ifdef __APPLE__
        WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_OSKEY, 0);
-       WM_keymap_add_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
+       WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
        WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0);
        WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0);
        WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
@@ -2727,12 +2719,12 @@ void wm_window_keymap(wmKeyConfig *keyconf)
        #endif
        WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0); 
-       WM_keymap_add_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
        WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
-       km= WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_boolean_set(km->ptr, "link", FALSE);
+       kmi= WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "link", FALSE);
 
        WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
@@ -2750,53 +2742,49 @@ void wm_window_keymap(wmKeyConfig *keyconf)
        /* Space switching */
 
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F2KEY, KM_PRESS, KM_SHIFT, 0); /* new in 2.5x, was DXF export */
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "LOGIC_EDITOR");
-
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F3KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "NODE_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F2KEY, KM_PRESS, KM_SHIFT, 0); /* new in 2.5x, was DXF export */
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "LOGIC_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F4KEY, KM_PRESS, KM_SHIFT, 0); /* new in 2.5x, was data browser */
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "CONSOLE");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F3KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "NODE_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F5KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "VIEW_3D");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F4KEY, KM_PRESS, KM_SHIFT, 0); /* new in 2.5x, was data browser */
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "CONSOLE");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F6KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "GRAPH_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F5KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "VIEW_3D");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F7KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "PROPERTIES");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F6KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "GRAPH_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F8KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "SEQUENCE_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F7KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "PROPERTIES");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F9KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "OUTLINER");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F8KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "SEQUENCE_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F9KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "OUTLINER");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F9KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "OUTLINER");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F10KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "IMAGE_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F10KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "IMAGE_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F11KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "TEXT_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F11KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "TEXT_EDITOR");
 
-       km = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F12KEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(km->ptr, "path", "area.type");
-       RNA_string_set(km->ptr, "value", "DOPESHEET_EDITOR");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F12KEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_string_set(kmi->ptr, "path", "area.type");
+       RNA_string_set(kmi->ptr, "value", "DOPESHEET_EDITOR");
 
        gesture_circle_modal_keymap(keyconf);
        gesture_border_modal_keymap(keyconf);