summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_textblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/edje/edje_textblock.c')
-rw-r--r--src/lib/edje/edje_textblock.c83
1 files changed, 58 insertions, 25 deletions
diff --git a/src/lib/edje/edje_textblock.c b/src/lib/edje/edje_textblock.c
index 9b9f17cc25..800a86636f 100644
--- a/src/lib/edje/edje_textblock.c
+++ b/src/lib/edje/edje_textblock.c
@@ -35,14 +35,30 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
35 int *maxw, int *maxh) 35 int *maxw, int *maxh)
36{ 36{
37 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; 37 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
38 unsigned char minx2 = 0, miny2 = 0, maxx2 = 0, maxy2 = 0;
39
40 minx2 = chosen_desc->text.min_x;
41 miny2 = chosen_desc->text.min_y;
42 maxx2 = chosen_desc->text.max_x;
43 maxy2 = chosen_desc->text.max_y;
44
45 // Do not use size from new api if min/max are non-zero in the theme
46 if (!chosen_desc->text.min_x && !chosen_desc->text.min_y &&
47 !chosen_desc->text.max_x && !chosen_desc->text.max_y)
48 {
49 minx2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_X;
50 miny2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_Y;
51 maxx2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_X;
52 maxy2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_Y;
53 }
38 54
39 /* Legacy code for Textblock min/max calculation */ 55 /* Legacy code for Textblock min/max calculation */
40 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y)) 56 if (minx2 || miny2)
41 { 57 {
42 int mw = 0, mh = 0; 58 int mw = 0, mh = 0;
43 59
44 tw = th = 0; 60 tw = th = 0;
45 if (!chosen_desc->text.min_x) 61 if (!minx2)
46 { 62 {
47 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h))); 63 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h)));
48 efl_canvas_text_size_formatted_get(ep->object, &tw, &th); 64 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
@@ -53,22 +69,22 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
53 &ins_r, &ins_t, &ins_b); 69 &ins_r, &ins_t, &ins_b);
54 mw = ins_l + tw + ins_r; 70 mw = ins_l + tw + ins_r;
55 mh = ins_t + th + ins_b; 71 mh = ins_t + th + ins_b;
56 if (minw && chosen_desc->text.min_x) 72 if (minw && minx2)
57 { 73 {
58 if (mw > *minw) *minw = mw; 74 if (mw > *minw) *minw = mw;
59 } 75 }
60 if (minh && chosen_desc->text.min_y) 76 if (minh && miny2)
61 { 77 {
62 if (mh > *minh) *minh = mh; 78 if (mh > *minh) *minh = mh;
63 } 79 }
64 } 80 }
65 81
66 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y)) 82 if ((maxx2) || (maxy2))
67 { 83 {
68 int mw = 0, mh = 0; 84 int mw = 0, mh = 0;
69 85
70 tw = th = 0; 86 tw = th = 0;
71 if (!chosen_desc->text.max_x) 87 if (!maxx2)
72 { 88 {
73 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h))); 89 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h)));
74 efl_canvas_text_size_formatted_get(ep->object, &tw, &th); 90 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
@@ -79,12 +95,12 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
79 &ins_t, &ins_b); 95 &ins_t, &ins_b);
80 mw = ins_l + tw + ins_r; 96 mw = ins_l + tw + ins_r;
81 mh = ins_t + th + ins_b; 97 mh = ins_t + th + ins_b;
82 if (maxw && chosen_desc->text.max_x) 98 if (maxw && maxx2)
83 { 99 {
84 if (mw > *maxw) *maxw = mw; 100 if (mw > *maxw) *maxw = mw;
85 if (minw && (*maxw < *minw)) *maxw = *minw; 101 if (minw && (*maxw < *minw)) *maxw = *minw;
86 } 102 }
87 if (maxh && chosen_desc->text.max_y) 103 if (maxh && maxy2)
88 { 104 {
89 if (mh > *maxh) *maxh = mh; 105 if (mh > *maxh) *maxh = mh;
90 if (minh && (*maxh < *minh)) *maxh = *minh; 106 if (minh && (*maxh < *minh)) *maxh = *minh;
@@ -102,18 +118,35 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
102 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; 118 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
103 Evas_Coord min_calc_w = 0, min_calc_h = 0; 119 Evas_Coord min_calc_w = 0, min_calc_h = 0;
104 120
121 unsigned char dminx, dminy, dmaxx, dmaxy;
122
123 dminx = chosen_desc->text.min_x;
124 dminy = chosen_desc->text.min_y;
125 dmaxx = chosen_desc->text.max_x;
126 dmaxy = chosen_desc->text.max_y;
127
128 // Do not use size from new api if min/max are non-zero in the theme
129 if (!chosen_desc->text.min_x && !chosen_desc->text.min_y &&
130 !chosen_desc->text.max_x && !chosen_desc->text.max_y)
131 {
132 dminx = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_X;
133 dminy = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_Y;
134 dmaxx = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_X;
135 dmaxy = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_Y;
136 }
137
105 /* min_calc_* values need to save calculated minumum size 138 /* min_calc_* values need to save calculated minumum size
106 * for maximum size calculation */ 139 * for maximum size calculation */
107 if (minw) min_calc_w = *minw; 140 if (minw) min_calc_w = *minw;
108 if (minh) min_calc_h = *minh; 141 if (minh) min_calc_h = *minh;
109 142
110 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y)) 143 if (dminx || dminy)
111 { 144 {
112 evas_object_textblock_style_insets_get(ep->object, &ins_l, 145 evas_object_textblock_style_insets_get(ep->object, &ins_l,
113 &ins_r, &ins_t, &ins_b); 146 &ins_r, &ins_t, &ins_b);
114 147
115 tw = th = 0; 148 tw = th = 0;
116 if (!chosen_desc->text.min_x) 149 if (!dminx)
117 { 150 {
118 /* text.min: 0 1 151 /* text.min: 0 1
119 * text.max: X X */ 152 * text.max: X X */
@@ -122,11 +155,11 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
122 155
123 if (min_calc_w > temp_w) 156 if (min_calc_w > temp_w)
124 temp_w = min_calc_w; 157 temp_w = min_calc_w;
125 if ((!chosen_desc->text.max_x) && 158 if ((!dmaxx) &&
126 maxw && (*maxw > -1) && (*maxw < temp_w)) 159 maxw && (*maxw > -1) && (*maxw < temp_w))
127 temp_w = *maxw; 160 temp_w = *maxw;
128 161
129 if (chosen_desc->text.max_y) 162 if (dmaxy)
130 { 163 {
131 /* text.min: 0 1 164 /* text.min: 0 1
132 * text.max: X 1 */ 165 * text.max: X 1 */
@@ -161,7 +194,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
161 { 194 {
162 /* text.min: 1 X 195 /* text.min: 1 X
163 * text.max: X X */ 196 * text.max: X X */
164 if (chosen_desc->text.min_y && (!chosen_desc->text.max_x) && 197 if (dminy && (!dmaxx) &&
165 maxw && (*maxw > -1)) 198 maxw && (*maxw > -1))
166 { 199 {
167 /* text.min: 1 1 200 /* text.min: 1 1
@@ -174,7 +207,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
174 if (min_calc_w > temp_w) 207 if (min_calc_w > temp_w)
175 temp_w = min_calc_w; 208 temp_w = min_calc_w;
176 209
177 if ((!chosen_desc->text.max_y) && maxh && (*maxh > -1)) 210 if ((!dmaxy) && maxh && (*maxh > -1))
178 { 211 {
179 /* text.min: 1 1 212 /* text.min: 1 1
180 * text.max: 0 0 213 * text.max: 0 0
@@ -210,7 +243,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
210 tw += ins_l + ins_r; 243 tw += ins_l + ins_r;
211 th += ins_t + ins_b; 244 th += ins_t + ins_b;
212 245
213 if (!chosen_desc->text.max_x && 246 if (!dmaxx &&
214 (maxw && (*maxw > -1) && (*maxw < tw))) 247 (maxw && (*maxw > -1) && (*maxw < tw)))
215 { 248 {
216 /* text.min: 1 0 249 /* text.min: 1 0
@@ -222,23 +255,23 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
222 255
223 if (tw > min_calc_w) min_calc_w = tw; 256 if (tw > min_calc_w) min_calc_w = tw;
224 if (th > min_calc_h) min_calc_h = th; 257 if (th > min_calc_h) min_calc_h = th;
225 if (chosen_desc->text.min_x && minw) *minw = min_calc_w; 258 if (dminx && minw) *minw = min_calc_w;
226 if (chosen_desc->text.min_y && minh) *minh = min_calc_h; 259 if (dminy && minh) *minh = min_calc_h;
227 } 260 }
228 261
229 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y)) 262 if ((dmaxx) || (dmaxy))
230 { 263 {
231 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r, 264 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
232 &ins_t, &ins_b); 265 &ins_t, &ins_b);
233 266
234 tw = th = 0; 267 tw = th = 0;
235 if (!chosen_desc->text.max_x) 268 if (!dmaxx)
236 { 269 {
237 /* text.min: X X 270 /* text.min: X X
238 * text.max: 0 1 */ 271 * text.max: 0 1 */
239 int temp_w, temp_h; 272 int temp_w, temp_h;
240 273
241 if (chosen_desc->text.min_y) 274 if (dminy)
242 { 275 {
243 /* text.min: X 1 276 /* text.min: X 1
244 * text.max: 0 1 277 * text.max: 0 1
@@ -284,7 +317,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
284 else 317 else
285 { 318 {
286 /* text.max: 1 X */ 319 /* text.max: 1 X */
287 if (chosen_desc->text.min_x) 320 if (dminx)
288 { 321 {
289 /* text.min: 1 X 322 /* text.min: 1 X
290 * text.max: 1 X 323 * text.max: 1 X
@@ -298,7 +331,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
298 { 331 {
299 /* text.min: 0 X 332 /* text.min: 0 X
300 * text.max: 1 X */ 333 * text.max: 1 X */
301 if (chosen_desc->text.max_y) 334 if (dmaxy)
302 { 335 {
303 /* text.min: 0 X 336 /* text.min: 0 X
304 * text.max: 1 1 */ 337 * text.max: 1 1 */
@@ -312,7 +345,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
312 if (min_calc_h > temp_h) 345 if (min_calc_h > temp_h)
313 temp_h = min_calc_h; 346 temp_h = min_calc_h;
314 347
315 if (chosen_desc->text.min_y) 348 if (dminy)
316 { 349 {
317 /* text.min: 0 1 350 /* text.min: 0 1
318 * text.max: 1 1 351 * text.max: 1 1
@@ -370,12 +403,12 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
370 } 403 }
371 } 404 }
372 405
373 if (maxw && chosen_desc->text.max_x) 406 if (maxw && dmaxx)
374 { 407 {
375 if (tw > *maxw) *maxw = tw; 408 if (tw > *maxw) *maxw = tw;
376 if (minw && (*maxw < *minw)) *maxw = *minw; 409 if (minw && (*maxw < *minw)) *maxw = *minw;
377 } 410 }
378 if (maxh && chosen_desc->text.max_y) 411 if (maxh && dmaxy)
379 { 412 {
380 if (th > *maxh) *maxh = th; 413 if (th > *maxh) *maxh = th;
381 if (minh && (*maxh < *minh)) *maxh = *minh; 414 if (minh && (*maxh < *minh)) *maxh = *minh;