- finished some minor drawing stuff which i couldnt complete last friday:
authorTon Roosendaal <ton@blender.org>
Mon, 17 Nov 2003 14:31:25 +0000 (14:31 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 17 Nov 2003 14:31:25 +0000 (14:31 +0000)
  (related to rounded theme)
  - layer buttons in view3d header grouped
  - outline colour now blends darker with respect to background (better
    visibility on dark backgrounds)
  - added some align calls to user settings menu

Now back to real bugs!

source/blender/include/BIF_resources.h
source/blender/src/header_view3d.c
source/blender/src/interface_draw.c
source/blender/src/resources.c
source/blender/src/space.c

index cc3f751bcbca404ce2b4c76af14e5b610d230589..f4257c829a7d69274ecb834837d3f13c98f3a44c 100644 (file)
@@ -332,6 +332,8 @@ void                BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
 
 // sets color, which is blend between two theme colors
 void   BIF_ThemeColorBlend(int colorid1, int colorid2, float fac);
+// same, with shade offset
+void    BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
 
 // returns one value, not scaled
 float  BIF_GetThemeValuef(int colorid);
index 91530da70412c3a82a812979d56c58994b3bd48e..239edeeb5d35c4e6644718005980e35866365d1f 100644 (file)
@@ -3091,11 +3091,21 @@ void view3d_buttons(void)
        /* LAYERS */
        if(G.vd->localview==0) {
                
-               for(a=0; a<10; a++) {
+               uiBlockBeginAlign(block);
+               for(a=0; a<5; a++)
+                       uiDefButI(block, TOG|BIT|a, B_LAY+a, "",        (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility");
+               for(a=0; a<5; a++)
                        uiDefButI(block, TOG|BIT|(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0,                      XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility");
+                       
+               xco+= 5;
+               uiBlockBeginAlign(block);
+               for(a=5; a<10; a++)
                        uiDefButI(block, TOG|BIT|a, B_LAY+a, "",        (short)(xco+a*(XIC/2)), (short)(YIC/2),(short)(XIC/2),(short)(YIC/2), &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility");
-                       if(a==4) xco+= 5;
-               }
+               for(a=5; a<10; a++)
+                       uiDefButI(block, TOG|BIT|(a+10), B_LAY+10+a, "",(short)(xco+a*(XIC/2)), 0,                      XIC/2, (YIC)/2, &(G.vd->lay), 0, 0, 0, 0, "Toggles Layer visibility");
+
+               uiBlockEndAlign(block);
+               
                xco+= (a-2)*(XIC/2)+3;
 
                /* LOCK */
index 762df51f37c7fc2a91adf5cefc34fb07d01beb84..8f635185c51fad24c5de08946859efda1acdd73c 100644 (file)
@@ -1246,7 +1246,8 @@ static void round_button(float x1, float y1, float x2, float y2, float asp, int
        gl_round_box(x1, y1, x2, y2, rad);
        glEnd();
        
-       BIF_ThemeColorShade(colorid, -70);
+       BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70);
+       //BIF_ThemeColorShade(colorid, -70);
        
        glBegin(GL_LINE_LOOP);
        gl_round_box(x1, y1, x2, y2, rad);
@@ -1260,7 +1261,8 @@ static void round_button_mid(float x1, float y1, float x2, float y2, float asp,
 {
        glRectf(x1, y1, x2, y2);
        
-       BIF_ThemeColorShade(colorid, -70);
+       //BIF_ThemeColorShade(colorid, -70);
+       BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70);
        // we draw full outline, its not AA, and it works better button mouse-over hilite
        
        // left right
index 433827da01e3e9a9cb4b8b0b025e59c20f64d02f..4d833d02f9b620d967daf504d867d8b296461257 100644 (file)
@@ -772,6 +772,27 @@ void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac)
        glColor3ub(r, g, b);
 }
 
+// blend between to theme colors, shade it, and set it
+void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
+{
+       int r, g, b;
+       char *cp1, *cp2;
+       
+       cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+       cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+       if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
+       r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]);
+       g= offset+floor((1.0-fac)*cp1[1] + fac*cp2[1]);
+       b= offset+floor((1.0-fac)*cp1[2] + fac*cp2[2]);
+       
+       r= r<0?0:(r>255?255:r);
+       g= g<0?0:(g>255?255:g);
+       b= b<0?0:(b>255?255:b);
+       
+       glColor3ub(r, g, b);
+}
+
 
 // get individual values, not scaled
 float BIF_GetThemeValuef(int colorid)
index 79ebe98903cc895e1cc48f54a27f55720fd1ace0..29da5bead056e9f7ea81c8b8f089815362880b6b 100644 (file)
@@ -1832,26 +1832,31 @@ void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
                uiDefButC(block, NUMSLI, B_UPDATE_THEME,"Vertex size ", 465,y3,200,20,  col, 1.0, 10.0, 0, 0, "");
        }
        else if(th_curcol==TH_BUT_DRAWTYPE) {
+               uiBlockBeginAlign(block);
                uiDefButC(block, ROW, B_UPDATE_THEME, "Minimal",        465,y3,100,20,  col, 2.0, 0.0, 0, 0, "");
                uiDefButC(block, ROW, B_UPDATE_THEME, "Shaded", 565,y3,100,20,  col, 2.0, 1.0, 0, 0, "");
                uiDefButC(block, ROW, B_UPDATE_THEME, "Rounded",        465,y2,100,20,  col, 2.0, 2.0, 0, 0, "");
                uiDefButC(block, ROW, B_UPDATE_THEME, "OldSkool",       565,y2,100,20,  col, 2.0, 3.0, 0, 0, "");
-       
+               uiBlockEndAlign(block);
        }
        else {
+               uiBlockBeginAlign(block);
+               if ELEM3(th_curcol, TH_PANEL, TH_FACE, TH_FACE_SELECT) {
+                       uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ",   465,y3+25,200,20,  col+3, 0.0, 255.0, B_THEMECOL, 0, "");
+               }
                uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ",   465,y3,200,20,  col, 0.0, 255.0, B_THEMECOL, 0, "");
                uiDefButC(block, NUMSLI, B_UPDATE_THEME,"G ",   465,y2,200,20,  col+1, 0.0, 255.0, B_THEMECOL, 0, "");
                uiDefButC(block, NUMSLI, B_UPDATE_THEME,"B ",   465,y1,200,20,  col+2, 0.0, 255.0, B_THEMECOL, 0, "");
+               uiBlockEndAlign(block);
 
                uiDefButC(block, COL, B_THEMECOL, "",           675,y1,50,y3-y1+20, col, 0, 0, 0, 0, "");
-               if ELEM3(th_curcol, TH_PANEL, TH_FACE, TH_FACE_SELECT) {
-                       uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ",   465,y3+25,200,20,  col+3, 0.0, 255.0, B_THEMECOL, 0, "");
-               }
-               
+                               
                /* copy paste */
+               uiBlockBeginAlign(block);
                uiDefBut(block, BUT, B_THEME_COPY, "Copy Color",        755,y2,120,20, NULL, 0, 0, 0, 0, "Stores current color in buffer");
                uiDefBut(block, BUT, B_THEME_PASTE, "Paste Color",      755,y1,120,20, NULL, 0, 0, 0, 0, "Pastes buffer color");
-
+               uiBlockEndAlign(block);
+               
                uiDefButC(block, COL, 0, "",                            885,y1,50,y2-y1+20, th_curcol_arr, 0, 0, 0, 0, "");
                
        }
@@ -1913,7 +1918,8 @@ void drawinfospace(ScrArea *sa, void *spacedata)
        /* set the colour to blue and draw the main 'tab' controls */
 
        uiBlockSetCol(block, TH_BUT_SETTING1);
-
+       uiBlockBeginAlign(block);
+       
        uiDefButI(block, ROW,B_USERPREF,"View & Controls",
                xpos,ypostab,(short)dx,buth,
                &U.userpref,1.0,0.0, 0, 0,"");
@@ -1943,7 +1949,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                &U.userpref,1.0,5.0, 0, 0,"");
 
        uiBlockSetCol(block, TH_AUTO);
-
+       uiBlockEndAlign(block);
        /* end 'tab' controls */
 
         /* line 2: left x co-ord, top y co-ord, width, height */
@@ -1956,7 +1962,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                uiDefBut(block, LABEL,0,"Display:",
                        xpos,y3label,medprefbut,buth,
                        0, 0, 0, 0, 0, "");
-
+               
                uiDefButS(block, TOG|BIT|11, 0, "ToolTips",
                        (xpos+edgespace),y2,smallprefbut,buth,
                        &(U.flag), 0, 0, 0, 0,