Merging r39050 through r39101 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / interface / interface_widgets.c
index bccedbe60fc3cd81e4f17e6a11b08894a43a28a9..214cdb9ac21733c4f81f085ece342775e7c39be9 100644 (file)
@@ -771,7 +771,6 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
 
 
 /* icons have been standardized... and this call draws in untransformed coordinates */
 
 
 /* icons have been standardized... and this call draws in untransformed coordinates */
-#define ICON_HEIGHT            UI_DPI_FAC*16.0f
 
 static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
 {
 
 static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
 {
@@ -791,15 +790,15 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
        if(aspect != but->aspect) {
                /* prevent scaling up icon in pupmenu */
                if (aspect < 1.0f) {                    
        if(aspect != but->aspect) {
                /* prevent scaling up icon in pupmenu */
                if (aspect < 1.0f) {                    
-                       height= ICON_HEIGHT;
+                       height= UI_DPI_ICON_SIZE;
                        aspect = 1.0f;
                        
                }
                else 
                        aspect = 1.0f;
                        
                }
                else 
-                       height= ICON_HEIGHT/aspect;
+                       height= UI_DPI_ICON_SIZE/aspect;
        }
        else
        }
        else
-               height= ICON_HEIGHT;
+               height= UI_DPI_ICON_SIZE;
        
        /* calculate blend color */
        if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
        
        /* calculate blend color */
        if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
@@ -866,7 +865,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
        int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
        int okwidth= rect->xmax-rect->xmin - border;
        
        int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
        int okwidth= rect->xmax-rect->xmin - border;
        
-       if (but->flag & UI_HAS_ICON) okwidth -= 16;
+       if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
        
        /* need to set this first */
        uiStyleFontSet(fstyle);
        
        /* need to set this first */
        uiStyleFontSet(fstyle);
@@ -1149,7 +1148,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
                if (but->flag & UI_HAS_ICON) {
                        widget_draw_icon(but, but->icon+but->iconadd, 1.0f, rect);
                        
                if (but->flag & UI_HAS_ICON) {
                        widget_draw_icon(but, but->icon+but->iconadd, 1.0f, rect);
                        
-                       rect->xmin += UI_icon_get_width(but->icon+but->iconadd);
+                       rect->xmin += (int)((float)UI_icon_get_width(but->icon+but->iconadd) * UI_DPI_ICON_FAC);
                        
                        if(but->editstr || (but->flag & UI_TEXT_LEFT)) 
                                rect->xmin += 5;
                        
                        if(but->editstr || (but->flag & UI_TEXT_LEFT)) 
                                rect->xmin += 5;
@@ -3137,7 +3136,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
        
        /* text location offset */
        rect->xmin+=5;
        
        /* text location offset */
        rect->xmin+=5;
-       if(iconid) rect->xmin+= ICON_HEIGHT;
+       if(iconid) rect->xmin+= UI_DPI_ICON_SIZE;
 
        /* cut string in 2 parts? */
        cpoin= strchr(name, '|');
 
        /* cut string in 2 parts? */
        cpoin= strchr(name, '|');
@@ -3162,7 +3161,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
 
        if(iconid) {
                int xs= rect->xmin+4;
 
        if(iconid) {
                int xs= rect->xmin+4;
-               int ys= 1 + (rect->ymin+rect->ymax- ICON_HEIGHT)/2;
+               int ys= 1 + (rect->ymin+rect->ymax- UI_DPI_ICON_SIZE)/2;
                glEnable(GL_BLEND);
                UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
                glDisable(GL_BLEND);
                glEnable(GL_BLEND);
                UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
                glDisable(GL_BLEND);