synched with trunk at revision 34793
[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 #include "BLI_utildefines.h"
35
36 #include "BKE_context.h"
37 #include "BKE_screen.h"
38
39 #include "ED_screen.h"
40
41 #include "WM_api.h"
42 #include "WM_types.h"
43
44 #include "UI_interface.h"
45
46 #include "sequencer_intern.h"
47
48
49 static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
50 {
51
52 }
53
54
55 static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
56 {
57         uiBlock *block;
58
59         block= uiLayoutAbsoluteBlock(pa->layout);
60         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
61         
62 }
63
64
65 static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
66 {
67         uiBlock *block;
68         
69         block= uiLayoutAbsoluteBlock(pa->layout);
70         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
71
72 }       
73
74 void sequencer_buttons_register(ARegionType *art)
75 {
76         PanelType *pt;
77
78         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
79         strcpy(pt->idname, "SEQUENCER_PT_properties");
80         strcpy(pt->label, "Strip Properties");
81         pt->draw= sequencer_panel_properties;
82         BLI_addtail(&art->paneltypes, pt);
83
84         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
85         strcpy(pt->idname, "SEQUENCER_PT_view_properties");
86         strcpy(pt->label, "View Properties");
87         pt->draw= sequencer_panel_view_properties;
88         BLI_addtail(&art->paneltypes, pt);
89
90 }
91
92 /* **************** operator to open/close properties view ************* */
93
94 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
95 {
96         ScrArea *sa= CTX_wm_area(C);
97         ARegion *ar= sequencer_has_buttons_region(sa);
98         
99         if(ar)
100                 ED_region_toggle_hidden(C, ar);
101
102         return OPERATOR_FINISHED;
103 }
104
105 void SEQUENCER_OT_properties(wmOperatorType *ot)
106 {
107         ot->name= "Properties";
108         ot->idname= "SEQUENCER_OT_properties";
109         ot->description= "Open sequencer properties panel";
110         
111         ot->exec= sequencer_properties;
112         ot->poll= ED_operator_sequencer_active;
113         
114         /* flags */
115         ot->flag= 0;
116 }
117