Key Configuration
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Oct 2009 18:40:03 +0000 (18:40 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Oct 2009 18:40:03 +0000 (18:40 +0000)
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.

There's actually 3 levels now:

* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
  or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
  to .py files as well to make creating distributable configurations
  easier.

Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.

Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
  keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
  added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.

108 files changed:
release/scripts/ui/space_userpref.py
source/blender/blenkernel/BKE_screen.h
source/blender/blenkernel/intern/blender.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/armature/armature_ops.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/gpencil/gpencil_ops.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/ED_armature.h
source/blender/editors/include/ED_curve.h
source/blender/editors/include/ED_gpencil.h
source/blender/editors/include/ED_markers.h
source/blender/editors/include/ED_mball.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_particle.h
source/blender/editors/include/ED_physics.h
source/blender/editors/include/ED_screen.h
source/blender/editors/include/ED_sculpt.h
source/blender/editors/include/ED_transform.h
source/blender/editors/include/ED_uvedit.h
source/blender/editors/include/UI_interface.h
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/metaball/mball_ops.c
source/blender/editors/object/object_ops.c
source/blender/editors/physics/physics_ops.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/space_action/action_intern.h
source/blender/editors/space_action/action_ops.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_intern.h
source/blender/editors/space_graph/graph_ops.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_nla/nla_intern.h
source/blender/editors/space_nla/nla_ops.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/outliner_intern.h
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_script/script_intern.h
source/blender/editors/space_script/script_ops.c
source/blender/editors/space_script/space_script.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_sound/space_sound.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_time/time_intern.h
source/blender/editors/space_time/time_ops.c
source/blender/editors/space_userpref/space_userpref.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_ops.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/python/intern/bpy_rna.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm.h
source/blender/windowmanager/wm_event_system.h
source/blender/windowmanager/wm_event_types.h

index 43c70dac4b1851c819c4194114578a1bf175d08c..ff4461db02f607143810b0ce5c9c66799aaf0f2b 100644 (file)
@@ -12,6 +12,10 @@ class USERPREF_HT_header(bpy.types.Header):
        
                layout.operator_context = "EXEC_AREA"
                layout.itemO("wm.save_homefile", text="Save As Default")
+
+               if userpref.active_section == 'INPUT':
+                       layout.operator_context = "INVOKE_DEFAULT"
+                       layout.itemO("wm.keyconfig_save", "Save Key Configuration...")
                        
 class USERPREF_MT_view(bpy.types.Menu):
        __space_type__ = 'USER_PREFERENCES'
@@ -31,14 +35,14 @@ class USERPREF_PT_tabs(bpy.types.Panel):
 
                layout.itemR(userpref, "active_section", expand=True)
 
-class USERPREF_PT_view(bpy.types.Panel):
+class USERPREF_PT_interface(bpy.types.Panel):
        __space_type__ = 'USER_PREFERENCES'
-       __label__ = "View"
+       __label__ = "Interface"
        __show_header__ = False
 
        def poll(self, context):
                userpref = context.user_preferences
-               return (userpref.active_section == 'VIEW_CONTROLS')
+               return (userpref.active_section == 'INTERFACE')
 
        def draw(self, context):
                layout = self.layout
@@ -87,37 +91,27 @@ class USERPREF_PT_view(bpy.types.Panel):
                sub1.itemR(view, "perspective_orthographic_switch")
                sub1.itemR(view, "smooth_view")
                sub1.itemR(view, "rotation_angle")
-               sub1.itemS()
-               sub1.itemL(text="NDOF Device:")
-               sub1.itemR(view, "ndof_pan_speed", text="Pan Speed")
-               sub1.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
                
                col = split.column()
                sub = col.split(percentage=0.85)
                
                sub1 = sub.column()
-               sub1.itemL(text="Mouse Buttons:")
-               
-               sub2 = sub1.column()
-               sub2.enabled = (view.select_mouse == 'RIGHT')
-               sub2.itemR(view, "emulate_3_button_mouse")
-               sub1.itemL(text="Select With:")
-               sub1.row().itemR(view, "select_mouse", expand=True)
-               sub1.itemL(text="Middle Mouse:")
-               sub1.row().itemR(view, "middle_mouse", expand=True)
-               sub1.itemR(view, "use_middle_mouse_paste")
-               sub1.itemL(text="Mouse Wheel:")
-               sub1.itemR(view, "wheel_invert_zoom", text="Invert Zoom")
-               sub1.itemR(view, "wheel_scroll_lines", text="Scroll Lines")
-               sub1.itemL(text="Mouse Motion:")
-               sub1.itemR(view, "continuous_mouse", text="Continuous Grab")
-               sub1.itemS()
                sub1.itemL(text="Menus:")
                sub1.itemR(view, "open_mouse_over")
                sub1.itemL(text="Menu Open Delay:")
                sub1.itemR(view, "open_toplevel_delay", text="Top Level")
                sub1.itemR(view, "open_sublevel_delay", text="Sub Level")
 
+               sub1.itemS()
+               sub1.itemS()
+               sub1.itemS()                    
+
+               sub1.itemL(text="Toolbox:")
+               sub1.itemR(view, "use_column_layout")
+               sub1.itemL(text="Open Toolbox Delay:")
+               sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
+               sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
+
                col = split.column()
                sub = col.split(percentage=0.85)
                
@@ -129,14 +123,6 @@ class USERPREF_PT_view(bpy.types.Panel):
                sub2.itemR(view, "manipulator_size", text="Size")
                sub2.itemR(view, "manipulator_handle_size", text="Handle Size")
                sub2.itemR(view, "manipulator_hotspot", text="Hotspot") 
-               sub1.itemS()
-               sub1.itemS()
-               sub1.itemS()                    
-               sub1.itemL(text="Toolbox:")
-               sub1.itemR(view, "use_column_layout")
-               sub1.itemL(text="Open Toolbox Delay:")
-               sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
-               sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
 
 class USERPREF_PT_edit(bpy.types.Panel):
        __space_type__ = 'USER_PREFERENCES'
@@ -145,7 +131,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
 
        def poll(self, context):
                userpref = context.user_preferences
-               return (userpref.active_section == 'EDIT_METHODS')
+               return (userpref.active_section == 'EDITING')
 
        def draw(self, context):
                layout = self.layout
@@ -248,7 +234,7 @@ class USERPREF_PT_system(bpy.types.Panel):
 
        def poll(self, context):
                userpref = context.user_preferences
-               return (userpref.active_section == 'SYSTEM_OPENGL')
+               return (userpref.active_section == 'SYSTEM')
 
        def draw(self, context):
                layout = self.layout
@@ -276,7 +262,7 @@ class USERPREF_PT_system(bpy.types.Panel):
                sub1.itemL(text="Sound:")
                sub1.row().itemR(system, "audio_device", expand=True)
                sub2 = sub1.column()
-               sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
+               sub2.active = system.audio_device != 'NONE'
                sub2.itemR(system, "enable_all_codecs")
                sub2.itemR(system, "game_sound")
                sub2.itemR(system, "audio_channels", text="Channels")
@@ -332,14 +318,14 @@ class USERPREF_PT_system(bpy.types.Panel):
                sub1.itemR(system, "prefetch_frames")
                sub1.itemR(system, "memory_cache_limit")
                
-class USERPREF_PT_filepaths(bpy.types.Panel):
+class USERPREF_PT_file(bpy.types.Panel):
        __space_type__ = 'USER_PREFERENCES'
-       __label__ = "File Paths"
+       __label__ = "Files"
        __show_header__ = False
 
        def poll(self, context):
                userpref = context.user_preferences
-               return (userpref.active_section == 'FILE_PATHS')
+               return (userpref.active_section == 'FILES')
 
        def draw(self, context):
                layout = self.layout
@@ -398,11 +384,314 @@ class USERPREF_PT_filepaths(bpy.types.Panel):
                sub3.enabled = paths.auto_save_temporary_files
                sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
 
+class USERPREF_PT_input(bpy.types.Panel):
+       __space_type__ = 'USER_PREFERENCES'
+       __label__ = "Input"
+       __show_header__ = False
+
+       def poll(self, context):
+               userpref = context.user_preferences
+               return (userpref.active_section == 'INPUT')
+
+       def draw(self, context):
+               layout = self.layout
+               
+               userpref = context.user_preferences
+               wm = context.manager
+               #input = userpref.input
+               input = userpref
+               view = userpref.view
+
+               split = layout.split(percentage=0.25)
+
+               # General settings
+               row = split.row()
+               col = row.column()
+
+               sub = col.column()
+               sub.itemL(text="Configuration:")
+               sub.item_pointerR(wm, "active_keyconfig", wm, "keyconfigs", text="")
+
+               col.itemS()
+
+               sub = col.column()
+               sub.itemL(text="Mouse:")
+               sub1 = sub.column()
+               sub1.enabled = (view.select_mouse == 'RIGHT')
+               sub1.itemR(view, "emulate_3_button_mouse")
+               sub.itemR(view, "continuous_mouse", text="Continuous Grab")
+
+               sub.itemL(text="Select With:")
+               sub.row().itemR(view, "select_mouse", expand=True)
+               #sub.itemL(text="Middle Mouse:")
+               #sub.row().itemR(view, "middle_mouse", expand=True)
+               #sub.itemR(view, "use_middle_mouse_paste")
+
+               #col.itemS()
+
+               #sub = col.column()
+               #sub.itemL(text="Mouse Wheel:")
+               #sub.itemR(view, "wheel_invert_zoom", text="Invert Zoom")
+               #sub.itemR(view, "wheel_scroll_lines", text="Scroll Lines")
+
+               col.itemS()
+
+               sub = col.column()
+               sub.itemL(text="NDOF Device:")
+               sub.itemR(view, "ndof_pan_speed", text="Pan Speed")
+               sub.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
+
+               row.itemS()
+
+               # Keymap Settings
+               col = split.column()
+
+               kc = wm.active_keyconfig
+               defkc = wm.default_keyconfig
+               km = wm.active_keymap
+
+               subsplit = col.split()
+               subsplit.item_pointerR(wm, "active_keymap", defkc, "keymaps", text="Map:")
+               if km.user_defined:
+                       row = subsplit.row()
+                       row.itemO("WM_OT_keymap_restore", text="Restore")
+                       row.item_booleanO("WM_OT_keymap_restore", "all", True, text="Restore All")
+               else:
+                       row = subsplit.row()
+                       row.itemO("WM_OT_keymap_edit", text="Edit")
+                       row.itemL()
+
+               col.itemS()
+               
+               for kmi in km.items:
+                       subcol = col.column()
+                       subcol.set_context_pointer("keyitem", kmi)
+
+                       row = subcol.row()
+
+                       if kmi.expanded:
+                               row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_DOWN")
+                       else:
+                               row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT")
+
+                       itemrow = row.row()
+                       itemrow.enabled = km.user_defined
+                       itemrow.itemR(kmi, "active", text="", icon="ICON_DOT")
+
+                       itemcol = itemrow.column()
+                       itemcol.active = kmi.active
+                       row = itemcol.row()
+                       row.itemR(kmi, "idname", text="")
+
+                       sub = row.row()
+                       sub.scale_x = 0.6
+                       sub.itemR(kmi, "map_type", text="")
+
+                       sub = row.row(align=True)
+                       if kmi.map_type == 'KEYBOARD':
+                               sub.itemR(kmi, "type", text="", full_event=True)
+                       elif kmi.map_type == 'MOUSE':
+                               sub.itemR(kmi, "type", text="", full_event=True)
+                       elif kmi.map_type == 'TWEAK':
+                               sub.scale_x = 0.5
+                               sub.itemR(kmi, "type", text="")
+                               sub.itemR(kmi, "value", text="")
+                       elif kmi.map_type == 'TIMER':
+                               sub.itemR(kmi, "type", text="")
+                       else:
+                               sub.itemL()
+
+                       if kmi.expanded:
+                               if kmi.map_type not in ('TEXTINPUT', 'TIMER'):
+                                       sub = itemcol.row(align=True)
+
+                                       if kmi.map_type == 'KEYBOARD':
+                                               sub.itemR(kmi, "type", text="", event=True)
+                                               sub.itemR(kmi, "value", text="")
+                                       elif kmi.map_type == 'MOUSE':
+                                               sub.itemR(kmi, "type", text="")
+                                               sub.itemR(kmi, "value", text="")
+                                       else:
+                                               sub.itemL()
+                                               sub.itemL()
+
+                                       subrow = sub.row()
+                                       subrow.scale_x = 0.75
+                                       subrow.itemR(kmi, "shift")
+                                       subrow.itemR(kmi, "ctrl")
+                                       subrow.itemR(kmi, "alt")
+                                       subrow.itemR(kmi, "oskey")
+                                       sub.itemR(kmi, "key_modifier", text="", event=True)
+
+                               flow = itemcol.column_flow(columns=2)
+                               props = kmi.properties
+
+                               if props != None:
+                                       for pname in dir(props):
+                                               if not props.is_property_hidden(pname):
+                                                       flow.itemR(props, pname)
+
+                               itemcol.itemS()
+
+                       itemrow.itemO("wm.keyitem_remove", text="", icon="ICON_ZOOMOUT")
+
+               itemrow = col.row()
+               itemrow.itemL()
+               itemrow.itemO("wm.keyitem_add", text="", icon="ICON_ZOOMIN")
+               itemrow.enabled = km.user_defined
+
 bpy.types.register(USERPREF_HT_header)
 bpy.types.register(USERPREF_MT_view)
 bpy.types.register(USERPREF_PT_tabs)
-bpy.types.register(USERPREF_PT_view)
+bpy.types.register(USERPREF_PT_interface)
 bpy.types.register(USERPREF_PT_edit)
 bpy.types.register(USERPREF_PT_system)
-bpy.types.register(USERPREF_PT_filepaths)
+bpy.types.register(USERPREF_PT_file)
+bpy.types.register(USERPREF_PT_input)
+
+class WM_OT_keyconfig_save(bpy.types.Operator):
+       "Save key configuration to a python script."
+       __idname__ = "wm.keyconfig_save"
+       __label__ = "Save Key Configuration..."
+       __props__ = [
+               bpy.props.StringProperty(attr="path", name="File Path", description="File path to write file to.")]
+
+       def _string_value(self, value):
+               result = ""
+               if isinstance(value, str):
+                       if value != "":
+                               result = "\'%s\'" % value
+               elif isinstance(value, bool):
+                       if value:
+                               result = "True"
+                       else:
+                               result = "False"
+               elif isinstance(value, float):
+                       result = "%.10f" % value
+               elif isinstance(value, int):
+                       result = "%d" % value
+               elif getattr(value, '__len__', False):
+                       if len(value):
+                               result = "["
+                               for i in range(0, len(value)):
+                                       result += self._string_value(value[i])
+                                       if i != len(value)-1:
+                                               result += ", "
+                               result += "]"
+               else:
+                       print("Save key configuration: can't write ", value)
+
+               return result
+
+       def execute(self, context):
+               if not self.path:
+                       raise Exception("File path not set.")
+
+               f = open(self.path, "w")
+               if not f:
+                       raise Exception("Could not open file.")
+
+               wm = context.manager
+               kc = wm.active_keyconfig
+
+               f.write('# Configuration %s\n' % kc.name)
+
+               f.write("wm = bpy.data.windowmanagers[0]\n");
+               f.write("kc = wm.add_keyconfig(\'%s\')\n\n" % kc.name)
+
+               for km in kc.keymaps:
+                       f.write("# Map %s\n" % km.name)
+                       f.write("km = kc.add_keymap(\'%s\', space_type=\'%s\', region_type=\'%s\')\n\n" % (km.name, km.space_type, km.region_type))
+                       for kmi in km.items:
+                               f.write("kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value))
+                               if kmi.shift:
+                                       f.write(", shift=True")
+                               if kmi.ctrl:
+                                       f.write(", ctrl=True")
+                               if kmi.alt:
+                                       f.write(", alt=True")
+                               if kmi.oskey:
+                                       f.write(", oskey=True")
+                               if kmi.key_modifier and kmi.key_modifier != 'NONE':
+                                       f.write(", key_modifier=\'%s\'" % kmi.key_modifier)
+                               f.write(")\n")
+
+                               props = kmi.properties
+
+                               if props != None:
+                                       for pname in dir(props):
+                                               if props.is_property_set(pname) and not props.is_property_hidden(pname):
+                                                       value = eval("props.%s" % pname)
+                                                       value = self._string_value(value)
+                                                       if value != "":
+                                                               f.write("kmi.properties.%s = %s\n" % (pname, value))
+
+                       f.write("\n")
+
+               f.close()
+
+               return ('FINISHED',)
+
+       def invoke(self, context, event):       
+               wm = context.manager
+               wm.add_fileselect(self.__operator__)
+               return ('RUNNING_MODAL',)
+
+class WM_OT_keymap_edit(bpy.types.Operator):
+       "Edit key map."
+       __idname__ = "wm.keymap_edit"
+       __label__ = "Edit Key Map"
+
+       def execute(self, context):
+               wm = context.manager
+               km = wm.active_keymap
+               km.copy_to_user()
+               return ('FINISHED',)
+
+class WM_OT_keymap_restore(bpy.types.Operator):
+       "Restore key map"
+       __idname__ = "wm.keymap_restore"
+       __label__ = "Restore Key Map"
+       __props__ = [bpy.props.BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default.")]
+
+       def execute(self, context):
+               wm = context.manager
+
+               if self.all:
+                       for km in wm.default_keyconfig.keymaps:
+                               km.restore_to_default()
+               else:
+                       km = wm.active_keymap
+                       km.restore_to_default()
+
+               return ('FINISHED',)
+       
+class WM_OT_keyitem_add(bpy.types.Operator):
+       "Add key map item."
+       __idname__ = "wm.keyitem_add"
+       __label__ = "Add Key Map Item"
+
+       def execute(self, context):
+               wm = context.manager
+               km = wm.active_keymap
+               kmi = km.add_item("", "A", "PRESS")
+               return ('FINISHED',)
+       
+class WM_OT_keyitem_remove(bpy.types.Operator):
+       "Remove key map item."
+       __idname__ = "wm.keyitem_remove"
+       __label__ = "Remove Key Map Item"
+
+       def execute(self, context):
+               wm = context.manager
+               kmi = context.keyitem
+               km = wm.active_keymap
+               km.remove_item(kmi)
+               return ('FINISHED',)
+
+bpy.ops.add(WM_OT_keyconfig_save)
+bpy.ops.add(WM_OT_keymap_edit)
+bpy.ops.add(WM_OT_keymap_restore)
+bpy.ops.add(WM_OT_keyitem_add)
+bpy.ops.add(WM_OT_keyitem_remove)
 
index b983c6f7dc432836a4730b86a956d1be40eff2f0..7c62c8c6dd459f6314e3ade59796095f71299591 100644 (file)
@@ -44,6 +44,7 @@ struct SpaceType;
 struct wmNotifier;
 struct wmWindow;
 struct wmWindowManager;
+struct wmKeyConfig;
 struct uiLayout;
 struct uiMenuItem;
 
@@ -81,7 +82,7 @@ typedef struct SpaceType {
        /* register operator types on startup */
        void            (*operatortypes)(void);
        /* add default items to WM keymap */
-       void            (*keymap)(struct wmWindowManager *);
+       void            (*keymap)(struct wmKeyConfig *);
 
        /* return context data */
        int                     (*context)(const struct bContext *, const char*, struct bContextDataResult *);
@@ -122,7 +123,7 @@ typedef struct ARegionType {
        /* register operator types on startup */
        void            (*operatortypes)(void);
        /* add own items to keymap */
-       void            (*keymap)(struct wmWindowManager *);
+       void            (*keymap)(struct wmKeyConfig *);
        /* allows default cursor per region */
        void            (*cursor)(struct wmWindow *, struct ScrArea *, struct ARegion *ar);
 
index f261b020717a1b78a5bf7fe36c2863fec4174824..2df5b7c173c64fa47e5d1f2176cce1aadd1b686d 100644 (file)
@@ -74,6 +74,7 @@
 #include "BKE_displist.h"
 #include "BKE_font.h"
 #include "BKE_global.h"
+#include "BKE_idprop.h"
 #include "BKE_library.h"
 #include "BKE_ipo.h"
 #include "BKE_main.h"
@@ -406,10 +407,26 @@ static int handle_subversion_warning(Main *main)
 
 void BKE_userdef_free(void)
 {
+       wmKeyMap *km;
+       wmKeyMapItem *kmi;
+
+       for(km=U.keymaps.first; km; km=km->next) {
+               for(kmi=km->items.first; kmi; kmi=kmi->next) {
+                       if(kmi->properties) {
+                               IDP_FreeProperty(kmi->properties);
+                               MEM_freeN(kmi->properties);
+                       }
+                       if(kmi->ptr)
+                               MEM_freeN(kmi->ptr);
+               }
+
+               BLI_freelistN(&km->items);
+       }
        
        BLI_freelistN(&U.uistyles);
        BLI_freelistN(&U.uifonts);
        BLI_freelistN(&U.themes);
+       BLI_freelistN(&U.keymaps);
        
 }
 
index ae18d7cac012db167f83722b3985ec97c5bf676f..f2bf8b19bc64c0dd18f420e3d5433c81d534681b 100644 (file)
@@ -4446,11 +4446,13 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
        }
        
        wm->operators.first= wm->operators.last= NULL;
-       wm->keymaps.first= wm->keymaps.last= NULL;
        wm->paintcursors.first= wm->paintcursors.last= NULL;
        wm->queue.first= wm->queue.last= NULL;
        BKE_reports_init(&wm->reports, RPT_STORE);
 
+       wm->keyconfigs.first= wm->keyconfigs.last= NULL;
+       wm->defaultconf= NULL;
+
        wm->jobs.first= wm->jobs.last= NULL;
        
        wm->windrawable= NULL;
@@ -5276,6 +5278,33 @@ static char *dataname(short id_code)
        
 }
 
+static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocname)
+{
+       bhead = blo_nextbhead(fd, bhead);
+
+       while(bhead && bhead->code==DATA) {
+               void *data;
+#if 0          
+               /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */         
+               short *sp= fd->filesdna->structs[bhead->SDNAnr];
+               char *allocname = fd->filesdna->types[ sp[0] ];
+               char *tmp= malloc(100);
+               
+               strcpy(tmp, allocname);
+               data= read_struct(fd, bhead, tmp);
+#endif
+               data= read_struct(fd, bhead, allocname);
+               
+               if (data) {
+                       oldnewmap_insert(fd->datamap, bhead->old, data, 0);
+               }
+
+               bhead = blo_nextbhead(fd, bhead);
+       }
+
+       return bhead;
+}
+
 static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID **id_r)
 {
        /* this routine reads a libblock and its direct data. Use link functions
@@ -5317,32 +5346,11 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
                return blo_nextbhead(fd, bhead);
        }
 
-       bhead = blo_nextbhead(fd, bhead);
-
        /* need a name for the mallocN, just for debugging and sane prints on leaks */
        allocname= dataname(GS(id->name));
        
-               /* read all data */
-       
-       while(bhead && bhead->code==DATA) {
-               void *data;
-#if 0          
-               /* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */         
-               short *sp= fd->filesdna->structs[bhead->SDNAnr];
-               char *allocname = fd->filesdna->types[ sp[0] ];
-               char *tmp= malloc(100);
-               
-               strcpy(tmp, allocname);
-               data= read_struct(fd, bhead, tmp);
-#endif
-               data= read_struct(fd, bhead, allocname);
-               
-               if (data) {
-                       oldnewmap_insert(fd->datamap, bhead->old, data, 0);
-               }
-
-               bhead = blo_nextbhead(fd, bhead);
-       }
+       /* read all data into fd->datamap */
+       bhead= read_data_into_oldnewmap(fd, bhead, allocname);
 
        /* init pointers direct data */
        switch( GS(id->name) ) {
@@ -9975,23 +9983,39 @@ static void lib_link_all(FileData *fd, Main *main)
 
 static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
 {
-       Link *link;
+       UserDef *user;
+       wmKeyMap *keymap;
+       wmKeyMapItem *kmi;
 
-       bfd->user= read_struct(fd, bhead, "user def");
-       bfd->user->themes.first= bfd->user->themes.last= NULL;
-       // XXX
-       bfd->user->uifonts.first= bfd->user->uifonts.last= NULL;
-       bfd->user->uistyles.first= bfd->user->uistyles.last= NULL;
+       bfd->user= user= read_struct(fd, bhead, "user def");
 
-       bhead = blo_nextbhead(fd, bhead);
+       /* read all data into fd->datamap */
+       bhead= read_data_into_oldnewmap(fd, bhead, "user def");
 
-               /* read all attached data */
-       while(bhead && bhead->code==DATA) {
-               link= read_struct(fd, bhead, "user def data");
-               BLI_addtail(&bfd->user->themes, link);
-               bhead = blo_nextbhead(fd, bhead);
+       link_list(fd, &user->themes);
+       link_list(fd, &user->keymaps);
+
+       for(keymap=user->keymaps.first; keymap; keymap=keymap->next) {
+               keymap->modal_items= NULL;
+               keymap->poll= NULL;
+
+               link_list(fd, &keymap->items);
+               for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+                       kmi->properties= newdataadr(fd, kmi->properties);
+                       if(kmi->properties)
+                               IDP_DirectLinkProperty(kmi->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+                       kmi->ptr= NULL;
+               }
        }
 
+       // XXX
+       user->uifonts.first= user->uifonts.last= NULL;
+       user->uistyles.first= user->uistyles.last= NULL;
+
+       /* free fd->datamap again */
+       oldnewmap_free_unused(fd->datamap);
+       oldnewmap_clear(fd->datamap);
+
        return bhead;
 }
 
index 25cbd4b65e72b46099436d24769ea533e57395eb..e3d061d8e4bab4e5516b45473e7ff7edeb44f560 100644 (file)
@@ -537,13 +537,23 @@ static void write_renderinfo(WriteData *wd, Main *mainvar)                /* for renderdeamon
 static void write_userdef(WriteData *wd)
 {
        bTheme *btheme;
+       wmKeyMap *keymap;
+       wmKeyMapItem *kmi;
 
        writestruct(wd, USER, "UserDef", 1, &U);
 
-       btheme= U.themes.first;
-       while(btheme) {
+       for(btheme= U.themes.first; btheme; btheme=btheme->next)
                writestruct(wd, DATA, "bTheme", 1, btheme);
-               btheme= btheme->next;
+
+       for(keymap= U.keymaps.first; keymap; keymap=keymap->next) {
+               writestruct(wd, DATA, "wmKeyMap", 1, keymap);
+
+               for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+                       writestruct(wd, DATA, "wmKeyMapItem", 1, kmi);
+
+                       if(kmi->properties)
+                               IDP_WriteProperty(kmi->properties, wd);
+               }
        }
 }
 
index 83f5fca5af5e0afb315a2a50dc3db1f8b7c2e3c4..7ee591f8cab07114114b5a55befb090bc39b24d4 100644 (file)
@@ -1687,9 +1687,9 @@ void ED_operatortypes_animchannels(void)
        WM_operatortype_append(ANIM_OT_channels_visibility_toggle);
 }
 
-void ED_keymap_animchannels(wmWindowManager *wm)
+void ED_keymap_animchannels(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap = WM_keymap_find(wm, "Animation_Channels", 0, 0);
+       wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation_Channels", 0, 0);
        
        /* selection */
                /* click-select */
index 6c44086af4100214d7d20e9ecc6949bec203ad9e..f4ecb9d5def701d8f60e7cd106003b791815e77e 100644 (file)
@@ -990,9 +990,9 @@ void ED_operatortypes_marker(void)
 }
 
 /* called in screen_ops.c:ED_keymap_screen() */
-void ED_marker_keymap(wmWindowManager *wm)
+void ED_marker_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Markers", 0, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Markers", 0, 0);
        
        WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "MARKER_OT_move", EVT_TWEAK_S, KM_ANY, 0, 0);
index 83b2e2688c97459ac1847dae25d84120fe0b55ff..35eac6d23f17bbca846d4f6308bedf809a7cb6c8 100644 (file)
@@ -416,9 +416,9 @@ void ED_operatortypes_anim(void)
        WM_operatortype_append(ANIM_OT_keying_set_path_remove);
 }
 
