hermet pushed a commit to branch master.

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

commit 94fb905d6570aa4f1b6c93ffe245435c71cf9b80
Author: ChunEon Park <her...@hermet.pe.kr>
Date:   Thu Feb 26 14:31:06 2015 +0900

    lib/edc_editor: add 2 more apis - redo, undo.
---
 data/themes/default/images/redo.png | Bin 0 -> 3209 bytes
 data/themes/default/images/undo.png | Bin 0 -> 3203 bytes
 src/lib/edc_editor.c                |  48 ++++++++++++++----------------------
 src/lib/enventor_object.eo          |  21 ++++++++++++++--
 src/lib/enventor_private.h          |   1 +
 src/lib/enventor_smart.c            |  11 +++++++++
 6 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/data/themes/default/images/redo.png 
b/data/themes/default/images/redo.png
new file mode 100755
index 0000000..38624f7
Binary files /dev/null and b/data/themes/default/images/redo.png differ
diff --git a/data/themes/default/images/undo.png 
b/data/themes/default/images/undo.png
new file mode 100755
index 0000000..78a564c
Binary files /dev/null and b/data/themes/default/images/undo.png differ
diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c
index e206a4b..0896f0f 100644
--- a/src/lib/edc_editor.c
+++ b/src/lib/edc_editor.c
@@ -643,35 +643,6 @@ syntax_color_full_update(edit_data *ed, Eina_Bool thread)
      }
 }
 
-static void
-edit_redoundo(edit_data *ed, Eina_Bool undo)
-{
-   int lines;
-   Eina_Bool changed;
-
-   if (undo) lines = redoundo_undo(ed->rd, &changed);
-   else lines = redoundo_redo(ed->rd, &changed);
-   if (!changed)
-     {
-#if 0
-        if (undo) stats_info_msg_update("No text to be undo.");
-        else stats_info_msg_update("No text to be redo.");
-#endif
-        return;
-     }
-
-#if 0
-   if (undo) stats_info_msg_update("Undo text.");
-   else stats_info_msg_update("Redo text.");
-#endif
-
-   if (lines > 0) edit_line_increase(ed, lines);
-   else edit_line_decrease(ed, abs(lines));
-
-   edit_changed_set(ed, EINA_TRUE);
-   syntax_color_full_update(ed, EINA_TRUE);
-}
-
 static Eina_Bool
 key_down_cb(void *data, int type EINA_UNUSED, void *ev)
 {
@@ -1360,3 +1331,22 @@ edit_ctxpopup_dismiss(edit_data *ed)
 {
    if (ed->ctxpopup) elm_ctxpopup_dismiss(ed->ctxpopup);
 }
+
+Eina_Bool
+edit_redoundo(edit_data *ed, Eina_Bool undo)
+{
+   int lines;
+   Eina_Bool changed;
+
+   if (undo) lines = redoundo_undo(ed->rd, &changed);
+   else lines = redoundo_redo(ed->rd, &changed);
+   if (!changed) return EINA_FALSE;
+
+   if (lines > 0) edit_line_increase(ed, lines);
+   else edit_line_decrease(ed, abs(lines));
+
+   edit_changed_set(ed, EINA_TRUE);
+   syntax_color_full_update(ed, EINA_TRUE);
+
+   return EINA_TRUE;
+}
diff --git a/src/lib/enventor_object.eo b/src/lib/enventor_object.eo
index e924e42..0f0e66c 100644
--- a/src/lib/enventor_object.eo
+++ b/src/lib/enventor_object.eo
@@ -463,7 +463,24 @@ class Enventor.Object (Elm_Widget, Efl.File) {
             @in Evas_Coord *h; /*@ ... */
          }
       }
-
+      redo {
+         /*@
+         @brief
+         @return
+         @warning
+         @see
+         @ingroup Enventor */
+         return: Eina_Bool;
+      }
+      undo {
+         /*@
+         @brief
+         @return
+         @warning
+         @see
+         @ingroup Enventor */
+         return: Eina_Bool;
+      }
    }
    implements {
       class.constructor;
@@ -491,6 +508,6 @@ class Enventor.Object (Elm_Widget, Efl.File) {
       ctxpopup,selected;
       ctxpopup,dismissed;
       edc,modified;
-               focused;
+      focused;
    }
 }
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index 11eb855..ef50ad4 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -236,5 +236,6 @@ 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);
 void edit_selection_clear(edit_data *ed);
+Eina_Bool edit_redoundo(edit_data *ed, Eina_Bool undo);
 
 #endif
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index dc65a79..2785f63 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -564,6 +564,17 @@ _enventor_object_disabled_set(Eo *obj EINA_UNUSED,
    edit_disabled_set(pd->ed, disabled);
 }
 
+EOLIAN static Eina_Bool
+_enventor_object_redo(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
+{
+   return edit_redoundo(pd->ed, EINA_FALSE);
+}
+
+EOLIAN static Eina_Bool
+_enventor_object_undo(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
+{
+   return edit_redoundo(pd->ed, EINA_TRUE);
+}
 
 /*****************************************************************************/
 /* Externally accessible calls                                               */

-- 


Reply via email to