part 1 of merge from trunk at r30358; it compiles, but doesn't link quite yet :)
[blender.git] / source / blender / editors / space_sequencer / sequencer_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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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
31 #include "MEM_guardedalloc.h"
32
33 #include "BLI_blenlib.h"
34
35 #include "BKE_context.h"
36 #include "BKE_global.h"
37 #include "BKE_main.h"
38 #include "BKE_screen.h"
39 #include "BKE_utildefines.h"
40
41
42 #include "ED_screen.h"
43
44
45 #include "WM_api.h"
46 #include "WM_types.h"
47
48 #include "UI_interface.h"
49
50 #include "sequencer_intern.h"
51
52
53 static void do_sequencer_panel_events(bContext *C, void *arg, int event)
54 {
55
56 }
57
58
59 static void sequencer_panel_view_properties(const bContext *C, Panel *pa)
60 {
61         uiBlock *block;
62
63         block= uiLayoutAbsoluteBlock(pa->layout);
64         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
65         
66 }
67
68
69 static void sequencer_panel_properties(const bContext *C, Panel *pa)
70 {
71         uiBlock *block;
72         
73         block= uiLayoutAbsoluteBlock(pa->layout);
74         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
75
76 }       
77
78 void sequencer_buttons_register(ARegionType *art)
79 {
80         PanelType *pt;
81
82         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
83         strcpy(pt->idname, "SEQUENCER_PT_properties");
84         strcpy(pt->label, "Strip Properties");
85         pt->draw= sequencer_panel_properties;
86         BLI_addtail(&art->paneltypes, pt);
87
88         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
89         strcpy(pt->idname, "SEQUENCER_PT_view_properties");
90         strcpy(pt->label, "View Properties");
91         pt->draw= sequencer_panel_view_properties;
92         BLI_addtail(&art->paneltypes, pt);
93
94 }
95
96 /* **************** operator to open/close properties view ************* */
97
98 static int sequencer_properties(bContext *C, wmOperator *op)
99 {
100         ScrArea *sa= CTX_wm_area(C);
101         ARegion *ar= sequencer_has_buttons_region(sa);
102         
103         if(ar)
104                 ED_region_toggle_hidden(C, ar);
105
106         return OPERATOR_FINISHED;
107 }
108
109 void SEQUENCER_OT_properties(wmOperatorType *ot)
110 {
111         ot->name= "Properties";
112         ot->idname= "SEQUENCER_OT_properties";
113         ot->description= "Open sequencer properties panel";
114         
115         ot->exec= sequencer_properties;
116         ot->poll= ED_operator_sequencer_active;
117         
118         /* flags */
119         ot->flag= 0;
120 }
121