* More 2.5 UI tweaks - text/controls/file browser
This commit is contained in:
@@ -44,6 +44,7 @@ typedef struct IconFile {
|
||||
} IconFile;
|
||||
|
||||
#define ICON_DEFAULT_HEIGHT 16
|
||||
#define ICON_DEFAULT_WIDTH 16
|
||||
#define PREVIEW_DEFAULT_HEIGHT 96
|
||||
|
||||
/*
|
||||
|
||||
@@ -2216,7 +2216,7 @@ static void ui_draw_text(uiBut *but, float x, float y, int sunken)
|
||||
|
||||
if (sunken) {
|
||||
y -= 1.0;
|
||||
col_offs = 230;
|
||||
col_offs = 200;
|
||||
}
|
||||
|
||||
/* text color, with pulldown item exception */
|
||||
@@ -2225,7 +2225,7 @@ static void ui_draw_text(uiBut *but, float x, float y, int sunken)
|
||||
float col[4];
|
||||
UI_GetThemeColor4ubv(TH_MENU_TEXT, col);
|
||||
if ((col[0] + col[1] + col[2]) / 3.f < 0.5f)
|
||||
UI_ThemeColorShadeAlpha(TH_HEADER, 40, alpha_offs);
|
||||
UI_ThemeColorShadeAlpha(TH_HEADER, 20, alpha_offs);
|
||||
} else if((but->flag & UI_ACTIVE) && but->type!=LABEL) { // LABEL = title in pulldowns
|
||||
UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, 0, alpha_offs);
|
||||
} else {
|
||||
|
||||
@@ -459,17 +459,17 @@ void ui_theme_init_userdef(void)
|
||||
/* to have something initialized */
|
||||
btheme->tfile= btheme->tv3d;
|
||||
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.text, 250, 250, 250, 255);
|
||||
SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
|
||||
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.hilite, 255, 140, 25, 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);
|
||||
SETCOL(btheme->tfile.grid, 250, 250, 250, 255);
|
||||
SETCOL(btheme->tfile.image, 250, 250, 250, 255);
|
||||
SETCOL(btheme->tfile.movie, 250, 250, 250, 255);
|
||||
SETCOL(btheme->tfile.scene, 250, 250, 250, 255);
|
||||
|
||||
|
||||
/* space action */
|
||||
|
||||
@@ -373,8 +373,8 @@ void file_draw_previews(const bContext *C, ARegion *ar)
|
||||
}
|
||||
|
||||
/* shadow */
|
||||
UI_ThemeColorShade(TH_BACK, -60);
|
||||
file_draw_string(sx + layout->prv_border_x, sy+3, file->relname, layout->tile_w, layout->tile_h);
|
||||
UI_ThemeColorShade(TH_BACK, -20);
|
||||
//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);
|
||||
@@ -443,20 +443,22 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
{
|
||||
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
|
||||
sx = v2d->tot.xmin;
|
||||
sy = v2d->tot.ymax - (sy + 2*layout->tile_border_y);
|
||||
sy = v2d->tot.ymax - (sy + layout->tile_border_y);
|
||||
//sy = v2d->tot.ymax - sy;
|
||||
|
||||
if (i % 2) UI_ThemeColor(TH_BACK);
|
||||
else UI_ThemeColorShade(TH_BACK, -10);
|
||||
else UI_ThemeColorShade(TH_BACK, -7);
|
||||
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);
|
||||
sdrawline(sx+1, ar->v2d.cur.ymax - layout->tile_border_y , sx+1, ar->v2d.cur.ymin + layout->tile_border_y);
|
||||
glColor4ub(0x30,0x30,0x30, 0xFF);
|
||||
sdrawline(sx, ar->v2d.cur.ymax - layout->tile_border_y , sx, ar->v2d.cur.ymin + layout->tile_border_y);
|
||||
|
||||
UI_ThemeColorShade(TH_BACK, 30);
|
||||
sdrawline(sx+1, ar->v2d.cur.ymax - layout->tile_border_y , sx+1, ar->v2d.cur.ymin);
|
||||
UI_ThemeColorShade(TH_BACK, -30);
|
||||
sdrawline(sx, ar->v2d.cur.ymax - layout->tile_border_y , sx, ar->v2d.cur.ymin);
|
||||
}
|
||||
|
||||
sx = ar->v2d.cur.xmin + layout->tile_border_x;
|
||||
@@ -473,31 +475,22 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
if (params->active_file == i) {
|
||||
if (file->flags & ACTIVE) colorid= TH_HILITE;
|
||||
else colorid = TH_BACK;
|
||||
draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h, colorid,20);
|
||||
draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,20);
|
||||
} else if (file->flags & ACTIVE) {
|
||||
colorid = TH_HILITE;
|
||||
draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h, colorid,0);
|
||||
draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,0);
|
||||
} else {
|
||||
/*
|
||||
colorid = TH_PANEL;
|
||||
draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, colorid);
|
||||
*/
|
||||
}
|
||||
if (type == FILE_MAIN) {
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
if (S_ISDIR(file->type))
|
||||
UI_ThemeColor4(TH_TEXT_HI);
|
||||
else
|
||||
UI_ThemeColor4(TH_TEXT);
|
||||
}
|
||||
|
||||
|
||||
spos = sx;
|
||||
file_draw_icon(spos, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
|
||||
spos += ICON_DEFAULT_WIDTH + 4;
|
||||
|
||||
file_draw_icon(spos, sy-3, get_file_icon(file), 16, 16);
|
||||
|
||||
spos += 16 + 4;
|
||||
UI_ThemeColor4(TH_TEXT);
|
||||
|
||||
sw = UI_GetStringWidth(G.font, file->size, 0);
|
||||
file_draw_string(spos, sy, file->relname, layout->tile_w - sw - 5, layout->tile_h);
|
||||
@@ -546,14 +539,20 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar)
|
||||
FileSelectParams* params = ED_fileselect_get_params(sfile);
|
||||
char bookmark[FILE_MAX];
|
||||
int nentries = fsmenu_get_nentries();
|
||||
int linestep = U.fontsize*3/2;
|
||||
int linestep = U.fontsize*2.0f;
|
||||
int i;
|
||||
short sx, sy;
|
||||
int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X;
|
||||
short sx, sy, xpos, ypos;
|
||||
int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - TILE_BORDER_X;
|
||||
int fontsize = U.fontsize;
|
||||
|
||||
sx = ar->v2d.cur.xmin + TILE_BORDER_X;
|
||||
sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y;
|
||||
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
file_draw_string(sx, sy, "BOOKMARKS", bmwidth, fontsize);
|
||||
|
||||
sy -= linestep;
|
||||
|
||||
for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
|
||||
char *fname = fsmenu_get_entry(i);
|
||||
|
||||
@@ -567,23 +566,28 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar)
|
||||
sl--;
|
||||
}
|
||||
if (params->active_bookmark == i ) {
|
||||
glColor4ub(0, 0, 0, 100);
|
||||
UI_ThemeColor(TH_HILITE);
|
||||
uiSetRoundBox(15);
|
||||
uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6);
|
||||
// glRecti(sx, sy - linestep, sx + bmwidth, sy);
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
} else {
|
||||
/* uiSetRoundBox(15);
|
||||
* uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 4.0f); */
|
||||
glRectf(ar->v2d.cur.xmin, sy-linestep, ar->v2d.cur.xmax + 2*TILE_BORDER_X, sy);
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
} else {
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
}
|
||||
|
||||
file_draw_string(sx, sy, bookmark, bmwidth, fontsize);
|
||||
xpos = sx;
|
||||
ypos = sy - (TILE_BORDER_Y * 0.5);
|
||||
|
||||
file_draw_icon(xpos, ypos, ICON_FILE_FOLDER, ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
|
||||
xpos += ICON_DEFAULT_WIDTH + 4;
|
||||
file_draw_string(xpos, ypos, bookmark, bmwidth, fontsize);
|
||||
sy -= linestep;
|
||||
} else {
|
||||
glColor4ub(0xB0,0xB0,0xB0, 0xFF);
|
||||
sdrawline(sx, sy-1-fontsize/2 , sx + bmwidth, sy-1-fontsize/2);
|
||||
glColor4ub(0x30,0x30,0x30, 0xFF);
|
||||
sdrawline(sx, sy-fontsize/2 , sx + bmwidth, sy - fontsize/2);
|
||||
UI_ThemeColorShade(TH_PANEL, 30);
|
||||
sdrawline(sx, sy-1-fontsize/2, sx + bmwidth, sy-1-fontsize/2);
|
||||
UI_ThemeColorShade(TH_PANEL, -30);
|
||||
sdrawline(sx, sy-fontsize/2, sx + bmwidth, sy - fontsize/2);
|
||||
|
||||
sy -= linestep;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,9 @@ static void set_active_bookmark(FileSelectParams* params, struct ARegion* ar, sh
|
||||
UI_view2d_region_to_view(&ar->v2d, x, y, &fx, &fy);
|
||||
|
||||
posy = ar->v2d.cur.ymax - 2*TILE_BORDER_Y - fy;
|
||||
params->active_bookmark = ((float)posy / (U.fontsize*3.0f/2.0f));
|
||||
posy -= U.fontsize*2.0f; /* header */
|
||||
|
||||
params->active_bookmark = ((float)posy / (U.fontsize*2.0f));
|
||||
if (params->active_bookmark < 0 || params->active_bookmark > nentries) {
|
||||
params->active_bookmark = -1;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
|
||||
sfile->layout->prv_w = 0;
|
||||
sfile->layout->prv_h = 0;
|
||||
sfile->layout->tile_border_x = 8;
|
||||
sfile->layout->tile_border_y = 1;
|
||||
sfile->layout->tile_border_y = 2;
|
||||
sfile->layout->prv_border_x = 0;
|
||||
sfile->layout->prv_border_y = 0;
|
||||
sfile->layout->tile_w = v2d->cur.xmax - v2d->cur.xmin - 2*sfile->layout->tile_border_x;
|
||||
|
||||
Reference in New Issue
Block a user