[Bf-blender-cvs] [3a09e34eb10] filebrowser_redesign: Align modification date column to center, size to the right
Julian Eisel
noreply at git.blender.org
Thu Jul 25 00:26:12 CEST 2019
Commit: 3a09e34eb107b595a645223db098c6729ff38b71
Author: Julian Eisel
Date: Thu Jul 25 00:24:32 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB3a09e34eb107b595a645223db098c6729ff38b71
Align modification date column to center, size to the right
===================================================================
M source/blender/editors/include/ED_fileselect.h
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/filesel.c
===================================================================
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index e1a7c319c9a..57e35a26121 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -50,6 +50,9 @@ typedef struct FileDetailsColumn {
float width;
/* The sort type to use when sorting by this column. */
int sort_type; /* eFileSortType */
+
+ /* Alignment of column texts, header text is always left aligned */
+ int text_align; /* eFontStyle_Align */
} FileDetailsColumn;
typedef struct FileLayout {
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 29ddddb5e18..25874145cc9 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -811,7 +811,7 @@ static void draw_details_columns(const FileSelectParams *params,
{
const bool small_size = SMALL_SIZE_CHECK(params->thumbnail_size);
const bool update_stat_strings = small_size != SMALL_SIZE_CHECK(layout->curr_size);
- int sx = pos_x - layout->tile_border_x, sy = pos_y;
+ int sx = pos_x - layout->tile_border_x - (UI_UNIT_X * 0.1f), sy = pos_y;
for (FileListColumns column_type = 0; column_type < COLUMN_MAX; column_type++) {
const FileDetailsColumn *column = &layout->details_columns[column_type];
@@ -830,7 +830,7 @@ static void draw_details_columns(const FileSelectParams *params,
str,
column->width - 2 * DETAILS_COLUMN_PADDING,
layout->tile_h,
- UI_STYLE_TEXT_LEFT,
+ column->text_align,
text_col);
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 287a2a2c1f9..a0dadcf4102 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -642,10 +642,13 @@ static void details_columns_init(const FileSelectParams *params, FileLayout *lay
layout->details_columns[COLUMN_NAME].name = "Name";
layout->details_columns[COLUMN_NAME].sort_type = FILE_SORT_ALPHA;
+ layout->details_columns[COLUMN_NAME].text_align = UI_STYLE_TEXT_LEFT;
layout->details_columns[COLUMN_DATETIME].name = "Date Modified";
layout->details_columns[COLUMN_DATETIME].sort_type = FILE_SORT_TIME;
+ layout->details_columns[COLUMN_DATETIME].text_align = UI_STYLE_TEXT_CENTER;
layout->details_columns[COLUMN_SIZE].name = "Size";
layout->details_columns[COLUMN_SIZE].sort_type = FILE_SORT_SIZE;
+ layout->details_columns[COLUMN_SIZE].text_align = UI_STYLE_TEXT_RIGHT;
}
void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
More information about the Bf-blender-cvs
mailing list