* fun 2.5 UI commit from seoul airport!
authorMatt Ebb <matt@mke3.net>
Mon, 9 Mar 2009 08:31:45 +0000 (08:31 +0000)
committerMatt Ebb <matt@mke3.net>
Mon, 9 Mar 2009 08:31:45 +0000 (08:31 +0000)
A few UI goodies from on the plane:
- fixed the sliders for non-rounded themes
- Made properties with rna subtype of 'percentage' automatically display a '%'
character *after* the numerical value, where it belongs. It would also be really great
to add a ° - degree symbol after angle and perhaps rotation subtypes. This works
fine with international fonts but not with oldskool bitmap fonts (not part of ascii). I
wonder if there's a way to get around this?
- Added nice embossing effects on buttons, labels and pulldowns (there you go, brecht :)
- and cooler looking tooltips

And did some work on the file browser. Andrea, I hope this is ok, let me know if
there are problems and I can work on fixing it up :)
- added some new icons for file types, that are now shown in list view.
icon designers, please feel free to update and make nicer ones!
- tweaked the default colour theme and did some graphical fiddling to make the
various views look nicer
- rearranged the buttons on the header and swapped the 'P' button for an up arrow
button, this needs a nicer icon too.
- added outliner style alternating bands to the list view to see info grouping better.
This has a small prob in columns view though, can fix that.

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/resources.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_header.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_info/info_header.c
source/blender/makesrna/intern/rna_scene.c

index a49a20062fdd8c87416516b6cbda4257d73381de..79c0cf5eae093348dfa76b68ad8c8ba18b133018 100644 (file)
@@ -1743,6 +1743,13 @@ void ui_check_but(uiBut *but)
                else {
                        sprintf(but->drawstr, "%s%d", but->str, (int)value);
                }
+                       
+               if(but->rnaprop) {
+                       PropertySubType pstype = RNA_property_subtype(&but->rnapoin, but->rnaprop);
+                       
+                       if (pstype == PROP_PERCENTAGE)
+                               strcat(but->drawstr, "%");
+               }
                break;
 
        case LABEL:
index 8fba831302bbda8d795374bfdee65072a3287cca..c45fc7ed73d4025522e33ede348b42202ba74a15 100644 (file)
@@ -896,6 +896,10 @@ static void round_button_shaded(int type, int colorid, float asp, float x1, floa
        int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
        float shadefac;
        
+       /* emboss */
+       UI_ThemeColorShade(TH_BUT_OUTLINE, 50);
+       uiRoundRectFakeAA(x1, y1-1, x2, y2-1, rad, asp);
+       
        /* colour shading */
        if (flag & UI_SELECT) {
                shadefac = -0.05;
@@ -924,6 +928,10 @@ static void round_button_flat(int colorid, float asp, float x1, float y1, float
 {      
        int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
        
+       /* emboss */
+       UI_ThemeColorShade(TH_BUT_OUTLINE, 50);
+       uiRoundRectFakeAA(x1, y1-1, x2, y2-1, rad, asp);
+       
        /* colour shading */
        if(flag & UI_SELECT) {
                if (flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -20);
@@ -933,16 +941,13 @@ static void round_button_flat(int colorid, float asp, float x1, float y1, float
                if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, 35);
                else UI_ThemeColorShade(colorid, 25);
        }
-       /* end colour shading */
        
        /* the solid base */
        gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
        
        /* outline */
        UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs);
-       
        uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
-       /* end outline */
 }
 
 static void ui_checkmark_box(int colorid, float x1, float y1, float x2, float y2)
@@ -1993,9 +1998,10 @@ static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float
        ymid= (y1+y2)/2.0;
        yc= 1.7*aspect; 
 
-       if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -50); 
+       if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -60); 
        else UI_ThemeColorShade(colorid, -40); 
 
+       origround = round;
        round &= ~(2|4);
        uiSetRoundBox(round);
        
@@ -2005,7 +2011,7 @@ static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float
                float start_rad;
                
                start_rad = fac;
-               ofsy = (rad - fac) * 0.5;
+               ofsy = (origround!=0) ? ((rad - fac) * 0.5) : 0.f;      /* shrink in Y if rounded but */
                
                gl_round_box(GL_POLYGON, x1, y1+ofsy, x1+fac, y2-ofsy, start_rad);
                
