2.5
authorTon Roosendaal <ton@blender.org>
Wed, 20 May 2009 14:32:15 +0000 (14:32 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 20 May 2009 14:32:15 +0000 (14:32 +0000)
- Made Normal (Sphere) button draw with nice AA
  (check in node editor)
- Bugfix in alignment code, collumns were not drawing OK
- Picker buttons draw swatches again, and made them work.

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/space_node/node_header.c

index 2bcc1a03923fadbb93641504cb47a870083464ed..8184e2e1fa92748034ef7df51e5c2f48e1bfd9d0 100644 (file)
@@ -612,6 +612,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
        
        rect->xmax= floor(getsizex*(0.5+ 0.5*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
        rect->ymax= floor(getsizey*(0.5+ 0.5*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+
 }
 
 /* uses local copy of style, to scale things down, and allow widgets to change stuff */
@@ -2041,6 +2042,7 @@ static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
                else if(buts_are_horiz(but, next)) {
                        /* check if this is already second row */
                        if( prev && buts_are_horiz(prev, but)==0) {
+                               flag &= ~UI_BUT_ALIGN_LEFT;
                                flag |= UI_BUT_ALIGN_TOP;
                                /* exception case: bottom row */
                                if(rows>0) {
@@ -2059,6 +2061,10 @@ static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
                                flag |= UI_BUT_ALIGN_TOP;
                        }
                        else {  /* next button switches to new row */
+                               
+                               if(prev && buts_are_horiz(prev, but))
+                                  flag |= UI_BUT_ALIGN_LEFT;
+                               
                                if( (flag & UI_BUT_ALIGN_TOP)==0) {     /* stil top row */
                                        if(prev)
                                                flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
index 8be2084ab01c4007a612a0065df9cf6772b57b32..955abe1aecd7002384fb7a1a210a750786fd7c20 100644 (file)
@@ -819,7 +819,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
        size= (rect->xmax-rect->xmin)/200.f;
        glScalef(size, size, size);
-                        
+       
        if(displist==0) {
                GLUquadricObj   *qobj;
                
@@ -838,13 +838,22 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        else glCallList(displist);
        
        /* restore */
-       glPopMatrix();
        glDisable(GL_LIGHTING);
        glDisable(GL_CULL_FACE);
        glMaterialfv(GL_FRONT, GL_DIFFUSE, diff); 
-       
        glDisable(GL_LIGHT7);
        
+       /* AA circle */
+       glEnable(GL_BLEND);
+       glEnable(GL_LINE_SMOOTH );
+       glColor3ubv(wcol->inner);
+       glutil_draw_lined_arc(0.0f, M_PI*2.0, 100.0f, 32);
+       glDisable(GL_BLEND);
+       glDisable(GL_LINE_SMOOTH );
+
+       /* matrix after circle */
+       glPopMatrix();
+
        /* enable blender light */
        for(a=0; a<8; a++) {
                if(old[a])
index ed126ed870dc0f6d76d18927ac66e6454834a2d6..65752423dce6f14bf0cd8721c3984d6384a0b99f 100644 (file)
@@ -311,8 +311,10 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
 
 static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-       if(but->type == COL)
-               ui_set_but_vectorf(but, data->vec);
+       if(but->type == COL) {
+               if(but->a1 != -1) // this is not a color picker (weak!)
+                       ui_set_but_vectorf(but, data->vec);
+       }
        else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
                ui_set_but_val(but, data->value);
 
index 57644e5decc42df4132f3d7ba0e3e4f48e9b8303..8474ee17ee07ef777852fe4f12a0b9c07316dee9 100644 (file)
@@ -1054,18 +1054,17 @@ static void ui_update_block_buts_hex(uiBlock *block, char *hexcol)
 /* callback to copy from/to palette */
 static void do_palette_cb(bContext *C, void *bt1, void *col1)
 {
+       wmWindow *win= CTX_wm_window(C);
        uiBut *but1= (uiBut *)bt1;
        float *col= (float *)col1;
        float *fp, hsv[3];
        
        fp= (float *)but1->poin;
        
-       /* XXX 2.50 bad access, how to solve?
-        *
-       if( (get_qual() & LR_CTRLKEY) ) {
+       if(win->eventstate->ctrl) {
                VECCOPY(fp, col);
        }
-       else*/ {
+       else {
                VECCOPY(col, fp);
        }
        
@@ -1205,8 +1204,6 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
 
        // palette
        
-       uiBlockSetEmboss(block, UI_EMBOSSP);
-       
        bt=uiDefButF(block, COL, retval, "",            FPICK+DPICK, 0, BPICK,BPICK, old, 0.0, 0.0, -1, 0, "Old color, click to restore");
        uiButSetFunc(bt, do_palette_cb, bt, col);
        uiDefButF(block, COL, retval, "",               FPICK+DPICK, BPICK+DPICK, BPICK,60-BPICK-DPICK, col, 0.0, 0.0, -1, 0, "Active color");
@@ -1221,8 +1218,6 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
        }
        uiBlockEndAlign(block);
        
-       uiBlockSetEmboss(block, UI_EMBOSS);
-
        // buttons
        rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
        sprintf(hexcol, "%02X%02X%02X", (unsigned int)(col[0]*255.0), (unsigned int)(col[1]*255.0), (unsigned int)(col[2]*255.0));      
index 002e4eea68131645397bcb1ecfc4b664407d1716..8c48d4b54e1b486e151e854afe47090180e2b243 100644 (file)
@@ -702,22 +702,22 @@ void node_header_buttons(const bContext *C, ARegion *ar)
        
                xmax= GetButStringLength("View");
                uiDefPulldownBut(block, node_viewmenu, NULL, 
-                                         "View", xco, yco-2, xmax-3, 24, "");
+                                         "View", xco, yco, xmax-3, 20, "");
                xco+= xmax;
                
                xmax= GetButStringLength("Select");
                uiDefPulldownBut(block, node_selectmenu, NULL, 
-                                                "Select", xco, yco-2, xmax-3, 24, "");
+                                                "Select", xco, yco, xmax-3, 20, "");
                xco+= xmax;
                
                xmax= GetButStringLength("Add");
                uiDefPulldownBut(block, node_addmenu, NULL, 
-                                                "Add", xco, yco-2, xmax-3, 24, "");
+                                                "Add", xco, yco, xmax-3, 20, "");
                xco+= xmax;
                
                xmax= GetButStringLength("Node");
                uiDefPulldownBut(block, node_nodemenu, NULL, 
-                                                "Node", xco, yco-2, xmax-3, 24, "");
+                                                "Node", xco, yco, xmax-3, 20, "");
                xco+= xmax;
        }