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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: interface_panel.c,v 1.40 2006/11/16 20:55:11 ton Exp $
 
2
 * $Id: interface_panel.c,v 1.43 2007/04/22 17:14:23 campbellbarton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
102
102
 
103
103
void uiSetRoundBox(int type)
104
104
{
105
 
        roundboxtype= type;
106
 
        
 
105
        /* Not sure the roundbox function is the best place to change this
 
106
         * if this is undone, its not that big a deal, only makes curves edges
 
107
         * square for the  */
 
108
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
 
109
                roundboxtype= 0;
 
110
        else
 
111
                roundboxtype= type;
 
112
 
107
113
        /* flags to set which corners will become rounded:
108
114
 
109
115
        1------2
204
210
        coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0;
205
211
        coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0;
206
212
 
207
 
        glShadeModel(GL_SMOOTH);
208
 
        glBegin(mode);
 
213
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
 
214
                glShadeModel(GL_SMOOTH);
 
215
                glBegin(mode);
 
216
        }
209
217
 
210
218
        /* start with corner right-bottom */
211
219
        if(roundboxtype & 4) {
350
358
        //if(active)
351
359
        //      gl_round_box_shade(GL_POLYGON, minx, miny, maxx, maxy, rad, 0.10, -0.05);
352
360
        // else
353
 
        /* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) �*/
 
361
        /* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) */
354
362
        gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
355
363
        
356
364
        /* set antialias line */
357
 
        glEnable( GL_LINE_SMOOTH );
358
 
        glEnable( GL_BLEND );
 
365
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
 
366
                glEnable( GL_LINE_SMOOTH );
 
367
                glEnable( GL_BLEND );
 
368
        }
359
369
 
360
370
        /* top shade */
361
371
        gl_round_box_topshade(minx+1, miny+1, maxx-1, maxy-1, rad);
388
398
        }
389
399
        
390
400
        /* set antialias line */
391
 
        glEnable( GL_LINE_SMOOTH );
392
 
        glEnable( GL_BLEND );
 
401
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
 
402
                glEnable( GL_LINE_SMOOTH );
 
403
                glEnable( GL_BLEND );
 
404
        }
393
405
 
394
406
        gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
395
407
   
415
427
        gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
416
428
        
417
429
        /* set antialias line */
418
 
        glEnable( GL_LINE_SMOOTH );
419
 
        glEnable( GL_BLEND );
420
 
 
 
430
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
 
431
                glEnable( GL_LINE_SMOOTH );
 
432
                glEnable( GL_BLEND );
 
433
        }
 
434
                
421
435
        gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
422
436
   
423
437
        glDisable( GL_BLEND );
525
539
        block->handler= pnl_handler;
526
540
        pa->active= 1;
527
541
        pa->control= pnl_control;
528
 
        pa->drawname[0]= 0;
529
542
        
530
543
        /* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */
531
544
        if(U.uiflag & USER_PANELPINNED);
554
567
        if(block->panel->paneltab) return 0;
555
568
        if(block->panel->flag & PNL_CLOSED) return 0;
556
569
 
 
570
        /* the 'return 0' above makes this to be in end. otherwise closes panels show wrong title */
 
571
        pa->drawname[0]= 0;
 
572
        
557
573
        return 1;
558
574
}
559
575
 
600
616
{
601
617
        uiBut *but;
602
618
        float facx= 1.0, facy= 1.0;
603
 
        int centrex= 0, topy=0, tabsy=0;
 
619
        int centerx= 0, topy=0, tabsy=0;
604
620
        
605
621
        if(block->panel==NULL) return;
606
622
 
611
627
        if( block->maxx-block->minx > block->panel->sizex - 2*PNL_SAFETY ) {
612
628
                facx= (block->panel->sizex - (2*PNL_SAFETY))/( block->maxx-block->minx );
613
629
        }
614
 
        else centrex= (block->panel->sizex-( block->maxx-block->minx ) - 2*PNL_SAFETY)/2;
 
630
        else centerx= (block->panel->sizex-( block->maxx-block->minx ) - 2*PNL_SAFETY)/2;
615
631
        
616
632
        // tabsy= PNL_HEADER*panel_has_tabs(block->panel);
617
633
        if( (block->maxy-block->miny) > block->panel->sizey - 2*PNL_SAFETY - tabsy) {
621
637
 
622
638
        but= block->buttons.first;
623
639
        while(but) {
624
 
                but->x1= PNL_SAFETY+centrex+ facx*(but->x1-block->minx);
 
640
                but->x1= PNL_SAFETY+centerx+ facx*(but->x1-block->minx);
625
641
                but->y1= PNL_SAFETY+topy   + facy*(but->y1-block->miny);
626
 
                but->x2= PNL_SAFETY+centrex+ facx*(but->x2-block->minx);
 
642
                but->x2= PNL_SAFETY+centerx+ facx*(but->x2-block->minx);
627
643
                but->y2= PNL_SAFETY+topy   + facy*(but->y2-block->miny);
628
644
                if(facx!=1.0) ui_check_but(but);        /* for strlen */
629
645
                but= but->next;