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:
authorAntony Riakiotakis <kalast@gmail.com>2015-04-22 14:19:58 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-04-22 14:19:58 +0300
commit1044dfd965a8a0b85095ce51b34eb3876701d967 (patch)
tree6dbcdbc82c21bb79be523e453339969dd67272ff /source/blender
parenta069b8d5d8195b9eb517c604f151366b51578d1e (diff)
Fix and simplify vertical positioning and calculation of metadata
display more.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/ED_util.h2
-rw-r--r--source/blender/editors/screen/area.c22
2 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 96d7828ffe9..9556c601d1f 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -42,8 +42,6 @@ void ED_editors_exit(struct bContext *C);
bool ED_editors_flush_edits(const struct bContext *C, bool for_render);
-void ED_draw_ibuf_meta_data(const bContext *C, struct ImBuf *ibuf);
-
/* ************** Undo ************************ */
/* undo.c */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c6de4e5df88..8844f344a6b 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2097,7 +2097,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i
else {
len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]);
if (metadata_is_valid(ibuf, temp_str, i + 1, len)) {
- BLF_position(fontid, rect.xmax + (0.2f * U.widget_unit),
+ line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_position(fontid, rect.xmax - line_width - (0.2f * U.widget_unit),
rect.ymax - factor * (1.5f * U.widget_unit - UI_UNIT_Y) - ofs_y, 0.0f);
BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
ofs_y += (height + (0.2f * U.widget_unit));
@@ -2112,7 +2113,7 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i
if (metadata_is_valid(ibuf, temp_str, i, len)) {
const int line_height = height;
BLF_position(fontid, rect.xmin + (0.2f * U.widget_unit) + ofs_x,
- rect.ymin - line_height + factor * (1.5f * U.widget_unit), 0.0f);
+ rect.ymin - line_height + factor * (U.widget_unit), 0.0f);
BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX);
ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X;
@@ -2124,26 +2125,29 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i
static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
{
char str[MAX_METADATA_STR];
- float height = 0;
- short i;
+ short i, count = 0;
+ const float height = BLF_height_max(fontid) + 0.2f * U.widget_unit;
if (is_top) {
- for (i = 0; i < 5 ; i++) {
+ if (metadata_is_valid(ibuf, str, 0, 0) || metadata_is_valid(ibuf, str, 1, 0)) {
+ count++;
+ }
+ for (i = 2; i < 5; i++) {
if (metadata_is_valid(ibuf, str, i, 0)) {
- height += BLF_height(fontid, str, strlen(str));
+ count++;
}
}
}
else {
for (i = 5; i < 10; i++) {
if (metadata_is_valid(ibuf, str, i, 0)) {
- height += BLF_height(fontid, str, strlen(str));
+ count = 1;
}
}
}
- if (height) {
- return (height + (0.2f * U.widget_unit));
+ if (count) {
+ return (height * count + (0.2f * U.widget_unit));
}
return 0;