Added Panel support in Sequence window, and converted old Nkey menu for it.
authorTon Roosendaal <ton@blender.org>
Wed, 16 Jun 2004 20:25:56 +0000 (20:25 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 16 Jun 2004 20:25:56 +0000 (20:25 +0000)
source/blender/include/BIF_editseq.h
source/blender/include/BIF_space.h
source/blender/src/drawseq.c
source/blender/src/drawview.c
source/blender/src/header_seq.c
source/blender/src/space.c
source/blender/src/toets.c
source/blender/src/toolbox.c

index cf0d9ca26d394102f54a4c6eb1e1dab83829e5c2..8001d504829ff642f514e18823ea6677c1838f54 100644 (file)
@@ -58,5 +58,8 @@ void                          touch_seq_files(void);
 void                           transform_seq(int mode);
 void                           un_meta(void);
 
+/* drawseq.c */
+void do_seqbuttons(short);
+
 #endif
 
index 8452745bbec7aeebc317a394f2c156a33b8f093c..c53b15d87740dc866457e56fb3d7e08c1be0efe1 100644 (file)
@@ -67,6 +67,9 @@ struct BWinEvent;
 /* nla handler codes */
 #define NLA_HANDLER_PROPERTIES 50
 
+/* sequence handler codes */
+#define SEQ_HANDLER_PROPERTIES 60
+
 
 void   scrarea_do_windraw              (struct ScrArea *sa);
 void   scrarea_do_winchange    (struct ScrArea *sa);
index cbaeea9cbe055207ebf510d9139a67d883d87015..f6a7dafb9fc408afb2d678435e9ba06fb9ef6e55 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
+#include "BKE_plugin_types.h"
 
 #include "BIF_gl.h"
 #include "BIF_mywindow.h"
 #include "BIF_editseq.h"
 #include "BIF_drawimage.h"
 #include "BIF_resources.h"
+#include "BIF_space.h"
+#include "BIF_interface.h"
 
 #include "BSE_view.h"
 #include "BSE_drawipo.h"
 #include "BSE_sequence.h"
 #include "BSE_seqaudio.h"
 
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "blendef.h"   /* CFRA */
+#include "mydevice.h"  /* REDRAWSEQ */
+
 int no_rightbox=0, no_leftbox= 0;
 
 static void EmbossBoxf(float x1, float y1, float x2, float y2, int sel, unsigned int dark, unsigned int light)
@@ -579,6 +588,109 @@ static void draw_extra_seqinfo(void)
        }       
 }
 