@@ -2013,32 +2019,38 @@ static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float
                /* if the slider is in the middle */
                
                gl_round_box(GL_POLYGON, x1, y1, x1+fac, y2, rad);
-               
+       
        } else if (x1+fac >= x2-rad) {
                /* if the slider is in the right end cap */
                float extx, ofsy;
                float end_rad;
                
                /* draw the full slider area at 100% */
-               uiSetRoundBox(1+2+4+8);
+               uiSetRoundBox(origround);
                gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
                
-               /* tricky hack to trim off right end curve by drawing over it */
+               /* don't draw anything else if the slider is completely full */
+               if (x2 - (x1+fac) < 0.05f)      
+                       return;
+               
+               /* tricky to trim off right end curve by drawing over it */
                extx = ((x1 + fac) - (x2 - rad)) * aspect;      /* width of extension bit */
                end_rad = rad - extx - 1.0;
-               ofsy = extx * 0.4;
+               ofsy = (origround!=0) ? (extx * 0.4) : 0.f;     /* shrink in Y if rounded but */
                
                if (end_rad > 1.0) {
                        
                        if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -20);
                        else UI_ThemeColorShade(colorid, -0);
                        
-                       uiSetRoundBox(2+4);
-                       gl_round_box(GL_POLYGON, x1+fac-1.0, y1+ofsy, x2, y2-ofsy, end_rad);
+                       round = origround;
+                       round &= ~(1|8);
+                       uiSetRoundBox(round);
+                       gl_round_box(GL_POLYGON, x1+fac-1.0, y1+ofsy, x2-1.0, y2-ofsy, end_rad);
                }
                
                UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs);
-               uiSetRoundBox(1+2+4+8);
+               uiSetRoundBox(origround);
                uiRoundRectFakeAA(x1, y1, x2, y2, rad, aspect);
        }
        
@@ -2191,17 +2203,73 @@ static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, f
 
 /* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
 
+#define BUT_TEXT_NORMAL        0
+#define BUT_TEXT_SUNKEN        1
 
+static void ui_draw_text(uiBut *but, float x, float y, int sunken)
+{
+       int alpha_offs= (but->flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
+       int col_offs = 0;
+       int transopts;
+       int len;
+       char *cpoin;
+       
+       if (sunken) {
+               y -= 1.0;
+               col_offs = 230;
+       }
+       
+       /* text color, with pulldown item exception */
+       if(but->dt==UI_EMBOSSP) {
+               if((but->flag & UI_ACTIVE) && but->type!=LABEL) {       // LABEL = title in pulldowns
+                       UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, col_offs, alpha_offs);
+               } else {
+                       UI_ThemeColorShadeAlpha(TH_MENU_TEXT, col_offs, alpha_offs);
+               }
+       }
+       else {
+               if(but->flag & UI_SELECT) {             
+                       UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, col_offs, alpha_offs);
+               } else {
+                       UI_ThemeColorShadeAlpha(TH_BUT_TEXT, col_offs, alpha_offs);
+               }
+       }
+       
+       /* LABEL button exception */
+       if(but->type==LABEL && but->min!=0.0) UI_ThemeColorShade(TH_BUT_TEXT_HI, col_offs);
+       
+       ui_rasterpos_safe(x, y, but->aspect);
+       if(but->type==IDPOIN) transopts= 0;     // no translation, of course!
+       else transopts= ui_translate_buttons();
+       
+       /* cut string in 2 parts */
+       cpoin= strchr(but->drawstr, '|');
+       if(cpoin) *cpoin= 0;            
+       
+#ifdef INTERNATIONAL
+       if (but->type == FTPREVIEW)
+               FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
+       else
+               UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
+#else
+       UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
+#endif
+       
+       /* part text right aligned */
+       if(cpoin) {
+               len= UI_GetStringWidth(but->font, cpoin+1, ui_translate_buttons());
+               ui_rasterpos_safe( but->x2 - len*but->aspect-3, y, but->aspect);
+               UI_DrawString(but->font, cpoin+1, ui_translate_buttons());
+               *cpoin= '|';
+       }
+}
 
 /* draws text and icons for buttons */
 static void ui_draw_text_icon(uiBut *but)
 {
-       float x;
-       int len;
-       char *cpoin;
+       float x, y;
        short t, pos, ch;
        short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
-       int alpha_offs= (but->flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
        
        /* check for button text label */
        if (but->type == ICONTEXTROW) {
@@ -2267,13 +2335,8 @@ static void ui_draw_text_icon(uiBut *but)
                }
                
                if(but->drawstr[0]!=0) {
-                       int transopts;
                        int tog3= 0;
                        
-                       // cut string in 2 parts
-                       cpoin= strchr(but->drawstr, '|');
-                       if(cpoin) *cpoin= 0;
-
                        /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
                        and offset the text label to accomodate it */
                        
@@ -2309,46 +2372,14 @@ static void ui_draw_text_icon(uiBut *but)
                                if (tog3) glColor3ub(255, 255, 0);
                        }
                        
-                       /* text color, with pulldown item exception */
-                       if(tog3);       // color already set
-                       else if(but->dt==UI_EMBOSSP) {
-                               if((but->flag & UI_ACTIVE) && but->type!=LABEL) {       // LABEL = title in pulldowns
-                                       UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, 0, alpha_offs);
-                               } else {
-                                       UI_ThemeColorShadeAlpha(TH_MENU_TEXT, 0, alpha_offs);
-                               }
-                       }
-                       else {
-                               if(but->flag & UI_SELECT) {             
-                                       UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, 0, alpha_offs);
-                               } else {
-                                       UI_ThemeColorShadeAlpha(TH_BUT_TEXT, 0, alpha_offs);
-                               }
-                       }
-
-                       /* LABEL button exception */
-                       if(but->type==LABEL && but->min!=0.0) UI_ThemeColor(TH_BUT_TEXT_HI);
-               
-                       ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
-                       if(but->type==IDPOIN) transopts= 0;     // no translation, of course!
-                       else transopts= ui_translate_buttons();
+                       /* position and draw */
+                       y = (but->y1+but->y2- 9.0)/2.0;
+                       
+                       if (ELEM(but->type, LABEL, PULLDOWN) && !(but->flag & UI_ACTIVE))
+                               ui_draw_text(but, x, y, BUT_TEXT_SUNKEN);
+                       
+                       ui_draw_text(but, x, y, BUT_TEXT_NORMAL);
                        
