svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22875:22935
[blender.git] / source / blender / editors / space_logic / logic_buttons.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 by Blender Foundation
21  * All rights reserved.
22  *
23  * ***** END GPL LICENSE BLOCK *****
24  */
25
26
27 #include <string.h>
28 #include <stdio.h>
29
30 #include "DNA_object_types.h"
31 #include "DNA_node_types.h"
32 #include "DNA_space_types.h"
33 #include "DNA_scene_types.h"
34 #include "DNA_screen_types.h"
35 #include "DNA_userdef_types.h"
36
37 #include "MEM_guardedalloc.h"
38
39 #include "BLI_blenlib.h"
40 #include "BLI_arithb.h"
41
42 #include "BKE_context.h"
43 #include "BKE_global.h"
44 #include "BKE_library.h"
45 #include "BKE_main.h"
46 #include "BKE_mesh.h"
47 #include "BKE_node.h"
48 #include "BKE_screen.h"
49 #include "BKE_utildefines.h"
50
51 #include "ED_space_api.h"
52 #include "ED_screen.h"
53 #include "ED_util.h"
54
55 #include "BIF_gl.h"
56 #include "BIF_glutil.h"
57
58 #include "RNA_access.h"
59
60 #include "WM_api.h"
61 #include "WM_types.h"
62
63 #include "UI_interface.h"
64 #include "UI_resources.h"
65 #include "UI_view2d.h"
66
67 #include "logic_intern.h"
68
69 #if 0
70 static void do_logic_panel_events(bContext *C, void *arg, int event)
71 {
72         
73         switch(event) {
74                 
75         }
76 }
77
78
79 /* *** */
80
81 static void logic_panel_properties(const bContext *C, Panel *pa)
82 {
83 //      SpaceLogic *slogic= CTX_wm_space_logic(C);
84         uiBlock *block;
85         
86         block= uiLayoutFreeBlock(pa->layout);
87         uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
88
89 }       
90
91 static void logic_panel_view_properties(const bContext *C, Panel *pa)
92 {
93         //      SpaceLogic *slogic= CTX_wm_space_logic(C);
94         uiBlock *block;
95         
96         block= uiLayoutFreeBlock(pa->layout);
97         uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
98         
99 }       
100 #endif
101
102 void logic_buttons_register(ARegionType *art)
103 {
104 #if 0
105         PanelType *pt;
106
107         pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties");
108         strcpy(pt->idname, "LOGIC_PT_properties");
109         strcpy(pt->label, "Logic Properties");
110         pt->draw= logic_panel_properties;
111         BLI_addtail(&art->paneltypes, pt);
112
113         pt= MEM_callocN(sizeof(PanelType), "spacetype logic view properties");
114         strcpy(pt->idname, "LOGIC_PT_view_properties");
115         strcpy(pt->label, "View Properties");
116         pt->draw= logic_panel_view_properties;
117         BLI_addtail(&art->paneltypes, pt);
118 #endif
119
120 }
121
122 static int logic_properties(bContext *C, wmOperator *op)
123 {
124         ScrArea *sa= CTX_wm_area(C);
125         ARegion *ar= logic_has_buttons_region(sa);
126         
127         if(ar) {
128                 ar->flag ^= RGN_FLAG_HIDDEN;
129                 ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */
130                 
131                 ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
132                 ED_area_tag_redraw(sa);
133         }
134         return OPERATOR_FINISHED;
135 }
136
137 void LOGIC_OT_properties(wmOperatorType *ot)
138 {
139         ot->name= "Properties";
140         ot->idname= "LOGIC_OT_properties";
141         
142         ot->exec= logic_properties;
143         ot->poll= ED_operator_logic_active;
144         
145         /* flags */
146         ot->flag= 0;
147 }
148
149
150