2.5
[blender-staging.git] / source / blender / editors / space_node / node_ops.c
1 /**
2  * $Id:
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation, Nathan Letwory
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include "DNA_node_types.h"
30 #include "DNA_material_types.h"
31 #include "DNA_texture_types.h"
32 #include "DNA_scene_types.h"
33 #include "DNA_space_types.h"
34
35 #include "BKE_context.h"
36 #include "BKE_node.h"
37
38 #include "ED_space_api.h"
39 #include "ED_screen.h"
40
41 #include "BIF_transform.h"
42
43 #include "RNA_access.h"
44 #include "RNA_define.h"
45
46 #include "WM_api.h"
47 #include "WM_types.h"
48
49 #include "node_intern.h"
50
51 void node_operatortypes(void)
52 {
53         WM_operatortype_append(NODE_OT_select);
54         WM_operatortype_append(NODE_OT_extend_select);
55         WM_operatortype_append(NODE_OT_visibility_toggle);
56         WM_operatortype_append(NODE_OT_fit_all);
57         WM_operatortype_append(NODE_OT_border_select);
58         WM_operatortype_append(NODE_OT_delete_selection);
59 }
60
61 void node_keymap(struct wmWindowManager *wm)
62 {
63         ListBase *keymap= WM_keymap_listbase(wm, "Node", SPACE_NODE, 0);
64         
65         /* mouse select in nodes used to be both keys, it's UI elements... */
66         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
67         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
68         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_extend_select", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
69         RNA_enum_set(WM_keymap_add_item(keymap, "NODE_OT_extend_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select_type", NODE_SELECT_MOUSE);
70         
71         WM_keymap_add_item(keymap, "NODE_OT_visibility_toggle", ACTIONMOUSE, KM_PRESS, 0, 0);
72         WM_keymap_add_item(keymap, "NODE_OT_fit_all", HOMEKEY, KM_PRESS, 0, 0);
73         WM_keymap_add_item(keymap, "NODE_OT_border_select", BKEY, KM_PRESS, 0, 0);
74         WM_keymap_add_item(keymap, "NODE_OT_delete_selection", XKEY, KM_PRESS, 0, 0);
75         
76         transform_keymap_for_space(wm, keymap, SPACE_NODE);
77 }