Blender V2.61 - r43446

sequencer_buttons.c

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