Merge branch 'master' into blender2.8
[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 "BLT_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 #include "ED_sequencer.h"
45
46 #include "WM_api.h"
47 #include "WM_types.h"
48
49
50 #include "sequencer_intern.h"
51
52 /* **************************** buttons ********************************* */
53
54 #if 0
55 static int sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt))
56 {
57         SpaceSeq *sseq = CTX_wm_space_seq(C);
58
59         /* don't show the gpencil if we are not showing the image */
60         return ED_space_sequencer_check_show_imbuf(sseq);
61 }
62 #endif
63
64 void sequencer_buttons_register(ARegionType *UNUSED(art))
65 {
66 #if 0
67         PanelType *pt;
68
69         pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
70         strcpy(pt->idname, "SEQUENCER_PT_gpencil");
71         strcpy(pt->label, N_("Grease Pencil"));
72         strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
73         pt->draw_header = ED_gpencil_panel_standard_header;
74         pt->draw = ED_gpencil_panel_standard;
75         pt->poll = sequencer_grease_pencil_panel_poll;
76         BLI_addtail(&art->paneltypes, pt);
77 #endif
78 }
79
80 /* **************** operator to open/close properties view ************* */
81
82 static int sequencer_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
83 {
84         ScrArea *sa = CTX_wm_area(C);
85         ARegion *ar = sequencer_has_buttons_region(sa);
86
87         if (ar)
88                 ED_region_toggle_hidden(C, ar);
89
90         return OPERATOR_FINISHED;
91 }
92
93 void SEQUENCER_OT_properties(wmOperatorType *ot)
94 {
95         ot->name = "Properties";
96         ot->idname = "SEQUENCER_OT_properties";
97         ot->description = "Toggle the properties region visibility";
98
99         ot->exec = sequencer_properties_toggle_exec;
100         ot->poll = ED_operator_sequencer_active;
101
102         /* flags */
103         ot->flag = 0;
104 }
105