abe6a58c9ef6a3c61557530e2b4d86f3ff4cd4a5
[blender.git] / source / blender / editors / space_sequencer / sequencer_buttons.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 by Blender Foundation
17  * All rights reserved.
18  */
19
20 /** \file \ingroup spseq
21  */
22
23 #include <string.h>
24 #include <stdio.h>
25
26
27 #include "MEM_guardedalloc.h"
28
29 #include "BLI_utildefines.h"
30
31 #include "BLT_translation.h"
32
33 #include "BKE_context.h"
34 #include "BKE_screen.h"
35
36 #include "ED_screen.h"
37 #include "ED_gpencil.h"
38 #include "ED_sequencer.h"
39
40 #include "WM_api.h"
41 #include "WM_types.h"
42
43
44 #include "sequencer_intern.h"
45
46 /* **************************** buttons ********************************* */
47
48 #if 0
49 static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt))
50 {
51         SpaceSeq *sseq = CTX_wm_space_seq(C);
52
53         /* don't show the gpencil if we are not showing the image */
54         return ED_space_sequencer_check_show_imbuf(sseq);
55 }
56 #endif
57
58 void sequencer_buttons_register(ARegionType *UNUSED(art))
59 {
60 #if 0
61         PanelType *pt;
62
63         pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
64         strcpy(pt->idname, "SEQUENCER_PT_gpencil");
65         strcpy(pt->label, N_("Grease Pencil"));
66         strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
67         pt->draw_header = ED_gpencil_panel_standard_header;
68         pt->draw = ED_gpencil_panel_standard;
69         pt->poll = sequencer_grease_pencil_panel_poll;
70         BLI_addtail(&art->paneltypes, pt);
71 #endif
72 }
73
74 /* **************** operator to open/close properties view ************* */
75
76 static int sequencer_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
77 {
78         ScrArea *sa = CTX_wm_area(C);
79         ARegion *ar = sequencer_has_buttons_region(sa);
80
81         if (ar)
82                 ED_region_toggle_hidden(C, ar);
83
84         return OPERATOR_FINISHED;
85 }
86
87 void SEQUENCER_OT_properties(wmOperatorType *ot)
88 {
89         ot->name = "Properties";
90         ot->idname = "SEQUENCER_OT_properties";
91         ot->description = "Toggle the properties region visibility";
92
93         ot->exec = sequencer_properties_toggle_exec;
94         ot->poll = ED_operator_sequencer_active;
95
96         /* flags */
97         ot->flag = 0;
98 }