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