Merged changes in the trunk up to revision 48505.
[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 #include <string.h>
29 #include <stdio.h>
30
31
32 #include "MEM_guardedalloc.h"
33
34 #include "BLI_blenlib.h"
35 #include "BLI_utildefines.h"
36
37 #include "BLF_translation.h"
38
39 #include "BKE_context.h"
40 #include "BKE_screen.h"
41
42 #include "ED_screen.h"
43 #include "ED_gpencil.h"
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 /* **************************** buttons ********************************* */
53
54 void sequencer_buttons_register(ARegionType *art)
55 {
56         PanelType *pt;
57         
58         pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
59         strcpy(pt->idname, "SEQUENCER_PT_gpencil");
60         strcpy(pt->label, N_("Grease Pencil"));
61         pt->draw = gpencil_panel_standard;
62         BLI_addtail(&art->paneltypes, pt);
63 }
64
65 /* **************** operator to open/close properties view ************* */
66
67 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
68 {
69         ScrArea *sa = CTX_wm_area(C);
70         ARegion *ar = sequencer_has_buttons_region(sa);
71         
72         if (ar)
73                 ED_region_toggle_hidden(C, ar);
74
75         return OPERATOR_FINISHED;
76 }
77
78 void SEQUENCER_OT_properties(wmOperatorType *ot)
79 {
80         ot->name = "Properties";
81         ot->idname = "SEQUENCER_OT_properties";
82         ot->description = "Open sequencer properties panel";
83         
84         ot->exec = sequencer_properties;
85         ot->poll = ED_operator_sequencer_active;
86         
87         /* flags */
88         ot->flag = 0;
89 }
90