81712ec10c4c1e85e1c41d2f8f3c87039a23cbb5
[blender.git] / source / blender / editors / space_sequencer / sequencer_buttons.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2009 by Blender Foundation
19  * All rights reserved.
20  *
21  * ***** END GPL LICENSE BLOCK *****
22  */
23
24 /** \file blender/editors/space_sequencer/sequencer_buttons.c
25  *  \ingroup spseq
26  */
27
28
29
30 #include <string.h>
31 #include <stdio.h>
32
33
34 #include "MEM_guardedalloc.h"
35
36 #include "BLI_blenlib.h"
37 #include "BLI_utildefines.h"
38
39 #include "BKE_context.h"
40 #include "BKE_screen.h"
41
42 #include "ED_screen.h"
43
44 #include "WM_api.h"
45 #include "WM_types.h"
46
47 #include "UI_interface.h"
48
49 #include "sequencer_intern.h"
50
51
52 static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
53 {
54
55 }
56
57
58 static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
59 {
60         uiBlock *block;
61
62         block = uiLayoutAbsoluteBlock(pa->layout);
63         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
64         
65 }
66
67
68 static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
69 {
70         uiBlock *block;
71         
72         block = uiLayoutAbsoluteBlock(pa->layout);
73         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
74
75 }       
76
77 void sequencer_buttons_register(ARegionType *art)
78 {
79         PanelType *pt;
80
81         pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
82         strcpy(pt->idname, "SEQUENCER_PT_properties");
83         strcpy(pt->label, "Strip Properties");
84         pt->draw = sequencer_panel_properties;
85         BLI_addtail(&art->paneltypes, pt);
86
87         pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
88         strcpy(pt->idname, "SEQUENCER_PT_view_properties");
89         strcpy(pt->label, "View Properties");
90         pt->draw = sequencer_panel_view_properties;
91         BLI_addtail(&art->paneltypes, pt);
92
93 }
94
95 /* **************** operator to open/close properties view ************* */
96
97 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
98 {
99         ScrArea *sa = CTX_wm_area(C);
100         ARegion *ar = sequencer_has_buttons_region(sa);
101         
102         if (ar)
103                 ED_region_toggle_hidden(C, ar);
104
105         return OPERATOR_FINISHED;
106 }
107
108 void SEQUENCER_OT_properties(wmOperatorType *ot)
109 {
110         ot->name = "Properties";
111         ot->idname = "SEQUENCER_OT_properties";
112         ot->description = "Open sequencer properties panel";
113         
114         ot->exec = sequencer_properties;
115         ot->poll = ED_operator_sequencer_active;
116         
117         /* flags */
118         ot->flag = 0;
119 }
120