forked from enlightenment/enventor
lib/edc_editor: add 2 more apis - redo, undo.
This commit is contained in:
parent
b28526310f
commit
94fb905d65
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue