Commit: 1cf883f5ac810894710f1fdb9be0db12083c8054
Author: Campbell Barton
Date:   Mon Aug 31 11:56:04 2015 +1000
Branches: temp-blf-wordwrap
https://developer.blender.org/rB1cf883f5ac810894710f1fdb9be0db12083c8054

Rename `lines_wrap` to `lines`, since this is used for \n newlines too.

===================================================================

M       source/blender/blenfont/BLF_api.h
M       source/blender/blenfont/intern/blf_font.c
M       source/blender/editors/interface/interface_regions.c

===================================================================

diff --git a/source/blender/blenfont/BLF_api.h 
b/source/blender/blenfont/BLF_api.h
index a066a98..aa8f221 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -230,10 +230,12 @@ extern int blf_mono_font_render; /* don't mess drawing 
with render threads. */
  */
 struct ResultBLF {
        /**
-        * Number of lines drawn when #BLF_WORD_WRAP is enabled
+        * Number of lines drawn when #BLF_WORD_WRAP is enabled (both wrapped 
and `\n` newline).
+        */
+       int lines;
+       /**
+        * The 'cursor' position on completion (ignoring character boundbox).
         */
-       int lines_wrap;
-
        int width;
 };
 
diff --git a/source/blender/blenfont/intern/blf_font.c 
b/source/blender/blenfont/intern/blf_font.c
index c2b0022..4e6e20f 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -207,7 +207,7 @@ static void blf_font_draw_ex(
        }
 
        if (r_info) {
-               r_info->lines_wrap = 1;
+               r_info->lines = 1;
                r_info->width = pen_x;
        }
 }
@@ -246,7 +246,7 @@ static void blf_font_draw_ascii_ex(
        }
 
        if (r_info) {
-               r_info->lines_wrap = 1;
+               r_info->lines = 1;
                r_info->width = pen_x;
        }
 }
@@ -635,7 +635,7 @@ static void blf_font_boundbox_ex(
        }
 
        if (r_info) {
-               r_info->lines_wrap = 1;
+               r_info->lines = 1;
                r_info->width = pen_x;
        }
 }
@@ -731,7 +731,7 @@ static void blf_font_wrap_apply(
        // printf("done! %d lines\n", lines);
 
        if (r_info) {
-               r_info->lines_wrap = lines;
+               r_info->lines = lines;
                /* width of last line only (with wrapped lines) */
                r_info->width = pen_x;
        }
diff --git a/source/blender/editors/interface/interface_regions.c 
b/source/blender/editors/interface/interface_regions.c
index f44f2c5..fe1bf52 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -175,7 +175,7 @@ typedef struct uiTooltipData {
 
        struct {
                unsigned int width;
-               unsigned int lines_wrap;
+               unsigned int lines;
        } line_geom[MAX_TOOLTIP_LINES];
 
        int wrap_width;
@@ -266,7 +266,7 @@ static void ui_tooltip_region_draw_cb(const bContext 
*UNUSED(C), ARegion *ar)
        bbox.ymax -= 0.25f * pad_px;
 
        for (i = 0; i < data->totline; i++) {
-               bbox.ymin = bbox.ymax - (data->lineh * 
data->line_geom[i].lines_wrap);
+               bbox.ymin = bbox.ymax - (data->lineh * 
data->line_geom[i].lines);
                if (data->format[i].style == UI_TIP_STYLE_HEADER) {
                        /* draw header and active data (is done here to be able 
to change color) */
                        uiFontStyle fstyle_header = data->fstyle;
@@ -313,7 +313,7 @@ static void ui_tooltip_region_draw_cb(const bContext 
*UNUSED(C), ARegion *ar)
                        UI_fontstyle_draw(&data->fstyle, &bbox, data->lines[i]);
                }
 
-               bbox.ymax -= data->lineh * data->line_geom[i].lines_wrap;
+               bbox.ymax -= data->lineh * data->line_geom[i].lines;
 
                if ((i + 1 != data->totline) && data->format[i + 1].is_pad) {
                        bbox.ymax -= data->lineh * (UI_TIP_PAD_FAC - 1);
@@ -627,12 +627,12 @@ ARegion *ui_tooltip_create(bContext *C, ARegion 
*butregion, uiBut *but)
 
                fontw = max_ii(fontw, w + w_other);
 
-               fonth += h * info.lines_wrap;
+               fonth += h * info.lines;
                if ((i + 1 != data->totline) && data->format[i + 1].is_pad) {
                        fonth += h * (UI_TIP_PAD_FAC - 1);
                }
 
-               data->line_geom[i].lines_wrap = info.lines_wrap;
+               data->line_geom[i].lines = info.lines;
                data->line_geom[i].width = w;
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to