~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/drawseq.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: drawseq.c,v 1.12 2004/05/03 21:21:29 ton Exp $
 
2
 * $Id: drawseq.c,v 1.33 2005/03/24 09:37:06 ton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
34
34
#include <config.h>
35
35
#endif
36
36
 
37
 
#ifdef _WIN32
38
 
#include "BLI_winstuff.h"
39
 
#endif
40
 
 
41
37
#include <string.h>
42
38
#include <math.h>
43
39
 
56
52
#include "DNA_space_types.h"
57
53
#include "DNA_view2d_types.h"
58
54
 
 
55
#include "BKE_global.h"
 
56
#include "BKE_plugin_types.h"
 
57
#include "BKE_scene.h"
59
58
#include "BKE_utildefines.h"
60
 
#include "BKE_global.h"
61
59
 
62
60
#include "BIF_gl.h"
63
61
#include "BIF_mywindow.h"
64
62
#include "BIF_screen.h"
65
63
#include "BIF_drawseq.h"
66
64
#include "BIF_editseq.h"
67
 
#include "BIF_drawimage.h"
 
65
#include "BIF_glutil.h"
68
66
#include "BIF_resources.h"
 
67
#include "BIF_space.h"
 
68
#include "BIF_interface.h"
69
69
 
70
70
#include "BSE_view.h"
71
71
#include "BSE_drawipo.h"
72
72
#include "BSE_sequence.h"
73
73
#include "BSE_seqaudio.h"
74
74
 
 
75
#include "IMB_imbuf_types.h"
 
76
#include "IMB_imbuf.h"
 
77
 
 
78
#include "blendef.h"    /* CFRA */
 
79
#include "mydevice.h"   /* REDRAWSEQ */
 
80
 
75
81
int no_rightbox=0, no_leftbox= 0;
76
82
 
77
83
static void EmbossBoxf(float x1, float y1, float x2, float y2, int sel, unsigned int dark, unsigned int light)
78
84
{
79
85
 
80
 
        if(sel) cpack(dark); 
 
86
        if(sel) cpack(dark);
81
87
        else cpack(light);
82
88
        if(sel) glLineWidth(2.0);
83
89
        fdrawline(x1,  y2,  x2,  y2);   /* top */
84
90
        if(no_leftbox==0) fdrawline(x1,  y1,  x1,  y2); /* left */
85
 
        
 
91
 
86
92
        if(sel) glLineWidth(1.0);
87
 
        
88
 
        if(sel) cpack(light); 
89
 
        else cpack(dark);       
 
93
 
 
94
        if(sel) cpack(light);
 
95
        else cpack(dark);
90
96
        fdrawline(x1,  y1,  x2,  y1); /* bottom */
91
97
        if(no_rightbox==0) fdrawline(x2,  y1,  x2,  y2);        /* right */
92
 
        
 
98
 
93
99
}
94
100
 
95
101
static char *give_seqname(Sequence *seq)
98
104
                if(seq->name[2]) return seq->name+2;
99
105
                return "META";
100
106
        }
 
107
        else if(seq->type==SEQ_IMAGE) return "IMAGE";
101
108
        else if(seq->type==SEQ_SCENE) return "SCENE";
102
109
        else if(seq->type==SEQ_MOVIE) return "MOVIE";
103
 
        else if(seq->type==SEQ_SOUND) return "AUDIO";   
 
110
        else if(seq->type==SEQ_SOUND) return "AUDIO";
104
111
        else if(seq->type<SEQ_EFFECT) return seq->strip->dir;
105
112
        else if(seq->type==SEQ_CROSS) return "CROSS";
106
113
        else if(seq->type==SEQ_GAMCROSS) return "GAMMA CROSS";
110
117
        else if(seq->type==SEQ_ALPHAOVER) return "ALPHAOVER";
111
118
        else if(seq->type==SEQ_ALPHAUNDER) return "ALPHAUNDER";
112
119
        else if(seq->type==SEQ_OVERDROP) return "OVER DROP";
 
120
        else if(seq->type==SEQ_WIPE) return "WIPE";
 
121
        else if(seq->type==SEQ_GLOW) return "GLOW";