-               #ifdef INTERNATIONAL
-                       if (but->type == FTPREVIEW)
-                               FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
-                       else
-                               UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
-               #else
-                       UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
-               #endif
-
-                       /* part text right aligned */
-                       if(cpoin) {
-                               len= UI_GetStringWidth(but->font, cpoin+1, ui_translate_buttons());
-                               ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
-                               UI_DrawString(but->font, cpoin+1, ui_translate_buttons());
-                               *cpoin= '|';
-                       }
                }
                /* if there's no text label, then check to see if there's an icon only and draw it */
                else if( but->flag & UI_HAS_ICON ) {
index 5365c3e09f09dbd88d13228aebeac567959d65ab..06fddc48013205839c20b5c5ff1da8dcd012b2a9 100644 (file)
@@ -261,7 +261,7 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
 {
        uiTooltipData *data;
        int x1, y1, x2, y2;
-
+       
        data= ar->regiondata;
 
        x1= ar->winrct.xmin;
@@ -269,34 +269,21 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar)
        x2= ar->winrct.xmax;
        y2= ar->winrct.ymax;
 
-       /* draw drop shadow */
-       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       /* draw background */
        glEnable(GL_BLEND);
-
-       glColor4ub(0, 0, 0, 20);
-       
-       gl_round_box(GL_POLYGON, 3, 3, x2-x1-3, y2-y1-2, 2.0);
-       gl_round_box(GL_POLYGON, 3, 2, x2-x1-2, y2-y1-2, 3.0);
+       glColor4f(0.15f, 0.15f, 0.15f, 0.85f);
        
-       glColor4ub(0, 0, 0, 8);
-       
-       gl_round_box(GL_POLYGON, 3, 1, x2-x1-1, y2-y1-3, 4.0);
-       gl_round_box(GL_POLYGON, 3, 0, x2-x1-0, y2-y1-3, 5.0);
-
-       glDisable(GL_BLEND);
-       
-       /* draw background */
-       glColor3f(1.0f, 1.0f, 0.8666f);
-       glRectf(0, 4, x2-x1-4, y2-y1);
+       uiSetRoundBox(15);
+       uiRoundBox(data->bbox.xmin, 2, data->bbox.xmax+10, y2-y1-2, 5.0f);
        
        /* draw text */
-       glColor3ub(0,0,0);
+       glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 
-       /* set the position for drawing text +4 in from the left edge, and leaving
+       /* set the position for drawing text +6 in from the left edge, and leaving
         * an equal gap between the top of the background box and the top of the
         * string's bbox, and the bottom of the background box, and the bottom of
         * the string's bbox */
-       ui_rasterpos_safe(4, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, data->aspect);
+       ui_rasterpos_safe(5, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, data->aspect);
        UI_SetScale(1.0);
 
        UI_DrawString(data->font, data->tip, ui_translate_tooltips());
index d0d1da40a8f84b37a6ab2aeac42713fc1545bb7d..a068f11588a05d1c8e7c6b3af247d4630644b4ab 100644 (file)
@@ -458,11 +458,18 @@ void ui_theme_init_userdef(void)
        /* space file */
        /* to have something initialized */
        btheme->tfile= btheme->tv3d;
-       SETCOL(btheme->tfile.back,      128, 128, 128, 255);
-       SETCOL(btheme->tfile.text,      0, 0, 0, 255);
+       SETCOL(btheme->tfile.back,      90, 90, 90, 255);
+       SETCOL(btheme->tfile.text,      240, 240, 240, 255);
        SETCOL(btheme->tfile.text_hi, 255, 255, 255, 255);
-       SETCOL(btheme->tfile.header, 182, 182, 182, 255);
-       SETCOL(btheme->tfile.hilite, 0xA0, 0xA0, 0xD0, 255); // selected files
+       SETCOL(btheme->tfile.header, 195, 195, 195, 255);
+       SETCOL(btheme->tfile.panel, 195, 195, 195, 255);        // bookmark/ui regions
+       SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
+       SETCOL(btheme->tfile.hilite, 0xFF, 0xA0, 0x00, 255); // selected files
+       
+       SETCOL(btheme->tfile.grid,      240, 240, 240, 255);
+       SETCOL(btheme->tfile.image,     240, 240, 240, 255);
+       SETCOL(btheme->tfile.movie,     240, 240, 240, 255);
+       SETCOL(btheme->tfile.scene,     240, 240, 240, 255);
 
        
        /* space action */
index 10c556a087dd4c6cf4d518aec8e83b8e198853c7..c22815882870c7650e23bf3d120fbb41c3121670 100644 (file)
@@ -76,7 +76,7 @@
 #include "file_intern.h"       // own include
 
 /* ui geometry */
-#define IMASEL_BUTTONS_HEIGHT 60
+#define IMASEL_BUTTONS_HEIGHT 40
 #define TILE_BORDER_X 8
 #define TILE_BORDER_Y 8
 
@@ -119,11 +119,11 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 
        int filebuty1, filebuty2;
 
-       float xmin = 10;
+       float xmin = 8;
        float xmax = ar->winx - 10;
 
-       filebuty1= ar->winy - IMASEL_BUTTONS_HEIGHT;
-       filebuty2= filebuty1+IMASEL_BUTTONS_HEIGHT/2 -6;
+       filebuty1= ar->winy - IMASEL_BUTTONS_HEIGHT - 12;
+       filebuty2= filebuty1 + IMASEL_BUTTONS_HEIGHT/2 + 4;
 
        /* HEADER */
        sprintf(name, "win %p", ar);
@@ -150,13 +150,12 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
        menu= fsmenu_build_menu();
 
        if (menu[0]&& (params->type != FILE_MAIN)) {
-               bookmarkbut_width = parentbut_width;
-               file_start_width = parentbut_width;
+               bookmarkbut_width = file_start_width;
        }
 
-       uiDefBut(block, TEX, 0 /* XXX B_FS_FILENAME */,"",      xmin+file_start_width+bookmarkbut_width+2, filebuty1, xmax-xmin-loadbutton-file_start_width-bookmarkbut_width, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
-       uiDefBut(block, TEX, 0 /* XXX B_FS_DIRNAME */,"",       xmin+parentbut_width, filebuty2, xmax-xmin-loadbutton-parentbut_width, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
-
+       uiDefBut(block, TEX, 0 /* XXX B_FS_FILENAME */,"",      xmin+file_start_width+bookmarkbut_width+2, filebuty1, xmax-xmin-loadbutton-file_start_width, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
+       uiDefBut(block, TEX, 0 /* XXX B_FS_DIRNAME */,"",       xmin+file_start_width+bookmarkbut_width+2, filebuty2, xmax-xmin-loadbutton-file_start_width, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
+       
        if(loadbutton) {
                uiSetCurFont(block, UI_HELV);
                uiDefBut(block, BUT, B_FS_EXEC, params->title,  xmax-loadbutton, filebuty2, loadbutton, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
@@ -173,7 +172,6 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 
        MEM_freeN(menu);
 
-       uiDefBut(block, BUT, B_FS_PARENT, "P", xmin, filebuty2, parentbut_width, 21, 0, 0, 0, 0, 0, "Move to the parent directory (PKEY)");     
        uiEndBlock(C, block);
        uiDrawBlock(C, block);
 }
@@ -215,6 +213,37 @@ static float shorten_string(char* string, float w)
        return sw;
 }
 
+static int get_file_icon(struct direntry *file)
+{
+       if (file->type & S_IFDIR)
+               return ICON_FILE_FOLDER;
+       else if (file->flags & BLENDERFILE)
+               return ICON_FILE_BLEND;
+       else if (file->flags & IMAGEFILE)
+               return ICON_FILE_IMAGE;
+       else if (file->flags & MOVIEFILE)
+               return ICON_FILE_MOVIE;
+       else if (file->flags & PYSCRIPTFILE)
+               return ICON_FILE_MOVIE;
+       else
+               return ICON_FILE_BLANK;
+}
+
+static void file_draw_icon(short sx, short sy, int icon, short width, short height)
+{
+       float x,y;
+       int blend=0;
+       
+       x = (float)(sx);
+       y = (float)(sy-height);
+       
+       if (icon == ICON_FILE_BLANK) blend = -80;
+       
+       glEnable(GL_BLEND);
+       
+       UI_icon_draw_aspect_blended(x, y, icon, 1.f, blend);
+}
+
 static void file_draw_string(short sx, short sy, char* string, short width, short height)
 {
        short soffs;
@@ -292,17 +321,14 @@ void file_draw_previews(const bContext *C, ARegion *ar)
                sy = v2d->tot.ymax - sy;
                file = filelist_file(files, i);                         
 
-               if (params->active_file == i) {
-                       colorid = TH_ACTIVE;
-                       draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
-               } else if (file->flags & ACTIVE) {
+               if (file->flags & ACTIVE) {
                        colorid = TH_HILITE;
                        draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
-               } else {
-                       colorid = TH_BACK;
-                       draw_tile(sx, sy, sfile->layout->tile_w, sfile->layout->tile_h, colorid, -5);
+               } else if (params->active_file == i) {
+                       colorid = TH_ACTIVE;
+                       draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
                }
-
+               
                if ( (file->flags & IMAGEFILE) /* || (file->flags & MOVIEFILE) */)
                {
                        if (do_load) {                                  
@@ -315,21 +341,41 @@ void file_draw_previews(const bContext *C, ARegion *ar)
                        imb = filelist_getimage(files, i);
                }
 
-               if (imb) {              
+               if (imb) {
                        float fx = ((float)layout->prv_w - (float)imb->x)/2.0f;
                        float fy = ((float)layout->prv_h - (float)imb->y)/2.0f;
-                       short dx = (short)(fx + 0.5f + sfile->layout->prv_border_x);
-                       short dy = (short)(fy + 0.5f - sfile->layout->prv_border_y);
+                       float dx = (fx + 0.5f + sfile->layout->prv_border_x);
+                       float dy = (fy + 0.5f - sfile->layout->prv_border_y);
+                       float xco = (float)sx + dx;
+                       float yco = (float)sy - sfile->layout->prv_h + dy;
+                       
+                       glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
+                       
+                       /* shadow */
+                       if (file->flags & IMAGEFILE)
+                               uiDrawBoxShadow(220, xco, yco, xco + imb->x, yco + imb->y);
                        
                        glEnable(GL_BLEND);
-                       glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);                                                                                                     
+                       
+                       /* the image */
                        // glaDrawPixelsSafe((float)sx+8 + dx, (float)sy - imgwidth + dy - 8, imb->x, imb->y, imb->x, GL_RGBA, GL_UNSIGNED_BYTE, imb->rect);
                        glColor4f(1.0, 1.0, 1.0, 1.0);
-                       glaDrawPixelsTex((float)sx + dx, (float)sy - sfile->layout->prv_h + dy, imb->x, imb->y,GL_UNSIGNED_BYTE, imb->rect);
+                       glaDrawPixelsTex(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect);
+                       
+                       /* border */
+                       if (file->flags & IMAGEFILE) {
+                               glColor4f(0.0, 0.0, 0.0, 0.4);
+                               fdrawbox(xco, yco, xco + imb->x, yco + imb->y);
+                       }
+                       
                        glDisable(GL_BLEND);
                        imb = 0;
                }
 
+               /* shadow */
+               UI_ThemeColorShade(TH_BACK, -60);
+               file_draw_string(sx + layout->prv_border_x, sy+3, file->relname, layout->tile_w, layout->tile_h);
+               
                if (type == FILE_MAIN) {
                        glColor4f(1.0f, 1.0f, 1.0f, 1.0f);                      
                }
@@ -356,14 +402,14 @@ void file_draw_previews(const bContext *C, ARegion *ar)
                                }
                        }
                }
-                       
-               file_draw_string(sx + layout->prv_border_x, sy+U.fontsize*3/2, file->relname, layout->tile_w, layout->tile_h);
+               file_draw_string(sx + layout->prv_border_x, sy+4, file->relname, layout->tile_w, layout->tile_h);
 
                if (!sfile->loadimage_timer)
                        sfile->loadimage_timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER1, 1.0/30.0);  /* max 30 frames/sec. */
 
        }
 
+       uiSetRoundBox(0);
 }
 
 
@@ -392,6 +438,19 @@ void file_draw_list(const bContext *C, ARegion *ar)
        offset = ED_fileselect_layout_offset(layout, 0, 0);
        if (offset<0) offset=0;
 
+       /* alternating flat shade background */
+       for (i=offset; (i <= numfiles); ++i)
+       {
+               ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
+               sx = v2d->tot.xmin;
+               sy = v2d->tot.ymax - (sy + 2*layout->tile_border_y);
+               
+               if (i % 2) UI_ThemeColor(TH_BACK);
+               else UI_ThemeColorShade(TH_BACK, -10);
+               glRectf(v2d->tot.xmin, sy, v2d->tot.xmax, sy+layout->tile_h+2*layout->tile_border_y);
+       }
+       
+       /* vertical column dividers */
        while (sx < ar->v2d.cur.xmax) {
                sx += (sfile->layout->tile_w+2*sfile->layout->tile_border_x);
                glColor4ub(0xB0,0xB0,0xB0, 0xFF);
@@ -400,11 +459,9 @@ void file_draw_list(const bContext *C, ARegion *ar)
                sdrawline(sx,  ar->v2d.cur.ymax - layout->tile_border_y ,  sx,  ar->v2d.cur.ymin + layout->tile_border_y); 
        }
 
-
        sx = ar->v2d.cur.xmin + layout->tile_border_x;
        sy = ar->v2d.cur.ymax - layout->tile_border_y;
 
-       if (offset<0) offset=0;
        for (i=offset; (i < numfiles); ++i)
        {
                ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
@@ -437,8 +494,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
                }
                
                spos = sx;
+               
+               file_draw_icon(spos, sy-3, get_file_icon(file), 16, 16);
+               
+               spos += 16 + 4;
+               
                sw = UI_GetStringWidth(G.font, file->size, 0);
                file_draw_string(spos, sy, file->relname, layout->tile_w - sw - 5, layout->tile_h);
+               
                spos += filelist_maxnamelen(sfile->files);
                if (params->display != FILE_SHOWSHORT) {
 #if 0 // XXX TODO: add this for non-windows systems
@@ -483,10 +546,10 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar)
        int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X;
        int fontsize = U.fontsize;
 
-               sx = ar->v2d.cur.xmin + TILE_BORDER_X;
-               sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y;
-               for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
-                       char *fname = fsmenu_get_entry(i);
+       sx = ar->v2d.cur.xmin + TILE_BORDER_X;
+       sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y;
+       for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
+               char *fname = fsmenu_get_entry(i);
 
                if (fname) {
                        int sl;
index 1e4feeed40576ba7f7293ca47c7f7db2a23fc3c0..e278b9cd227a9591e01bf7badac614dd13f487e8 100644 (file)
@@ -128,10 +128,10 @@ void file_header_buttons(const bContext *C, ARegion *ar)
        
        xco= ED_area_header_standardbuttons(C, block, yco);
        
+       /*
        if((sa->flag & HEADER_NO_PULLDOWN)==0) {
                int xmax;
                
-               /* pull down menus */
                uiBlockSetEmboss(block, UI_EMBOSSP);
                
                xmax= GetButStringLength("View");
@@ -139,34 +139,46 @@ void file_header_buttons(const bContext *C, ARegion *ar)
                                                 "View", xco, yco-2, xmax-3, 24, "");
                xco+=XIC+xmax;
        }
+        */
        
        /* SORT TYPE */
        uiBlockSetEmboss(block, UI_EMBOSSX);
+       
+       xco += 5;
+       
+       uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_TRIA_UP, xco, yco, 20, 20, "Navigate to Parent Folder");
+       
        xco+=XIC;