-void ED_keymap_anim(wmWindowManager *wm)
+void ED_keymap_anim(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Animation", 0, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Animation", 0, 0);
        
        /* frame management */
                /* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */
index d465c1f8c9a5115a16edea063b080b0911bbc078..2bf414ef9698c16113aa081214f72ec0812d4a1a 100644 (file)
@@ -205,13 +205,13 @@ void ED_operatortypes_armature(void)
        WM_operatortype_append(ARMATURE_OT_test); // XXX temp test for context iterators... to be removed
 }
 
-void ED_keymap_armature(wmWindowManager *wm)
+void ED_keymap_armature(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
        /* Armature ------------------------ */
-       keymap= WM_keymap_find(wm, "Armature", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Armature", 0, 0);
        keymap->poll= ED_operator_editarmature;
        
        /* only set in editmode armature, by space_view3d listener */
@@ -297,7 +297,7 @@ void ED_keymap_armature(wmWindowManager *wm)
 
        /* Pose ------------------------ */
        /* only set in posemode, by space_view3d listener */
-       keymap= WM_keymap_find(wm, "Pose", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Pose", 0, 0);
        keymap->poll= ED_operator_posemode;
        
        // XXX: set parent is object-based operator, but it should also be available here...
index 77c5ed1de2c4099e478b381ae9b9fe16013a2bd0..a71ff8347e815bfe1788dc35d1f672ead7d46539 100644 (file)
@@ -161,11 +161,11 @@ void ED_operatortypes_curve(void)
        WM_operatortype_append(CURVE_OT_specials_menu);
 }
 
-void ED_keymap_curve(wmWindowManager *wm)
+void ED_keymap_curve(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
-       keymap= WM_keymap_find(wm, "Font", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Font", 0, 0);
        keymap->poll= ED_operator_editfont;
        
        /* only set in editmode font, by space_view3d listener */
@@ -215,7 +215,7 @@ void ED_keymap_curve(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "FONT_OT_text_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
 
        /* only set in editmode curve, by space_view3d listener */
-       keymap= WM_keymap_find(wm, "Curve", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Curve", 0, 0);
        keymap->poll= ED_operator_editsurfcurve;
        
        WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
index d311b39b9a34a3ebf32bad0b82f048ef97802a44..6237e193a13f39b9b70be55a444de17738844dcb 100644 (file)
 /* ****************************************** */
 /* Generic Editing Keymap */
 
-void ED_keymap_gpencil(wmWindowManager *wm)
+void ED_keymap_gpencil(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
-       wmKeymapItem *kmi;
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
+       wmKeyMapItem *kmi;
        
        /* Draw */
                /* draw */
index d943995656913d560a655ff69e8beb342bf55cad..97f4dd915e4396c892a87a6cd53a91218956ec79 100644 (file)
@@ -34,7 +34,7 @@ struct ListBase;
 struct AnimData;
 
 struct bContext;
-struct wmWindowManager;
+struct wmKeyConfig;
 struct ScrArea;
 struct ARegion;
 struct View2D;
@@ -487,11 +487,11 @@ void ANIM_pose_to_action_sync(struct Object *ob, struct ScrArea *sa);
        
        /* generic animation channels */
 void ED_operatortypes_animchannels(void);
-void ED_keymap_animchannels(struct wmWindowManager *wm);
+void ED_keymap_animchannels(struct wmKeyConfig *keyconf);
 
        /* generic time editing */
 void ED_operatortypes_anim(void);
-void ED_keymap_anim(struct wmWindowManager *wm);
+void ED_keymap_anim(struct wmKeyConfig *keyconf);
 
 /* ************************************************ */
 
index 8bdfe41ef80ad0ce5c11adcc4dedfef28173ee89..6479030bcd1472b4ae158fc3eab891ef95dfe69c 100644 (file)
@@ -35,7 +35,7 @@ struct Bone;
 struct bArmature;
 struct bPoseChannel;
 struct wmOperator;
-struct wmWindowManager;
+struct wmKeyConfig;
 struct ListBase;
 struct View3D;
 struct ViewContext;
@@ -92,7 +92,7 @@ typedef struct EditBone
 
 /* armature_ops.c */
 void ED_operatortypes_armature(void);
-void ED_keymap_armature(struct wmWindowManager *wm);
+void ED_keymap_armature(struct wmKeyConfig *keyconf);
 
 /* editarmature.c */
 void ED_armature_from_edit(struct Object *obedit);
index 4149c6a9cca0d4bf8e43c2b7402bbe0aefcd9676..fea684971b23e833a1aa274df072253398917044 100644 (file)
@@ -36,11 +36,11 @@ struct Scene;
 struct Text;
 struct View3D;
 struct wmOperator;
-struct wmWindowManager;
+struct wmKeyConfig;
 
 /* curve_ops.c */
 void   ED_operatortypes_curve(void);
-void   ED_keymap_curve (struct wmWindowManager *wm);
+void   ED_keymap_curve (struct wmKeyConfig *keyconf);
 
 /* editcurve.c */
 void   undo_push_curve (struct bContext *C, char *name);
index 388da9a2acc3c4d00f1d36ab07f1735bb699e357..ff95f8ce6eb005b28aeab3e885f5c7455ef281a5 100644 (file)
@@ -41,7 +41,7 @@ struct bGPDframe;
 struct PointerRNA;
 struct Panel;
 struct ImBuf;
-struct wmWindowManager;
+struct wmKeyConfig;
 
 
 /* ------------- Grease-Pencil Helpers ---------------- */
@@ -62,7 +62,7 @@ struct bGPdata *gpencil_data_get_active(struct bContext *C);
 
 /* ----------- Grease Pencil Operators ----------------- */
 
-void ED_keymap_gpencil(struct wmWindowManager *wm);
+void ED_keymap_gpencil(struct wmKeyConfig *keyconf);
 void ED_operatortypes_gpencil(void);
 
 /* ------------ Grease-Pencil Drawing API ------------------ */
index 4b7a295420629734737307f476fe7a3b23fc16fe..58ca85bb74ccf066b9745c29fec208c88fe7262c 100644 (file)
@@ -28,7 +28,7 @@
 #ifndef ED_MARKERS_H
 #define ED_MARKERS_H
 
-struct wmWindowManager;
+struct wmKeyConfig;
 struct bContext;
 struct TimeMarker;
 
@@ -56,7 +56,7 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
 /* called in screen_ops.c:ED_operatortypes_screen() */
 void ED_operatortypes_marker(void); 
 /* called in screen_ops.c:ED_keymap_screen() */
-void ED_marker_keymap(struct wmWindowManager *wm);
+void ED_marker_keymap(struct wmKeyConfig *keyconf);
 
 
 #endif /* ED_MARKERS_H */
index 49c1d856a27850aae6b9ba3db6956373a6481f13..6708a73e0889d7ed27bf662501635a35eb8575dd 100644 (file)
 
 struct bContext;
 struct Object;
-struct wmWindowManager;
+struct wmKeyConfig;
 
 void ED_operatortypes_metaball(void);
-void ED_keymap_metaball(struct wmWindowManager *wm);
+void ED_keymap_metaball(struct wmKeyConfig *keyconf);
 
 struct MetaElem *add_metaball_primitive(struct bContext *C, int type, int newname);
 
index fd88f9889ae38d9ac07755428e4298a78ad16fe0..cf0e6eb01c3aa92f6e00f2d5c2af82d72e42d290 100644 (file)
@@ -38,6 +38,7 @@ struct EditFace;
 struct bContext;
 struct wmOperator;
 struct wmWindowManager;
+struct wmKeyConfig;
 struct ReportList;
 struct EditSelection;
 struct ViewContext;
@@ -84,13 +85,13 @@ int                 join_mesh_exec(struct bContext *C, struct wmOperator *op);
 
 /* mesh_ops.c */
 void           ED_operatortypes_mesh(void);
-void           ED_keymap_mesh(struct wmWindowManager *wm);
+void           ED_keymap_mesh(struct wmKeyConfig *keyconf);
 
 
 /* editmesh.c */
 
 void           ED_spacetypes_init(void);
-void           ED_keymap_mesh(struct wmWindowManager *wm);
+void           ED_keymap_mesh(struct wmKeyConfig *keyconf);
 
 void           make_editMesh(struct Scene *scene, struct Object *ob);
 void           load_editMesh(struct Scene *scene, struct Object *ob);
index 363795afeab06fbb06d3cdf078ddfd8b860d45e9..ec763fe3dfc4aa3e910743bd8469e3bf1c9f3922 100644 (file)
@@ -28,7 +28,7 @@
 #ifndef ED_OBJECT_H
 #define ED_OBJECT_H
 
-struct wmWindowManager;
+struct wmKeyConfig;
 struct Scene;
 struct Object;
 struct bContext;
@@ -44,7 +44,7 @@ struct ModifierData;
 
 /* object_edit.c */
 void ED_operatortypes_object(void);
-void ED_keymap_object(struct wmWindowManager *wm);
+void ED_keymap_object(struct wmKeyConfig *keyconf);
 
        /* send your own notifier for select! */
 void ED_base_object_select(struct Base *base, short mode);
index a052142102daf18091265871e11371d3d96dc2ee..3d7fc5ea15b4c65d2a9835a520496ea5871c1bd4 100644 (file)
@@ -36,7 +36,7 @@ struct ParticleEditSettings;
 struct ParticleSystem;
 struct RadialControl;
 struct rcti;
-struct wmWindowManager;
+struct wmKeyConfig;
 struct PTCacheEdit;
 struct Scene;
 
index ee340c54e7daafed1db20a6757d90b5600d021ef..df303d7c9f1edf3d78cc4e6bd4147adb8adb0429 100644 (file)
 #ifndef ED_PHYSICS_H
 #define ED_PHYSICS_H
 
+struct wmKeyConfig;
+
 /* operators */
 void ED_operatortypes_physics(void);
-void ED_keymap_physics(struct wmWindowManager *wm);
+void ED_keymap_physics(struct wmKeyConfig *keyconf);
 
 #endif /* ED_PHYSICS_H */
 
index 63b6a067389128c811a4486f937b929eaf72a2be..18c86306e445064ee5f800e96ce95d5691fc5fde 100644 (file)
@@ -37,6 +37,7 @@ struct wmWindowManager;
 struct wmWindow;
 struct wmNotifier;
 struct wmEvent;
+struct wmKeyConfig;
 struct bContext;
 struct SpaceType;
 struct Scene;
@@ -63,7 +64,7 @@ void  region_scissor_winrct(struct ARegion *ar, struct rcti *winrct);
 
 /* spaces */
 void   ED_spacetypes_init(void);
-void   ED_spacetypes_keymap(struct wmWindowManager *wm);
+void   ED_spacetypes_keymap(struct wmKeyConfig *keyconf);
 int            ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco);
 int            ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco);
 void   ED_area_overdraw(struct bContext *C);
@@ -107,7 +108,7 @@ void        ED_screen_new_window(struct bContext *C, struct rcti *position, int type);
 void   ED_update_for_newframe(const struct bContext *C, int mute);
 
 void   ED_operatortypes_screen(void);
-void   ED_keymap_screen(struct wmWindowManager *wm);
+void   ED_keymap_screen(struct wmKeyConfig *keyconf);
 
 /* operators; context poll callbacks */
 int            ED_operator_screenactive(struct bContext *C);
index a08f0576f42ecb829beb2e39e31fdf0eb54abc02..764efb4ef0c0f2765afaebc6cf84a54b5bc73922 100644 (file)
 #define ED_SCULPT_H
 
 struct bContext;
-struct wmWindowManager;
+struct wmKeyConfig;
 
 /* sculpt.c */
 void ED_operatortypes_sculpt(void);
 
 /* paint_ops.c */
 void ED_operatortypes_paint(void);
-void ED_keymap_paint(struct wmWindowManager *wm);
+void ED_keymap_paint(struct wmKeyConfig *keyconf);
 
 /* paint_image.c */
 void undo_imagepaint_step(int step);
index 7f08e95acebe7b5d15602754298801588d9478ed..a7ffefba8df5ebdcc7eb1c2352db538964dbda1d 100644 (file)
@@ -42,8 +42,9 @@ struct uiLayout;
 struct EnumPropertyItem;
 struct wmOperatorType;
 struct wmKeyMap;
+struct wmKeyConfig;
 
-void transform_keymap_for_space(struct wmWindowManager *wm, struct wmKeyMap *keymap, int spaceid);
+void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid);
 void transform_operatortypes(void);
 
 /* ******************** Macros & Prototypes *********************** */
index 74a9be75db6d9eb721dc4b60d84f40a57f2fc3c3..8823437cf794964902df9f9e13ebc1a864f7ab0d 100644 (file)
@@ -34,11 +34,11 @@ struct Object;
 struct MTFace;
 struct EditFace;
 struct Image;
-struct wmWindowManager;
+struct wmKeyConfig;
 
 /* uvedit_ops.c */
 void ED_operatortypes_uvedit(void);
-void ED_keymap_uvedit(struct wmWindowManager *wm);
+void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
 
 void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
 void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile);
index 35598db9e024d270571828ca29a4f3833824b224..3c6ed1137ae9cceef9b57489fbece33661d8e407 100644 (file)
@@ -147,6 +147,7 @@ typedef struct uiLayout uiLayout;
 #define UI_BUT_INACTIVE                (1<<23)
 #define UI_BUT_LAST_ACTIVE     (1<<24)
 #define UI_BUT_UNDO                    (1<<25)
+#define UI_BUT_IMMEDIATE       (1<<26)
 
 #define UI_PANEL_WIDTH                 340
 #define UI_COMPACT_PANEL_WIDTH 160
@@ -572,6 +573,8 @@ void UI_exit(void);
 #define UI_ITEM_R_SLIDER               4
 #define UI_ITEM_R_TOGGLE               8
 #define UI_ITEM_R_ICON_ONLY            16
+#define UI_ITEM_R_EVENT                        32
+#define UI_ITEM_R_FULL_EVENT   64
 
 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
index 38c4d82e6daafef06cf941fc00a04b4f102e21a7..8fbff25589d422224df77affabf86628119b4b65 100644 (file)
@@ -128,7 +128,7 @@ struct View2D;
 struct View2DGrid;
 struct View2DScrollers;
 
-struct wmWindowManager;
+struct wmKeyConfig;
 struct bScreen;
 struct ScrArea;
 struct ARegion;
@@ -196,7 +196,7 @@ void UI_view2d_text_cache_draw(struct ARegion *ar);
 
 /* operators */
 void ui_view2d_operatortypes(void);
-void UI_view2d_keymap(struct wmWindowManager *wm);
+void UI_view2d_keymap(struct wmKeyConfig *keyconf);
 
 #endif /* UI_VIEW2D_H */
 
index 3e5cc0e6d67575714c26152b09af45eb4dd05a9d..fcc41e4f53338a77f43084ddac65324cbb157260 100644 (file)
@@ -1958,7 +1958,10 @@ void ui_check_but(uiBut *but)
                if (but->flag & UI_SELECT) {
                        short *sp= (short *)but->func_arg3;
                        
-                       strcpy(but->drawstr, but->str);
+                       if(but->flag & UI_BUT_IMMEDIATE)
+                               strcpy(but->drawstr, but->str);
+                       else
+                               strcpy(but->drawstr, "");
                        
                        if(*sp) {
                                char *str= but->drawstr;
@@ -1974,10 +1977,10 @@ void ui_check_but(uiBut *but)
                        }
                        else
                                strcat(but->drawstr, "Press a key  ");
-               } else {
-                       /* XXX todo, button currently only used temporarily */
-                       strcpy(but->drawstr, WM_key_event_string((short) ui_get_but_val(but)));
                }
+               else
+                       strcpy(but->drawstr, but->str);
+
                break;
                
        case BUT_TOGDUAL:
index 8dea3fa1fc3214d8c5dfb36eb2991ecd0bf989b4..195129eac8f772a05a0c23e1f72d9e7befb49130 100644 (file)
@@ -1858,6 +1858,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
        if(data->state == BUTTON_STATE_HIGHLIGHT) {
                if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
                        but->drawstr[0]= 0;
+                       *(short *)but->func_arg3= 0;
                        button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -1868,9 +1869,12 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
                if(event->type == MOUSEMOVE)
                        return WM_UI_HANDLER_CONTINUE;
                
-               if(ELEM(event->type, ESCKEY, LEFTMOUSE)) {
+               if(event->type == ESCKEY) {
                        /* data->cancel doesnt work, this button opens immediate */
-                       ui_set_but_val(but, 0);
+                       if(but->flag & UI_BUT_IMMEDIATE)
+                               ui_set_but_val(but, 0);
+                       else
+                               data->cancel= 1;
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -3325,6 +3329,7 @@ static uiBlock *menu_change_hotkey(bContext *C, ARegion *ar, void *arg_but)
        strcat(buf, " |");
        
        but= uiDefHotKeyevtButS(block, 0, buf, 0, 0, 200, 20, dummy, dummy+1, "");
+       uiButSetFlag(but, UI_BUT_IMMEDIATE);
        uiButSetFunc(but, do_menu_change_hotkey, arg_but, dummy);
 
        uiPopupBoundsBlock(block, 6.0f, 50, -10);
@@ -3782,8 +3787,11 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
        button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
        
        /* activate right away */
-       if(but->type==HOTKEYEVT)
-               button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
+       if(but->flag & UI_BUT_IMMEDIATE) {
+               if(but->type==HOTKEYEVT)
+                       button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
+               /* .. more to be added here */
+       }
        
        if(type == BUTTON_ACTIVATE_OPEN) {
                button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
index b15be940eefadedd2a5fdd0a103681a57e989a37..eb81044852a76edb8263cd8c38760eddb5f6494b 100644 (file)
@@ -476,8 +476,20 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
                MEM_freeN(item);
 }
 
+/* callback for keymap item change button */
+static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v)
+{
+       uiBut *but= but_v;
+       short modifier= *((short*)key_v);
+
+       RNA_boolean_set(&but->rnapoin, "shift", (modifier & KM_SHIFT) != 0);
+       RNA_boolean_set(&but->rnapoin, "ctrl", (modifier & KM_CTRL) != 0);
+       RNA_boolean_set(&but->rnapoin, "alt", (modifier & KM_ALT) != 0);
+       RNA_boolean_set(&but->rnapoin, "oskey", (modifier & KM_OSKEY) != 0);
+}
+
 /* create label + button for RNA property */
-static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int icon_only)
+static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag)
 {
        uiLayout *sub;
        uiBut *but=NULL;
@@ -507,10 +519,26 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, i
                /* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
                but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, "Browse for file or directory.");
        }
-       else if(subtype == PROP_DIRECTION)
-               uiDefButR(block, BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
+       else if(subtype == PROP_DIRECTION) {
+               uiDefButR(block, BUT_NORMAL, 0, name, x, y, 100, 100, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
+       }
+       else if(flag & UI_ITEM_R_EVENT) {
+               uiDefButR(block, KEYEVT, 0, name, x, y, w, h, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
+       }
+       else if(flag & UI_ITEM_R_FULL_EVENT) {
+               if(RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
+                       static short dummy = 0;
+                       char buf[128];
+
+                       WM_keymap_item_to_string(ptr->data, buf, sizeof(buf));
+
+                       but= uiDefButR(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, RNA_property_identifier(prop), 0, 0, 0, -1, -1, NULL);
+                       but->func_arg3= &dummy; // XXX abuse
+                       uiButSetFunc(but, ui_keymap_but_cb, but, &dummy);
+               }
+       }
        else
-               but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !icon_only)? NULL: "", icon, x, y, w, h);
+               but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY))? NULL: "", icon, x, y, w, h);
 
        uiBlockSetCurLayout(block, layout);
        return but;
@@ -897,7 +925,7 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
                ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
        /* property with separate label */
        else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
-               but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, icon_only);
+               but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
                ui_but_add_search(but, ptr, prop, NULL, NULL);
        }
        /* single button */
index 1d56ed4fb6aba3f175db39212f75b82388a4d8af..eca4eef230c9e39c9620529eec5bb38b0f7678a9 100644 (file)
@@ -126,10 +126,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
 void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns)
 {
        uiLayout *split, *col;
+       int flag;
        char *name;
 
        RNA_STRUCT_BEGIN(ptr, prop) {
-               if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
+               flag= RNA_property_flag(prop);
+               if(flag & PROP_HIDDEN)
                        continue;
 
                name= (char*)RNA_property_ui_name(prop);
index 0af5a5cac97e5ebe26dc1de044cf994988569b17..ef37f6e530aa6f619bc85676e1c0f43342e9015e 100644 (file)
@@ -1407,9 +1407,9 @@ void ui_view2d_operatortypes(void)
        WM_operatortype_append(VIEW2D_OT_reset);
 }
 
-void UI_view2d_keymap(wmWindowManager *wm)
+void UI_view2d_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "View2D", 0, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "View2D", 0, 0);
        
        /* pan/scroll */
        WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
@@ -1445,7 +1445,7 @@ void UI_view2d_keymap(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);
 
        /* Alternative keymap for buttons listview */
-       keymap= WM_keymap_find(wm, "View2D Buttons List", 0, 0);
+       keymap= WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
        WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0);
