lib/edc_editor: add 2 more apis - redo, undo.

This commit is contained in:
ChunEon Park 2015-02-26 14:31:06 +09:00
parent b28526310f
commit 94fb905d65
6 changed files with 50 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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 */