+       
+       if (sfile->params->type != FILE_MAIN) {
+               uiBlockBeginAlign(block);
+               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, 1.0, 0, 0, "Displays short file description");
+               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY,  xco+=XIC, yco, XIC,YIC, &params->display, 1.0, 2.0, 0, 0, "Displays long file description");
+               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMGDISPLAY,   xco+=XIC, yco, XIC,YIC, &params->display, 1.0, 3.0, 0, 0, "Displays files as thumbnails");
+               uiBlockEndAlign(block);
+               
+               xco+=XIC;
+       }
+       
        uiBlockBeginAlign(block);
-       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA,     xco+=XIC,0,XIC,YIC, &params->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
-       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTBYEXT,     xco+=XIC,0,XIC,YIC, &params->sort, 1.0, 3.0, 0, 0, "Sorts files by extension"); 
-       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTTIME,      xco+=XIC,0,XIC,YIC, &params->sort, 1.0, 1.0, 0, 0, "Sorts files by time");
-       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTSIZE,      xco+=XIC,0,XIC,YIC, &params->sort, 1.0, 2.0, 0, 0, "Sorts files by size");      
+       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA,     xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
+       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTBYEXT,     xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 3.0, 0, 0, "Sorts files by extension");     
+       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTTIME,      xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 1.0, 0, 0, "Sorts files by time");
+       uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTSIZE,      xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 2.0, 0, 0, "Sorts files by size");  
        uiBlockEndAlign(block);
