Outliner: Added recursive select/deselect (CTRL+LMB) and extend (CTRL+SHIFT+LMB)
[blender.git] / source / blender / editors / space_outliner / outliner_ops.c
index a35b912..b9e3942 100644 (file)
@@ -1,6 +1,4 @@
-/**
- * $Id:
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -15,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2008 Blender Foundation.
  * All rights reserved.
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#include <stdlib.h>
+/** \file blender/editors/space_outliner/outliner_ops.c
+ *  \ingroup spoutliner
+ */
 
 #include "DNA_space_types.h"
-#include "DNA_windowmanager_types.h"
 
-#include "WM_api.h"
-#include "WM_types.h"
+#include "BLI_utildefines.h"
 
 #include "RNA_access.h"
-#include "RNA_define.h"
 
-#include "ED_screen.h"
+#include "WM_api.h"
+#include "WM_types.h"
 
 #include "outliner_intern.h"
 
-/* ************************** registration **********************************/
-
 
+/* ************************** registration **********************************/
 
 void outliner_operatortypes(void)
 {
        WM_operatortype_append(OUTLINER_OT_item_activate);
+       WM_operatortype_append(OUTLINER_OT_select_border);
        WM_operatortype_append(OUTLINER_OT_item_openclose);
        WM_operatortype_append(OUTLINER_OT_item_rename);
        WM_operatortype_append(OUTLINER_OT_operation);
@@ -55,10 +53,13 @@ void outliner_operatortypes(void)
        WM_operatortype_append(OUTLINER_OT_group_operation);
        WM_operatortype_append(OUTLINER_OT_id_operation);
        WM_operatortype_append(OUTLINER_OT_data_operation);
+       WM_operatortype_append(OUTLINER_OT_animdata_operation);
+       WM_operatortype_append(OUTLINER_OT_action_set);
 
        WM_operatortype_append(OUTLINER_OT_show_one_level);
        WM_operatortype_append(OUTLINER_OT_show_active);
        WM_operatortype_append(OUTLINER_OT_show_hierarchy);
+       WM_operatortype_append(OUTLINER_OT_scroll_page);
        
        WM_operatortype_append(OUTLINER_OT_selected_toggle);
        WM_operatortype_append(OUTLINER_OT_expanded_toggle);
@@ -70,19 +71,45 @@ void outliner_operatortypes(void)
        WM_operatortype_append(OUTLINER_OT_keyingset_add_selected);
        WM_operatortype_append(OUTLINER_OT_keyingset_remove_selected);
        
-       WM_operatortype_append(OUTLINER_OT_drivers_add);
-       WM_operatortype_append(OUTLINER_OT_drivers_delete);
+       WM_operatortype_append(OUTLINER_OT_drivers_add_selected);
+       WM_operatortype_append(OUTLINER_OT_drivers_delete_selected);
+
+       WM_operatortype_append(OUTLINER_OT_parent_drop);
+       WM_operatortype_append(OUTLINER_OT_parent_clear);
+       WM_operatortype_append(OUTLINER_OT_scene_drop);
+       WM_operatortype_append(OUTLINER_OT_material_drop);
 }
 
-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);
+       wmKeyMapItem *kmi;
        
-       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);
+       WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
+
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, 0, 0);
+       RNA_boolean_set(kmi->ptr, "recursive", FALSE);
+       RNA_boolean_set(kmi->ptr, "extend", FALSE);
+
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "recursive", FALSE);
+       RNA_boolean_set(kmi->ptr, "extend", TRUE);
+
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
+       RNA_boolean_set(kmi->ptr, "recursive", TRUE);
+       RNA_boolean_set(kmi->ptr, "extend", FALSE);
+
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_CTRL | KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "recursive", TRUE);
+       RNA_boolean_set(kmi->ptr, "extend", TRUE);
+
+
+       WM_keymap_add_item(keymap, "OUTLINER_OT_select_border", BKEY, KM_PRESS, 0, 0);
        
-       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0)->ptr, "all", 0);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", 1);
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0);
+       RNA_boolean_set(kmi->ptr, "all", FALSE);
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0);
+       RNA_boolean_set(kmi->ptr, "all", TRUE);
        
        WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "OUTLINER_OT_operation", RIGHTMOUSE, KM_PRESS, 0, 0);
@@ -92,8 +119,13 @@ void outliner_keymap(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0);
        
+       WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEDOWNKEY, KM_PRESS, 0, 0);
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0);
+       RNA_boolean_set(kmi->ptr, "up", TRUE);
+       
        WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */
-       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */
+       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0);
+       RNA_boolean_set(kmi->ptr, "open", FALSE); /* close */
        
        WM_keymap_verify_item(keymap, "OUTLINER_OT_selected_toggle", AKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "OUTLINER_OT_expanded_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
@@ -107,10 +139,10 @@ void outliner_keymap(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_add_selected", KKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "OUTLINER_OT_keyingset_remove_selected", KKEY, KM_PRESS, KM_ALT, 0);
        
-       WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe", IKEY, KM_PRESS, 0, 0);
-       WM_keymap_verify_item(keymap, "ANIM_OT_delete_keyframe", IKEY, KM_PRESS, KM_ALT, 0);
+       WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0);
+       WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete", IKEY, KM_PRESS, KM_ALT, 0);
        
-       WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_add", DKEY, KM_PRESS, 0, 0);
-       WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete", DKEY, KM_PRESS, KM_ALT, 0);
+       WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_add_selected", DKEY, KM_PRESS, 0, 0);
+       WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete_selected", DKEY, KM_PRESS, KM_ALT, 0);
 }