index 4c9f63f910c2dd134aa863bdf20affe0a8c48791..4669f7a6741e24888aafc947f6234af55f243e39 100644 (file)
@@ -1240,36 +1240,34 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr,
        EnumPropertyItem *item= NULL;
        int totitem= 0;
        
-       if(C==NULL) {
-               /* needed for doc generation */
-               RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
-               RNA_enum_items_add(&item, &totitem, prop_simedge_types);
-               RNA_enum_items_add(&item, &totitem, prop_simface_types);
-               RNA_enum_item_end(&item, &totitem);
-               *free= 1;
+       if(C) {
+               obedit= CTX_data_edit_object(C);
                
-               return item;
-       }
-       
-       obedit= CTX_data_edit_object(C);
-       
-       if(obedit && obedit->type == OB_MESH) {
-               EditMesh *em= BKE_mesh_get_editmesh(obedit->data); 
+               if(obedit && obedit->type == OB_MESH) {
+                       EditMesh *em= BKE_mesh_get_editmesh(obedit->data); 
 
-               if(em->selectmode & SCE_SELECT_VERTEX)
-                       RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
-               else if(em->selectmode & SCE_SELECT_EDGE)
-                       RNA_enum_items_add(&item, &totitem, prop_simedge_types);
-               else if(em->selectmode & SCE_SELECT_FACE)
-                       RNA_enum_items_add(&item, &totitem, prop_simface_types);
-               RNA_enum_item_end(&item, &totitem);
+                       if(em->selectmode & SCE_SELECT_VERTEX)
+                               RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+                       else if(em->selectmode & SCE_SELECT_EDGE)
+                               RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+                       else if(em->selectmode & SCE_SELECT_FACE)
+                               RNA_enum_items_add(&item, &totitem, prop_simface_types);
+                       RNA_enum_item_end(&item, &totitem);
 
-               *free= 1;
+                       *free= 1;
 
-               return item;
+                       return item;
+               }
        }
+
+       /* needed for doc generation */
+       RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+       RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+       RNA_enum_items_add(&item, &totitem, prop_simface_types);
+       RNA_enum_item_end(&item, &totitem);
+       *free= 1;
        
-       return NULL;
+       return item;
 }
 
 void MESH_OT_select_similar(wmOperatorType *ot)
@@ -1290,7 +1288,7 @@ void MESH_OT_select_similar(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       prop= RNA_def_enum(ot->srna, "type", prop_simvertex_types, 0, "Type", "");
+       prop= RNA_def_enum(ot->srna, "type", prop_simvertex_types, SIMVERT_NORMAL, "Type", "");
        RNA_def_enum_funcs(prop, select_similar_type_itemf);
 }
 
index 13d73faeb98f886873024cf22b2caee896de08eb..6f94db3831646d1b410de465723b8bd82640b748 100644 (file)
@@ -348,12 +348,12 @@ void ED_operatortypes_mesh(void)
 }
 
 /* note mesh keymap also for other space? */
-void ED_keymap_mesh(wmWindowManager *wm)
+void ED_keymap_mesh(wmKeyConfig *keyconf)
 {      
        wmKeyMap *keymap;
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
-       keymap= WM_keymap_find(wm, "EditMesh", 0, 0);
+       keymap= WM_keymap_find(keyconf, "EditMesh", 0, 0);
        keymap->poll= ED_operator_editmesh;
        
        WM_keymap_add_item(keymap, "MESH_OT_loopcut", RKEY, KM_PRESS, KM_CTRL, 0);
index dd8a18f385c66fe0576115a02af905b17aac701f..01da90212a077ced4c43495be00992753166451d 100644 (file)
@@ -51,11 +51,11 @@ void ED_operatortypes_metaball(void)
        WM_operatortype_append(MBALL_OT_select_random_metaelems);
 }
 
-void ED_keymap_metaball(wmWindowManager *wm)
+void ED_keymap_metaball(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
-       keymap= WM_keymap_find(wm, "Metaball", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Metaball", 0, 0);
        keymap->poll= ED_operator_editmball;
 
        WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0);
index 82135bf3804e38716037b4ada29b213116324daa..f2f24c099bca0be07dba0ff868ebd25a1956f9a1 100644 (file)
@@ -196,12 +196,12 @@ static int object_mode_poll(bContext *C)
        return (!ob || ob->mode == OB_MODE_OBJECT);
 }
 
