Blender  V2.59
sequencer_buttons.c
Go to the documentation of this file.
00001 /*
00002  * $Id: sequencer_buttons.c 35242 2011-02-27 20:29:51Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2009 by Blender Foundation
00021  * All rights reserved.
00022  *
00023  * ***** END GPL LICENSE BLOCK *****
00024  */
00025 
00032 #include <string.h>
00033 #include <stdio.h>
00034 
00035 
00036 #include "MEM_guardedalloc.h"
00037 
00038 #include "BLI_blenlib.h"
00039 #include "BLI_utildefines.h"
00040 
00041 #include "BKE_context.h"
00042 #include "BKE_screen.h"
00043 
00044 #include "ED_screen.h"
00045 
00046 #include "WM_api.h"
00047 #include "WM_types.h"
00048 
00049 #include "UI_interface.h"
00050 
00051 #include "sequencer_intern.h"
00052 
00053 
00054 static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
00055 {
00056 
00057 }
00058 
00059 
00060 static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
00061 {
00062         uiBlock *block;
00063 
00064         block= uiLayoutAbsoluteBlock(pa->layout);
00065         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
00066         
00067 }
00068 
00069 
00070 static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
00071 {
00072         uiBlock *block;
00073         
00074         block= uiLayoutAbsoluteBlock(pa->layout);
00075         uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
00076 
00077 }       
00078 
00079 void sequencer_buttons_register(ARegionType *art)
00080 {
00081         PanelType *pt;
00082 
00083         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
00084         strcpy(pt->idname, "SEQUENCER_PT_properties");
00085         strcpy(pt->label, "Strip Properties");
00086         pt->draw= sequencer_panel_properties;
00087         BLI_addtail(&art->paneltypes, pt);
00088 
00089         pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
00090         strcpy(pt->idname, "SEQUENCER_PT_view_properties");
00091         strcpy(pt->label, "View Properties");
00092         pt->draw= sequencer_panel_view_properties;
00093         BLI_addtail(&art->paneltypes, pt);
00094 
00095 }
00096 
00097 /* **************** operator to open/close properties view ************* */
00098 
00099 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
00100 {
00101         ScrArea *sa= CTX_wm_area(C);
00102         ARegion *ar= sequencer_has_buttons_region(sa);
00103         
00104         if(ar)
00105                 ED_region_toggle_hidden(C, ar);
00106 
00107         return OPERATOR_FINISHED;
00108 }
00109 
00110 void SEQUENCER_OT_properties(wmOperatorType *ot)
00111 {
00112         ot->name= "Properties";
00113         ot->idname= "SEQUENCER_OT_properties";
00114         ot->description= "Open sequencer properties panel";
00115         
00116         ot->exec= sequencer_properties;
00117         ot->poll= ED_operator_sequencer_active;
00118         
00119         /* flags */
00120         ot->flag= 0;
00121 }
00122