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