summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2020-02-25 11:30:23 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-20 15:58:06 +0100
commit8e7a01b16f64227143101a517daec7333ed430e8 (patch)
tree24130e014f381caa141e3774f7939f08054b2253
parente4ecb159e7701fe4b7a3595fcb7541dfb3d3649d (diff)
efl.ui.textbox: load default font properties once
As described in task T8617 when toggle editable mode for textbox, we will reserve user changes (instead of reload them again). this issue is affected by D9502, I do not fully understand why do we need it, so I leave color loading as it is. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11404
-rw-r--r--src/lib/elementary/efl_ui_textbox.c38
-rw-r--r--src/tests/elementary/efl_ui_test_text.c21
2 files changed, 45 insertions, 14 deletions
diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c
index 17cd36fd4a..a5d5852fe9 100644
--- a/src/lib/elementary/efl_ui_textbox.c
+++ b/src/lib/elementary/efl_ui_textbox.c
@@ -631,7 +631,8 @@ _efl_ui_textbox_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Textbox_Data *sd)
631 efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table); 631 efl_content_set(efl_part(sd->entry_edje, "efl.text"), sd->text_table);
632 } 632 }
633 633
634 _create_text_cursors(obj, sd); 634 if (!sd->cursor && !sd->cursor_bidi)
635 _create_text_cursors(obj, sd);
635 636
636 return theme_apply; 637 return theme_apply;
637} 638}
@@ -1593,11 +1594,17 @@ _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd)
1593 1594
1594 // Main Text 1595 // Main Text
1595 // font_set 1596 // font_set
1596 font_name = efl_layout_group_data_get(wd->resize_obj, "font.name"); 1597 if (!efl_text_font_family_get(sd->text_obj))
1597 font_size = efl_layout_group_data_get(wd->resize_obj, "font.size"); 1598 {
1598 font_size_n = font_size ? atoi(font_size) : 0; 1599 font_name = efl_layout_group_data_get(wd->resize_obj, "font.name");
1599 efl_text_font_family_set(sd->text_obj, font_name); 1600 efl_text_font_family_set(sd->text_obj, font_name);
1600 efl_text_font_size_set(sd->text_obj, font_size_n); 1601 }
1602 if (!efl_text_font_size_get(sd->text_obj))
1603 {
1604 font_size = efl_layout_group_data_get(wd->resize_obj, "font.size");
1605 font_size_n = font_size ? atoi(font_size) : 0;
1606 efl_text_font_size_set(sd->text_obj, font_size_n);
1607 }
1601 1608
1602 // color 1609 // color
1603 if (disabled) 1610 if (disabled)
@@ -1610,11 +1617,17 @@ _update_text_theme(Eo *obj, Efl_Ui_Textbox_Data *sd)
1610 } 1617 }
1611 1618
1612 // Guide Text 1619 // Guide Text
1613 font_name = efl_layout_group_data_get(wd->resize_obj, "guide.font.name"); 1620 if (!efl_text_font_family_get(sd->text_guide_obj))
1614 font_size = efl_layout_group_data_get(wd->resize_obj, "guide.font.size"); 1621 {
1615 font_size_n = font_size ? atoi(font_size) : 0; 1622 font_name = efl_layout_group_data_get(wd->resize_obj, "guide.font.name");
1616 efl_text_font_family_set(sd->text_guide_obj, font_name); 1623 efl_text_font_family_set(sd->text_guide_obj, font_name);
1617 efl_text_font_size_set(sd->text_guide_obj, font_size_n); 1624 }
1625 if (!efl_text_font_size_get(sd->text_guide_obj))
1626 {
1627 font_size = efl_layout_group_data_get(wd->resize_obj, "guide.font.size");
1628 font_size_n = font_size ? atoi(font_size) : 0;
1629 efl_text_font_size_set(sd->text_guide_obj, font_size_n);
1630 }
1618 1631
1619 colorcode = NULL; 1632 colorcode = NULL;
1620 // color 1633 // color
@@ -1796,8 +1809,6 @@ _efl_ui_textbox_efl_text_format_password_set(Eo *obj, Efl_Ui_Textbox_Data *sd, E
1796 efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) | EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA)); 1809 efl_input_text_input_content_type_set(obj, ((efl_input_text_input_content_type_get(obj) | EFL_INPUT_TEXT_CONTENT_TYPE_AUTO_COMPLETE) & ~EFL_INPUT_TEXT_CONTENT_TYPE_SENSITIVE_DATA));
1797 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY); 1810 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
1798 } 1811 }
1799
1800 efl_ui_widget_theme_apply(obj);
1801} 1812}
1802 1813
1803static void 1814static void
@@ -1856,7 +1867,6 @@ _efl_ui_textbox_efl_text_interactive_editable_set(Eo *obj, Efl_Ui_Textbox_Data *
1856 1867
1857 efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable); 1868 efl_text_interactive_editable_set(efl_super(obj, MY_CLASS), editable);
1858 1869
1859 efl_ui_widget_theme_apply(obj);
1860 efl_ui_widget_focus_allow_set(obj, editable); 1870 efl_ui_widget_focus_allow_set(obj, editable);
1861 1871
1862 if (editable) 1872 if (editable)
diff --git a/src/tests/elementary/efl_ui_test_text.c b/src/tests/elementary/efl_ui_test_text.c
index 0944afa0ef..63df67919c 100644
--- a/src/tests/elementary/efl_ui_test_text.c
+++ b/src/tests/elementary/efl_ui_test_text.c
@@ -264,6 +264,26 @@ EFL_START_TEST(text_keys_handler)
264} 264}
265EFL_END_TEST 265EFL_END_TEST
266 266
267EFL_START_TEST(text_editable)
268{
269 Eo *txt, *win;
270 win = win_add();
271 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
272 efl_text_font_size_set(txt, 100);
273 efl_text_font_family_set(txt, "Arial");
274 efl_text_interactive_editable_set(txt, !efl_text_interactive_editable_get(txt));
275 ck_assert_int_eq(efl_text_font_size_get(txt), 100);
276 ck_assert_str_eq(efl_text_font_family_get(txt), "Arial");
277
278 efl_ui_widget_disabled_set(txt, EINA_TRUE);
279 ck_assert_int_eq(efl_text_font_size_get(txt), 100);
280 ck_assert_str_eq(efl_text_font_family_get(txt), "Arial");
281
282 efl_del(txt);
283 efl_del(win);
284}
285EFL_END_TEST
286
267void efl_ui_test_text(TCase *tc) 287void efl_ui_test_text(TCase *tc)
268{ 288{
269 tcase_add_test(tc, text_cnp); 289 tcase_add_test(tc, text_cnp);
@@ -273,4 +293,5 @@ void efl_ui_test_text(TCase *tc)
273 tcase_add_test(tc, text_scroll_mode); 293 tcase_add_test(tc, text_scroll_mode);
274 tcase_add_test(tc, text_change_event); 294 tcase_add_test(tc, text_change_event);
275 tcase_add_test(tc, text_keys_handler); 295 tcase_add_test(tc, text_keys_handler);
296 tcase_add_test(tc, text_editable);
276} 297}