From: Jean-Philippe Andre Date: Thu, 18 Jan 2018 07:19:01 +0000 (+0900) Subject: ui.text: Use proper EO type for cnp mode X-Git-Tag: upstream/1.21.0~2231 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=636468b15ebfeccc66f32154777c8522c9bf6865;p=platform%2Fupstream%2Fefl.git ui.text: Use proper EO type for cnp mode It's not working. Just "fixing" the API for consistency. Also, we're lacking a proper hint for "markup without images". So I think EFL_SELECTION_FORMAT_MARKUP should be without images, while EFL_SELECTION_FORMAT_MARKUP | EFL_SELECTION_FORMAT_IMAGE would allow markup with images. Ping @thiep.ha Ref T5329 --- diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index 9e45171..026016a 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -283,6 +283,7 @@ typedef Eo Efl_Ui_Focus_Manager; #include #ifdef EFL_EO_API_SUPPORT +# include # include # include # include @@ -329,7 +330,6 @@ typedef Eo Efl_Ui_Focus_Manager; # include # include # include -# include # include # include # include diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c index 4b9cb6c..c186463 100644 --- a/src/lib/elementary/efl_ui_multibuttonentry.c +++ b/src/lib/elementary/efl_ui_multibuttonentry.c @@ -1572,7 +1572,7 @@ _view_init(Evas_Object *obj, Efl_Ui_Multibuttonentry_Data *sd) sd->entry = efl_add(EFL_UI_TEXT_CLASS, sd->box, efl_text_multiline_set(efl_added, EINA_FALSE), efl_text_set(efl_added, ""), - efl_ui_text_cnp_mode_set(efl_added, EINA_FALSE), + efl_ui_text_cnp_mode_set(efl_added, EFL_SELECTION_FORMAT_MARKUP), efl_ui_text_input_panel_enabled_set(efl_added, EINA_FALSE), efl_ui_text_interactive_editable_set(efl_added, EINA_TRUE), efl_composite_attach(obj, efl_added)); diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 0a7af70..e1f1bc1 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -3606,24 +3606,36 @@ _efl_ui_text_efl_file_file_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const } EOLIAN static void -_efl_ui_text_cnp_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Cnp_Mode cnp_mode) +_efl_ui_text_cnp_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Selection_Format cnp_mode) { - Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP; + /* FIXME: CnP format handling really odd... */ + Elm_Sel_Format dnd_format = ELM_SEL_FORMAT_MARKUP; + Elm_Sel_Format cnp_format = cnp_mode; - if (sd->cnp_mode == cnp_mode) return; - sd->cnp_mode = cnp_mode; - if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT) - format = ELM_SEL_FORMAT_TEXT; - else if (cnp_mode == ELM_CNP_MODE_MARKUP) - format |= ELM_SEL_FORMAT_IMAGE; + if (cnp_mode != EFL_SELECTION_FORMAT_TARGETS) + { + if (cnp_mode & EFL_SELECTION_FORMAT_VCARD) + ERR("VCARD format not supported for copy & paste!"); + else if (cnp_mode & EFL_SELECTION_FORMAT_HTML) + ERR("HTML format not supported for copy & paste!"); + cnp_mode &= ~EFL_SELECTION_FORMAT_VCARD; + cnp_mode &= ~EFL_SELECTION_FORMAT_HTML; + } + + if (sd->cnp_mode == cnp_format) return; + sd->cnp_mode = cnp_format; + if (sd->cnp_mode == EFL_SELECTION_FORMAT_TEXT) + dnd_format = ELM_SEL_FORMAT_TEXT; + else if (cnp_mode == EFL_SELECTION_FORMAT_IMAGE) + dnd_format |= ELM_SEL_FORMAT_IMAGE; elm_drop_target_del(obj, sd->drop_format, _dnd_enter_cb, NULL, _dnd_leave_cb, NULL, _dnd_pos_cb, NULL, _dnd_drop_cb, NULL); - sd->drop_format = format; + sd->drop_format = dnd_format; elm_drop_target_add(obj, sd->drop_format, _dnd_enter_cb, NULL, _dnd_leave_cb, NULL, @@ -3631,7 +3643,7 @@ _efl_ui_text_cnp_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Cnp_Mode cnp_mode) _dnd_drop_cb, NULL); } -EOLIAN static Elm_Cnp_Mode +EOLIAN static Efl_Selection_Format _efl_ui_text_cnp_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd) { return sd->cnp_mode; diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo index 7df95db..341a951 100644 --- a/src/lib/elementary/efl_ui_text.eo +++ b/src/lib/elementary/efl_ui_text.eo @@ -59,6 +59,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, } } @property cnp_mode { + /* FIXME: Efl.Selection.Format does not allow markup without images! */ set { [[Control pasting of text and images for the widget. @@ -77,7 +78,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, ]] } values { - cnp_mode: Elm.Cnp_Mode; [[One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, #ELM_CNP_MODE_NO_IMAGE, #ELM_CNP_MODE_PLAINTEXT.]] + format: Efl.Selection.Format; [[Format for copy & paste.]] } } @property input_panel_language {