-       xco+=XIC+10;
+       
+       xco+=XIC;
 
+       /* replace with consistent sub-region collapsing
        if (sfile->params->type != FILE_MAIN) {
                uiBlockBeginAlign(block);
                // uiDefIconButBitS(block, TOG, FILE_BOOKMARKS, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, &params->flag, 0, 0, 0, 0, "Toggles Bookmarks on/off");
-               uiDefIconButO(block, TOG, "FILE_OT_bookmark_toggle", WM_OP_INVOKE_DEFAULT, ICON_BOOKMARKS, xco,yco,20,20, "Toggle Bookmarks");
+               uiDefIconButO(block, TOG, "FILE_OT_bookmark_toggle", WM_OP_INVOKE_DEFAULT, ICON_BOOKMARKS, xco+XIC,yco,20,20, "Toggle Bookmarks");
                uiBlockEndAlign(block);
-               xco+=XIC+10;
-       } 
+               xco+=XIC;
+       }
+        */
 
-       if (sfile->params->type != FILE_MAIN) {
-               uiBlockBeginAlign(block);
-               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC,0,XIC,YIC, &params->display, 1.0, 1.0, 0, 0, "Displays short file description");
-               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY,  xco+=XIC,0,XIC,YIC, &params->display, 1.0, 2.0, 0, 0, "Displays long file description");
-               uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMAGE_COL /* ICON_IMGDISPLAY */,      xco+=XIC,0,XIC,YIC, &params->display, 1.0, 3.0, 0, 0, "Displays files as thumbnails");
-               uiBlockEndAlign(block);
-               xco+=XIC+10;
-       } 
        xcotitle= xco;
        xco+= UI_GetStringWidth(G.font, params->title, 0);
 