+#define SEQ_BUT_PLUGIN 1
+#define SEQ_BUT_MOVIE  2
+
+void do_seqbuttons(short val)
+{
+       extern Sequence *last_seq;
+       StripElem *se;
+       
+       switch(val) {
+       case SEQ_BUT_PLUGIN:
+               new_stripdata(last_seq);
+               free_imbuf_effect_spec(CFRA);
+               break;
+               
+       case SEQ_BUT_MOVIE:
+               se= last_seq->curelem;
+               if(se && se->ibuf ) {
+                       IMB_freeImBuf(se->ibuf);
+                       se->ibuf= 0;
+               }
+               break;
+       }
+       
+       allqueue(REDRAWSEQ, 0);
+}
+
+static void seq_panel_properties(short cntrl)  // SEQ_HANDLER_PROPERTIES
+{
+       extern Sequence *last_seq;
+       uiBlock *block;
+       
+       block= uiNewBlock(&curarea->uiblocks, "seq_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
+       uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
+       uiSetPanelHandler(SEQ_HANDLER_PROPERTIES);  // for close and esc
+       if(uiNewPanel(curarea, block, "Transform Properties", "Seq", 10, 230, 318, 204)==0) return;
+
+       if(last_seq==NULL) return;
+
+       if(last_seq->type==SEQ_PLUGIN) {
+               PluginSeq *pis;
+               VarStruct *varstr;
+               int a, xco, yco;
+               
+               pis= last_seq->plugin;
+               if(pis->vars==0) return;
+               
+               varstr= pis->varstr;
+               if(varstr) {
+                       for(a=0; a<pis->vars; a++, varstr++) {
+                               xco= 150*(a/6)+10;
+                               yco= 125 - 20*(a % 6)+1;
+                               uiDefBut(block, varstr->type, SEQ_BUT_PLUGIN, varstr->name, xco,yco,150,19, &(pis->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
+
+                       }
+               }
+       }
+       else if(last_seq->type==SEQ_MOVIE) {
+
+               if(last_seq->mul==0.0) last_seq->mul= 1.0;
+
+               uiDefBut(block, TEX, 0, "Name ", 10,140,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
+               uiDefButS(block, TOG|BIT|4, SEQ_BUT_MOVIE, "FilterY ", 10,120,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "");
+               uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Mul:", 10,100,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "");
+
+       }
+       else if(last_seq->type==SEQ_SOUND) {
+
+               uiDefBut(block, TEX, 0, "Name ", 10,140,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
+               uiDefButS(block, TOG|BIT|5, 0, "Mute", 10,120,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "");
+               uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Gain (dB):", 10,100,150,19, &last_seq->level, -96.0, 6.0, 100, 0, "");
+               uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Pan:",    10,80,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, "");
+       }               
+       else if(last_seq->type==SEQ_META) {
+
+               uiDefBut(block, TEX, 0, "Name ", 10,140,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
+
+       }
+
+}
+
+static void seq_blockhandlers(ScrArea *sa)
+{
+       SpaceSeq *sseq= sa->spacedata.first;
+       short a;
+
+       /* warning; blocks need to be freed each time, handlers dont remove (for ipo moved to drawipospace) */
+       uiFreeBlocksWin(&sa->uiblocks, sa->win);
+
+       for(a=0; a<SPACE_MAXHANDLER; a+=2) {
+               switch(sseq->blockhandler[a]) {
+
+               case SEQ_HANDLER_PROPERTIES:
+                       seq_panel_properties(sseq->blockhandler[a+1]);
+                       break;
+               
+               }
+               /* clear action value for event */
+               sseq->blockhandler[a+1]= 0;
+       }
+       uiDrawBlocksPanels(sa, 0);
+
+}
+
 void drawseqspace(ScrArea *sa, void *spacedata)
 {
        SpaceSeq *sseq;
@@ -594,7 +706,10 @@ void drawseqspace(ScrArea *sa, void *spacedata)
                draw_image_seq();
                return;
        }
-       
+
+       bwin_clear_viewmat(sa->win);    /* clear buttons view */
+       glLoadIdentity();
+
        BIF_GetThemeColor3fv(TH_BACK, col);
        if(ed && ed->metastack.first) glClearColor(col[0], col[1], col[2]-1.0, 0.0);
        else glClearColor(col[0], col[1], col[2], 0.0);
@@ -656,6 +771,12 @@ void drawseqspace(ScrArea *sa, void *spacedata)
        }
        
        draw_area_emboss(sa);
+
+       if(sseq->mainb==0) {
+               /* it is important to end a view in a transform compatible with buttons */
+               bwin_scalematrix(sa->win, sseq->blockscale, sseq->blockscale, sseq->blockscale);
+               seq_blockhandlers(sa);
+       }
        
        curarea->win_swap= WIN_BACK_OK;
 }
index 5777964a803bf4a63e9d3144625c70ab60d35a62..3927f4c3b9b7164a450e543043ec868c5fdd1197 100644 (file)
@@ -1628,6 +1628,7 @@ static void view3d_blockhandlers(ScrArea *sa)
        View3D *v3d= sa->spacedata.first;
        short a;
        
+       /* warning; blocks need to be freed each time, handlers dont remove */
        uiFreeBlocksWin(&sa->uiblocks, sa->win);
 
        for(a=0; a<SPACE_MAXHANDLER; a+=2) {
index a86cb4d4e4d32b91636964923464087e60d8cb37..7aa981969ace5ace6a27dbe1fc721cb6457be559 100644 (file)
@@ -301,8 +301,8 @@ static void do_seq_editmenu(void *arg, int event)
        case 3: /* Separate Meta Strip */
                un_meta();
                break;
-       case 4: /* Meta Properties... */
-               clever_numbuts_seq();
+       case 4: /* Properties... */
+               add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
                break;
        case 5: /* Duplicate */
                add_duplicate_seq();
index a0203e961c4cf11424379c07f1203a39d2362d58..5facc3159c67225816c8244741c11233fd8d5322 100644 (file)
@@ -2864,6 +2864,9 @@ void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
 
                switch(event) {
+               case UI_BUT_EVENT:
+                       do_seqbuttons(val);                     
+                       break;
                case LEFTMOUSE:
                        if(sseq->mainb || view2dmove(event)==0) {
                                
@@ -3012,6 +3015,12 @@ void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        make_meta();
                        }
                        break;
+               case NKEY:
+                       if(G.qual==0) {
+                               add_blockhandler(curarea, SEQ_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE);
+                               scrarea_queue_winredraw(curarea);
+                       }
+                       break;
                case SKEY:
                        if((G.qual==LR_SHIFTKEY))
                                seq_snap_menu();
index 0d5498a9efd00e89717a1037dda469406e88c62f..1e41d6b0024d99428a051c6cc6730fd4fa26459f 100644 (file)
@@ -814,6 +814,7 @@ int blenderqread(unsigned short event, short val)
                                else if(curarea->spacetype==SPACE_IMAGE);                       // is new panel, in ipo queue
                                else if(curarea->spacetype==SPACE_ACTION);                      // is own queue
                                else if(curarea->spacetype==SPACE_NLA);                 // is new panel
+                               else if(curarea->spacetype==SPACE_SEQ);                 // is new panel
                                else {
                                        clever_numbuts();
                                        return 0;
index 26a947d7022c53e6d2ef6c98907c252224cd9ad7..a6bd7c87ee352270d1d650923946fd11c027998d 100644 (file)
@@ -1418,7 +1418,7 @@ void clever_numbuts(void)
                // panel now
        }
        else if(curarea->spacetype==SPACE_SEQ) {
-               clever_numbuts_seq();
+               // panel now
        }
        else if(curarea->spacetype==SPACE_IMAGE) {
                // panel now