113
122
        else if(seq->type==SEQ_PLUGIN) {
114
123
                if(seq->plugin && seq->plugin->doit) return seq->plugin->pname;
115
124
                return "PLUGIN";
116
125
        }
117
126
        else return "EFFECT";
118
 
        
 
127
 
119
128
}
120
129
static void draw_cfra_seq(void)
121
130
{
154
163
                return 0x9080A0;
155
164
        case SEQ_OVERDROP:
156
165
                return 0x5080B0;
 
166
        case SEQ_WIPE:
 
167
                return 0x2080B0;
 
168
        case SEQ_GLOW:
 
169
                return 0x0080B0;
157
170
        case SEQ_PLUGIN:
158
171
                return 0x906000;
159
172
        case SEQ_SOUND:
161
174
        default:
162
175
                return 0x906060;
163
176
        }
164
 
        
 
177
 
165
178
}
166
179
static void drawmeta_contents(Sequence *seqm, float x1, float y1, float x2, float y2)
167
180
{
168
181
        Sequence *seq;
169
182
        float dx;
170
183
        int nr;
171
 
        
 
184
 
172
185
        nr= 0;
173
186
        WHILE_SEQ(&seqm->seqbase) {
174
187
                nr++;
175
188
        }
176
189
        END_SEQ
177
 
        
 
190
 
178
191
        dx= (x2-x1)/nr;
179
 
        
 
192
 
180
193
        WHILE_SEQ(&seqm->seqbase) {
181
194
                cpack(seq_color(seq));
182
195
                glRectf(x1,  y1,  x1+0.9*dx,  y2);
186
199
        END_SEQ
187
200
}
188
201
 
189
 
void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2)
 