index f4f512ff8c2076cb927683a1a4a6e46df05e603a..ae4bc9e639cd4e9ee06489660d8a64e8543274ba 100644 (file)
@@ -181,12 +181,12 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
        if (params->display == FILE_IMGDISPLAY) {
                sfile->layout->prv_w = 96;
                sfile->layout->prv_h = 96;
-               sfile->layout->tile_border_x = 4;
-               sfile->layout->tile_border_y = 4;
-               sfile->layout->prv_border_x = 4;
-               sfile->layout->prv_border_y = 4;
+               sfile->layout->tile_border_x = 6;
+               sfile->layout->tile_border_y = 6;
+               sfile->layout->prv_border_x = 6;
+               sfile->layout->prv_border_y = 6;
                sfile->layout->tile_w = sfile->layout->prv_w + 2*sfile->layout->prv_border_x;
-               sfile->layout->tile_h = sfile->layout->prv_h + 4*sfile->layout->prv_border_y + U.fontsize*3/2;
+               sfile->layout->tile_h = sfile->layout->prv_h + 2*sfile->layout->prv_border_y + U.fontsize;
                sfile->layout->width= (v2d->cur.xmax - v2d->cur.xmin - 2*sfile->layout->tile_border_x);
                sfile->layout->columns= sfile->layout->width / (sfile->layout->tile_w + 2*sfile->layout->tile_border_x);
                if(sfile->layout->columns)
index da7b61b5ee728875944051b02cbd581dfde7f5b4..1c7edd24df5a4262edac14d03f262c4ba7ce2225 100644 (file)
@@ -84,14 +84,13 @@ static SpaceLink *file_new(const bContext *C)
        ar= MEM_callocN(sizeof(ARegion), "header for file");
        BLI_addtail(&sfile->regionbase, ar);
        ar->regiontype= RGN_TYPE_HEADER;
-       ar->alignment= RGN_ALIGN_BOTTOM;
+       ar->alignment= RGN_ALIGN_TOP;
 
        /* channel list region */
        ar= MEM_callocN(sizeof(ARegion), "channel area for file");
        BLI_addtail(&sfile->regionbase, ar);
        ar->regiontype= RGN_TYPE_CHANNELS;
-       ar->alignment= RGN_ALIGN_LEFT;
-       ar->flag |= RGN_FLAG_HIDDEN;
+       ar->alignment= RGN_ALIGN_LEFT;  
 
        /* ui list region */
        ar= MEM_callocN(sizeof(ARegion), "ui area for file");
@@ -302,7 +301,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar)
        View2D *v2d= &ar->v2d;
        float col[3];
 
