edc_edit: code refactoring.

toggle option for ctxpopup should be global.
so, take care of this in enventor object data.

This is a partial change for multiple edc editor.
This commit is contained in:
Hermet Park 2016-05-08 03:16:46 +09:00
parent a77f756735
commit c20a47bced
3 changed files with 7 additions and 22 deletions

View File

@ -62,7 +62,6 @@ struct editor_s
Eina_Bool edit_changed : 1;
Eina_Bool ctrl_pressed : 1;
Eina_Bool on_select_recover : 1;
Eina_Bool ctxpopup_enabled : 1;
Eina_Bool on_save : 1;
};
@ -727,7 +726,7 @@ edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
edit_data *ed = data;
if (ed->ctrl_pressed) return;
if (!ed->ctxpopup_enabled) return;
if (!enventor_obj_ctxpopup_get(ed->enventor)) return;
char *selected = (char *) elm_entry_selection_get(obj);
if (!selected) return;
@ -1425,7 +1424,6 @@ edit_init(Enventor_Object *enventor)
ed->en_edit = en_edit;
ed->layout = layout;
ed->enventor = enventor;
ed->ctxpopup_enabled = EINA_TRUE;
ed->cur_line = -1;
ed->select_pos = -1;
ed->pd = parser_init();
@ -1709,19 +1707,6 @@ edit_error_set(edit_data *ed, int line, const char *target)
ed->error_target = target;
}
Eina_Bool
edit_ctxpopup_enabled_get(edit_data *ed)
{
return ed->ctxpopup_enabled;
}
void
edit_ctxpopup_enabled_set(edit_data *ed, Eina_Bool enabled)
{
enabled = !!enabled;
ed->ctxpopup_enabled = enabled;
}
Eina_Bool
edit_ctxpopup_visible_get(edit_data *ed)
{

View File

@ -259,8 +259,6 @@ void edit_line_increase(edit_data *ed, int cnt);
void edit_line_decrease(edit_data *ed, int cnt);
int edit_cur_indent_depth_get(edit_data *ed);
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_ctxpopup_dismiss(edit_data *ed);
Eina_Bool edit_load(edit_data *ed, const char *edc_path);

View File

@ -22,6 +22,7 @@
#define DEFAULT_AUTO_INDENT EINA_TRUE
#define DEFAULT_PART_HIGHLIGHT EINA_TRUE
#define DEFAULT_SMART_UNDO_REDO EINA_FALSE
#define DEFAULT_CTXPOPUP EINA_TRUE
typedef struct _Enventor_Object_Data Enventor_Object_Data;
typedef struct _Enventor_Item_Data Enventor_Item_Data;
@ -51,6 +52,7 @@ struct _Enventor_Object_Data
Eina_Bool auto_indent : 1;
Eina_Bool part_highlight : 1;
Eina_Bool smart_undo_redo : 1;
Eina_Bool ctxpopup : 1;
};
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
@ -246,6 +248,7 @@ _enventor_object_evas_object_smart_add(Eo *obj, Enventor_Object_Data *pd)
pd->auto_indent = DEFAULT_AUTO_INDENT;
pd->part_highlight = DEFAULT_PART_HIGHLIGHT;
pd->smart_undo_redo = DEFAULT_SMART_UNDO_REDO;
pd->ctxpopup = DEFAULT_CTXPOPUP;
}
EOLIAN static void
@ -555,16 +558,15 @@ EOLIAN static Eina_Bool
_enventor_object_ctxpopup_get(Eo *obj EINA_UNUSED,
Enventor_Object_Data *pd)
{
//FIXME: Move to enventor object data
return edit_ctxpopup_enabled_get(pd->main_it.ed);
return pd->ctxpopup;
}
EOLIAN static void
_enventor_object_ctxpopup_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
Eina_Bool ctxpopup)
{
//Main Item
edit_ctxpopup_enabled_set(pd->main_it.ed, ctxpopup);
ctxpopup = !!ctxpopup;
pd->ctxpopup = ctxpopup;
}
EOLIAN static Eina_Bool