redoundo: code refactoring.
toggle option for redoundo should be global. so, take care of this in enventor object data.
This commit is contained in:
parent
e36b84e53d
commit
0b27ce5474
|
@ -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();
|
||||
|
@ -1758,22 +1756,6 @@ edit_disabled_set(edit_data *ed, Eina_Bool disabled)
|
|||
else if (enventor_obj_part_highlight_get(ed->enventor)) edit_view_sync(ed);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -485,13 +483,6 @@ redoundo_n_diff_cancel(redoundo_data *rd, unsigned int n)
|
|||
untracked_diff_free(rd);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue