hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=c20a47bcede5151c14e34c1ac52401fd2360f01f

commit c20a47bcede5151c14e34c1ac52401fd2360f01f
Author: Hermet Park <[email protected]>
Date:   Sun May 8 03:16:46 2016 +0900

    edc_edit: code refactoring.
    
    toggle option for ctxpopup should be global.
    so, take care of this in enventor object data.
    
    This is a partial change for multiple edc editor.
---
 src/lib/edc_editor.c       | 17 +----------------
 src/lib/enventor_private.h |  2 --
 src/lib/enventor_smart.c   | 10 ++++++----
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c
index 342b8a4..5ae3843 100644
--- a/src/lib/edc_editor.c
+++ b/src/lib/edc_editor.c
@@ -62,7 +62,6 @@ struct editor_s
    Eina_Bool edit_changed : 1;
    Eina_Bool ctrl_pressed : 1;
    Eina_Bool on_select_recover : 1;
-   Eina_Bool ctxpopup_enabled : 1;
    Eina_Bool on_save : 1;
 };
 
@@ -727,7 +726,7 @@ edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
    edit_data *ed = data;
 
    if (ed->ctrl_pressed) return;
-   if (!ed->ctxpopup_enabled) return;
+   if (!enventor_obj_ctxpopup_get(ed->enventor)) return;
 
    char *selected = (char *) elm_entry_selection_get(obj);
    if (!selected) return;
@@ -1425,7 +1424,6 @@ edit_init(Enventor_Object *enventor)
    ed->en_edit = en_edit;
    ed->layout = layout;
    ed->enventor = enventor;
-   ed->ctxpopup_enabled = EINA_TRUE;
    ed->cur_line = -1;
    ed->select_pos = -1;
    ed->pd = parser_init();
@@ -1710,19 +1708,6 @@ edit_error_set(edit_data *ed, int line, const char 
*target)
 }
 
 Eina_Bool
-edit_ctxpopup_enabled_get(edit_data *ed)
-{
-   return ed->ctxpopup_enabled;
-}
-
-void
-edit_ctxpopup_enabled_set(edit_data *ed, Eina_Bool enabled)
-{
-   enabled = !!enabled;
-   ed->ctxpopup_enabled = enabled;
-}
-
-Eina_Bool
 edit_ctxpopup_visible_get(edit_data *ed)
 {
    return (ed->ctxpopup ? EINA_TRUE : EINA_FALSE);
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index eb637ae..21b9c58 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -259,8 +259,6 @@ void edit_line_increase(edit_data *ed, int cnt);
 void edit_line_decrease(edit_data *ed, int cnt);
 int edit_cur_indent_depth_get(edit_data *ed);
 void edit_redoundo_region_push(edit_data *ed, int cursor_pos1, int 
cursor_pos2);
-void edit_ctxpopup_enabled_set(edit_data *ed, Eina_Bool enabled);
-Eina_Bool edit_ctxpopup_enabled_get(edit_data *ed);
 Eina_Bool edit_ctxpopup_visible_get(edit_data *ed);
 void edit_ctxpopup_dismiss(edit_data *ed);
 Eina_Bool edit_load(edit_data *ed, const char *edc_path);
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index 44ff462..2f56349 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -22,6 +22,7 @@
 #define DEFAULT_AUTO_INDENT EINA_TRUE
 #define DEFAULT_PART_HIGHLIGHT EINA_TRUE
 #define DEFAULT_SMART_UNDO_REDO EINA_FALSE
+#define DEFAULT_CTXPOPUP EINA_TRUE
 
 typedef struct _Enventor_Object_Data Enventor_Object_Data;
 typedef struct _Enventor_Item_Data Enventor_Item_Data;
@@ -51,6 +52,7 @@ struct _Enventor_Object_Data
    Eina_Bool auto_indent : 1;
    Eina_Bool part_highlight : 1;
    Eina_Bool smart_undo_redo : 1;
+   Eina_Bool ctxpopup : 1;
 };
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
@@ -246,6 +248,7 @@ _enventor_object_evas_object_smart_add(Eo *obj, 
Enventor_Object_Data *pd)
    pd->auto_indent = DEFAULT_AUTO_INDENT;
    pd->part_highlight = DEFAULT_PART_HIGHLIGHT;
    pd->smart_undo_redo = DEFAULT_SMART_UNDO_REDO;
+   pd->ctxpopup = DEFAULT_CTXPOPUP;
 }
 
 EOLIAN static void
@@ -555,16 +558,15 @@ EOLIAN static Eina_Bool
 _enventor_object_ctxpopup_get(Eo *obj EINA_UNUSED,
                               Enventor_Object_Data *pd)
 {
-   //FIXME: Move to enventor object data
-   return edit_ctxpopup_enabled_get(pd->main_it.ed);
+   return pd->ctxpopup;
 }
 
 EOLIAN static void
 _enventor_object_ctxpopup_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
                               Eina_Bool ctxpopup)
 {
-   //Main Item
-   edit_ctxpopup_enabled_set(pd->main_it.ed, ctxpopup);
+   ctxpopup = !!ctxpopup;
+   pd->ctxpopup = ctxpopup;
 }
 
 EOLIAN static Eina_Bool

-- 


Reply via email to