summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2018-01-18 16:19:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-18 16:27:57 +0900
commit15d32fd4cc41efd810e151455c3611d360621dac (patch)
tree3be408d8b0de84cf47bf8dbaf3639a7b7dd1f77e
parent4e055db429208ac80b7e746bf604438a0c1d9067 (diff)
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
-rw-r--r--src/lib/elementary/Elementary.h2
-rw-r--r--src/lib/elementary/efl_ui_multibuttonentry.c2
-rw-r--r--src/lib/elementary/efl_ui_text.c32
-rw-r--r--src/lib/elementary/efl_ui_text.eo3
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;
279#include <elm_win.h> 279#include <elm_win.h>
280 280
281#ifdef EFL_EO_API_SUPPORT 281#ifdef EFL_EO_API_SUPPORT
282# include <efl_selection_types.eot.h>
282# include <efl_ui_list_segarray.h> 283# include <efl_ui_list_segarray.h>
283# include <efl_config_global.eo.h> 284# include <efl_config_global.eo.h>
284# include <efl_ui_widget.eo.h> 285# include <efl_ui_widget.eo.h>
@@ -325,7 +326,6 @@ typedef Eo Efl_Ui_Focus_Manager;
325# include <efl_ui_list_pan.eo.h> 326# include <efl_ui_list_pan.eo.h>
326# include <efl_ui_scroll_manager.eo.h> 327# include <efl_ui_scroll_manager.eo.h>
327# include <efl_ui_scroller.eo.h> 328# include <efl_ui_scroller.eo.h>
328# include <efl_selection_types.eot.h>
329# include <efl_ui_dnd_types.eot.h> 329# include <efl_ui_dnd_types.eot.h>
330# include <efl_ui_pan.eo.h> 330# include <efl_ui_pan.eo.h>
331# include <efl_selection.eo.h> 331# 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)
1445 sd->entry = efl_add(EFL_UI_TEXT_CLASS, sd->box, 1445 sd->entry = efl_add(EFL_UI_TEXT_CLASS, sd->box,
1446 efl_text_multiline_set(efl_added, EINA_FALSE), 1446 efl_text_multiline_set(efl_added, EINA_FALSE),
1447 efl_text_set(efl_added, ""), 1447 efl_text_set(efl_added, ""),
1448 efl_ui_text_cnp_mode_set(efl_added, EINA_FALSE), 1448 efl_ui_text_cnp_mode_set(efl_added, EFL_SELECTION_FORMAT_MARKUP),
1449 efl_ui_text_input_panel_enabled_set(efl_added, EINA_FALSE), 1449 efl_ui_text_input_panel_enabled_set(efl_added, EINA_FALSE),
1450 efl_ui_text_interactive_editable_set(efl_added, EINA_TRUE), 1450 efl_ui_text_interactive_editable_set(efl_added, EINA_TRUE),
1451 efl_composite_attach(obj, efl_added)); 1451 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
3606} 3606}
3607 3607
3608EOLIAN static void 3608EOLIAN static void
3609_efl_ui_text_cnp_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Cnp_Mode cnp_mode) 3609_efl_ui_text_cnp_mode_set(Eo *obj, Efl_Ui_Text_Data *sd, Efl_Selection_Format cnp_mode)
3610{ 3610{
3611 Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP; 3611 /* FIXME: CnP format handling really odd... */
3612 3612
3613 Elm_Sel_Format dnd_format = ELM_SEL_FORMAT_MARKUP;
3614 Elm_Sel_Format cnp_format = cnp_mode;
3613 3615
3614 if (sd->cnp_mode == cnp_mode) return; 3616 if (cnp_mode != EFL_SELECTION_FORMAT_TARGETS)
3615 sd->cnp_mode = cnp_mode; 3617 {
3616 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT) 3618 if (cnp_mode & EFL_SELECTION_FORMAT_VCARD)
3617 format = ELM_SEL_FORMAT_TEXT; 3619 ERR("VCARD format not supported for copy & paste!");
3618 else if (cnp_mode == ELM_CNP_MODE_MARKUP) 3620 else if (cnp_mode & EFL_SELECTION_FORMAT_HTML)
3619 format |= ELM_SEL_FORMAT_IMAGE; 3621 ERR("HTML format not supported for copy & paste!");
3622 cnp_mode &= ~EFL_SELECTION_FORMAT_VCARD;
3623 cnp_mode &= ~EFL_SELECTION_FORMAT_HTML;
3624 }
3625
3626 if (sd->cnp_mode == cnp_format) return;
3627 sd->cnp_mode = cnp_format;
3628 if (sd->cnp_mode == EFL_SELECTION_FORMAT_TEXT)
3629 dnd_format = ELM_SEL_FORMAT_TEXT;
3630 else if (cnp_mode == EFL_SELECTION_FORMAT_IMAGE)
3631 dnd_format |= ELM_SEL_FORMAT_IMAGE;
3620 3632
3621 elm_drop_target_del(obj, sd->drop_format, 3633 elm_drop_target_del(obj, sd->drop_format,
3622 _dnd_enter_cb, NULL, 3634 _dnd_enter_cb, NULL,
3623 _dnd_leave_cb, NULL, 3635 _dnd_leave_cb, NULL,
3624 _dnd_pos_cb, NULL, 3636 _dnd_pos_cb, NULL,
3625 _dnd_drop_cb, NULL); 3637 _dnd_drop_cb, NULL);
3626 sd->drop_format = format; 3638 sd->drop_format = dnd_format;
3627 elm_drop_target_add(obj, sd->drop_format, 3639 elm_drop_target_add(obj, sd->drop_format,
3628 _dnd_enter_cb, NULL, 3640 _dnd_enter_cb, NULL,
3629 _dnd_leave_cb, NULL, 3641 _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)
3631 _dnd_drop_cb, NULL); 3643 _dnd_drop_cb, NULL);
3632} 3644}
3633 3645
3634EOLIAN static Elm_Cnp_Mode 3646EOLIAN static Efl_Selection_Format
3635_efl_ui_text_cnp_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd) 3647_efl_ui_text_cnp_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
3636{ 3648{
3637 return sd->cnp_mode; 3649 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,
59 } 59 }
60 } 60 }
61 @property cnp_mode { 61 @property cnp_mode {
62 /* FIXME: Efl.Selection.Format does not allow markup without images! */
62 set { 63 set {
63 [[Control pasting of text and images for the widget. 64 [[Control pasting of text and images for the widget.
64 65
@@ -77,7 +78,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
77 ]] 78 ]]
78 } 79 }
79 values { 80 values {
80 cnp_mode: Elm.Cnp_Mode; [[One of #Elm_Cnp_Mode: #ELM_CNP_MODE_MARKUP, #ELM_CNP_MODE_NO_IMAGE, #ELM_CNP_MODE_PLAINTEXT.]] 81 format: Efl.Selection.Format; [[Format for copy & paste.]]
81 } 82 }
82 } 83 }
83 @property input_panel_language { 84 @property input_panel_language {