-       UI_GetThemeColor3fv(TH_BACK, col);
+       UI_GetThemeColor3fv(TH_PANEL, col);
        glClearColor(col[0], col[1], col[2], 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
 
@@ -350,7 +349,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
 {
        float col[3];
        /* clear */
-       UI_GetThemeColor3fv(TH_BACK, col);
+       UI_GetThemeColor3fv(TH_PANEL, col);
        glClearColor(col[0], col[1], col[2], 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
 
@@ -403,7 +402,7 @@ void ED_spacetype_file(void)
        /* regions: ui */
        art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
        art->regionid = RGN_TYPE_UI;
-       art->minsizey= 80;
+       art->minsizey= 60;
        art->keymapflag= ED_KEYMAP_UI;
        art->init= file_ui_area_init;
        art->draw= file_ui_area_draw;
index 8b72e20ec511d378a261b2c6dd5a08bb1b69dbfc..69f33df3005e705e2b47692371e12dbd2aaed404 100644 (file)
@@ -404,7 +404,7 @@ void info_header_buttons(const bContext *C, ARegion *ar)
                uiBlockSetEmboss(block, UI_EMBOSSP);
                
                xmax= GetButStringLength("File");
-               uiDefMenuBut(block, info_filemenu, NULL, "File", xco, yco, xmax-3, 24, "");
+               uiDefMenuBut(block, info_filemenu, NULL, "File", xco, yco, xmax-3, 22, "");
                xco+= xmax;
                
                xmax= GetButStringLength("Add");
index 2797f22daf8065f79fbf97ec5563bce01ade6732..e3b8233e12be2258b77ef8f7db9c7923b315ee79 100644 (file)
@@ -222,7 +222,7 @@ void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image.");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
-       prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_NONE);
+       prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
        RNA_def_property_int_sdna(prop, NULL, "size");
        RNA_def_property_range(prop, 1, 400);
        RNA_def_property_ui_text(prop, "Resolution %", "Preview scale for render resolution");