-void ED_keymap_object(wmWindowManager *wm)
+void ED_keymap_object(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
-       keymap= WM_keymap_find(wm, "Object Non-modal", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
        
        /* Note: this keymap works disregarding mode */
        WM_keymap_add_item(keymap, "OBJECT_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0);
@@ -217,7 +217,7 @@ void ED_keymap_object(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "OBJECT_OT_center_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
 
        /* Note: this keymap gets disabled in non-objectmode,  */
-       keymap= WM_keymap_find(wm, "Object Mode", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Object Mode", 0, 0);
        keymap->poll= object_mode_poll;
        
        WM_keymap_add_item(keymap, "OBJECT_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
@@ -264,7 +264,7 @@ void ED_keymap_object(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
 
        /* Lattice */
-       keymap= WM_keymap_find(wm, "Lattice", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
        keymap->poll= ED_operator_editlattice;
 
        WM_keymap_add_item(keymap, "LATTICE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
index ddc5fb9c9b6d2cf43074494b90896def360f35e1..0ebbfa6b701582178e2c41d6ce5bea764858be8c 100644 (file)
@@ -83,11 +83,11 @@ static void operatortypes_particle(void)
        WM_operatortype_append(PARTICLE_OT_dupliob_move_down);
 }
 
-static void keymap_particle(wmWindowManager *wm)
+static void keymap_particle(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
-       keymap= WM_keymap_find(wm, "Particle", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
        keymap->poll= PE_poll;
        
        WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
@@ -166,10 +166,10 @@ void ED_operatortypes_physics(void)
        operatortypes_pointcache();
 }
 
-void ED_keymap_physics(wmWindowManager *wm)
+void ED_keymap_physics(wmKeyConfig *keyconf)
 {
-       keymap_particle(wm);
-       //keymap_pointcache(wm);
+       keymap_particle(keyconf);
+       //keymap_pointcache(keyconf);
 }
 
 
index fb782837d5e14df77bc1ed303624e65cdee80b45..f539020c93d52229f3efabd706a5f5a013fdad27 100644 (file)
@@ -824,24 +824,24 @@ static void ed_default_handlers(wmWindowManager *wm, ListBase *handlers, int fla
                UI_add_region_handlers(handlers);
        }
        if(flag & ED_KEYMAP_VIEW2D) {
-               wmKeyMap *keymap= WM_keymap_find(wm, "View2D", 0, 0);
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_MARKERS) {
-               wmKeyMap *keymap= WM_keymap_find(wm, "Markers", 0, 0);
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
                // XXX need boundbox check urgently!!!
        }
        if(flag & ED_KEYMAP_ANIMATION) {
-               wmKeyMap *keymap= WM_keymap_find(wm, "Animation", 0, 0);
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_FRAMES) {
-               wmKeyMap *keymap= WM_keymap_find(wm, "Frames", 0, 0);
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
        if(flag & ED_KEYMAP_GPENCIL) {
-               wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
+               wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
                WM_event_add_keymap_handler(handlers, keymap);
        }
 }
@@ -1371,7 +1371,7 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
        
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
 
-       keymap= WM_keymap_find(wm, "View2D Buttons List", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
index 8d8c2eba2a8feafb733b98d62accf0d06b04fd9f..7ba83753fee0450e1f78217d4c586eafe500e218 100644 (file)
@@ -2550,7 +2550,7 @@ static ScrArea *find_empty_image_area(bContext *C)
 static void screen_set_image_output(bContext *C, int mx, int my)
 {
        Scene *scene= CTX_data_scene(C);
-       ScrArea *sa;
+       ScrArea *sa= NULL;
        SpaceImage *sima;
        
        if(scene->r.displaymode==R_OUTPUT_WINDOW) {
@@ -2580,8 +2580,8 @@ static void screen_set_image_output(bContext *C, int mx, int my)
                ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
                sa= CTX_wm_area(C);
        }
-       else {
        
+       if(!sa) {
                sa= find_area_showing_r_result(C);
                if(sa==NULL)
                        sa= find_area_image_empty(C);
@@ -3286,7 +3286,7 @@ void ED_operatortypes_screen(void)
        
 }
 
-static void keymap_modal_set(wmWindowManager *wm)
+static void keymap_modal_set(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
                {KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@@ -3297,7 +3297,7 @@ static void keymap_modal_set(wmWindowManager *wm)
        wmKeyMap *keymap;
        
        /* Standard Modal keymap ------------------------------------------------ */
-       keymap= WM_modalkeymap_add(wm, "Standard Modal Map", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "Standard Modal Map", modal_items);
        
        WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, KM_MODAL_CANCEL);
        WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, KM_MODAL_APPLY);
@@ -3312,12 +3312,12 @@ static void keymap_modal_set(wmWindowManager *wm)
 }
 
 /* called in spacetypes.c */
-void ED_keymap_screen(wmWindowManager *wm)
+void ED_keymap_screen(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
        /* Screen Editing ------------------------------------------------ */
-       keymap= WM_keymap_find(wm, "Screen Editing", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Screen Editing", 0, 0);
        
        RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0);
        RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1);
@@ -3334,7 +3334,7 @@ void ED_keymap_screen(wmWindowManager *wm)
 
 
        /* Screen General ------------------------------------------------ */
-       keymap= WM_keymap_find(wm, "Screen", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Screen", 0, 0);
        
        /* standard timers */
        WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
@@ -3389,7 +3389,7 @@ void ED_keymap_screen(wmWindowManager *wm)
        
        
        /* Anim Playback ------------------------------------------------ */
-       keymap= WM_keymap_find(wm, "Frames", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
        
        /* frame offsets */
        RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 10);
@@ -3409,6 +3409,6 @@ void ED_keymap_screen(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", KKEY, KM_PRESS, 0, LKEY);
        RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1);
 
-       keymap_modal_set(wm);
+       keymap_modal_set(keyconf);
 }
 
index 514c80d929d43de521ab02b86419eada7b2e14e0..11dbeffdb221accaa5908dba37bdb4b1bb6de41e 100644 (file)
@@ -134,12 +134,12 @@ void ED_operatortypes_paint(void)
        WM_operatortype_append(PAINT_OT_vertex_color_set);
 }
 
-void ED_keymap_paint(wmWindowManager *wm)
+void ED_keymap_paint(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
        /* Sculpt mode */
-       keymap= WM_keymap_find(wm, "Sculpt", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
        keymap->poll= sculpt_poll;
 
        RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@@ -150,7 +150,7 @@ void ED_keymap_paint(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
 
        /* Vertex Paint mode */
-       keymap= WM_keymap_find(wm, "Vertex Paint", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
        keymap->poll= vertex_paint_poll;
 
        RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@@ -159,7 +159,7 @@ void ED_keymap_paint(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
 
        /* Weight Paint mode */
-       keymap= WM_keymap_find(wm, "Weight Paint", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0);
        keymap->poll= weight_paint_poll;
 
        RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
@@ -168,7 +168,7 @@ void ED_keymap_paint(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
 
        /* Image/Texture Paint mode */
-       keymap= WM_keymap_find(wm, "Image Paint", 0, 0);
+       keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
        keymap->poll= image_texture_paint_poll;
 
        RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE);
index 4326bed62d3928ac1b498e186b6d82655bb2e7cb..c436475b537ee3a2269a5f55bb7ccb15d3a30f99 100644 (file)
@@ -124,7 +124,7 @@ enum {
 /* ***************************************** */
 /* action_ops.c */
 void action_operatortypes(void);
-void action_keymap(struct wmWindowManager *wm);
+void action_keymap(struct wmKeyConfig *keyconf);
 
 #endif /* ED_ACTION_INTERN_H */
 
index 00b22232608d66dd8bd75d0c4706c7e441c9b53f..ba504fa8a691307b688b0b8a50fc1b07b4dd4f92 100644 (file)
@@ -91,9 +91,9 @@ void action_operatortypes(void)
 
 /* ************************** registration - keymaps **********************************/
 
-static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
+static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 {
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
        /* action_select.c - selection tools */
                /* click-select */
@@ -156,7 +156,7 @@ static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
        WM_keymap_add_item(keymap, "ACT_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
        
        /* transform system */
-       transform_keymap_for_space(wm, keymap, SPACE_ACTION);
+       transform_keymap_for_space(keyconf, keymap, SPACE_ACTION);
        
                /* test */
        /* WM_keymap_add_item(keymap, "ACT_OT_test", QKEY, KM_PRESS, 0, 0); */
@@ -164,7 +164,7 @@ static void action_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
 
 /* --------------- */
 
-void action_keymap(wmWindowManager *wm)
+void action_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
@@ -175,7 +175,7 @@ void action_keymap(wmWindowManager *wm)
         */
        
        /* keyframes */
-       keymap= WM_keymap_find(wm, "Action_Keys", SPACE_ACTION, 0);
-       action_keymap_keyframes(wm, keymap);
+       keymap= WM_keymap_find(keyconf, "Action_Keys", SPACE_ACTION, 0);
+       action_keymap_keyframes(keyconf, keymap);
 }
 
index 3b275cab814be8d702f13b7cbfbec0203d14c899..07de15a26b4384aa83a00ee28f90078333e7f04c 100644 (file)
@@ -158,7 +158,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Action_Keys", SPACE_ACTION, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Action_Keys", SPACE_ACTION, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -221,7 +221,7 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Animation_Channels", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Animation_Channels", 0, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 8c563c98d9ba5f33e864d0ca6ffd6ff29f673c41..397da005543f217bef9723d80a54a59b75c8d1e5 100644 (file)
@@ -110,35 +110,35 @@ void ED_spacetypes_init(void)
 /* called in wm.c */
 /* keymap definitions are registered only once per WM initialize, usually on file read,
    using the keymap the actual areas/regions add the handlers */
-void ED_spacetypes_keymap(wmWindowManager *wm)
+void ED_spacetypes_keymap(wmKeyConfig *keyconf)
 {
        const ListBase *spacetypes;
        SpaceType *stype;
        ARegionType *atype;
 
-       ED_keymap_screen(wm);
-       ED_keymap_anim(wm);
-       ED_keymap_animchannels(wm);
-       ED_keymap_gpencil(wm);
-       ED_keymap_object(wm);
-       ED_keymap_mesh(wm);
-       ED_keymap_uvedit(wm);
-       ED_keymap_curve(wm);
-       ED_keymap_armature(wm);
-       ED_keymap_physics(wm);
-       ED_keymap_metaball(wm);
-       ED_keymap_paint(wm);
-       ED_marker_keymap(wm);
-
-       UI_view2d_keymap(wm);
+       ED_keymap_screen(keyconf);
+       ED_keymap_anim(keyconf);
+       ED_keymap_animchannels(keyconf);
+       ED_keymap_gpencil(keyconf);
+       ED_keymap_object(keyconf);
+       ED_keymap_mesh(keyconf);
+       ED_keymap_uvedit(keyconf);
+       ED_keymap_curve(keyconf);
+       ED_keymap_armature(keyconf);
+       ED_keymap_physics(keyconf);
+       ED_keymap_metaball(keyconf);
+       ED_keymap_paint(keyconf);
+       ED_marker_keymap(keyconf);
+
+       UI_view2d_keymap(keyconf);
 
        spacetypes = BKE_spacetypes_list();
        for(stype=spacetypes->first; stype; stype=stype->next) {
                if(stype->keymap)
-                       stype->keymap(wm);
+                       stype->keymap(keyconf);
                for(atype=stype->regiontypes.first; atype; atype=atype->next) {
                        if(atype->keymap)
-                               atype->keymap(wm);
+                               atype->keymap(keyconf);
                }
        }
 }
@@ -234,7 +234,7 @@ static void xxx_operatortypes(void)
        /* register operator types for this space */
 }
 
-static void xxx_keymap(wmWindowManager *wm)
+static void xxx_keymap(wmKeyConfig *keyconf)
 {
        /* add default items to keymap */
 }
index 6ffbb79f27300515bb1ff167d84beda41326579e..03d126a3e7b0a1dbda41441b68dcc2483eb8dec7 100644 (file)
@@ -142,7 +142,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
 
        ED_region_panels_init(wm, ar);
 
-       keymap= WM_keymap_find(wm, "Buttons Generic", SPACE_BUTS, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Buttons Generic", SPACE_BUTS, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -189,9 +189,9 @@ void buttons_operatortypes(void)
        WM_operatortype_append(BUTTONS_OT_file_browse);
 }
 
-void buttons_keymap(struct wmWindowManager *wm)
+void buttons_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Buttons Generic", SPACE_BUTS, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Buttons Generic", SPACE_BUTS, 0);
        
        WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
 }
index 19fb575ed16443271c95e5929c030da168c4a939..49bc3adb5b98a21b9977cfe8c9077c9fbd2cd9bd 100644 (file)
@@ -152,7 +152,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Console", SPACE_CONSOLE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -232,9 +232,9 @@ void console_operatortypes(void)
        WM_operatortype_append(CONSOLE_OT_report_copy);
 }
 
-void console_keymap(struct wmWindowManager *wm)
+void console_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Console", SPACE_CONSOLE, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
        
 #ifdef __APPLE__
        RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
index 1b54277c3831e105935e03ab70c493d847d348aa..afdb0d24917aa66c41910df4bff9c1270eb3eda8 100644 (file)
@@ -172,16 +172,16 @@ static void file_panel_operator(const bContext *C, Panel *pa)
 {
        SpaceFile *sfile= CTX_wm_space_file(C);
        wmOperator *op= sfile->op;
-       int empty= 1;
+       int empty= 1, flag;
 
        if(op->type->ui) {
                op->type->ui((bContext*)C, op->ptr, pa->layout);
        }
        else {
                RNA_STRUCT_BEGIN(op->ptr, prop) {
-                       if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
-                               continue;
-                       if(strcmp(RNA_property_identifier(prop), "filemode") == 0)
+                       flag= RNA_property_flag(prop);
+
+                       if(flag & PROP_HIDDEN)
                                continue;
                        if(strcmp(RNA_property_identifier(prop), "path") == 0)
                                continue;
@@ -189,10 +189,6 @@ static void file_panel_operator(const bContext *C, Panel *pa)
                                continue;
                        if(strcmp(RNA_property_identifier(prop), "filename") == 0)
                                continue;
-                       if(strcmp(RNA_property_identifier(prop), "display") == 0)
-                               continue;
-                       if(strncmp(RNA_property_identifier(prop), "filter", 6) == 0)
-                               continue;
 
                        uiItemFullR(pa->layout, NULL, 0, op->ptr, prop, -1, 0, 0);
                        empty= 0;
index 8257aa5482fd8b8e5891f217602dba8f7eb83552..94d90929d80960df1ff0bda3721315ab4c7785e1 100644 (file)
@@ -406,7 +406,7 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
        previous_folder = folderlist->last;
 
        // check if already exists
-       if(previous_folder){
+       if(previous_folder && previous_folder->foldername){
                if(! strcmp(previous_folder->foldername, dir)){
                        return;
                }
index 1f461f1bbd59227a8da00e292a36eb4430e15648..9f5d889c7b94c7c194ef7a2c2cc0bd687b207c4c 100644 (file)
@@ -124,7 +124,10 @@ short ED_fileselect_set_params(SpaceFile *sfile)
        if (op) {
                BLI_strncpy(params->title, op->type->name, sizeof(params->title));
 
-               params->type = RNA_int_get(op->ptr, "filemode");
+               if(RNA_struct_find_property(op->ptr, "filename"))
+                       params->type = RNA_int_get(op->ptr, "filemode");
+               else
+                       params->type = FILE_SPECIAL;
 
                if (RNA_property_is_set(op->ptr, "path")) {
                        RNA_string_get(op->ptr, "path", name);
@@ -140,15 +143,24 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        }
                }
                params->filter = 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
-               params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_blender"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_image"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_movie"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_movie") ? MOVIEFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_text"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_python"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_python") ? PYSCRIPTFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_font"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_sound"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_text"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_text") ? TEXTFILE : 0;
+               if(RNA_struct_find_property(op->ptr, "filter_folder"))
+                       params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
                if (params->filter != 0)
                        params->flag |= FILE_FILTER;
 
index 77f50d91e775b3a194e4a750f577979fe73513e3..4d3376e0e1f2d865133624c3e515b5adfc8db0e6 100644 (file)
@@ -253,10 +253,10 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
        
        /* own keymaps */
-       keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-       keymap= WM_keymap_find(wm, "FileMain", SPACE_FILE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "FileMain", SPACE_FILE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
                                                           
 
@@ -364,11 +364,11 @@ void file_operatortypes(void)
 }
 
 /* NOTE: do not add .blend file reading on this level */
-void file_keymap(struct wmWindowManager *wm)
+void file_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        /* keys for all areas */
-       wmKeyMap *keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "File", SPACE_FILE, 0);
        WM_keymap_add_item(keymap, "FILE_OT_bookmark_toggle", NKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "FILE_OT_add_bookmark", BKEY, KM_PRESS, KM_CTRL, 0);
@@ -380,7 +380,7 @@ void file_keymap(struct wmWindowManager *wm)
        WM_keymap_add_item(keymap, "FILE_OT_delete", DELKEY, KM_PRESS, 0, 0);
 
        /* keys for main area */
-       keymap= WM_keymap_find(wm, "FileMain", SPACE_FILE, 0);
+       keymap= WM_keymap_find(keyconf, "FileMain", SPACE_FILE, 0);
        WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "FILE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "FILE_OT_select_border", BKEY, KM_PRESS, 0, 0);
@@ -401,7 +401,7 @@ void file_keymap(struct wmWindowManager *wm)
        RNA_int_set(kmi->ptr, "increment",-100);
        
        /* keys for button area (top) */
-       keymap= WM_keymap_find(wm, "FileButtons", SPACE_FILE, 0);
+       keymap= WM_keymap_find(keyconf, "FileButtons", SPACE_FILE, 0);
        WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
        kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
        RNA_int_set(kmi->ptr, "increment", 1);
@@ -425,7 +425,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
        ED_region_panels_init(wm, ar);
 
        /* own keymaps */
-       keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);      
+       keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0); 
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -461,10 +461,10 @@ static void file_ui_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
 
        /* own keymap */
-       keymap= WM_keymap_find(wm, "File", SPACE_FILE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "File", SPACE_FILE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-       keymap= WM_keymap_find(wm, "FileButtons", SPACE_FILE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "FileButtons", SPACE_FILE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 83a565e485f0d8725224e2f1e035419054be9eef..9b7c2eb3656cb830a8506ea4f58de16f6ba99c71 100644 (file)
@@ -159,7 +159,7 @@ int graphop_selected_fcurve_poll(struct bContext *C);
 
 /* ***************************************** */
 /* graph_ops.c */
-void graphedit_keymap(struct wmWindowManager *wm);
+void graphedit_keymap(struct wmKeyConfig *keyconf);
 void graphedit_operatortypes(void);
 
 
index b82055064f8b5a59e8c5e604fa21f888377a1b9b..ab35bda0e2f0dc69162d30766b434dbbbfc5ef1a 100644 (file)
@@ -141,9 +141,9 @@ void graphedit_operatortypes(void)
 
 /* ************************** registration - keymaps **********************************/
 
-static void graphedit_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
+static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 {
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
        /* view */
        WM_keymap_add_item(keymap, "GRAPH_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
@@ -225,17 +225,17 @@ static void graphedit_keymap_keyframes (wmWindowManager *wm, wmKeyMap *keymap)
        
        
        /* transform system */
-       transform_keymap_for_space(wm, keymap, SPACE_IPO);
+       transform_keymap_for_space(keyconf, keymap, SPACE_IPO);
 }
 
 /* --------------- */
 
-void graphedit_keymap(wmWindowManager *wm)
+void graphedit_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
        /* keymap for all regions */
-       keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
+       keymap= WM_keymap_find(keyconf, "GraphEdit Generic", SPACE_IPO, 0);
        WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
 
        /* channels */
@@ -245,7 +245,7 @@ void graphedit_keymap(wmWindowManager *wm)
         */
        
        /* keyframes */
-       keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
-       graphedit_keymap_keyframes(wm, keymap);
+       keymap= WM_keymap_find(keyconf, "GraphEdit Keys", SPACE_IPO, 0);
+       graphedit_keymap_keyframes(keyconf, keymap);
 }
 
index a7ea2294ed49a8e1ffa43e139156f12ddec57062..c8d2c571a16d49c90172eba1b933ab33287904fa 100644 (file)
@@ -208,9 +208,9 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "GraphEdit Keys", SPACE_IPO, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Keys", SPACE_IPO, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-       keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -286,9 +286,9 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Animation_Channels", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Animation_Channels", 0, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-       keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -356,7 +356,7 @@ static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
        
        ED_region_panels_init(wm, ar);
 
-       keymap= WM_keymap_find(wm, "GraphEdit Generic", SPACE_IPO, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "GraphEdit Generic", SPACE_IPO, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 4cf59c9a28e6859865001d47772b5676e69f6366..e64bb1a4209a0f5c34b053a6da0dab4d82ec048e 100644 (file)
@@ -202,9 +202,9 @@ void image_operatortypes(void)
        WM_operatortype_append(IMAGE_OT_properties);
 }
 
-void image_keymap(struct wmWindowManager *wm)
+void image_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
        
        WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
@@ -212,7 +212,7 @@ void image_keymap(struct wmWindowManager *wm)
        WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
        
-       keymap= WM_keymap_find(wm, "Image", SPACE_IMAGE, 0);
+       keymap= WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
        
        WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "IMAGE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
@@ -389,16 +389,16 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
        // UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 
        /* image paint polls for mode */
-       keymap= WM_keymap_find(wm, "Image Paint", SPACE_IMAGE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Image Paint", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-       keymap= WM_keymap_find(wm, "UVEdit", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "UVEdit", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
        /* own keymaps */
-       keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
-       keymap= WM_keymap_find(wm, "Image", SPACE_IMAGE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -463,7 +463,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
        ED_region_panels_init(wm, ar);
        
-       keymap= WM_keymap_find(wm, "Image Generic", SPACE_IMAGE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
index d3f9c97205c8bdacc4ee99f862e2352d91398bc7..518553c9a7a1a25553aeac3f39a7648cfa81ca90 100644 (file)
@@ -134,7 +134,7 @@ void info_operatortypes(void)
        WM_operatortype_append(FILE_OT_find_missing_files);
 }
 
-void info_keymap(struct wmWindowManager *wm)
+void info_keymap(struct wmKeyConfig *keyconf)
 {
        
 }
index 7043d625ab0f12b191fcb5112bbaba0690f914e6..836ac4c6659bc1e22b331e8c08b464d74217f757 100644 (file)
@@ -186,9 +186,9 @@ void logic_operatortypes(void)
 
 }
 
-void logic_keymap(struct wmWindowManager *wm)
+void logic_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Logic Generic", SPACE_LOGIC, 0);
        
        WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
 }
@@ -239,7 +239,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
        /* own keymaps */
-       keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Logic Generic", SPACE_LOGIC, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -280,7 +280,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
        ED_region_panels_init(wm, ar);
        
-       keymap= WM_keymap_find(wm, "Logic Generic", SPACE_LOGIC, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Logic Generic", SPACE_LOGIC, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
index e4557ec878fa80a02d4ef1bb89d0c0b3950b960c..91c1decc576c34a0113e58c1c03e6e21ebdc611b 100644 (file)
@@ -130,7 +130,7 @@ short nlaedit_is_tweakmode_on(bAnimContext *ac);
 /* --- */
 
 void nla_operatortypes(void);
-void nla_keymap(wmWindowManager *wm);
+void nla_keymap(wmKeyConfig *keyconf);
 
 #endif /* ED_NLA_INTERN_H */
 
index 5ea2e99ad6ae7ea1dbbd7b51b28685ebe5811619..6c940f32c24d0157a1fa528d0f5d05c8d555dd82 100644 (file)
@@ -167,7 +167,7 @@ void nla_operatortypes(void)
 
 /* ************************** registration - keymaps **********************************/
 
-static void nla_keymap_channels (wmWindowManager *wm, wmKeyMap *keymap)
+static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap)
 {
        /* NLA-specific (different to standard channels keymap) -------------------------- */
        /* selection */
@@ -210,9 +210,9 @@ static void nla_keymap_channels (wmWindowManager *wm, wmKeyMap *keymap)
        RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_collapse", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "all", 1);
 }
 
-static void nla_keymap_main (wmWindowManager *wm, wmKeyMap *keymap)
+static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
 {
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
        /* selection */
                /* click select */
@@ -277,17 +277,17 @@ static void nla_keymap_main (wmWindowManager *wm, wmKeyMap *keymap)
        WM_keymap_add_item(keymap, "NLA_OT_fmodifier_add", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
        
        /* transform system */
-       transform_keymap_for_space(wm, keymap, SPACE_NLA);
+       transform_keymap_for_space(keyconf, keymap, SPACE_NLA);
 }
 
 /* --------------- */
 
-void nla_keymap(wmWindowManager *wm)
+void nla_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
        /* keymap for all regions */
-       keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
+       keymap= WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
        WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0);
        
        /* channels */
@@ -297,11 +297,11 @@ void nla_keymap(wmWindowManager *wm)
         *
         * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
         */
-       keymap= WM_keymap_find(wm, "NLA Channels", SPACE_NLA, 0);
-       nla_keymap_channels(wm, keymap);
+       keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
+       nla_keymap_channels(keyconf, keymap);
        
        /* data */
-       keymap= WM_keymap_find(wm, "NLA Data", SPACE_NLA, 0);
-       nla_keymap_main(wm, keymap);
+       keymap= WM_keymap_find(keyconf, "NLA Data", SPACE_NLA, 0);
+       nla_keymap_main(keyconf, keymap);
 }
 
index 414358108893b97078b1e8295330258305b2e14f..32ff7766690443190181eff4b194e66ca2f76bc6 100644 (file)
@@ -214,9 +214,9 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
        
        /* own keymap */
        // TODO: cannot use generic copy, need special NLA version
-       keymap= WM_keymap_find(wm, "NLA Channels", SPACE_NLA, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-       keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -259,9 +259,9 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "NLA Data", SPACE_NLA, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "NLA Data", SPACE_NLA, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-       keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -358,7 +358,7 @@ static void nla_buttons_area_init(wmWindowManager *wm, ARegion *ar)
        
        ED_region_panels_init(wm, ar);
        
-       keymap= WM_keymap_find(wm, "NLA Generic", SPACE_NLA, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 9f28a5e3dcbec09c5a18a7c4eb3c80fc693256a9..f55ecf1d0f49fe1cef2c8d613972a7d750eaff3a 100644 (file)
@@ -53,7 +53,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
 
 /* node_ops.c */
 void node_operatortypes(void);
-void node_keymap(wmWindowManager *wm);
+void node_keymap(wmKeyConfig *keyconf);
 
 /* node_select.c */
 void NODE_OT_select(struct wmOperatorType *ot);
index 880cc4898385d49b5cec67fc3b021309c5605b5e..443b83a91bc2bbae173891be33c319617ba3b034 100644 (file)
@@ -67,10 +67,10 @@ void node_operatortypes(void)
        WM_operatortype_append(NODE_OT_group_edit);
 }
 
-void node_keymap(struct wmWindowManager *wm)
+void node_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Node", SPACE_NODE, 0);
-       wmKeymapItem *kmi;
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Node", SPACE_NODE, 0);
+       wmKeyMapItem *kmi;
        
        /* mouse select in nodes used to be both keys, it's UI elements... */
        RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
@@ -101,5 +101,5 @@ void node_keymap(struct wmWindowManager *wm)
        kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", AKEY, KM_PRESS, KM_SHIFT, 0);
        RNA_string_set(kmi->ptr, "name", "NODE_MT_add");
 
-       transform_keymap_for_space(wm, keymap, SPACE_NODE);
+       transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
 }
index bdd2a65984fc93452273aa08477e18d79e891425..41140eae776978d3bb85838c54b3be3415022eb8 100644 (file)
@@ -252,7 +252,7 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Node", SPACE_NODE, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Node", SPACE_NODE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 641137c010b82751c22f3a558bc8f2e472616e38..28fdc4708dfbb128da1739955609866a28292528 100644 (file)
@@ -1113,16 +1113,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
        }
        else if(type == TSE_KEYMAP) {
                wmKeyMap *km= (wmKeyMap *)idv;
-               wmKeymapItem *kmi;
+               wmKeyMapItem *kmi;
                char opname[OP_MAX_TYPENAME];
                
                te->directdata= idv;
-               te->name= km->nameid;
+               te->name= km->idname;
                
                if(!(tselem->flag & TSE_CLOSED)) {
                        a= 0;
                        
-                       for (kmi= km->keymap.first; kmi; kmi= kmi->next, a++) {
+                       for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
                                const char *key= WM_key_event_string(kmi->type);
                                
                                if(key[0]) {
@@ -1408,7 +1408,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
                wmWindowManager *wm= mainvar->wm.first;
                wmKeyMap *km;
                
-               for(km= wm->keymaps.first; km; km= km->next) {
+               for(km= wm->defaultconf->keymaps.first; km; km= km->next) {
                        ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
                }
        }
@@ -2229,14 +2229,14 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme
 
 static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set)
 {
-       wmKeymapItem *kmi= te->directdata;
+       wmKeyMapItem *kmi= te->directdata;
        
        if(set==0) {
-               if(kmi->inactive) return 0;
+               if(kmi->flag & KMI_INACTIVE) return 0;
                return 1;
        }
        else {
-               kmi->inactive= !kmi->inactive;
+               kmi->flag ^= KMI_INACTIVE;
        }
        return 0;
 }
@@ -4957,7 +4957,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
 static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2)
 {
        wmOperatorType *ot= arg2;
-       wmKeymapItem *kmi= arg_kmi;
+       wmKeyMapItem *kmi= arg_kmi;
        
        if(ot)
                BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
@@ -4987,7 +4987,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
        static char search[OP_MAX_TYPENAME];
        wmEvent event;
        wmWindow *win= CTX_wm_window(C);
-       wmKeymapItem *kmi= arg_kmi;
+       wmKeyMapItem *kmi= arg_kmi;
        wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
        uiBlock *block;
        uiBut *but;
@@ -5026,8 +5026,8 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
 static short keymap_menu_type(short type)
 {
        if(ISKEYBOARD(type)) return OL_KM_KEYBOARD;
-       if(WM_key_event_is_tweak(type)) return OL_KM_TWEAK;
-       if(type >= LEFTMOUSE && type <= WHEELOUTMOUSE) return OL_KM_MOUSE;
+       if(ISTWEAK(type)) return OL_KM_TWEAK;
+       if(ISMOUSE(type)) return OL_KM_MOUSE;
 //     return OL_KM_SPECIALS;
        return 0;
 }
@@ -5083,8 +5083,6 @@ static char *keymap_tweak_menu(void)
        str += sprintf(str, formatstr, "Left Mouse", EVT_TWEAK_L);
        str += sprintf(str, formatstr, "Middle Mouse", EVT_TWEAK_M);
        str += sprintf(str, formatstr, "Right Mouse", EVT_TWEAK_R);
-       str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE);
-       str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE);
        str += sprintf(str, formatstr, "Action Mouse", EVT_TWEAK_A);
        str += sprintf(str, formatstr, "Select Mouse", EVT_TWEAK_S);
        
@@ -5115,7 +5113,7 @@ static char *keymap_tweak_dir_menu(void)
 
 static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v)
 {
-       wmKeymapItem *kmi= kmi_v;
+       wmKeyMapItem *kmi= kmi_v;
        short maptype= keymap_menu_type(kmi->type);
        
        if(maptype!=kmi->maptype) {
@@ -5158,7 +5156,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
                        int butw3= 43; /* modifiers */
 
                        if(tselem->type == TSE_KEYMAP_ITEM) {
-                               wmKeymapItem *kmi= te->directdata;
+                               wmKeyMapItem *kmi= te->directdata;
                                
                                /* modal map? */
                                if(kmi->propvalue);
index 4f9a0f686b97a4636898b2e5ac60a1d05a3993b7..c71b5181d16320a1ca76bb99bad8c8d15031c6f1 100644 (file)
@@ -110,7 +110,7 @@ typedef struct TreeElement {
 
 /* outliner_ops.c */
 void outliner_operatortypes(void);
-void outliner_keymap(struct wmWindowManager *wm);
+void outliner_keymap(struct wmKeyConfig *keyconf);
 
 /* outliner_header.c */
 void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
index a35b91249dbdca3488e8e1ba774d15dca34abab2..3cdd054fe0e991107c99aef27cc406e14c4c0dc6 100644 (file)
@@ -74,9 +74,9 @@ void outliner_operatortypes(void)
        WM_operatortype_append(OUTLINER_OT_drivers_delete);
 }
 
-void outliner_keymap(wmWindowManager *wm)
+void outliner_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
        
        RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
index eb0e9dafbaa4c9b248f04b31660b5737b326446d..fabe889ace63a3cadb29006360757780bbf5ff0a 100644 (file)
@@ -77,7 +77,7 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Outliner", SPACE_OUTLINER, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 59858ee62892835a5bc6bc4679dfd25d668e2e58..7534fc98de111430a7c615813487e1f290c3b75f 100644 (file)
@@ -36,7 +36,7 @@ void script_header_buttons(const bContext *C, ARegion *ar);
 
 /* script_ops.c */
 void script_operatortypes(void);
-void script_keymap(struct wmWindowManager *wm);
+void script_keymap(struct wmKeyConfig *keyconf);
 
 /* script_edit.c */
 void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);
index 0e6ea9cf4fd52a269aff67c909aa197f44ee1eae..bf0a7e5769eb96df11af9ac26dbe0cf225ac6a6a 100644 (file)
@@ -63,9 +63,9 @@ void script_operatortypes(void)
        WM_operatortype_append(SCRIPT_OT_python_run_ui_scripts);
 }
 
-void script_keymap(wmWindowManager *wm)
+void script_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Script", SPACE_SCRIPT, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
 
        /* TODO - this is just while we have no way to load a text datablock */
        RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "path", "test.py");
index a0e73082701637cc325e4400737b17125e2215d4..eae0f77d0e17011890c73f6bfe7c00050efb7d88 100644 (file)
@@ -138,7 +138,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Script", SPACE_SCRIPT, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index ac396440a002fcf00053d42663ba3c5f85af42a0..d45d7bf4d186ee36d49f92e2f5893ed840154604 100644 (file)
@@ -75,7 +75,8 @@ extern EnumPropertyItem prop_side_types[];
 
 /* operators */
 struct wmOperatorType;
-struct wmWindowManager;
+struct wmKeyConfig;
+
 void SEQUENCER_OT_cut(struct wmOperatorType *ot);
 void SEQUENCER_OT_mute(struct wmOperatorType *ot);
 void SEQUENCER_OT_unmute(struct wmOperatorType *ot);
@@ -137,7 +138,7 @@ enum {
 
 /* sequencer_ops.c */
 void sequencer_operatortypes(void);
-void sequencer_keymap(struct wmWindowManager *wm);
+void sequencer_keymap(struct wmKeyConfig *keyconf);
 
 /* sequencer_scope.c */
 struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf);
index 1541b32f5667a4f1addf6f1976fffc1f964b65f2..eedbab779c0d1e8fa20b6797d136667364854f88 100644 (file)
@@ -103,10 +103,10 @@ void sequencer_operatortypes(void)
 }
 
 
-void sequencer_keymap(wmWindowManager *wm)
+void sequencer_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Sequencer", SPACE_SEQ, 0);
-       wmKeymapItem *kmi;
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
+       wmKeyMapItem *kmi;
        
        WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
        
@@ -183,6 +183,6 @@ void sequencer_keymap(wmWindowManager *wm)
        
        WM_keymap_verify_item(keymap, "ANIM_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0);
 
-       transform_keymap_for_space(wm, keymap, SPACE_SEQ);
+       transform_keymap_for_space(keyconf, keymap, SPACE_SEQ);
 }
 
index c2756b05946cf342ef087af4883e9c131a8f1c77..626a3e6e2e05d9b9304ead0ae48728093edbe1f4 100644 (file)
@@ -190,7 +190,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Sequencer", SPACE_SEQ, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 6713e19b6dedfca4ffdf73d7f1ba9dacd434c132..7cd9988eea0aace20ea0c9d9947ec1bef46ed25a 100644 (file)
@@ -147,7 +147,7 @@ static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Sound", SPACE_SOUND, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Sound", SPACE_SOUND, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -179,7 +179,7 @@ void sound_operatortypes(void)
        
 }
 
-void sound_keymap(struct wmWindowManager *wm)
+void sound_keymap(struct wmKeyConfig *keyconf)
 {
        
 }
index e068c1a70bb19550a3d10cc6bb815380ff8b4416..e3816ed7495bf0e6fb6c6b99fed6b518b9323693 100644 (file)
@@ -206,11 +206,11 @@ static void text_operatortypes(void)
        WM_operatortype_append(TEXT_OT_resolve_conflict);
 }
 
-static void text_keymap(struct wmWindowManager *wm)
+static void text_keymap(struct wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
-       keymap= WM_keymap_find(wm, "Text", SPACE_TEXT, 0);
+       keymap= WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
        
        #ifdef __APPLE__
        RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
@@ -336,7 +336,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "Text", SPACE_TEXT, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 0f05eb0149dc224915f91118fdf5ea2f86370aa3..501ac1c0cbae787d307c2d5f4456a833e38cb5e4 100644 (file)
@@ -207,7 +207,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
        
        /* own keymap */
-       keymap= WM_keymap_find(wm, "TimeLine", SPACE_TIME, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "TimeLine", SPACE_TIME, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
index 25f4c63fed1e0db7e99f520d521fba570b8336f2..ac6b407d117abeec1e7633c2fc2fd9355aceb7b6 100644 (file)
@@ -35,7 +35,7 @@ struct wmWindowManager;
 
 /* time_ops.c */
 void time_operatortypes(void);
-void time_keymap(struct wmWindowManager *wm);
+void time_keymap(struct wmKeyConfig *keyconf);
 
 /* time_header.c */
 void time_header_buttons(const bContext *C, ARegion *ar);
index 2b073f269bffb19ea4351b7129a6c6c2fcc917e5..7d91c6d0fc782e8d3d2ac14a7c96967b1391843e 100644 (file)
@@ -140,9 +140,9 @@ void time_operatortypes(void)
        WM_operatortype_append(TIME_OT_end_frame_set);
 }
 
-void time_keymap(wmWindowManager *wm)
+void time_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "TimeLine", SPACE_TIME, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "TimeLine", SPACE_TIME, 0);
        
        WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
index 8c9d723ce2c60fbef51d96053d8b7ad24b30649a..39fc2fd2bd1628755802999d313cc040934ba527 100644 (file)
@@ -115,7 +115,7 @@ void userpref_operatortypes(void)
 {
 }
 
-void userpref_keymap(struct wmWindowManager *wm)
+void userpref_keymap(struct wmKeyConfig *keyconf)
 {
        
 }
@@ -167,7 +167,7 @@ void ED_spacetype_userpref(void)
        art->init= userpref_main_area_init;
        art->draw= userpref_main_area_draw;
        art->listener= userpref_main_area_listener;
-       art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+       art->keymapflag= ED_KEYMAP_UI;
 
        BLI_addhead(&st->regiontypes, art);
        
index 735f3df9b09b0b789f86cd453ce38631989bd618..e1bd48e002f571140531bb0b4184bbe340c78725 100644 (file)
@@ -280,62 +280,62 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
        wmKeyMap *keymap;
 
        /* object ops. */
-       keymap= WM_keymap_find(wm, "Object Non-modal", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
        /* pose is not modal, operator poll checks for this */
-       keymap= WM_keymap_find(wm, "Pose", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
-       keymap= WM_keymap_find(wm, "Object Mode", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Image Paint", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Vertex Paint", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Weight Paint", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Sculpt", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
-       keymap= WM_keymap_find(wm, "EditMesh", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "EditMesh", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
-       keymap= WM_keymap_find(wm, "Curve", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
-       keymap= WM_keymap_find(wm, "Armature", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Pose", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Metaball", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
        
-       keymap= WM_keymap_find(wm, "Lattice", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
        /* armature sketching needs to take over mouse */
-       keymap= WM_keymap_find(wm, "Armature_Sketch", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Armature_Sketch", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "Particle", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
        /* editfont keymap swallows all... */
-       keymap= WM_keymap_find(wm, "Font", 0, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "Font", 0, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
        /* own keymap, last so modes can override it */
-       keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-       keymap= WM_keymap_find(wm, "View3D", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "View3D", SPACE_VIEW3D, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -491,7 +491,7 @@ static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
 /* add handlers, stuff you only do once or on area/region changes */
 static void view3d_header_area_init(wmWindowManager *wm, ARegion *ar)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
+       wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
        
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 
@@ -531,7 +531,7 @@ static void view3d_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
        ED_region_panels_init(wm, ar);
        
-       keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -602,7 +602,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar)
        
        ED_region_panels_init(wm, ar);
 
-       keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(wm->defaultconf, "View3D Generic", SPACE_VIEW3D, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
index c07d91089939f68a298b806fad8d905a951b2b28..4c96e1fee3904408d387fd35a946f9746f77191c 100644 (file)
@@ -371,7 +371,7 @@ enum {
 
 
 /* called in transform_ops.c, on each regeneration of keymaps  */
-void viewrotate_modal_keymap(wmWindowManager *wm)
+void viewrotate_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Cancel", ""},
@@ -381,12 +381,12 @@ void viewrotate_modal_keymap(wmWindowManager *wm)
 
        {0, NULL, 0, NULL, NULL}};
 
-       wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Rotate Modal");
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
 
        /* this function is called for each spacetype, only needs to add map once */
        if(keymap) return;
 
-       keymap= WM_modalkeymap_add(wm, "View3D Rotate Modal", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
 
        /* items for modal map */
        WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
@@ -630,19 +630,19 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
 
 /* called in transform_ops.c, on each regeneration of keymaps  */
-void viewmove_modal_keymap(wmWindowManager *wm)
+void viewmove_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 
        {0, NULL, 0, NULL, NULL}};
 
-       wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Move Modal");
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Move Modal");
 
        /* this function is called for each spacetype, only needs to add map once */
        if(keymap) return;
 
-       keymap= WM_modalkeymap_add(wm, "View3D Move Modal", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
 
        /* items for modal map */
        WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
@@ -749,19 +749,19 @@ void VIEW3D_OT_move(wmOperatorType *ot)
 /* ************************ viewzoom ******************************** */
 
 /* called in transform_ops.c, on each regeneration of keymaps  */
-void viewzoom_modal_keymap(wmWindowManager *wm)
+void viewzoom_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 
        {0, NULL, 0, NULL, NULL}};
 
-       wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Zoom Modal");
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
 
        /* this function is called for each spacetype, only needs to add map once */
        if(keymap) return;
 
-       keymap= WM_modalkeymap_add(wm, "View3D Zoom Modal", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
 
        /* items for modal map */
        WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
index d80cec9ad480d6b39033cb52b699a1addd289865..84d1a1275a9c357ad1cdf1c19fc5e21311431891 100644 (file)
@@ -62,7 +62,7 @@ void VIEW3D_OT_layers(struct wmOperatorType *ot);
 
 /* view3d_ops.c */
 void view3d_operatortypes(void);
-void view3d_keymap(struct wmWindowManager *wm);
+void view3d_keymap(struct wmKeyConfig *keyconf);
 
 /* view3d_edit.c */
 void VIEW3D_OT_zoom(struct wmOperatorType *ot);
@@ -137,10 +137,10 @@ void smooth_view(struct bContext *C, Object *, Object *, float *ofs, float *quat
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
 
-void fly_modal_keymap(struct wmWindowManager *wm);
-void viewrotate_modal_keymap(struct wmWindowManager *wm);
-void viewmove_modal_keymap(struct wmWindowManager *wm);
-void viewzoom_modal_keymap(struct wmWindowManager *wm);
+void fly_modal_keymap(struct wmKeyConfig *keyconf);
+void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
+void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
+void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
 
 /* view3d_buttons.c */
 void VIEW3D_OT_properties(struct wmOperatorType *ot);
index a151ff3e73a64ad52301c1f3aae215a8d103b387..74074a041883c4a37efed4773861a8b9bb1e046b 100644 (file)
@@ -103,18 +103,18 @@ void view3d_operatortypes(void)
        transform_operatortypes();
 }
 
-void view3d_keymap(wmWindowManager *wm)
+void view3d_keymap(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
-       wmKeymapItem *km;
+       wmKeyMapItem *km;
        
-       keymap= WM_keymap_find(wm, "View3D Generic", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(keyconf, "View3D Generic", SPACE_VIEW3D, 0);
        
        WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "VIEW3D_OT_toolbar", TKEY, KM_PRESS, 0, 0);
        
        /* only for region 3D window */
-       keymap= WM_keymap_find(wm, "View3D", SPACE_VIEW3D, 0);
+       keymap= WM_keymap_find(keyconf, "View3D", SPACE_VIEW3D, 0);
        
        WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, 0, 0); /* manipulator always on left mouse, not on action mouse*/
        
@@ -221,11 +221,11 @@ void view3d_keymap(wmWindowManager *wm)
        
        WM_keymap_add_item(keymap, "VIEW3D_OT_snap_menu", SKEY, KM_PRESS, KM_SHIFT, 0);
 
-       transform_keymap_for_space(wm, keymap, SPACE_VIEW3D);
+       transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
 
-       fly_modal_keymap(wm);
-       viewrotate_modal_keymap(wm);
-       viewmove_modal_keymap(wm);
-       viewzoom_modal_keymap(wm);
+       fly_modal_keymap(keyconf);
+       viewrotate_modal_keymap(keyconf);
+       viewmove_modal_keymap(keyconf);
+       viewzoom_modal_keymap(keyconf);
 }
 
index 505f3abf401ed348d1ba7b77599435a09ecabcaf..d26141e3b542fce9d430063c77671b91c1124618 100644 (file)
@@ -1633,7 +1633,7 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
 #define FLY_MODAL_PRECISION_DISABLE    16
 
 /* called in transform_ops.c, on each regeneration of keymaps  */
-void fly_modal_keymap(wmWindowManager *wm)
+void fly_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {FLY_MODAL_CANCEL,      "CANCEL", 0, "Cancel", ""},
@@ -1659,12 +1659,12 @@ void fly_modal_keymap(wmWindowManager *wm)
 
        {0, NULL, 0, NULL, NULL}};
 
-       wmKeyMap *keymap= WM_modalkeymap_get(wm, "View3D Fly Modal");
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal");
 
        /* this function is called for each spacetype, only needs to add map once */
        if(keymap) return;
 
-       keymap= WM_modalkeymap_add(wm, "View3D Fly Modal", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "View3D Fly Modal", modal_items);
 
        /* items for modal map */
        WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, FLY_MODAL_CANCEL);
index 839c3543515e6fbdd8bd42b52771fd6e0b577116..ad89d8a3a5905d5f229b5fd0fc954b08fec0fcf3 100644 (file)
@@ -515,7 +515,7 @@ static char *transform_to_undostr(TransInfo *t)
 #define TFM_MODAL_SNAP_GEARS_OFF       7
 
 /* called in transform_ops.c, on each regeneration of keymaps */
-void transform_modal_keymap(wmWindowManager *wm)
+void transform_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@@ -527,12 +527,12 @@ void transform_modal_keymap(wmWindowManager *wm)
        {TFM_MODAL_SNAP_GEARS_OFF, "SNAP_GEARS_OFF", 0, "Snap Off", ""},
        {0, NULL, 0, NULL, NULL}};
        
-       wmKeyMap *keymap= WM_modalkeymap_get(wm, "Transform Modal Map");
+       wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
        
        /* this function is called for each spacetype, only needs to add map once */
        if(keymap) return;
        
-       keymap= WM_modalkeymap_add(wm, "Transform Modal Map", modal_items);
+       keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
        
        /* items for modal map */
        WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);
index 1c170a31c45b59ddd25d2564ed6c62e3aee5b511..60786127e3a53943cf7a5409237273966b5df316 100644 (file)
@@ -508,7 +508,7 @@ int Align(TransInfo *t, short mval[2]);
 
 void drawPropCircle(const struct bContext *C, TransInfo *t);
 
-void transform_modal_keymap(struct wmWindowManager *wm);
+void transform_modal_keymap(struct wmKeyConfig *keyconf);
 
 
 /*********************** transform_conversions.c ********** */
index 7ef8ad17a69bf30960b0dbf82edafdc6bf991e96..0913f0ea273a5284eed87200b3f1eb5d21efc73f 100644 (file)
@@ -734,12 +734,12 @@ void transform_operatortypes(void)
        WM_operatortype_append(TFM_OT_delete_orientation);
 }
 
-void transform_keymap_for_space(struct wmWindowManager *wm, struct wmKeyMap *keymap, int spaceid)
+void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid)
 {
-       wmKeymapItem *km;
+       wmKeyMapItem *km;
        
        /* transform.c, only adds modal map once, checks if it's there */
-       transform_modal_keymap(wm);
+       transform_modal_keymap(keyconf);
        
        switch(spaceid)
        {
index 9216cfb5cdc96bdcf0afff545517a3d162d4a99b..0f79420d3a7d2d70691c83ae845ed3f42e29a593 100644 (file)
@@ -3084,11 +3084,11 @@ void ED_operatortypes_uvedit(void)
        WM_operatortype_append(UV_OT_tile_set);
 }
 
-void ED_keymap_uvedit(wmWindowManager *wm)
+void ED_keymap_uvedit(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        
-       keymap= WM_keymap_find(wm, "UVEdit", 0, 0);
+       keymap= WM_keymap_find(keyconf, "UVEdit", 0, 0);
        keymap->poll= ED_operator_uvedit;
        
        /* pick selection */
@@ -3129,6 +3129,6 @@ void ED_keymap_uvedit(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "UV_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "UV_OT_tile_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
 
-       transform_keymap_for_space(wm, keymap, SPACE_IMAGE);
+       transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE);
 }
 
index 5aa1aa6dfff0b4c392a6e428b9485ec1045e5bc2..6a1b22e1ed525523cc293a6a159a012046f5051e 100644 (file)
@@ -308,6 +308,8 @@ typedef struct UserDef {
        struct ListBase themes;
        struct ListBase uifonts;
        struct ListBase uistyles;
+       struct ListBase keymaps;
+       char keyconfigstr[64];
        
        short undosteps;
        short undomemory;
@@ -345,6 +347,14 @@ extern UserDef U; /* from blenkernel blender.c */
 
 /* ***************** USERDEF ****************** */
 
+/* userpref/section */
+#define USER_SECTION_INTERFACE 0
+#define USER_SECTION_EDIT              1
+#define USER_SECTION_FILE              2
+#define USER_SECTION_SYSTEM            3
+#define USER_SECTION_THEME             4
+#define USER_SECTION_INPUT             5
+
 /* flag */
 #define USER_AUTOSAVE                  (1 << 0)
 #define USER_AUTOGRABGRID              (1 << 1)
index ea9d0e86c38759865d67fd5c71565dee888a9c49..2b986d6d80273f52aba5da092733a681555646d8 100644 (file)
@@ -42,6 +42,7 @@ struct wmGesture;
 struct wmOperatorType;
 struct wmOperator;
 struct wmKeyMap;
+struct wmKeyConfig;
 
 /* forwards */
 struct bContext;
@@ -120,9 +121,9 @@ typedef struct wmWindowManager {
        
        ListBase paintcursors;  /* extra overlay cursors to draw, like circles */
        
-       /* used keymaps, optionally/partially saved */
-       ListBase keymaps;
-       
+       ListBase keyconfigs;                            /* known key configurations */
+       struct wmKeyConfig *defaultconf;        /* default configuration, not saved */
+       int defaultactmap, pad2;                        /* active keymap from default for editing */
 } wmWindowManager;
 
 /* wmWindowManager.initialized */
@@ -234,44 +235,70 @@ typedef struct wmOperatorType {
 
 
 /* partial copy of the event, for matching by eventhandler */
-typedef struct wmKeymapItem {
-       struct wmKeymapItem *next, *prev;
+typedef struct wmKeyMapItem {
+       struct wmKeyMapItem *next, *prev;
        
+       /* operator */
        char idname[64];                                /* used to retrieve operator type pointer */
-       struct PointerRNA *ptr;                 /* rna pointer to access properties */
+       IDProperty *properties;                 /* operator properties */
        
+       /* modal */
+       short propvalue;                                /* if used, the item is from modal map */
+
+       /* event */
        short type;                                             /* event code itself */
        short val;                                              /* 0=any, 1=click, 2=release, or wheelvalue, or... */
        short shift, ctrl, alt, oskey;  /* oskey is apple or windowskey, value denotes order of pressed */
        short keymodifier;                              /* rawkey modifier */
        
-       short propvalue;                                /* if used, the item is from modal map */
-       
-       short inactive;                                 /* if set, deactivated item */
-       short maptype;                                          /* keymap editor */
-       short pad2, pad3;
-} wmKeymapItem;
+       /* flag: inactive, expanded */
+       short flag;
 
+       /* runtime */
+       short maptype, pad[2];                  /* keymap editor */
+       struct PointerRNA *ptr;                 /* rna pointer to access properties */
+} wmKeyMapItem;
+
+/* wmKeyMapItem.flag */
+#define KMI_INACTIVE   1
+#define KMI_EXPANDED   2
 
 /* stored in WM, the actively used keymaps */
 typedef struct wmKeyMap {
        struct wmKeyMap *next, *prev;
        
-       ListBase keymap;
+       ListBase items;
        
-       char nameid[64];        /* global editor keymaps, or for more per space/region */
+       char idname[64];        /* global editor keymaps, or for more per space/region */
        short spaceid;          /* same IDs as in DNA_space_types.h */
        short regionid;         /* see above */
        
-       short is_modal;         /* modal map, not using operatornames */
+       short flag;                     /* general flags */
        short pad;
        
-       void *items;            /* struct EnumPropertyItem for now */
-
-       /* verify if the keymap is enabled in the current context */
-       int (*poll)(struct bContext *);
+       /* runtime */
+       int (*poll)(struct bContext *); /* verify if enabled in the current context */
+       void *modal_items;                              /* for modal, EnumPropertyItem for now */
 } wmKeyMap;
 
+/* wmKeyMap.flag */
+#define KEYMAP_MODAL           1       /* modal map, not using operatornames */
+#define KEYMAP_USER                    2       /* user created keymap */
+
+typedef struct wmKeyConfig {
+       struct wmKeyConfig *next, *prev;
+
+       char idname[64];                /* unique name */
+       char basename[64];              /* idname of configuration this is derives from, "" if none */
+
+       ListBase keymaps;
+       int actkeymap, flag;
+} wmKeyConfig;
+
+/* wmKeyConfig.flag */
+#define KEYCONF_TWOBUTTONMOUSE (1 << 1)
+#define KEYCONF_LMOUSESELECT   (1 << 2)
+#define KEYCONF_NONUMPAD               (1 << 3)
 
 /* this one is the operator itself, stored in files for macros etc */
 /* operator + operatortype should be able to redo entirely, but for different contextes */
index 9ea7725b85549e2b7a11171c390a28a9695b1e60..810fb110f7a0add232fe8484257be46a9b1e30b6 100644 (file)
@@ -56,6 +56,7 @@ extern StructRNA RNA_Area;
 extern StructRNA RNA_AreaLamp;
 extern StructRNA RNA_Armature;
 extern StructRNA RNA_ArmatureModifier;
+extern StructRNA RNA_ArmatureSensor;
 extern StructRNA RNA_ArrayModifier;
 extern StructRNA RNA_BackgroundImage;
 extern StructRNA RNA_BevelModifier;
@@ -76,6 +77,7 @@ extern StructRNA RNA_BoneGroup;
 extern StructRNA RNA_BooleanModifier;
 extern StructRNA RNA_BooleanProperty;
 extern StructRNA RNA_Brush;
+extern StructRNA RNA_BrushTextureSlot;
 extern StructRNA RNA_BuildModifier;
 extern StructRNA RNA_Camera;
 extern StructRNA RNA_CastModifier;
@@ -99,7 +101,8 @@ extern StructRNA RNA_CompositorNodeBilateralblur;
 extern StructRNA RNA_CompositorNodeBlur;
 extern StructRNA RNA_CompositorNodeBrightContrast;
 extern StructRNA RNA_CompositorNodeChannelMatte;
-extern StructRNA RNA_CompositorNodeChroma;
+extern StructRNA RNA_CompositorNodeChromaMatte;
+extern StructRNA RNA_CompositorNodeColorMatte;
 extern StructRNA RNA_CompositorNodeColorSpill;
 extern StructRNA RNA_CompositorNodeCombHSVA;
 extern StructRNA RNA_CompositorNodeCombRGBA;
@@ -114,6 +117,7 @@ extern StructRNA RNA_CompositorNodeDefocus;
 extern StructRNA RNA_CompositorNodeDiffMatte;
 extern StructRNA RNA_CompositorNodeDilateErode;
 extern StructRNA RNA_CompositorNodeDisplace;
+extern StructRNA RNA_CompositorNodeDistanceMatte;
 extern StructRNA RNA_CompositorNodeFilter;
 extern StructRNA RNA_CompositorNodeFlip;
 extern StructRNA RNA_CompositorNodeGamma;
@@ -123,6 +127,7 @@ extern StructRNA RNA_CompositorNodeIDMask;
 extern StructRNA RNA_CompositorNodeImage;
 extern StructRNA RNA_CompositorNodeInvert;
 extern StructRNA RNA_CompositorNodeLensdist;
+extern StructRNA RNA_CompositorNodeLevels;
 extern StructRNA RNA_CompositorNodeLumaMatte;
 extern StructRNA RNA_CompositorNodeMapUV;
 extern StructRNA RNA_CompositorNodeMapValue;
@@ -174,9 +179,11 @@ extern StructRNA RNA_DistortedNoiseTexture;
 extern StructRNA RNA_DomainFluidSettings;
 extern StructRNA RNA_Driver;
 extern StructRNA RNA_DriverTarget;
+extern StructRNA RNA_DupliObject;
 extern StructRNA RNA_EdgeSplitModifier;
 extern StructRNA RNA_EditBone;
 extern StructRNA RNA_EffectSequence;
+extern StructRNA RNA_EffectorWeights;
 extern StructRNA RNA_EnumProperty;
 extern StructRNA RNA_EnumPropertyItem;
 extern StructRNA RNA_EnvironmentMap;
@@ -204,6 +211,10 @@ extern StructRNA RNA_FluidSettings;
 extern StructRNA RNA_FluidSimulationModifier;
 extern StructRNA RNA_FollowPathConstraint;
 extern StructRNA RNA_Function;
+extern StructRNA RNA_GPencilFrame;
+extern StructRNA RNA_GPencilLayer;
+extern StructRNA RNA_GPencilStroke;
+extern StructRNA RNA_GPencilStrokePoint;
 extern StructRNA RNA_GameBooleanProperty;
 extern StructRNA RNA_GameFloatProperty;
 extern StructRNA RNA_GameIntProperty;
@@ -214,10 +225,6 @@ extern StructRNA RNA_GameStringProperty;
 extern StructRNA RNA_GameTimerProperty;
 extern StructRNA RNA_GlowSequence;
 extern StructRNA RNA_GreasePencil;
-extern StructRNA RNA_GPencilLayer;
-extern StructRNA RNA_GPencilFrame;
-extern StructRNA RNA_GPencilStroke;
-extern StructRNA RNA_GPencilStrokePoint;
 extern StructRNA RNA_Group;
 extern StructRNA RNA_Header;
 extern StructRNA RNA_HemiLamp;
@@ -225,6 +232,7 @@ extern StructRNA RNA_HookModifier;
 extern StructRNA RNA_ID;
 extern StructRNA RNA_IDProperty;
 extern StructRNA RNA_IDPropertyGroup;
+extern StructRNA RNA_IKParam;
 extern StructRNA RNA_Image;
 extern StructRNA RNA_ImagePaint;
 extern StructRNA RNA_ImageSequence;
@@ -232,8 +240,12 @@ extern StructRNA RNA_ImageTexture;
 extern StructRNA RNA_ImageUser;
 extern StructRNA RNA_InflowFluidSettings;
 extern StructRNA RNA_IntProperty;
+extern StructRNA RNA_Itasc;
 extern StructRNA RNA_JoystickSensor;
 extern StructRNA RNA_Key;
+extern StructRNA RNA_KeyConfig;
+extern StructRNA RNA_KeyMap;
+extern StructRNA RNA_KeyMapItem;
 extern StructRNA RNA_KeyboardSensor;
 extern StructRNA RNA_KeyingSet;
 extern StructRNA RNA_KeyingSetPath;
@@ -263,6 +275,7 @@ extern StructRNA RNA_MaterialSlot;
 extern StructRNA RNA_MaterialStrand;
 extern StructRNA RNA_MaterialSubsurfaceScattering;
 extern StructRNA RNA_MaterialTextureSlot;
+extern StructRNA RNA_MaterialVolume;
 extern StructRNA RNA_Menu;
 extern StructRNA RNA_Mesh;
 extern StructRNA RNA_MeshColor;
@@ -313,6 +326,7 @@ extern StructRNA RNA_Paint;
 extern StructRNA RNA_Panel;
 extern StructRNA RNA_Particle;
 extern StructRNA RNA_ParticleBrush;
+extern StructRNA RNA_ParticleDupliWeight;
 extern StructRNA RNA_ParticleEdit;
 extern StructRNA RNA_ParticleFluidSettings;
 extern StructRNA RNA_ParticleHairKey;
@@ -327,13 +341,12 @@ extern StructRNA RNA_PluginTexture;
 extern StructRNA RNA_PointCache;
 extern StructRNA RNA_PointDensity;
 extern StructRNA RNA_PointDensityTexture;
-extern StructRNA RNA_PointerProperty;
 extern StructRNA RNA_PointLamp;
+extern StructRNA RNA_PointerProperty;
 extern StructRNA RNA_Pose;
 extern StructRNA RNA_PoseChannel;
 extern StructRNA RNA_Property;
 extern StructRNA RNA_PropertySensor;
-extern StructRNA RNA_ArmatureSensor;
 extern StructRNA RNA_PythonConstraint;
 extern StructRNA RNA_PythonController;
 extern StructRNA RNA_RadarSensor;
@@ -344,7 +357,6 @@ extern StructRNA RNA_RenderEngine;
 extern StructRNA RNA_RenderLayer;
 extern StructRNA RNA_RenderPass;
 extern StructRNA RNA_RenderResult;
-extern StructRNA RNA_RenderValue;
 extern StructRNA RNA_RigidBodyJointConstraint;
 extern StructRNA RNA_Scene;
 extern StructRNA RNA_SceneGameData;
@@ -492,12 +504,12 @@ extern StructRNA RNA_TransformSequence;
 extern StructRNA RNA_UILayout;
 extern StructRNA RNA_UIListItem;
 extern StructRNA RNA_UVProjectModifier;
+extern StructRNA RNA_UVProjector;
 extern StructRNA RNA_UnitSettings;
 extern StructRNA RNA_UnknownType;
 extern StructRNA RNA_UserPreferences;
 extern StructRNA RNA_UserPreferencesEdit;
 extern StructRNA RNA_UserPreferencesFilePaths;
-extern StructRNA RNA_UserPreferencesLanguage;
 extern StructRNA RNA_UserPreferencesSystem;
 extern StructRNA RNA_UserPreferencesView;
 extern StructRNA RNA_UserSolidLight;
index df44789483027d583eb932c865d21505803010e2..576f5cbb9846595193bba7a92d8c598b179a8991 100644 (file)
@@ -142,6 +142,9 @@ typedef enum PropertyFlag {
        /* icon */
        PROP_ICONS_CONSECUTIVE = 4096,
 
+       /* hidden in  the user interface */
+       PROP_HIDDEN = 524288,
+
        /* function paramater flags */
        PROP_REQUIRED = 4,
        PROP_RETURN = 8,
index da467381c0618fdc135b4d46512744cb82d91b40..bec2025907a124077ec65f59e4acfc332cf96d77 100644 (file)
@@ -2785,7 +2785,10 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name)
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
 
        if(prop) {
-               return (rna_idproperty_find(ptr, name) != NULL);
+               if(prop->flag & PROP_IDPROPERTY)
+                       return (rna_idproperty_find(ptr, name) != NULL);
+               else
+                       return 1;
        }
        else {
                // printf("RNA_property_is_set: %s.%s not found.\n", ptr->type->identifier, name);
index cc86da18a0bbd0667ab380ab5d4e50066b08b761..f3fb1244565eb820af7f503c73c8b7628dcd515c 100644 (file)
@@ -667,6 +667,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
                }
 
                prop= RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
+               RNA_def_property_flag(prop, PROP_HIDDEN);
                RNA_def_property_ui_text(prop, "RNA", "RNA type definition.");
 
                if(DefRNA.preprocess) {
index 1ebf03425d4b2b145104c4c5820ca1851c080b09..23592212f68b425a88f6ad9e33c4002f2f64a7ac 100644 (file)
@@ -203,7 +203,9 @@ void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
 
 void RNA_api_action(StructRNA *srna);
 void RNA_api_image(struct StructRNA *srna);
+void RNA_api_keyconfig(struct StructRNA *srna);
 void RNA_api_keyingset(struct StructRNA *srna);
+void RNA_api_keymap(struct StructRNA *srna);
 void RNA_api_main(struct StructRNA *srna);
 void RNA_api_material(StructRNA *srna);
 void RNA_api_mesh(struct StructRNA *srna);
@@ -213,7 +215,6 @@ void RNA_api_text(struct StructRNA *srna);
 void RNA_api_ui_layout(struct StructRNA *srna);
 void RNA_api_wm(struct StructRNA *srna);
 
-
 /* ID Properties */
 
 extern StringPropertyRNA rna_IDProperty_string;
index 17846651c3b29e202c7f10fbb9614307e2b75572..436efbcb2cfab30d63e5052896a3290e398da31e 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifdef RNA_RUNTIME
 
-static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only)
+static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, char *propname, int expand, int slider, int toggle, int icon_only, int event, int full_event)
 {
        int flag= 0;
 
@@ -45,6 +45,8 @@ static void rna_uiItemR(uiLayout *layout, char *name, int icon, PointerRNA *ptr,
        flag |= (expand)? UI_ITEM_R_EXPAND: 0;
        flag |= (toggle)? UI_ITEM_R_TOGGLE: 0;
        flag |= (icon_only)? UI_ITEM_R_ICON_ONLY: 0;
+       flag |= (event)? UI_ITEM_R_EVENT: 0;
+       flag |= (full_event)? UI_ITEM_R_FULL_EVENT: 0;
        
        uiItemR(layout, name, icon, ptr, propname, flag);
 }
@@ -147,6 +149,8 @@ void RNA_api_ui_layout(StructRNA *srna)
        RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values.");
        RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values.");
        RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text.");
+       RNA_def_boolean(func, "event", 0, "", "Use button to input key events.");
+       RNA_def_boolean(func, "full_event", 0, "", "Use button to input full events including modifiers.");
 
        func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR");
        api_ui_item_rna_common(func);
index 8f999300c718abccf7e177b6633cb221220b8f36..3e3ed669e02a40dc541f7d09c8b7e535e496896f 100644 (file)
@@ -1977,68 +1977,68 @@ static void rna_def_userdef_system(BlenderRNA *brna)
        StructRNA *srna;
 
        static EnumPropertyItem gl_texture_clamp_items[] = {
-               {0, "GL_CLAMP_OFF", 0, "Off", ""},
-               {8192, "GL_CLAMP_8192", 0, "8192", ""},
-               {4096, "GL_CLAMP_4096", 0, "4096", ""},
-               {2048, "GL_CLAMP_2048", 0, "2048", ""},
-               {1024, "GL_CLAMP_1024", 0, "1024", ""},
-               {512, "GL_CLAMP_512", 0, "512", ""},
-               {256, "GL_CLAMP_256", 0, "256", ""},
-               {128, "GL_CLAMP_128", 0, "128", ""},
+               {0, "CLAMP_OFF", 0, "Off", ""},
+               {8192, "CLAMP_8192", 0, "8192", ""},
+               {4096, "CLAMP_4096", 0, "4096", ""},
+               {2048, "CLAMP_2048", 0, "2048", ""},
+               {1024, "CLAMP_1024", 0, "1024", ""},
+               {512, "CLAMP_512", 0, "512", ""},
+               {256, "CLAMP_256", 0, "256", ""},
+               {128, "CLAMP_128", 0, "128", ""},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem audio_mixing_samples_items[] = {
-               {256, "AUDIO_SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
-               {512, "AUDIO_SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
-               {1024, "AUDIO_SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
-               {2048, "AUDIO_SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
-               {4096, "AUDIO_SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
-               {8192, "AUDIO_SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
-               {16384, "AUDIO_SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
-               {32768, "AUDIO_SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
+               {256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
+               {512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
+               {1024, "SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
+               {2048, "SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
+               {4096, "SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
+               {8192, "SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
+               {16384, "SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
+               {32768, "SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem audio_device_items[] = {
-               {0, "AUDIO_DEVICE_NULL", 0, "No Audio", "Null device - there will be no audio output."},
+               {0, "NONE", 0, "None", "Null device - there will be no audio output."},
 #ifdef WITH_SDL
-               {1, "AUDIO_DEVICE_SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage."},
+               {1, "SDL", 0, "SDL", "SDL device - simple direct media layer, recommended for sequencer usage."},
 #endif
 #ifdef WITH_OPENAL
-               {2, "AUDIO_DEVICE_OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage."},
+               {2, "OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage."},
 #endif
 #ifdef WITH_JACK
-               {3, "AUDIO_DEVICE_JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users."},
+               {3, "JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users."},
 #endif
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem audio_rate_items[] = {
-//             {8000, "AUDIO_RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second."},
-//             {11025, "AUDIO_RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second."},
-//             {16000, "AUDIO_RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second."},
-//             {22050, "AUDIO_RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second."},
-//             {32000, "AUDIO_RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second."},
-               {44100, "AUDIO_RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second."},
-               {48000, "AUDIO_RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second."},
-//             {88200, "AUDIO_RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second."},
-               {96000, "AUDIO_RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second."},
-               {192000, "AUDIO_RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second."},
+//             {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second."},
+//             {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second."},
+//             {16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second."},
+//             {22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second."},
+//             {32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second."},
+               {44100, "RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second."},
+               {48000, "RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second."},
+//             {88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second."},
+               {96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second."},
+               {192000, "RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second."},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem audio_format_items[] = {
-               {0x01, "AUDIO_FORMAT_U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer."},
-               {0x12, "AUDIO_FORMAT_S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer."},
-               {0x13, "AUDIO_FORMAT_S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer."},
-               {0x14, "AUDIO_FORMAT_S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer."},
-               {0x24, "AUDIO_FORMAT_FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float."},
-               {0x28, "AUDIO_FORMAT_DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float."},
+               {0x01, "U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer."},
+               {0x12, "S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer."},
+               {0x13, "S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer."},
+               {0x14, "S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer."},
+               {0x24, "FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float."},
+               {0x28, "DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float."},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem audio_channel_items[] = {
-               {1, "AUDIO_CHANNELS_MONO", 0, "Mono", "Set audio channels to mono."},
-               {2, "AUDIO_CHANNELS_STEREO", 0, "Stereo", "Set audio channels to stereo."},
-               {4, "AUDIO_CHANNELS_SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels."},
-               {6, "AUDIO_CHANNELS_SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound."},
-               {8, "AUDIO_CHANNELS_SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound."},
+               {1, "MONO", 0, "Mono", "Set audio channels to mono."},
+               {2, "STEREO", 0, "Stereo", "Set audio channels to stereo."},
+               {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels."},
+               {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound."},
+               {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound."},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem draw_method_items[] = {
@@ -2340,11 +2340,12 @@ void RNA_def_userdef(BlenderRNA *brna)
        PropertyRNA *prop;
 
        static EnumPropertyItem user_pref_sections[] = {
-               {0, "VIEW_CONTROLS", 0, "View", ""},
-               {1, "EDIT_METHODS", 0, "Editing", ""},
-               {2, "FILE_PATHS", 0, "File", ""},
-               {3, "SYSTEM_OPENGL", 0, "System", ""},
-//             {4, "THEMES", 0, "Themes", ""}, // Leave this out until we figure out a way to manage themes in the prefs.
+               {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
+               {USER_SECTION_EDIT, "EDITING", 0, "Editing", ""},
+               {USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
+//             {USER_SECTION_THEME, "THEMES", 0, "Themes", ""}, // Leave this out until we figure out a way to manage themes in the prefs.
+               {USER_SECTION_FILE, "FILES", 0, "File", ""},
+               {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
                {0, NULL, 0, NULL, NULL}};
 
        rna_def_userdef_dothemes(brna);
@@ -2358,6 +2359,7 @@ void RNA_def_userdef(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "userpref");
        RNA_def_property_enum_items(prop, user_pref_sections);
        RNA_def_property_ui_text(prop, "Active Section", "Active section of the user preferences shown in the user interface.");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop= RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "themes", NULL);
index 0dd9e3aed421cfb35122c219a0caad4522f0cf43..82b244fa7025ad94727e9557919815ca477cf200 100644 (file)
 
 #include <stdlib.h>
 
+#include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 #include "RNA_types.h"
 
 #include "rna_internal.h"
 
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
 #include "DNA_windowmanager_types.h"
-#include "WM_types.h" /* wmEvent */
 
+#include "WM_types.h"
+
+EnumPropertyItem event_keymouse_value_items[] = {
+       {KM_ANY, "ANY", 0, "Any", ""},
+       {KM_PRESS, "PRESS", 0, "Press", ""},
+       {KM_RELEASE, "RELEASE", 0, "Release", ""},
+       {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem event_tweak_value_items[]= {
+       {KM_ANY, "ANY", 0, "Any", ""},
+       {EVT_GESTURE_N, "NORTH", 0, "North", ""},
+       {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
+       {EVT_GESTURE_E, "EAST", 0, "East", ""},
+       {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
+       {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
+       {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
+       {EVT_GESTURE_W, "WEST", 0, "West", ""},
+       {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
+       {0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem event_value_items[] = {
        {KM_ANY, "ANY", 0, "Any", ""},
@@ -40,9 +63,43 @@ EnumPropertyItem event_value_items[] = {
        {KM_RELEASE, "RELEASE", 0, "Release", ""},
        {0, NULL, 0, NULL, NULL}};
 
+EnumPropertyItem event_tweak_type_items[]= {
+       {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
+       {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
+       {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
+       {EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Action", ""},
+       {EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Select", ""},
+       {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem event_mouse_type_items[]= {
+       {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
+       {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
+       {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
+       {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
+       {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
+       {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action", ""},
+       {SELECTMOUSE, "SELECTMOUSE", 0, "Select", ""},
+       {0, "", 0, NULL, NULL},
+       {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
+       {0, "", 0, NULL, NULL},
+       {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
+       {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
+       {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
+       {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
+       {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem event_timer_type_items[]= {
+       {TIMER, "TIMER", 0, "Timer", ""},
+       {TIMER0, "TIMER0", 0, "Timer 0", ""},
+       {TIMER1, "TIMER1", 0, "Timer 1", ""},
+       {TIMER2, "TIMER2", 0, "Timer 2", ""},
+       {TIMERJOBS, "JOBS_TIMER", 0, "Jobs Timer", ""},
+       {0, NULL, 0, NULL, NULL}};
+
 /* not returned: CAPSLOCKKEY, UNKNOWNKEY, GRLESSKEY */
 EnumPropertyItem event_type_items[] = {
 
+       {0, "NONE", 0, "", ""},
        {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", ""},
        {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", ""},
        {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", ""},
@@ -50,20 +107,20 @@ EnumPropertyItem event_type_items[] = {
        {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", ""},
        {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", ""},
        {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""},
-
+       {0, "", 0, NULL, NULL},
        {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""},
-
+       {0, "", 0, NULL, NULL},
        {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
        {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
        {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
        {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
-
+       {0, "", 0, NULL, NULL},
        {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", ""},
        {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", ""},
        {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", ""},
        {EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Tweak Action", ""},
        {EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Tweak Select", ""},
-
+       {0, "", 0, NULL, NULL},
        {AKEY, "A", 0, "A", ""},
        {BKEY, "B", 0, "B", ""},
        {CKEY, "C", 0, "C", ""},
@@ -90,7 +147,7 @@ EnumPropertyItem event_type_items[] = {
        {XKEY, "X", 0, "X", ""},
        {YKEY, "Y", 0, "Y", ""},
        {ZKEY, "Z", 0, "Z", ""},
-       
+       {0, "", 0, NULL, NULL},
        {ZEROKEY, "ZERO",       0, "0", ""},
        {ONEKEY, "ONE",         0, "1", ""},
        {TWOKEY, "TWO",         0, "2", ""},
@@ -101,16 +158,16 @@ EnumPropertyItem event_type_items[] = {
        {SEVENKEY, "SEVEN",     0, "7", ""},
        {EIGHTKEY, "EIGHT",     0, "8", ""},
        {NINEKEY, "NINE",       0, "9", ""},
-       
+       {0, "", 0, NULL, NULL},
        {LEFTCTRLKEY,   "LEFT_CTRL",    0, "Left Ctrl", ""},
        {LEFTALTKEY,    "LEFT_ALT",             0, "Left Alt", ""},
        {LEFTSHIFTKEY,  "LEFT_SHIFT",   0, "Left Shift", ""},
        {RIGHTALTKEY,   "RIGHT_ALT",    0, "Right Alt", ""},
        {RIGHTCTRLKEY,  "RIGHT_CTRL",   0, "Right Ctrl", ""},
        {RIGHTSHIFTKEY, "RIGHT_SHIFT",  0, "Right Shift", ""},
-
+       {0, "", 0, NULL, NULL},
        {COMMANDKEY,    "COMMAND",      0, "Command", ""},
-       
+       {0, "", 0, NULL, NULL},
        {ESCKEY, "ESC", 0, "Esc", ""},
        {TABKEY, "TAB", 0, "Tab", ""},
        {RETKEY, "RET", 0, "Return", ""},
@@ -167,8 +224,20 @@ EnumPropertyItem event_type_items[] = {
        {PAGEUPKEY, "PAGE_UP", 0, "Page Up", ""},
        {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""},
        {ENDKEY, "END", 0, "End", ""},
+       {0, "", 0, NULL, NULL},
+       {TIMER, "TIMER", 0, "Timer", ""},
+       {TIMER0, "TIMER0", 0, "Timer 0", ""},
+       {TIMER1, "TIMER1", 0, "Timer 1", ""},
+       {TIMER2, "TIMER2", 0, "Timer 2", ""},
+       {TIMERJOBS, "JOBS_TIMER", 0, "Jobs Timer", ""},
        {0, NULL, 0, NULL, NULL}};      
 
+#define KMI_TYPE_KEYBOARD      0
+#define KMI_TYPE_MOUSE         1
+#define KMI_TYPE_TWEAK         2
+#define KMI_TYPE_TEXTINPUT     3
+#define KMI_TYPE_TIMER         4
+
 #ifdef RNA_RUNTIME
 
 #include "WM_api.h"
@@ -263,6 +332,156 @@ static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
        }
 }
 
+static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
+{
+       wmKeyMapItem *kmi= ptr->data;
+
+       if(kmi->ptr)
+               return *(kmi->ptr);
+       
+       //return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties);
+       return PointerRNA_NULL;
+}
+
+static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
+{
+       wmKeyMapItem *kmi= ptr->data;
+
+       if(ISTIMER(kmi->type)) return KMI_TYPE_TIMER;
+    if(ISKEYBOARD(kmi->type)) return KMI_TYPE_KEYBOARD;
+       if(ISTWEAK(kmi->type)) return KMI_TYPE_TWEAK;
+       if(ISMOUSE(kmi->type)) return KMI_TYPE_MOUSE;
+       if(kmi->type == KM_TEXTINPUT) return KMI_TYPE_TEXTINPUT;
+       return KMI_TYPE_KEYBOARD;
+}
+
+static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
+{
+       wmKeyMapItem *kmi= ptr->data;
+       int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+
+       if(value != map_type) {
+               switch(value) {
+               case KMI_TYPE_KEYBOARD:
+                       kmi->type= AKEY;
+                       kmi->val= KM_PRESS;
+                       break;
+               case KMI_TYPE_TWEAK:
+                       kmi->type= EVT_TWEAK_L;
+                       kmi->val= KM_ANY;
+                       break;
+               case KMI_TYPE_MOUSE:
+                       kmi->type= LEFTMOUSE;
+                       kmi->val= KM_PRESS;
+                       break;
+               case KMI_TYPE_TEXTINPUT:
+                       kmi->type= KM_TEXTINPUT;
+                       kmi->val= KM_NOTHING;
+                       break;
+               case KMI_TYPE_TIMER:
+                       kmi->type= TIMER;
+                       kmi->val= KM_NOTHING;
+                       break;
+               }
+       }
+}
+
+static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+       int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+
+       if(map_type == KMI_TYPE_MOUSE) return event_mouse_type_items;
+       if(map_type == KMI_TYPE_TWEAK) return event_tweak_type_items;
+       if(map_type == KMI_TYPE_TIMER) return event_timer_type_items;
+       else return event_type_items;
+}
+
+static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+       int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+
+       if(map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD) return event_keymouse_value_items;
+       if(map_type == KMI_TYPE_TWEAK) return event_tweak_value_items;
+       else return event_value_items;
+}
+
+static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
+{
+       wmWindowManager *wm= ptr->data;
+       wmKeyConfig *kc;
+
+       for(kc=wm->keyconfigs.first; kc; kc=kc->next)
+               if(strcmp(kc->idname, U.keyconfigstr) == 0)
+                       break;
+       
+       if(!kc)
+               kc= wm->defaultconf;
+       
+       return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
+}
+
+static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
+{
+       wmKeyConfig *kc= value.data;
+
+       if(kc)
+               BLI_strncpy(U.keyconfigstr, kc->idname, sizeof(U.keyconfigstr));
+}
+
+static PointerRNA rna_WindowManager_active_keymap_get(PointerRNA *ptr)
+{
+       wmWindowManager *wm= ptr->data;
+       wmKeyMap *km= NULL;
+       
+       if(wm->defaultconf) {
+               km= BLI_findlink(&wm->defaultconf->keymaps, wm->defaultactmap);
+               
+               if(!km)
+                       km= wm->defaultconf->keymaps.first;
+       }
+
+       return rna_pointer_inherit_refine(ptr, &RNA_KeyMap, WM_keymap_active(wm, km));
+}
+
+static void rna_WindowManager_active_keymap_set(PointerRNA *ptr, PointerRNA value)
+{
+       wmWindowManager *wm= ptr->data;
+       wmKeyMap *km= value.data;
+       int index;
+       
+       if(wm->defaultconf && km) {
+               km= WM_keymap_find(wm->defaultconf, km->idname, km->spaceid, km->regionid);
+               index= BLI_findindex(&wm->defaultconf->keymaps, km);
+
+               if(index != -1) wm->defaultactmap= index;
+               else wm->defaultactmap= 0;
+       }
+}
+
+static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
+{
+       wmKeyMapItem *kmi= ptr->data;
+       WM_operator_py_idname(value, kmi->idname);
+}
+
+static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
+{
+       wmKeyMapItem *kmi= ptr->data;
+       char pyname[OP_MAX_TYPENAME];
+
+       WM_operator_py_idname(pyname, kmi->idname);
+       return strlen(pyname);
+}
+
+static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
+{
+       wmKeyMapItem *kmi= ptr->data;
+       char idname[OP_MAX_TYPENAME];
+
+       WM_operator_bl_idname(idname, value);
+       BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
+}
+
 #else
 
 static void rna_def_operator(BlenderRNA *brna)
@@ -434,9 +653,154 @@ static void rna_def_windowmanager(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "Window");
        RNA_def_property_ui_text(prop, "Windows", "Open windows.");
 
+       prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyConfig");
+       RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations.");
+
+       prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "KeyConfig");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0);
+       RNA_def_property_ui_text(prop, "Active Key Configuration", "");
+
+       prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
+       RNA_def_property_struct_type(prop, "KeyConfig");
+       RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+
+       prop= RNA_def_property(srna, "active_keymap", PROP_POINTER, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "KeyMap");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keymap_get", "rna_WindowManager_active_keymap_set", 0);
+       RNA_def_property_ui_text(prop, "Active Key Map", "");
+
        RNA_api_wm(srna);
 }
 
+static void rna_def_keyconfig(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       FunctionRNA *func;
+       PropertyRNA *prop, *parm;
+
+       static EnumPropertyItem map_type_items[] = {
+               {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
+               {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
+               {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
+               {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
+               {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       /* KeyConfig */
+       srna= RNA_def_struct(brna, "KeyConfig", NULL);
+       RNA_def_struct_sdna(srna, "wmKeyConfig");
+       RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps.");
+
+       prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "idname");
+       RNA_def_property_ui_text(prop, "Name", "Name of the key configuration.");
+       RNA_def_struct_name_property(srna, prop);
+
+       prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyMap");
+       RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration.");
+
+       RNA_api_keyconfig(srna);
+
+       /* KeyMap */
+       srna= RNA_def_struct(brna, "KeyMap", NULL);
+       RNA_def_struct_sdna(srna, "wmKeyMap");
+       RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps.");
+
+       prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "idname");
+       RNA_def_property_ui_text(prop, "Name", "Name of the key map.");
+       RNA_def_struct_name_property(srna, prop);
+
+       prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "spaceid");
+       RNA_def_property_enum_items(prop, space_type_items);
+       RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with.");
+
+       prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "regionid");
+       RNA_def_property_enum_items(prop, region_type_items);
+       RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with.");
+
+       prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_struct_type(prop, "KeyMapItem");
+       RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event.");
+
+       prop= RNA_def_property(srna, "user_defined", PROP_BOOLEAN, PROP_NEVER_NULL);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER);
+       RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user.");
+
+       RNA_api_keymap(srna);
+
+       /* KeyMapItem */
+       srna= RNA_def_struct(brna, "KeyMapItem", NULL);
+       RNA_def_struct_sdna(srna, "wmKeyMapItem");
+       RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map.");
+
+       prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+       RNA_def_property_string_sdna(prop, NULL, "idname");
+       RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event.");
+       RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set");
+       RNA_def_struct_name_property(srna, prop);
+
+       prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "OperatorProperties");
+       RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL);
+       RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called.");
+
+       prop= RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "maptype");
+       RNA_def_property_enum_items(prop, map_type_items);
+       RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
+       RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping.");
+
+       prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "type");
+       RNA_def_property_enum_items(prop, event_type_items);
+       RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
+       RNA_def_property_ui_text(prop, "Type", "Type of event.");
+
+       prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "val");
+       RNA_def_property_enum_items(prop, event_value_items);
+       RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
+       RNA_def_property_ui_text(prop, "Value", "");
+
+       prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
+       RNA_def_property_ui_text(prop, "Shift", "Shift key pressed.");
+
+       prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
+       RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed.");
+
+       prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
+       RNA_def_property_ui_text(prop, "Alt", "Alt key pressed.");
+
+       prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
+       RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed.");
+
+       prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
+       RNA_def_property_enum_items(prop, event_type_items);
+       RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier.");
+
+       prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
+       RNA_def_property_ui_text(prop, "Expanded", "Expanded in the user interface.");
+
+       prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
+       RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item.");
+}
+
 void RNA_def_wm(BlenderRNA *brna)
 {
        rna_def_operator(brna);
@@ -445,6 +809,7 @@ void RNA_def_wm(BlenderRNA *brna)
        rna_def_event(brna);
        rna_def_window(brna);
        rna_def_windowmanager(brna);
+       rna_def_keyconfig(brna);
 }
 
 #endif
index fd34d7c4d70208eb0c6fcad52dd70af661ba72d4..44c6967189d473b6c174fb3b6ffb64ad9eafaf8d 100644 (file)
 
 #include "RNA_define.h"
 #include "RNA_types.h"
+#include "RNA_enum_types.h"
+
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
 
 #ifdef RNA_RUNTIME
 
 #include "BKE_context.h"
 
 #include "WM_api.h"
+#include "WM_types.h"
+
+static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, char *idname, int type, int value, int shift, int ctrl, int alt, int oskey, int keymodifier)
+{
+       int modifier= 0;
+
+       if(shift) modifier |= KM_SHIFT;
+       if(ctrl) modifier |= KM_CTRL;
+       if(alt) modifier |= KM_ALT;
+       if(oskey) modifier |= KM_OSKEY;
+
+       return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
+}
 
 #else
 
 void RNA_api_wm(StructRNA *srna)
 {
        FunctionRNA *func;
-       PropertyRNA *prop;
+       PropertyRNA *parm;
 
        func= RNA_def_function(srna, "add_fileselect", "WM_event_add_fileselect");
        RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
        RNA_def_function_ui_description(func, "Show up the file selector.");
-       prop= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
-       RNA_def_property_flag(prop, PROP_REQUIRED);
+       parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
+       func= RNA_def_function(srna, "add_keyconfig", "WM_keyconfig_add");
+       parm= RNA_def_string(func, "name", "", 0, "Name", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
+       RNA_def_function_return(func, parm);
+}
+
+void RNA_api_keyconfig(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       func= RNA_def_function(srna, "add_keymap", "WM_keymap_find");
+       parm= RNA_def_string(func, "name", "", 0, "Name", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
+       RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+       parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
+       RNA_def_function_return(func, parm);
+}
+
+void RNA_api_keymap(StructRNA *srna)
+{
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       func= RNA_def_function(srna, "add_item", "rna_KeyMap_add_item");
+       parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_boolean(func, "shift", 0, "Shift", "");
+       RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
+       RNA_def_boolean(func, "alt", 0, "Alt", "");
+       RNA_def_boolean(func, "oskey", 0, "OS Key", "");
+       RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", "");
+       parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
+       RNA_def_function_return(func, parm);
+
+       func= RNA_def_function(srna, "remove_item", "WM_keymap_remove_item");
+       parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
+       func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user");
+       parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map.");
+       RNA_def_function_return(func, parm);
+
+       func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
 }
 
 #endif
index 42b905dc0d8c4e9241e804a82a14930d54f86dc7..44b419e8ae99318241ae280dc4ca03942742c9ba 100644 (file)
@@ -433,7 +433,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
        {
                PointerRNA newptr;
                newptr= RNA_property_pointer_get(ptr, prop);
-               if (newptr.data) {
+               if (newptr.type) {
                        ret = pyrna_struct_CreatePyObject(&newptr);
                } else {
                        ret = Py_None;
@@ -1153,6 +1153,31 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA * self, PyObject *ar
        return PyBool_FromLong( insert_keyframe((ID *)self->ptr.data, NULL, NULL, path, index, cfra, 0));
 }
 
+static PyObject *pyrna_struct_is_property_set(BPy_StructRNA * self, PyObject *args)
+{
+       char *name;
+
+       if (!PyArg_ParseTuple(args, "s:is_property_set", &name))
+               return NULL;
+
+       return PyBool_FromLong(RNA_property_is_set(&self->ptr, name));
+}
+
+static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA * self, PyObject *args)
+{
+       PropertyRNA *prop;
+       char *name;
+       int hidden;
+
+       if (!PyArg_ParseTuple(args, "s:is_property_hidden", &name))
+               return NULL;
+       
+       prop= RNA_struct_find_property(&self->ptr, name);
+       hidden= (prop)? (RNA_property_flag(prop) & PROP_HIDDEN): 1;
+
+       return PyBool_FromLong(hidden);
+}
+
 
 static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
 {
@@ -1272,7 +1297,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA * self, PyObject *pyname )
 
                CTX_data_get(self->ptr.data, name, &newptr, &newlb);
 
-        if (newptr.data) {
+        if (newptr.type) {
             ret = pyrna_struct_CreatePyObject(&newptr);
                }
                else if (newlb.first) {
@@ -1745,6 +1770,8 @@ static struct PyMethodDef pyrna_struct_methods[] = {
 
        /* maybe this become and ID function */
        {"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, NULL},
+       {"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, NULL},
+       {"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
 
        {"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
        {NULL, NULL, 0, NULL}
index 0054f151803671282b3566e78b8100caa9eb7f2b..b29dbec63643a6e7dfa9d655f2575aca5cd469da 100644 (file)
@@ -82,22 +82,30 @@ void                WM_timecursor           (struct wmWindow *win, int nr);
 void           *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), void (*draw)(struct bContext *C, int, int, void *customdata), void *customdata);
 void           WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
 
-                       /* keymap */
+                       /* keyconfig and keymap */
+wmKeyConfig *WM_keyconfig_add  (struct wmWindowManager *wm, char *idname);
+void           WM_keyconfig_free       (struct wmKeyConfig *keyconf);
+void           WM_keyconfig_userdef(struct wmWindowManager *wm);
+
 void           WM_keymap_init          (struct bContext *C);
-wmKeymapItem *WM_keymap_verify_item(wmKeyMap *keymap, char *idname, short type, 
-                                                                short val, int modifier, short keymodifier);
-wmKeymapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, short type, 
-                                                                short val, int modifier, short keymodifier);
-void           WM_keymap_tweak (wmKeyMap *keymap, short type, short val, int modifier, short keymodifier);
-wmKeyMap       *WM_keymap_find (struct wmWindowManager *wm, const char *nameid,
-                                                                short spaceid, short regionid);
-
-wmKeyMap       *WM_modalkeymap_add(struct wmWindowManager *wm, const char *nameid, struct EnumPropertyItem *items);
-wmKeyMap       *WM_modalkeymap_get(struct wmWindowManager *wm, const char *nameid);
-void           WM_modalkeymap_add_item(wmKeyMap *km, short type, short val, int modifier, short keymodifier, short value);
-void           WM_modalkeymap_assign(wmKeyMap *km, const char *opname);
-
-int                    WM_key_event_is_tweak(short type);
+void           WM_keymap_free          (struct wmKeyMap *keymap);
+
+wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, char *idname, int type, 
+                                                                int val, int modifier, int keymodifier);
+wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type, 
+                                                                int val, int modifier, int keymodifier);
+void         WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
+char            *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
+
+wmKeyMap       *WM_keymap_find(struct wmKeyConfig *keyconf, char *idname, int spaceid, int regionid);
+wmKeyMap       *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
+wmKeyMap       *WM_keymap_copy_to_user(struct wmKeyMap *keymap);
+void           WM_keymap_restore_to_default(struct wmKeyMap *keymap);
+
+wmKeyMap       *WM_modalkeymap_add(struct wmKeyConfig *keyconf, char *idname, struct EnumPropertyItem *items);
+wmKeyMap       *WM_modalkeymap_get(struct wmKeyConfig *keyconf, char *idname);
+void           WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
+void           WM_modalkeymap_assign(struct wmKeyMap *km, char *opname);
 
 const char     *WM_key_event_string(short type);
 char           *WM_key_event_operator_string(const struct bContext *C, const char *opname, int opcontext, struct IDProperty *properties, char *str, int len);
index 4405b52888daf5f3478b72ffd1eda3aba06c667a..a068f84ae294f413b4928012d08464803a578c38 100644 (file)
@@ -132,12 +132,18 @@ void WM_keymap_init(bContext *C)
 {
        wmWindowManager *wm= CTX_wm_manager(C);
 
+       if(!wm->defaultconf)
+               wm->defaultconf= WM_keyconfig_add(wm, "Blender");
+       
        if(wm && CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
-               wm_window_keymap(wm);
-               ED_spacetypes_keymap(wm);
+               /* create default key config */
+               wm_window_keymap(wm->defaultconf);
+               ED_spacetypes_keymap(wm->defaultconf);
 
                wm->initialized |= WM_INIT_KEYMAP;
        }
+
+       WM_keyconfig_userdef(wm);
 }
 
 void wm_check(bContext *C)
@@ -151,15 +157,16 @@ void wm_check(bContext *C)
        }
        if(wm==NULL) return;
        if(wm->windows.first==NULL) return;
+
+       /* case: fileread */
+       if((wm->initialized & WM_INIT_WINDOW) == 0)
+               WM_keymap_init(C);
        
        /* case: no open windows at all, for old file reads */
        wm_window_add_ghostwindows(wm);
        
        /* case: fileread */
        if((wm->initialized & WM_INIT_WINDOW) == 0) {
-               
-               WM_keymap_init(C);
-               
                ED_screens_initialize(wm);
                wm->initialized |= WM_INIT_WINDOW;
        }
@@ -211,8 +218,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
 {
        wmWindow *win;
        wmOperator *op;
-       wmKeyMap *km;
-       wmKeymapItem *kmi;
+       wmKeyConfig *keyconf;
        
        while((win= wm->windows.first)) {
                BLI_remlink(&wm->windows, win);
@@ -226,19 +232,11 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
                WM_operator_free(op);
        }
 
-       while((km= wm->keymaps.first)) {
-               for(kmi=km->keymap.first; kmi; kmi=kmi->next) {
-                       if(kmi->ptr) {
-                               WM_operator_properties_free(kmi->ptr);
-                               MEM_freeN(kmi->ptr);
-                       }
-               }
-
-               BLI_freelistN(&km->keymap);
-               BLI_remlink(&wm->keymaps, km);
-               MEM_freeN(km);
+       while((keyconf=wm->keyconfigs.first)) {
+               BLI_remlink(&wm->keyconfigs, keyconf);
+               WM_keyconfig_free(keyconf);
        }
-       
+
        BLI_freelistN(&wm->queue);
        
        BLI_freelistN(&wm->paintcursors);
index 4a8aac4525d2333a14959f72c27eeb2158bf9ea7..ea73ed38123e590837038dd43a26e63d74e37dbb 100644 (file)
@@ -725,16 +725,16 @@ static int wm_userdef_event_map(int kmitype)
        return kmitype;
 }
 
-static int wm_eventmatch(wmEvent *winevent, wmKeymapItem *kmi)
+static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 {
        int kmitype= wm_userdef_event_map(kmi->type);
 
-       if(kmi->inactive) return 0;
+       if(kmi->flag & KMI_INACTIVE) return 0;
 
        /* exception for middlemouse emulation */
        if((U.flag & USER_TWOBUTTONMOUSE) && (kmi->type == MIDDLEMOUSE)) {
                if(winevent->type == LEFTMOUSE && winevent->alt) {
-                       wmKeymapItem tmp= *kmi;
+                       wmKeyMapItem tmp= *kmi;
 
                        tmp.type= winevent->type;
                        tmp.alt= winevent->alt;
@@ -784,9 +784,9 @@ static int wm_event_always_pass(wmEvent *event)
 static void wm_event_modalkeymap(wmOperator *op, wmEvent *event)
 {
        if(op->type->modalkeymap) {
-               wmKeymapItem *kmi;
+               wmKeyMapItem *kmi;
                
-               for(kmi= op->type->modalkeymap->keymap.first; kmi; kmi= kmi->next) {
+               for(kmi= op->type->modalkeymap->items.first; kmi; kmi= kmi->next) {
                        if(wm_eventmatch(event, kmi)) {
                                        
                                event->type= EVT_MODAL_MAP;
@@ -1031,6 +1031,7 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
 
 static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 {
+       wmWindowManager *wm= CTX_wm_manager(C);
        wmEventHandler *handler, *nexthandler;
        int action= WM_HANDLER_CONTINUE;
        int always_pass;
@@ -1051,11 +1052,11 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
                                action= WM_HANDLER_BREAK;
 
                        if(handler->keymap) {
-                               wmKeyMap *keymap= handler->keymap;
-                               wmKeymapItem *kmi;
+                               wmKeyMap *keymap= WM_keymap_active(wm, handler->keymap);
+                               wmKeyMapItem *kmi;
                                
                                if(!keymap->poll || keymap->poll(C)) {
-                                       for(kmi= keymap->keymap.first; kmi; kmi= kmi->next) {
+                                       for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
                                                if(wm_eventmatch(event, kmi)) {
                                                        
                                                        event->keymap_idname= kmi->idname;      /* weak, but allows interactive callback to not use rawkey */
index 7d25fb8172efe03d2f02ba12254ea859e4764853..3d3a6e46fb2091a71cedf806e5e40d4b1374ce83 100644 (file)
@@ -29,6 +29,7 @@
 #include <string.h>
 
 #include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
 #include "DNA_windowmanager_types.h"
 
 #include "MEM_guardedalloc.h"
 #include "wm_event_system.h"
 #include "wm_event_types.h"
 
+/* ********************* key config ***********************/
+
+static void keymap_properties_set(wmKeyMapItem *kmi)
+{
+       if(!kmi->properties) {
+               IDPropertyTemplate val = {0};
+               kmi->properties= IDP_New(IDP_GROUP, val, "wmKeyMapItemProperties");
+       }
+
+       if(!kmi->ptr) {
+               kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeyMapItemPtr");
+               WM_operator_properties_create(kmi->ptr, kmi->idname);
+       }
+
+       kmi->ptr->data= kmi->properties;
+}
+
+wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname)
+{
+       wmKeyConfig *keyconf;
+       
+       keyconf= MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
+       BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
+       BLI_addtail(&wm->keyconfigs, keyconf);
+
+       return keyconf;
+}
+
+void WM_keyconfig_free(wmKeyConfig *keyconf)
+{
+       wmKeyMap *km;
+
+       while((km= keyconf->keymaps.first)) {
+               WM_keymap_free(km);
+               BLI_freelinkN(&keyconf->keymaps, km);
+       }
+
+       MEM_freeN(keyconf);
+}
+
+void WM_keyconfig_userdef(wmWindowManager *wm)
+{
+       wmKeyMap *km;
+       wmKeyMapItem *kmi;
+
+       for(km=U.keymaps.first; km; km=km->next)
+               for(kmi=km->items.first; kmi; kmi=kmi->next)
+                       keymap_properties_set(kmi);
+}
+
+static wmKeyConfig *wm_keyconfig_list_find(ListBase *lb, char *idname)
+{
+       wmKeyConfig *kc;
+
+       for(kc= lb->first; kc; kc= kc->next)
+               if(0==strncmp(idname, kc->idname, KMAP_MAX_NAME))
+                       return kc;
+       
+       return NULL;
+}
+
+/* ************************ free ************************* */
+
+void WM_keymap_free(wmKeyMap *keymap)
+{
+       wmKeyMapItem *kmi;
+
+       for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+               if(kmi->ptr) {
+                       WM_operator_properties_free(kmi->ptr);
+                       MEM_freeN(kmi->ptr);
+               }
+       }
+
+       BLI_freelistN(&keymap->items);
+}
+
 /* ***************** generic call, exported **************** */
 
-static void keymap_event_set(wmKeymapItem *kmi, short type, short val, int modifier, short keymodifier)
+static void keymap_event_set(wmKeyMapItem *kmi, short type, short val, int modifier, short keymodifier)
 {
        kmi->type= type;
        kmi->val= val;
@@ -87,26 +165,18 @@ static void keymap_event_set(wmKeymapItem *kmi, short type, short val, int modif
        }
 }
 
-static void keymap_properties_set(wmKeymapItem *kmi)
-{
-       if(!kmi->ptr) {
-               kmi->ptr= MEM_callocN(sizeof(PointerRNA), "wmKeymapItemPtr");
-               WM_operator_properties_create(kmi->ptr, kmi->idname);
-       }
-}
-
 /* if item was added, then bail out */
-wmKeymapItem *WM_keymap_verify_item(wmKeyMap *keymap, char *idname, short type, short val, int modifier, short keymodifier)
+wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier)
 {
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
        
-       for(kmi= keymap->keymap.first; kmi; kmi= kmi->next)
+       for(kmi= keymap->items.first; kmi; kmi= kmi->next)
                if(strncmp(kmi->idname, idname, OP_MAX_TYPENAME)==0)
                        break;
        if(kmi==NULL) {
-               kmi= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
+               kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
                
-               BLI_addtail(&keymap->keymap, kmi);
+               BLI_addtail(&keymap->items, kmi);
                BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
                
                keymap_event_set(kmi, type, val, modifier, keymodifier);
@@ -116,11 +186,11 @@ wmKeymapItem *WM_keymap_verify_item(wmKeyMap *keymap, char *idname, short type,
 }
 
 /* always add item */
-wmKeymapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, short type, short val, int modifier, short keymodifier)
+wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier)
 {
-       wmKeymapItem *kmi= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
+       wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
        
-       BLI_addtail(&keymap->keymap, kmi);
+       BLI_addtail(&keymap->items, kmi);
        BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
 
        keymap_event_set(kmi, type, val, modifier, keymodifier);
@@ -128,27 +198,45 @@ wmKeymapItem *WM_keymap_add_item(wmKeyMap *keymap, char *idname, short type, sho
        return kmi;
 }
 
+void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
+{
+       if(BLI_findindex(&keymap->items, kmi) != -1) {
+               if(kmi->ptr) {
+                       WM_operator_properties_free(kmi->ptr);
+                       MEM_freeN(kmi->ptr);
+               }
+               BLI_freelinkN(&keymap->items, kmi);
+       }
+}
+
 /* ****************** storage in WM ************ */
 
 /* name id's are for storing general or multiple keymaps, 
    space/region ids are same as DNA_space_types.h */
 /* gets free'd in wm.c */
 
-wmKeyMap *WM_keymap_find(wmWindowManager *wm, const char *nameid, short spaceid, short regionid)
+static wmKeyMap *wm_keymap_list_find(ListBase *lb, char *idname, int spaceid, int regionid)
 {
        wmKeyMap *km;
-       
-       for(km= wm->keymaps.first; km; km= km->next)
+
+       for(km= lb->first; km; km= km->next)
                if(km->spaceid==spaceid && km->regionid==regionid)
-                       if(0==strncmp(nameid, km->nameid, KMAP_MAX_NAME))
+                       if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
                                return km;
        
+       return NULL;
+}
+
+wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
+{
+       wmKeyMap *km= wm_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
+       
        if(km==NULL) {
                km= MEM_callocN(sizeof(struct wmKeyMap), "keymap list");
-               BLI_strncpy(km->nameid, nameid, KMAP_MAX_NAME);
+               BLI_strncpy(km->idname, idname, KMAP_MAX_NAME);
                km->spaceid= spaceid;
                km->regionid= regionid;
-               BLI_addtail(&wm->keymaps, km);
+               BLI_addtail(&keyconf->keymaps, km);
        }
        
        return km;
@@ -158,39 +246,39 @@ wmKeyMap *WM_keymap_find(wmWindowManager *wm, const char *nameid, short spaceid,
 
 /* modal maps get linked to a running operator, and filter the keys before sending to modal() callback */
 
-wmKeyMap *WM_modalkeymap_add(wmWindowManager *wm, const char *nameid, EnumPropertyItem *items)
+wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, char *idname, EnumPropertyItem *items)
 {
-       wmKeyMap *km= WM_keymap_find(wm, nameid, 0, 0);
-       km->is_modal= 1;
-       km->items= items;
+       wmKeyMap *km= WM_keymap_find(keyconf, idname, 0, 0);
+       km->flag |= KEYMAP_MODAL;
+       km->modal_items= items;
        
        return km;
 }
 
-wmKeyMap *WM_modalkeymap_get(wmWindowManager *wm, const char *nameid)
+wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, char *idname)
 {
        wmKeyMap *km;
        
-       for(km= wm->keymaps.first; km; km= km->next)
-               if(km->is_modal)
-                       if(0==strncmp(nameid, km->nameid, KMAP_MAX_NAME))
+       for(km= keyconf->keymaps.first; km; km= km->next)
+               if(km->flag & KEYMAP_MODAL)
+                       if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
                                break;
        
        return km;
 }
 
 
-void WM_modalkeymap_add_item(wmKeyMap *km, short type, short val, int modifier, short keymodifier, short value)
+void WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
 {
-       wmKeymapItem *kmi= MEM_callocN(sizeof(wmKeymapItem), "keymap entry");
+       wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
        
-       BLI_addtail(&km->keymap, kmi);
+       BLI_addtail(&km->items, kmi);
        kmi->propvalue= value;
        
        keymap_event_set(kmi, type, val, modifier, keymodifier);
 }
 
-void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
+void WM_modalkeymap_assign(wmKeyMap *km, char *opname)
 {
        wmOperatorType *ot= WM_operatortype_find(opname, 0);
        
@@ -200,7 +288,6 @@ void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
                printf("error: modalkeymap_assign, unknown operator %s\n", opname);
 }
 
-
 /* ***************** get string from key events **************** */
 
 const char *WM_key_event_string(short type)
@@ -212,9 +299,9 @@ const char *WM_key_event_string(short type)
        return "";
 }
 
-static char *wm_keymap_item_to_string(wmKeymapItem *kmi, char *str, int len)
+char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
 {
-       char buf[100];
+       char buf[128];
 
        buf[0]= 0;
 
@@ -236,25 +323,30 @@ static char *wm_keymap_item_to_string(wmKeymapItem *kmi, char *str, int len)
        return str;
 }
 
-static wmKeymapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props)
+static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props, wmKeyMap **keymap_r)
 {
+       wmWindowManager *wm= CTX_wm_manager(C);
        wmEventHandler *handler;
        wmKeyMap *keymap;
-       wmKeymapItem *kmi;
+       wmKeyMapItem *kmi;
 
        /* find keymap item in handlers */
        for(handler=handlers->first; handler; handler=handler->next) {
-               keymap= handler->keymap;
+               keymap= WM_keymap_active(wm, handler->keymap);
 
                if(keymap && (!keymap->poll || keymap->poll((bContext*)C))) {
-                       for(kmi=keymap->keymap.first; kmi; kmi=kmi->next) {
+                       for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
                                if(strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
                                        if(compare_props) {
-                                               if(kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data))
+                                               if(kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
+                                                       if(keymap_r) *keymap_r= keymap;
                                                        return kmi;
+                                               }
                                        }
-                                       else
+                                       else {
+                                               if(keymap_r) *keymap_r= keymap;
                                                return kmi;
+                                       }
                                }
                        }
                }
@@ -263,74 +355,162 @@ static wmKeymapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *h
        return NULL;
 }
 
-static wmKeymapItem *wm_keymap_item_find(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int compare_props)
+static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int compare_props, wmKeyMap **keymap_r)
 {
-       wmKeymapItem *found= NULL;
+       wmWindow *win= CTX_wm_window(C);
+       ScrArea *sa= CTX_wm_area(C);
+       ARegion *ar= CTX_wm_region(C);
+       wmKeyMapItem *found= NULL;
 
        /* look into multiple handler lists to find the item */
-       if(CTX_wm_window(C))
-               found= wm_keymap_item_find_handlers(C, &CTX_wm_window(C)->handlers, opname, opcontext, properties, compare_props);
+       if(win)
+               found= wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, compare_props, keymap_r);
        
 
-       if(CTX_wm_area(C) && found==NULL)
-               found= wm_keymap_item_find_handlers(C, &CTX_wm_area(C)->handlers, opname, opcontext, properties, compare_props);
+       if(sa && found==NULL)
+               found= wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, compare_props, keymap_r);
 
        if(found==NULL) {
                if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
-                       if(CTX_wm_area(C)) {
-                               ARegion *ar= CTX_wm_area(C)->regionbase.first;
+                       if(sa) {
+                               ARegion *ar= sa->regionbase.first;
                                for(; ar; ar= ar->next)
                                        if(ar->regiontype==RGN_TYPE_WINDOW)
                                                break;
 
                                if(ar)
-                                       found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props);
+                                       found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, keymap_r);
                        }
                }
                else {
-                       if(CTX_wm_region(C))
-                               found= wm_keymap_item_find_handlers(C, &CTX_wm_region(C)->handlers, opname, opcontext, properties, compare_props);
+                       if(ar)
+                               found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, keymap_r);
                }
        }
        
        return found;
 }
 
-char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, char *str, int len)
+static wmKeyMapItem *wm_keymap_item_find(const bContext *C, const char *opname, int opcontext, IDProperty *properties, wmKeyMap **keymap_r)
 {
-       wmKeymapItem *found= wm_keymap_item_find(C, opname, opcontext, properties, 1);
+       wmKeyMapItem *found= wm_keymap_item_find_props(C, opname, opcontext, properties, 1, keymap_r);
 
        if(!found)
-               found= wm_keymap_item_find(C, opname, opcontext, properties, 0);
+               found= wm_keymap_item_find_props(C, opname, opcontext, properties, 0, keymap_r);
+
+       return found;
+}
+
+char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, char *str, int len)
+{
+       wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, NULL);
        
-       if(found) {
-               wm_keymap_item_to_string(found, str, len);
+       if(kmi) {
+               WM_keymap_item_to_string(kmi, str, len);
                return str;
        }
 
        return NULL;
 }
 
-/* searches context and changes keymap item, if found */
-void WM_key_event_operator_change(const bContext *C, const char *opname, int opcontext, IDProperty *properties, short key, short modifier)
-{
-       wmKeymapItem *found= wm_keymap_item_find(C, opname, opcontext, properties, 1);
+/* ***************** user preferences ******************* */
 
-       if(!found)
-               found= wm_keymap_item_find(C, opname, opcontext, properties, 0);
+wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
+{
+       wmKeyConfig *keyconf;
+       wmKeyMap *km;
 
-       if(found) {
-               keymap_event_set(found, key, KM_PRESS, modifier, 0);
+       if(!keymap)
+               return NULL;
+       
+       /* first user defined keymaps */
+       km= wm_keymap_list_find(&U.keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+       if(km)
+               return km;
+       
+       /* then user key config */
+       keyconf= wm_keyconfig_list_find(&wm->keyconfigs, U.keyconfigstr);
+       if(keyconf) {
+               km= wm_keymap_list_find(&keyconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+               if(km)
+                       return km;
        }
+
+       /* then use default */
+       km= wm_keymap_list_find(&wm->defaultconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+       return km;
 }
 
-/* ********************* */
+wmKeyMap *WM_keymap_copy_to_user(wmKeyMap *keymap)
+{
+       wmKeyMap *usermap;
+       wmKeyMapItem *kmi;
+
+       usermap= wm_keymap_list_find(&U.keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+
+       if(!usermap) {
+               /* not saved yet, duplicate existing */
+               usermap= MEM_dupallocN(keymap);
+               usermap->modal_items= NULL;
+               usermap->poll= NULL;
+               usermap->flag |= KEYMAP_USER;
+
+               BLI_addtail(&U.keymaps, usermap);
+       }
+       else {
+               /* already saved, free items for re-copy */
+               WM_keymap_free(usermap);
+       }
+
+       BLI_duplicatelist(&usermap->items, &keymap->items);
+
+       for(kmi=usermap->items.first; kmi; kmi=kmi->next) {
+               if(kmi->properties) {
+                       kmi->ptr= MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
+                       WM_operator_properties_create(kmi->ptr, kmi->idname);
+
+                       kmi->properties= IDP_CopyProperty(kmi->properties);
+                       kmi->ptr->data= kmi->properties;
+               }
+       }
+
+       for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+               kmi->flag &= ~KMI_EXPANDED;
+
+       return usermap;
+}
 
-int WM_key_event_is_tweak(short type)
+void WM_keymap_restore_to_default(wmKeyMap *keymap)
 {
-       if(type>=EVT_TWEAK_L && type<=EVT_GESTURE)
-               return 1;
-       return 0;
+       wmKeyMap *usermap;
+
+       usermap= wm_keymap_list_find(&U.keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+
+       if(usermap) {
+               WM_keymap_free(usermap);
+               BLI_freelinkN(&U.keymaps, usermap);
+       }
 }
 
+/* searches context and changes keymap item, if found */
+void WM_key_event_operator_change(const bContext *C, const char *opname, int opcontext, IDProperty *properties, short key, short modifier)
+{
+       wmWindowManager *wm= CTX_wm_manager(C);
+       wmKeyMap *keymap;
+       wmKeyMapItem *kmi;
+       
+       kmi= wm_keymap_item_find(C, opname, opcontext, properties, &keymap);
+
+       if(kmi) {
+               /* if the existing one is in a default keymap, copy it
+                  to user preferences, and lookup again so we get a
+                  key map item from the user preferences we can modify */
+               if(BLI_findindex(&wm->defaultconf->keymaps, keymap) >= 0) {
+                       WM_keymap_copy_to_user(keymap);
+                       kmi= wm_keymap_item_find(C, opname, opcontext, properties, NULL);
+               }
+
+               keymap_event_set(kmi, key, KM_PRESS, modifier, 0);
+       }
+}
 
index 9ec0ce0df8d2cb53cd2a998187a90bc3eaee9a44..a92fcee48e2d583da255232377ca360067463cae 100644 (file)
@@ -517,22 +517,33 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event)
 /* default properties for fileselect */
 void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type)
 {
-       RNA_def_string_file_path(ot->srna, "path", "", FILE_MAX, "FilePath", "Path to file.");
-       RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "FileName", "Name of the file.");
-       RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Directory of the file.");
+       PropertyRNA *prop;
 
-       RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
-       RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
-       RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
-       RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), "Filter python files", "");
-       RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), "Filter font files", "");
-       RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), "Filter sound files", "");
-       RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), "Filter text files", "");
-       RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), "Filter folders", "");
+       RNA_def_string_file_path(ot->srna, "path", "", FILE_MAX, "File Path", "Path to file.");
+       RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file.");
+       RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Directory of the file.");
 
-       RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL, 
+       prop= RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), "Filter python files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), "Filter font files", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+       prop= RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), "Filter sound files", "");
+       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_folder", (filter & FOLDERFILE), "Filter folders", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN);
+
+       prop= RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL, 
                "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file.",
                FILE_LOADLIB, FILE_SPECIAL);
+       RNA_def_property_flag(prop, PROP_HIDDEN);
 }
 
 /* op->poll */
@@ -1103,6 +1114,8 @@ static void WM_OT_link_append(wmOperatorType *ot)
        ot->exec= wm_link_append_exec;
        ot->poll= WM_operator_winactive;
        
+       ot->flag |= OPTYPE_UNDO;
+
        WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB);
        
        RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending.");
@@ -1382,7 +1395,7 @@ static void wm_gesture_end(bContext *C, wmOperator *op)
 
 int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       if(WM_key_event_is_tweak(event->type))
+       if(ISTWEAK(event->type))
                op->customdata= WM_gesture_new(C, event, WM_GESTURE_RECT);
        else
                op->customdata= WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
@@ -2146,9 +2159,9 @@ void wm_operatortype_init(void)
 }
 
 /* default keymap for windows and screens, only call once per WM */
-void wm_window_keymap(wmWindowManager *wm)
+void wm_window_keymap(wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(wm, "Window", 0, 0);
+       wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
        
        /* items to make WM work */
        WM_keymap_verify_item(keymap, "WM_OT_jobs_timer", TIMERJOBS, KM_ANY, KM_ANY, 0);
index e3cfb9ad60df51fbacf099e3a7254123c849bd86..44b7b60e451ce35b182f1a7cd38623b10d9f2097 100644 (file)
@@ -373,15 +373,15 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
                /* happens after fileread */
                if(win->eventstate==NULL)
                   win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
-               
+
                /* add keymap handlers (1 handler for all keys in map!) */
-               keymap= WM_keymap_find(wm, "Window", 0, 0);
+               keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0);
                WM_event_add_keymap_handler(&win->handlers, keymap);
                
-               keymap= WM_keymap_find(wm, "Screen", 0, 0);
+               keymap= WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
                WM_event_add_keymap_handler(&win->handlers, keymap);
 
-               keymap= WM_keymap_find(wm, "Screen Editing", 0, 0);
+               keymap= WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
                WM_event_add_keymap_handler(&win->modalhandlers, keymap);
                
                wm_window_title(wm, win);
index a75291570724dfd9b25a9d8d68a5f72354244cb5..832558b961f78dc35140b57a52daf039b6edc5c9 100644 (file)
@@ -54,7 +54,7 @@ extern void wm_report_free(wmReport *report);
 /* wm_operator.c, for init/exit */
 void wm_operatortype_free(void);
 void wm_operatortype_init(void);
-void wm_window_keymap(wmWindowManager *wm);
+void wm_window_keymap(wmKeyConfig *keyconf);
 
 void wm_tweakevent_test(bContext *C, wmEvent *event, int action);
 
index 4360e49e37125f75ce89046ad67e8d14c857a8db..4322f70ea613c5f5ad44e406ae546746f8ccf236 100644 (file)
@@ -44,7 +44,6 @@ typedef struct wmEventHandler {
        
        /* keymap handler */
        wmKeyMap *keymap;                       /* pointer to builtin/custom keymaps */
-       
        rcti *bblocal, *bbwin;          /* optional local and windowspace bb */
        
        /* modal operator handler */
index cc6041ce529a2357d7537344c276d2ab475a8a45..b33c4bd14e815c6bb856bfbad7a8d67d6ccfe04a 100644 (file)
        /* test wether the event is a key on the keyboard */
 #define ISKEYBOARD(event)      (event >=' ' && event <=320)
 
-/* test whether event type is acceptable as hotkey, excluding modifiers */
-#define ISHOTKEY(event)        (ISKEYBOARD(event) && !(event>=LEFTCTRLKEY && event<=ESCKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
+       /* test wether the event is a mouse button */
+#define ISMOUSE(event) (event >= LEFTMOUSE && event <= WHEELOUTMOUSE)
+
+       /* test wether the event is timer event */
+#define ISTIMER(event) (event >= TIMER && event <= TIMERJOBS)
 
+       /* test wether the event is tweak event */
+#define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
+
+/* test whether event type is acceptable as hotkey, excluding modifiers */
+#define ISHOTKEY(event)        ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=ESCKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
 
 /* **************** BLENDER GESTURE EVENTS ********************* */