[Bf-blender-cvs] [f7d848bfd55] filebrowser_redesign: Add padding to details columns
Julian Eisel
noreply at git.blender.org
Mon Jul 22 19:37:25 CEST 2019
Commit: f7d848bfd55ceb6c7600bd66d62364c7bed733a4
Author: Julian Eisel
Date: Mon Jul 22 19:29:13 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBf7d848bfd55ceb6c7600bd66d62364c7bed733a4
Add padding to details columns
===================================================================
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/file_intern.h
M source/blender/editors/space_file/filesel.c
===================================================================
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 200d7a34119..21c22efa7fa 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -70,8 +70,6 @@
#include "file_intern.h" // own include
-#define COLUMN_PADDING (0.6f * UI_UNIT_X)
-
/* Dummy helper - we need dynamic tooltips here. */
static char *file_draw_tooltip_func(bContext *UNUSED(C), void *argN, const char *UNUSED(tip))
{
@@ -750,8 +748,9 @@ static void draw_columnheader_columns(const FileSelectParams *params,
if (!filelist_column_enabled(params, column)) {
continue;
}
- const int width = (column == COLUMN_NAME) ? remaining_width :
- layout->column_widths[column] + COLUMN_PADDING;
+ const int width = (column == COLUMN_NAME) ?
+ remaining_width :
+ layout->column_widths[column] + DETAILS_COLUMN_PADDING;
/* Active sort type triangle */
if (filelist_column_matches_sort(params, column)) {
@@ -861,10 +860,15 @@ static void draw_details_columns(const FileSelectParams *params,
const char *str = filelist_get_details_column_string(
column, file, small_size, update_stat_strings);
- sx -= (int)layout->column_widths[column] + COLUMN_PADDING;
+ sx -= (int)layout->column_widths[column] + DETAILS_COLUMN_PADDING;
if (str) {
- file_draw_string(
- sx, sy, str, layout->column_widths[column], layout->tile_h, align, text_col);
+ file_draw_string(sx + DETAILS_COLUMN_PADDING,
+ sy,
+ str,
+ layout->column_widths[column],
+ layout->tile_h,
+ align,
+ text_col);
}
}
}
@@ -1033,7 +1037,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
width = layout->tile_w - 2 * padx;
}
else if (params->display == FILE_LONGDISPLAY) {
- width = layout->column_widths[COLUMN_NAME] + COLUMN_PADDING - 2 * padx;
+ width = layout->column_widths[COLUMN_NAME] + DETAILS_COLUMN_PADDING - 2 * padx;
}
else {
BLI_assert(params->display == FILE_IMGDISPLAY);
@@ -1070,7 +1074,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
sx + 1 + icon_ofs, tpos, file->name, (float)textwidth, textheight, align, text_col);
}
- sx += (int)layout->column_widths[COLUMN_NAME] + COLUMN_PADDING;
+ sx += (int)layout->column_widths[COLUMN_NAME] + DETAILS_COLUMN_PADDING;
draw_details_columns(params, layout, file, xmin, sy, align, text_col);
}
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 5fea2637130..68412e2b21d 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -42,6 +42,8 @@ struct ARegion *file_tools_region(struct ScrArea *sa);
#define IMASEL_BUTTONS_HEIGHT (UI_UNIT_Y * 2)
#define IMASEL_BUTTONS_MARGIN (UI_UNIT_Y / 6)
+#define DETAILS_COLUMN_PADDING (0.6f * UI_UNIT_X)
+
#define SMALL_SIZE_CHECK(_size) ((_size) < 64) /* Related to FileSelectParams.thumbnail_size. */
#if 0
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index f03b3d8b3a1..ad0de41c2fa 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -545,6 +545,7 @@ static void column_widths(FileSelectParams *params, struct FileLayout *layout)
{
int i;
const bool small_size = SMALL_SIZE_CHECK(params->thumbnail_size);
+ const int pad = small_size ? 0 : DETAILS_COLUMN_PADDING;
for (i = 0; i < MAX_FILE_COLUMN; ++i) {
layout->column_widths[i] = 0;
@@ -552,9 +553,10 @@ static void column_widths(FileSelectParams *params, struct FileLayout *layout)
layout->column_widths[COLUMN_NAME] = ((float)params->thumbnail_size / 8.0f) * UI_UNIT_X;
/* Biggest possible reasonable values... */
- layout->column_widths[COLUMN_DATE] = file_string_width(small_size ? "23/08/89" : "23-Dec-89");
- layout->column_widths[COLUMN_TIME] = file_string_width("23:59");
- layout->column_widths[COLUMN_SIZE] = file_string_width(small_size ? "98.7 M" : "98.7 MiB");
+ layout->column_widths[COLUMN_DATE] = file_string_width(small_size ? "23/08/89" : "23-Dec-89") +
+ pad;
+ layout->column_widths[COLUMN_TIME] = file_string_width("23:59") + pad;
+ layout->column_widths[COLUMN_SIZE] = file_string_width(small_size ? "98.7 M" : "98.7 MiB") + pad;
}
static void column_names(FileLayout *layout)
More information about the Bf-blender-cvs
mailing list