202
static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2)
190
203
{
191
204
        float f, height, midy;
192
205
        int offset, sofs, eofs;
195
208
 
196
209
        audio_makestream(seq->sound);
197
210
        if(seq->sound->stream==NULL) return;
198
 
        
 
211
 
199
212
        if (seq->flag & SEQ_MUTE) glColor3ub(0x70, 0x80, 0x80); else glColor3ub(0x70, 0xc0, 0xc0);
200
213
        sound = seq->sound;
201
214
        sofs = ((int)( (((float)(seq->startdisp-seq->start))/(float)G.scene->r.frs_sec)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
202
 
        eofs = ((int)( (((float)(seq->enddisp-seq->start))/(float)G.scene->r.frs_sec)*(float)G.scene->audio.mixrate*4.0 )) & (~3);      
203
 
        
 
215
        eofs = ((int)( (((float)(seq->enddisp-seq->start))/(float)G.scene->r.frs_sec)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
 
216
 
204
217
        for (f=x1; f<=x2; f+=0.2) {
205
218
                offset = (int) ((float)sofs + ((f-x1)/(x2-x1)) * (float)(eofs-sofs)) & (~3);
206
219
                if (offset >= sound->streamlen) offset = sound->streamlen-1;
221
234
        int len, size;
222
235
        short mval[2];
223
236
        char str[120], *strp;
224
 
        
 
237
 
225
238
 
226
239
        if(seq->startdisp > seq->enddisp) body= 0x707070;
227
240
 
244
257
        if(seq->endstill) x2= seq->start+seq->len;
245
258
        else x2= seq->enddisp;
246
259
        y2= seq->machine+0.8;
247
 
        
 
260
 
248
261
        cpack(body);
249
262
        glRectf(x1,  y1,  x2,  y2);
250
263
        if (seq->type == SEQ_SOUND) drawseqwave(seq, x1, y1, x2, y2);
251
264
        EmbossBoxf(x1, y1, x2, y2, seq->flag & 1, dark, light);
252
 
        
 
265
 
253
266
        v1[1]= y1;
254
267
        v2[1]= y2;
255
268
        if(seq->type < SEQ_EFFECT) {
257
270
                /* decoration: the bars */
258
271
                x1= seq->startdisp;
259
272
                x2= seq->enddisp;
260
 
                
 
273
 
261
274
                if(seq->startofs) {
262
275
                        cpack(0x707070);
263
276
                        glRectf((float)(seq->start),  y1-0.2,  x1,  y1);
283
296
                        EmbossBoxf((float)(seq->start+seq->len), y1+0.1, x2, y1+0.5, seq->flag & 1, dark, light);
284
297
                        no_leftbox= 0;
285
298
                }
286
 
                
 
299
 
287
300
        }
288
301
 
289
302
        /* calculate if seq is long enough to print a name */
290
303
        x1= seq->startdisp+seq->handsize;
291
304
        x2= seq->enddisp-seq->handsize;
292
 
        
 
305
 
293
306
        /* but first the contents of a meta */
294
307
        if(seq->type==SEQ_META) drawmeta_contents(seq, x1, y1+0.15, x2, y2-0.15);
295
 
        
 
308
 
296
309
        if(x1<G.v2d->cur.xmin) x1= G.v2d->cur.xmin;
297
310
        else if(x1>G.v2d->cur.xmax) x1= G.v2d->cur.xmax;
298
311
        if(x2<G.v2d->cur.xmin) x2= G.v2d->cur.xmin;
299
312
        else if(x2>G.v2d->cur.xmax) x2= G.v2d->cur.xmax;
300
 
        
 
313
 
301
314
        if(x1 != x2) {
302
315
                v1[0]= x1;
303
316
                ipoco_to_areaco_noclip(G.v2d, v1, mval);
306
319
                ipoco_to_areaco_noclip(G.v2d, v2, mval);
307
320
                x2= mval[0];
308
321
                size= x2-x1;
309
 
                
310
 
                if(seq->type == SEQ_META) sprintf(str, "%d %s", seq->len, give_seqname(seq));
311
 
                else if(seq->type == SEQ_SCENE) {
312
 
                        if(seq->scene) sprintf(str, "%d %s %s", seq->len, give_seqname(seq), seq->scene->id.name+2);
313
 
                        else sprintf(str, "%d %s", seq->len, give_seqname(seq));
314
 
                }
315
 
                else if(seq->type & SEQ_EFFECT) {
316
 
                        if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
317
 
                                sprintf(str, "%d %s: %d-%d (use %d)", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine, seq->seq3->machine);
318
 
                        else 
319
 
                                sprintf(str, "%d %s: %d-%d", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine);
320
 
                }
321
 
                else if(seq->name[2]) sprintf(str, "%s", seq->name+2);
322
 
                else {
323
 
                        if (seq->type == SEQ_SOUND) {
 
322
 
 
323
                if(seq->name[2]) {
 
324
                        sprintf(str, "%s: %s (%d)", give_seqname(seq), seq->name+2, seq->len);
 
325
                }else{
 
326
                        if(seq->type == SEQ_META) {
 
327
                                sprintf(str, "%d %s", seq->len, give_seqname(seq));
 
328
                        }
 
329
                        else if(seq->type == SEQ_SCENE) {
 
330
                                if(seq->scene) sprintf(str, "%d %s %s", seq->len, give_seqname(seq), seq->scene->id.name+2);
 
331
                                else sprintf(str, "%d %s", seq->len, give_seqname(seq));
 
332
 
 
333
                        }
 
334
                        else if(seq->type == SEQ_IMAGE) {
 
335
                                sprintf(str, "%d %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
 
336
                        }
 
337
                        else if(seq->type & SEQ_EFFECT) {
 
338
                                if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
 
339
                                        sprintf(str, "%d %s: %d-%d (use %d)", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine, seq->seq3->machine);
 
340
                                else
 
341
                                        sprintf(str, "%d %s: %d-%d", seq->len, give_seqname(seq), seq->seq1->machine, seq->seq2->machine);
 
342
                        }
 
343
                        else if (seq->type == SEQ_SOUND) {
324
344
                                sprintf(str, "%d %s", seq->len, seq->strip->stripdata->name);
325
 
                        } else {
326
 
                                sprintf(str, "%d %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);                        
 
345
                        }
 
346
                        else if (seq->type == SEQ_MOVIE) {
 
347
                                sprintf(str, "%d %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
327
348
                        }
328
349
                }
329
350
 
 
351
 
330
352
                strp= str;
331
 
                
 
353
 
332
354
                while( (len= BMF_GetStringWidth(G.font, strp)) > size) {
333
355
                        if(len < 10) break;
334
356
                        if(strp[1]==0) break;
335
357
                        strp++;
336
358
                }
337
 
                
 
359
 
338
360
                mval[0]= (x1+x2-len+1)/2;
339
361
                mval[1]= 1;
340
362
                areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
341
 
                
 
363
 
342
364
                if(seq->flag & SELECT) cpack(0xFFFFFF);
343
365
                else cpack(0x0);
344
366
                glRasterPos3f(x1,  y1+0.2, 0.0);
353
375
                body+= 0x101010;
354
376
                dark= 0x202020;
355
377
                light= 0xB0B0B0;
356
 
                
 
378
 
357
379
                /* left triangle */
358
380
                if(seq->flag & SEQ_LEFTSEL) {
359
381
                        cpack(body+0x20);
389
411
                sprintf(str, "%d", seq->startdisp);
390
412
                BMF_DrawString(G.font, str);
391
413
        }
392
 
                
 
414
 
393
415
                /* right triangle */
394
 
        if(seq->type < SEQ_EFFECT) {            
 
416
        if(seq->type < SEQ_EFFECT) {
395
417
                dark= 0x202020;
396
418
                light= 0xB0B0B0;
397
419
 
410
432
                        v1[0]= x2; glVertex2fv(v1);
411
433
                        v2[0]-= seq->handsize; v2[1]= (y1+y2)/2.0; glVertex2fv(v2); v2[1]= y2;
412
434
                glEnd();
413
 
                
 
435
 
414
436
                cpack(dark);
415
437
                glBegin(GL_LINE_STRIP);
416
438
                        v2[0]= x2; glVertex2fv(v2);
443
465
}
444
466
 
445
467
 
446
 
static void draw_image_seq(void)
 
468
static void draw_image_seq(ScrArea *sa)
447
469
{
448
470
        SpaceSeq *sseq;
449
471
        StripElem *se;
450
472
        struct ImBuf *ibuf;
451
473
        int x1, y1;
452
 
        
 
474
 
453
475
        glClearColor(0.0, 0.0, 0.0, 0.0);
454
476
        glClear(GL_COLOR_BUFFER_BIT);
455
477
 
456
 
        curarea->win_swap= WIN_BACK_OK;
457
 
 
458
478
        ibuf= (ImBuf *)give_ibuf_seq( (G.scene->r.cfra));
459
479
 
460
480
        if(special_seq_update) {
468
488
       }
469
489
        }
470
490
        if(ibuf==0 || ibuf->rect==0) return;
471
 
        
472
 
        sseq= curarea->spacedata.first;
 
491
 
 
492
        sseq= sa->spacedata.first;
473
493
        if(sseq==0) return;
474
 
        
 
494
 
475
495
        /* calc location */
476
 
        x1= curarea->winrct.xmin+(curarea->winx-sseq->zoom*ibuf->x)/2;
477
 
        y1= curarea->winrct.ymin+(curarea->winy-sseq->zoom*ibuf->y)/2;
478
 
        
479
 
        rectwrite_part(curarea->winrct.xmin, curarea->winrct.ymin, 
480
 
                                curarea->winrct.xmax, curarea->winrct.ymax, 
481
 
                                x1, y1, ibuf->x, ibuf->y, (float)sseq->zoom,(float)sseq->zoom, ibuf->rect);
482
 
 
 
496
        x1= (sa->winx-sseq->zoom*ibuf->x)/2;
 
497
        y1= (sa->winy-sseq->zoom*ibuf->y)/2;
 
498
 
 
499
        /* needed for gla draw */
 
500
        glaDefine2DArea(&curarea->winrct);
 
501
        glPixelZoom((float)sseq->zoom, (float)sseq->zoom);
 
502
        
 
503
        glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->rect);
 
504
        
 
505
        glPixelZoom(1.0, 1.0);
 
506
 
 
507
        sa->win_swap= WIN_BACK_OK;
483
508
}
484
509
 
485
510
static void draw_extra_seqinfo(void)
489
514
        float xco, xfac;
490
515
        int sta, end;
491
516
        char str[256];
492
 
        
 
517
 
493
518
        if(last_seq==0) return;
494
 
                
 
519
 
495
520
        /* xfac: size of 1 pixel */
496
521
        xfac= G.v2d->cur.xmax - G.v2d->cur.xmin;
497
522
        xfac/= (float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
498
523
        xco= G.v2d->cur.xmin+40*xfac;
499
 
        
 
524
 
500
525
        BIF_ThemeColor(TH_TEXT);
501
 
        
 
526
 
502
527
        /* NAME */
503
528
        glRasterPos3f(xco,  0.3, 0.0);
504
 
        strcpy(str, give_seqname(last_seq));
 
529
        strncpy(str, give_seqname(last_seq), 255);
505
530
        BMF_DrawString(G.font, str);
506
531
        xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
507
532
 
514
539
        /* LEN */
515
540
        if(last_seq->type & SEQ_EFFECT)
516
541
                sprintf(str, "len: %d   From %d - %d", last_seq->len, last_seq->startdisp, last_seq->enddisp-1);
517
 
        else 
 
542
        else
518
543
                sprintf(str, "len: %d (%d)", last_seq->enddisp-last_seq->startdisp, last_seq->len);
519
 
        
 
544
 
520
545
        glRasterPos3f(xco,  0.3, 0.0);
521
546
        BMF_DrawString(G.font, str);
522
547
        xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
523
548
 
524
549
        if(last_seq->type==SEQ_IMAGE) {
525
 
        
 
550
 
526
551
                /* CURRENT */
527
552
                se= (StripElem *)give_stripelem(last_seq,  (G.scene->r.cfra));
528
553
                if(se) {
531
556
                        BMF_DrawString(G.font, str);
532
557
                        xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
533
558
                }
534
 
                
 
559
 
535
560
                /* FIRST AND LAST */
536
 
        
 
561
 
537
562
                if(last_seq->strip) {
538
563
                        se= last_seq->strip->stripdata;
539
564
                        last= se+last_seq->len-1;
540
565
                        if(last_seq->startofs) se+= last_seq->startofs;
541
566
                        if(last_seq->endofs) last-= last_seq->endofs;
542
 
                        
 
567
 
543
568
                        sprintf(str, "First: %s at %d     Last: %s at %d", se->name, last_seq->startdisp, last->name, last_seq->enddisp-1);
544
569
                        glRasterPos3f(xco,  0.3, 0.0);
545
570
                        BMF_DrawString(G.font, str);
546
571
                        xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
547
 
                        
 
572
 
548
573
                        /* orig size */
549
574
                        sprintf(str, "OrigSize: %d x %d", last_seq->strip->orx, last_seq->strip->ory);
550
575
                        glRasterPos3f(xco,  0.3, 0.0);
553
578
                }
554
579
        }
555
580
        else if(last_seq->type==SEQ_MOVIE) {
556
 
        
 
581
 
557
582
                sta= last_seq->startofs;
558
583
                end= last_seq->len-1-last_seq->endofs;
559
 
        
560
 
                sprintf(str, "%s   %s%s  First: %d at %d     Last: %d at %d     Cur: %d", 
561
 
                                last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name, 
 
584
 
 
585
                sprintf(str, "%s   %s%s  First: %d at %d     Last: %d at %d     Cur: %d",
 
586
                                last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name,
562
587
                                sta, last_seq->startdisp, end, last_seq->enddisp-1,  (G.scene->r.cfra)-last_seq->startdisp);
563
 
                
 
588
 
564
589
                glRasterPos3f(xco,  0.3, 0.0);
565
590
                BMF_DrawString(G.font, str);
566
591
        }
567
592
        else if(last_seq->type==SEQ_SOUND) {
568
 
        
 
593
 
569
594
                sta= last_seq->startofs;
570
595
                end= last_seq->len-1-last_seq->endofs;
571
 
        
572
 
                sprintf(str, "%s   %s%s  First: %d at %d     Last: %d at %d     Cur: %d     Gain: %.2f dB     Pan: %.2f", 
573
 
                                last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name, 
 
596
 
 
597
                sprintf(str, "%s   %s%s  First: %d at %d     Last: %d at %d     Cur: %d     Gain: %.2f dB     Pan: %.2f",
 
598
                                last_seq->name+2, last_seq->strip->dir, last_seq->strip->stripdata->name,
574
599
                                sta, last_seq->startdisp, end, last_seq->enddisp-1,  (G.scene->r.cfra)-last_seq->startdisp,
575
600
                                last_seq->level, last_seq->pan);
576
 
                
 
601
 
577
602
                glRasterPos3f(xco,  0.3, 0.0);
578
603
                BMF_DrawString(G.font, str);
579
 
        }       
 
604
        }
 
605
}
 
606
 
 
607
#define SEQ_BUT_PLUGIN  1
 
608
#define SEQ_BUT_RELOAD  2
 
609
#define SEQ_BUT_EFFECT  3
 
610
 
 
611
void do_seqbuttons(short val)
 
612
{
 
613
        extern Sequence *last_seq;
 
614
 
 
615
        switch(val) {
 
616
        case SEQ_BUT_PLUGIN:
 
617
                new_stripdata(last_seq);
 
618
                free_imbuf_effect_spec(CFRA);
 
619
                break;
 
620
 
 
621
        case SEQ_BUT_RELOAD:
 
622
                free_imbuf_seq();       // frees all
 
623
                break;
 
624
        case SEQ_BUT_EFFECT:
 
625
                new_stripdata(last_seq);
 
626
                calc_sequence(last_seq);
 
627
                break;
 
628
        }
 
629
 
 
630
        allqueue(REDRAWSEQ, 0);
 
631
}
 
632
 
 
633
static void seq_panel_properties(short cntrl)   // SEQ_HANDLER_PROPERTIES
 
634
{
 
635
        extern Sequence *last_seq;
 
636
        uiBlock *block;
 
637
 
 
638
        block= uiNewBlock(&curarea->uiblocks, "seq_panel_properties", UI_EMBOSS, UI_HELV, curarea->win);
 
639
        uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
 
640
        uiSetPanelHandler(SEQ_HANDLER_PROPERTIES);  // for close and esc
 
641
        if(uiNewPanel(curarea, block, "Strip Properties", "Seq", 10, 230, 318, 204)==0) return;
 
642
 
 
643
        if(last_seq==NULL) return;
 
644
 
 
645
        if(last_seq->type==SEQ_PLUGIN) {
 
646
                PluginSeq *pis;
 
647
                VarStruct *varstr;
 
648
                int a, xco, yco;
 
649
 
 
650
                uiDefBut(block, LABEL, 0, "Type: Plugin", 10,50,70,20, 0, 0, 0, 0, 0, "");
 
651
 
 
652
                pis= last_seq->plugin;
 
653
                if(pis->vars==0) return;
 
654
 
 
655
                varstr= pis->varstr;
 
656
                if(varstr) {
 
657
                        for(a=0; a<pis->vars; a++, varstr++) {
 
658
                                xco= 150*(a/6)+10;
 
659
                                yco= 125 - 20*(a % 6)+1;
 
660
                                uiDefBut(block, varstr->type, SEQ_BUT_PLUGIN, varstr->name, xco,yco,150,19, &(pis->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
 
661
 
 
662
                        }
 
663
                }
 
664
        }
 
665
        else if(last_seq->type==SEQ_IMAGE) {
 
666
 
 
667
                uiDefBut(block, LABEL, 0, "Type: Image", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
668
                uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
669
 
 
670
                uiDefButS(block, TOG|BIT|6, SEQ_BUT_RELOAD, "Convert to Premul", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha");
 
671
                uiDefButS(block, TOG|BIT|4, SEQ_BUT_RELOAD, "FilterY",  10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields");
 
672
                uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:",                   10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors");
 
673
        }
 
674
        else if(last_seq->type==SEQ_META) {
 
675
 
 
676
                uiDefBut(block, LABEL, 0, "Type: Meta", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
677
                uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
678
 
 
679
        }
 
680
        else if(last_seq->type==SEQ_SCENE) {
 
681
 
 
682
                uiDefBut(block, LABEL, 0, "Type: Scene", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
683
                uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
684
 
 
685
        }
 
686
        else if(last_seq->type==SEQ_MOVIE) {
 
687
 
 
688
                if(last_seq->mul==0.0) last_seq->mul= 1.0;
 
689
 
 
690
                uiDefBut(block, LABEL, 0, "Type: Movie", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
691
                uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
692
 
 
693
                uiDefButS(block, TOG|BIT|6, SEQ_BUT_RELOAD, "Make Premul Alpha ", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha");
 
694
                uiDefButS(block, TOG|BIT|4, SEQ_BUT_RELOAD, "FilterY ", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields");
 
695
                uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:",                   10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors");
 
696
 
 
697
        }
 
698
        else if(last_seq->type==SEQ_SOUND) {
 
699
 
 
700
                uiDefBut(block, LABEL, 0, "Type: Audio", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
701
                uiDefBut(block, TEX, 0, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
702
 
 
703
                uiDefButS(block, TOG|BIT|5, B_NOP, "Mute", 10,90,120,19, &last_seq->flag, 0.0, 21.0, 100, 0, "");
 
704
                uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Gain (dB):", 10,70,150,19, &last_seq->level, -96.0, 6.0, 100, 0, "");
 
705
                uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Pan:",   10,50,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, "");
 
706
        }
 
707
        else if(last_seq->type>=SEQ_EFFECT) {
 
708
                uiDefBut(block, LABEL, 0, "Type: Effect", 10,140,150,20, 0, 0, 0, 0, 0, "");
 
709
                uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, "");
 
710
 
 
711
                if(last_seq->type==SEQ_WIPE){
 
712
                        WipeVars *wipe = (WipeVars *)last_seq->effectdata;
 
713
                        char formatstring[256];
 
714
                        strncpy(formatstring, "Transition Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4|Clock Wipe %x5", 255);
 
715
                        uiDefButS(block, MENU,SEQ_BUT_EFFECT, formatstring,     10,90,220,22, &wipe->wipetype, 0, 0, 0, 0, "What type of wipe should be performed");
 
716
                        uiDefButF(block, NUM,SEQ_BUT_EFFECT,"Blur:",    10,65,220,22, &wipe->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
 
717
                        switch(wipe->wipetype){ /*Skip Types that do not require angle*/
 
718
                                case DO_IRIS_WIPE:
 
719
                                case DO_CLOCK_WIPE:
 
720
                                break;
 
721
                                
 
722
                                default:
 
723
                                        uiDefButF(block, NUM,SEQ_BUT_EFFECT,"Angle:",   10,40,220,22, &wipe->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
 
724
                        }
 
725
                        uiDefButS(block, TOG,SEQ_BUT_EFFECT,"Wipe In",  10,15,220,22, &wipe->forward,0,0, 0, 0, "Controls Primary Direction of Wipe");                          
 
726
                }
 
727
                else if(last_seq->type==SEQ_GLOW){
 
728
                        GlowVars *glow = (GlowVars *)last_seq->effectdata;
 
729
 
 
730
                        uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Threshold:",     10,90,150,19, &glow->fMini, 0.0, 1.0, 0, 0, "Trigger Intensity");
 
731
                        uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Clamp:",         10,70,150,19, &glow->fClamp, 0.0, 1.0, 0, 0, "Brightness limit of intensity");
 
732
                        uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Boost factor:",  10,50,150,19, &glow->fBoost, 0.0, 10.0, 0, 0, "Brightness multiplier");
 
733
                        uiDefButF(block, NUM, SEQ_BUT_EFFECT, "Blur distance:",         10,30,150,19, &glow->dDist, 0.5, 20.0, 0, 0, "Radius of glow effect");
 
734
                        uiDefButI(block, NUM, B_NOP, "Quality:", 10,10,150,19, &glow->dQuality, 1.0, 5.0, 0, 0, "Accuracy of the blur effect");
 
735
                        uiDefButI(block, TOG, B_NOP, "Only boost", 10,-10,150,19, &glow->bNoComp, 0.0, 0.0, 0, 0, "Show the glow buffer only");
 
736
                }
 
737
 
 
738
        }
 
739
 
 
740
 
 
741
}
 
742
 
 
743
static void seq_blockhandlers(ScrArea *sa)
 
744
{
 
745
        SpaceSeq *sseq= sa->spacedata.first;
 
746
        short a;
 
747
 
 
748
        /* warning; blocks need to be freed each time, handlers dont remove (for ipo moved to drawipospace) */
 
749
        uiFreeBlocksWin(&sa->uiblocks, sa->win);
 
750
 
 
751
        for(a=0; a<SPACE_MAXHANDLER; a+=2) {
 
752
                switch(sseq->blockhandler[a]) {
 
753
 
 
754
                case SEQ_HANDLER_PROPERTIES:
 
755
                        seq_panel_properties(sseq->blockhandler[a+1]);
 
756
                        break;
 
757
 
 
758
                }
 
759
                /* clear action value for event */
 
760
                sseq->blockhandler[a+1]= 0;
 
761
        }
 
762
        uiDrawBlocksPanels(sa, 0);
 
763
 
580
764
}
581
765
 
582
766
void drawseqspace(ScrArea *sa, void *spacedata)
588
772
        int ofsx, ofsy;
589
773
 
590
774
        ed= G.scene->ed;
591
 
        
 
775
 
592
776
        sseq= curarea->spacedata.first;
593
777
        if(sseq->mainb==1) {
594
 
                draw_image_seq();
 
778
                draw_image_seq(curarea);
595
779
                return;
596
780
        }
597
 
        
 
781
 
 
782
        bwin_clear_viewmat(sa->win);    /* clear buttons view */
 
783
        glLoadIdentity();
 
784
 
598
785
        BIF_GetThemeColor3fv(TH_BACK, col);
599
 
        if(ed && ed->metastack.first) glClearColor(col[0], col[1], col[2]-1.0, 0.0);
 
786
        if(ed && ed->metastack.first) glClearColor(col[0], col[1], col[2]-0.1, 0.0);
600
787
        else glClearColor(col[0], col[1], col[2], 0.0);
601
 
        
 
788
 
602
789
        glClear(GL_COLOR_BUFFER_BIT);
603
790
 
604
 
        calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
 
791
        calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
605
792
 
606
793
        if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
607
 
                if(G.v2d->scroll) {     
 
794
                if(G.v2d->scroll) {
608
795
                        ofsx= curarea->winrct.xmin;     /* because of mywin */
609
796
                        ofsy= curarea->winrct.ymin;
610
 
                        glViewport(ofsx+G.v2d->mask.xmin,  ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); 
 
797
                        glViewport(ofsx+G.v2d->mask.xmin,  ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
611
798
                        glScissor(ofsx+G.v2d->mask.xmin,  ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
612
799
                }
613
800
        }
614
801
 
615
802
 
616
803
        myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
617
 
        
 
804
 
618
805
        BIF_ThemeColorShade(TH_BACK, -20);
619
806
        glRectf(G.v2d->cur.xmin,  0.0,  G.v2d->cur.xmax,  1.0);
620
 
        
 
807
 
621
808
        boundbox_seq();
622
 
        calc_ipogrid(); 
 
809
        calc_ipogrid();
623
810
        draw_ipogrid();
624
811
        draw_cfra_seq();
625
812
 
626
813
        /* sequences: first deselect */
627
 
        
 
814
 
628
815
        if(ed) {
629
816
                seq= ed->seqbasep->first;
630
817
                while(seq) {
654
841
                        drawscroll(0);
655
842
                }
656
843
        }
657
 
        
 
844
 
658
845
        draw_area_emboss(sa);
659
 
        
 
846
 
 
847
        if(sseq->mainb==0) {
 
848
                /* it is important to end a view in a transform compatible with buttons */
 
849
                bwin_scalematrix(sa->win, sseq->blockscale, sseq->blockscale, sseq->blockscale);
 
850
                seq_blockhandlers(sa);
 
851
        }
 
852
 
660
853
        curarea->win_swap= WIN_BACK_OK;
661
854
}
662
855