Merge of itasc branch. Project files, scons and cmake should be working. Makefile...
[blender.git] / source / blender / editors / gpencil / gpencil_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) 2009, Blender Foundation, Joshua Leung
21  * This is a new part of Blender
22  *
23  * Contributor(s): Joshua Leung
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 #include <stdlib.h>
29 #include <stddef.h>
30 #include <stdio.h>
31
32 #include "BLI_blenlib.h"
33
34 #include "DNA_windowmanager_types.h" 
35
36 #include "WM_api.h"
37 #include "WM_types.h"
38
39 #include "RNA_access.h"
40 #include "RNA_define.h"
41 #include "RNA_enum_types.h"
42
43 #include "gpencil_intern.h"
44
45 /* ****************************************** */
46 /* Generic Editing Keymap */
47
48 void ED_keymap_gpencil(wmWindowManager *wm)
49 {
50         wmKeyMap *keymap= WM_keymap_find(wm, "Grease Pencil", 0, 0);
51         wmKeymapItem *kmi;
52         
53         /* Draw */
54                 /* draw */
55         WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, 0, DKEY);
56                 /* draw - straight lines */
57         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL, DKEY);
58                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_DRAW_STRAIGHT);
59                 /* erase */
60         kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, 0, DKEY);
61                 RNA_enum_set(kmi->ptr, "mode", GP_PAINTMODE_ERASER);
62 }
63
64 /* ****************************************** */
65
66 void ED_operatortypes_gpencil (void)
67 {
68         /* Drawing ----------------------- */
69         
70         WM_operatortype_append(GPENCIL_OT_draw);
71         
72         /* Editing (Buttons) ------------ */
73         
74         WM_operatortype_append(GPENCIL_OT_data_add);
75         WM_operatortype_append(GPENCIL_OT_data_unlink);
76         
77         WM_operatortype_append(GPENCIL_OT_layer_add);
78         
79         WM_operatortype_append(GPENCIL_OT_active_frame_delete);
80         
81         WM_operatortype_append(GPENCIL_OT_convert);
82         
83         /* Editing (Time) --------------- */
84 }
85
86 /* ****************************************** */