jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=15d32fd4cc41efd810e151455c3611d360621dac

commit 15d32fd4cc41efd810e151455c3611d360621dac
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Jan 18 16:19:01 2018 +0900

    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
---
 src/lib/elementary/Elementary.h              |  2 +-
 src/lib/elementary/efl_ui_multibuttonentry.c |  2 +-
 src/lib/elementary/efl_ui_text.c             | 32 +++++++++++++++++++---------
 src/lib/elementary/efl_ui_text.eo            |  3 ++-
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index e5597b8e1a..fa34c3ed43 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -279,6 +279,7 @@ typedef Eo Efl_Ui_Focus_Manager;
 #include <elm_win.h>
 
 #ifdef EFL_EO_API_SUPPORT
+# include <efl_selection_types.eot.h>
 # include <efl_ui_list_segarray.h>
 # include <efl_config_global.eo.h>
 # include <efl_ui_widget.eo.h>
@@ -325,7 +326,6 @@ typedef Eo Efl_Ui_Focus_Manager;
 # include <efl_ui_list_pan.eo.h>
 # include <efl_ui_scroll_manager.eo.h>
 # include <efl_ui_scroller.eo.h>
-# include <efl_selection_types.eot.h>
 # include <efl_ui_dnd_types.eot.h>
 # include <efl_ui_pan.eo.h>
 # include <efl_selection.eo.h>
diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c 
b/src/lib/elementary/efl_ui_multibuttonentry.c
index 630ac60ce3..638c79199c 100644
--- a/src/lib/elementary/efl_ui_multibuttonentry.c
+++ b/src/lib/elementary/efl_ui_multibuttonentry.c
@@ -1445,7 +1445,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 43146f5490..ed4f5d1718 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 7df95dbceb..341a951679 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 {

-- 


Reply via email to