hermet pushed a commit to branch master.

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

commit 0b27ce5474517c3ed83184bd8df27346fe8b48c0
Author: Hermet Park <her...@hermet.pe.kr>
Date:   Sun May 8 02:34:31 2016 +0900

    redoundo: code refactoring.
    
    toggle option for redoundo should be global.
    so, take care of this in enventor object data.
---
 src/lib/edc_editor.c       | 18 ------------------
 src/lib/enventor_private.h |  3 ---
 src/lib/enventor_smart.c   | 10 ++++++----
 src/lib/redoundo.c         | 11 +----------
 4 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c
index 06ebf88..e06604b 100644
--- a/src/lib/edc_editor.c
+++ b/src/lib/edc_editor.c
@@ -64,7 +64,6 @@ struct editor_s
    Eina_Bool on_select_recover : 1;
    Eina_Bool ctxpopup_enabled : 1;
    Eina_Bool on_save : 1;
-   Eina_Bool smart_undo_redo : 1;
 };
 
 /*****************************************************************************/
@@ -1481,7 +1480,6 @@ edit_init(Enventor_Object *enventor)
    ed->layout = layout;
    ed->enventor = enventor;
    ed->ctxpopup_enabled = EINA_TRUE;
-   ed->smart_undo_redo = EINA_FALSE;
    ed->cur_line = -1;
    ed->select_pos = -1;
    ed->pd = parser_init();
@@ -1759,22 +1757,6 @@ edit_disabled_set(edit_data *ed, Eina_Bool disabled)
 }
 
 void
-edit_smart_undo_redo_set(edit_data *ed, Eina_Bool smart_undo_redo)
-{
-   if (!ed) return;
-
-   smart_undo_redo = !!smart_undo_redo;
-   ed->smart_undo_redo = smart_undo_redo;
-   redoundo_smart_set(ed->rd, smart_undo_redo);
-}
-
-Eina_Bool
-edit_smart_undo_redo_get(edit_data *ed)
-{
-   return ed->smart_undo_redo;
-}
-
-void
 edit_error_set(edit_data *ed, int line, const char *target)
 {
    ed->error_line = line;
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index ecb8f87..861e2e2 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -188,7 +188,6 @@ void redoundo_entry_region_push(redoundo_data *rd, int 
cursor_pos, int cursor_po
 int redoundo_undo(redoundo_data *rd, Eina_Bool *changed);
 int redoundo_redo(redoundo_data *rd, Eina_Bool *changed);
 void redoundo_n_diff_cancel(redoundo_data *rd, unsigned int n);
-void redoundo_smart_set(redoundo_data *rd, Eina_Bool status);
 void redoundo_diff_buildable(redoundo_data *rd, Eina_Bool buildable);
 
 
@@ -261,8 +260,6 @@ 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_smart_undo_redo_set(edit_data *ed, Eina_Bool smart_undo_redo);
-Eina_Bool edit_smart_undo_redo_get(edit_data *ed);
 void edit_ctxpopup_dismiss(edit_data *ed);
 Eina_Bool edit_load(edit_data *ed, const char *edc_path);
 void edit_selection_clear(edit_data *ed);
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index 367ab80..d5fa757 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -21,6 +21,7 @@
 #define DEFAULT_FONT_SCALE 1
 #define DEFAULT_AUTO_INDENT EINA_TRUE
 #define DEFAULT_PART_HIGHLIGHT EINA_TRUE
+#define DEFAULT_SMART_UNDO_REDO EINA_FALSE
 
 typedef struct _Enventor_Object_Data Enventor_Object_Data;
 typedef struct _Enventor_Item_Data Enventor_Item_Data;
@@ -50,6 +51,7 @@ struct _Enventor_Object_Data
    Eina_Bool linenumber : 1;
    Eina_Bool auto_indent : 1;
    Eina_Bool part_highlight : 1;
+   Eina_Bool smart_undo_redo : 1;
 };
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
@@ -241,6 +243,7 @@ _enventor_object_evas_object_smart_add(Eo *obj, 
Enventor_Object_Data *pd)
    pd->linenumber = DEFAULT_LINENUMBER;
    pd->auto_indent = DEFAULT_AUTO_INDENT;
    pd->part_highlight = DEFAULT_PART_HIGHLIGHT;
+   pd->smart_undo_redo = DEFAULT_SMART_UNDO_REDO;
 }
 
 EOLIAN static void
@@ -415,15 +418,14 @@ _enventor_object_smart_undo_redo_set(Eo *obj EINA_UNUSED,
                                      Enventor_Object_Data *pd,
                                      Eina_Bool smart_undo_redo)
 {
-   //Main Item
-   edit_smart_undo_redo_set(pd->main_it.ed, smart_undo_redo);
+   smart_undo_redo = !!smart_undo_redo;
+   pd->smart_undo_redo = smart_undo_redo;
 }
 
 EOLIAN static Eina_Bool
 _enventor_object_smart_undo_redo_get(Eo *obj EINA_UNUSED, Enventor_Object_Data 
*pd)
 {
-   //FIXME: ...
-   return edit_smart_undo_redo_get(pd->main_it.ed);
+   return pd->smart_undo_redo;
 }
 
 EOLIAN static void
diff --git a/src/lib/redoundo.c b/src/lib/redoundo.c
index cf0ec6c..d53a484 100644
--- a/src/lib/redoundo.c
+++ b/src/lib/redoundo.c
@@ -31,7 +31,6 @@ struct redoundo_s
    Eina_Bool internal_change : 1; //Entry change by redoundo
    edit_data *ed;
    struct {
-      Eina_Bool enable;
       Ecore_Timer *timer;
       Eina_Bool continues_input;
       double input_delay;
@@ -55,7 +54,7 @@ _input_timer_cb(void *data)
 static diff_data *
 smart_analyser(redoundo_data *rd, diff_data *diff)
 {
-   if (!rd->smart.enable) return diff;
+   if (!enventor_obj_smart_undo_redo_get(rd->enventor)) return diff;
 
    if (rd->smart.timer)
      {
@@ -404,7 +403,6 @@ redoundo_init(edit_data *ed, Enventor_Object *enventor)
    rd->textblock = elm_entry_textblock_get(entry);
    rd->cursor = evas_object_textblock_cursor_new(rd->textblock);
    rd->queue_max = DEFAULT_QUEUE_SIZE;
-   rd->smart.enable = EINA_FALSE;
    rd->smart.input_delay = INPUT_SPEED;
    rd->ed = ed;
 
@@ -486,13 +484,6 @@ redoundo_n_diff_cancel(redoundo_data *rd, unsigned int n)
 }
 
 void
-redoundo_smart_set(redoundo_data *rd, Eina_Bool status)
-{
-   if (!rd) return;
-   rd->smart.enable = status;
-}
-
-void
 redoundo_diff_buildable(redoundo_data *rd, Eina_Bool buildable)
 {
    if (!rd || !rd->queue || !rd->last_diff)

-- 


Reply via email to