Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-01-04 01:58:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-04 03:00:48 +0300
commit54a4c1cf359c369c8fc16ecf0ecaa92e6f650e2f (patch)
tree763437a793072d559095c6bb8d9cf23ca1c111f1 /source/blender/editors/space_file
parent4431c5825bf26d314abe1f79646883fd746e495b (diff)
UI: refactor layout vars out of uiFontStyle
Word wrap and alignment layout args only used by UI_fontstyle_draw were vars in uiFontStyle. These were written to before drawing, so better pass as an argument. Pass uiFontStyle & uiWidgetColors as const args.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/file_draw.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 08dafe0cb88..4b2486f2a68 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -291,8 +291,9 @@ static void file_draw_icon(uiBlock *block, const char *path, int sx, int sy, int
}
-static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align,
- const unsigned char col[4])
+static void file_draw_string(
+ int sx, int sy, const char *string, float width, int height, eFontStyle_Align align,
+ const uchar col[4])
{
uiStyle *style;
uiFontStyle fs;
@@ -306,8 +307,6 @@ static void file_draw_string(int sx, int sy, const char *string, float width, in
style = UI_style_get();
fs = style->widgetlabel;
- fs.align = align;
-
BLI_strncpy(fname, string, FILE_MAXFILE);
UI_text_clip_middle_ex(&fs, fname, width, UI_DPI_ICON_SIZE, sizeof(fname), '\0');
@@ -317,7 +316,9 @@ static void file_draw_string(int sx, int sy, const char *string, float width, in
rect.ymin = sy - height;
rect.ymax = sy;
- UI_fontstyle_draw(&fs, &rect, fname, col);
+ UI_fontstyle_draw(
+ &fs, &rect, fname, col,
+ &(struct uiFontStyleDraw_Params) { .align = align, });
}
void file_calc_previews(const bContext *C, ARegion *ar)
@@ -553,7 +554,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
int textwidth, textheight;
int i;
bool is_icon;
- short align;
+ eFontStyle_Align align;
bool do_drag;
int column_space = 0.6f * UI_UNIT_X;
unsigned char text_col[4];