multi-file: re-implemented item grouping infra.

Changed item concept that only one item can represent the enventor object.
I'd thought multiple editors of Enventor could be active at the same time,
but it brought Enventor Lib has over-concept feature,
because Enventor App doesn't support it so far.
This commit is contained in:
Hermet Park 2016-07-07 20:34:42 +09:00
parent ace06a6d8b
commit 4b8f989090
8 changed files with 59 additions and 132 deletions

View File

@ -401,13 +401,6 @@ base_enventor_set(Enventor_Object *enventor)
EINA_SAFETY_ON_NULL_RETURN(bd);
bd->enventor = enventor;
}
void
base_text_editor_set(Enventor_Item *it)
{
base_data *bd = g_bd;
EINA_SAFETY_ON_NULL_RETURN(bd);
panes_text_editor_set(enventor_item_editor_get(it));
panes_text_editor_set(enventor);
}

View File

@ -266,8 +266,7 @@ file_mgr_file_focus(Enventor_Item *it)
EINA_SAFETY_ON_NULL_RETURN(it);
file_tab_it_select(it);
enventor_item_focus_set(it);
base_text_editor_set(it);
enventor_item_represent(it);
base_title_set(enventor_item_file_get(it));
//Reset context if the find/replace is working on.

View File

@ -301,10 +301,6 @@ panes_text_editor_set(Evas_Object *text_editor)
panes_data *pd = g_pd;
EINA_SAFETY_ON_NULL_RETURN(pd);
Evas_Object *prev = elm_object_content_unset(pd->text_tool_layout);
evas_object_hide(prev);
//FIXME: Not Enventor????
elm_object_content_set(pd->text_tool_layout, text_editor);
}

View File

@ -22,7 +22,6 @@ void base_console_auto_hide(void);
void base_console_toggle(void);
void base_live_view_set(Evas_Object *live_view);
void base_enventor_set(Enventor_Object *enventor);
void base_text_editor_set(Enventor_Item *it);
void base_gui_term(void);
void base_console_reset(void);
void base_error_msg_set(const char *msg);

View File

@ -10,7 +10,7 @@ EAPI const Eina_List *enventor_object_sub_items_get(const Evas_Object *obj);
EAPI Evas_Object *enventor_item_editor_get(const Enventor_Item *it);
EAPI const char *enventor_item_file_get(const Enventor_Item *it);
EAPI Enventor_Item *enventor_object_focused_item_get(const Evas_Object *obj);
EAPI Eina_Bool enventor_item_focus_set(Enventor_Item *it);
EAPI Eina_Bool enventor_item_represent(Enventor_Item *it);
EAPI int enventor_item_max_line_get(const Enventor_Item *it);
EAPI Eina_Bool enventor_item_line_goto(Enventor_Item *it, int line);
EAPI Eina_Bool enventor_item_syntax_color_full_apply(Enventor_Item *it, Eina_Bool force);

View File

@ -1357,6 +1357,7 @@ edit_init(Enventor_Object *enventor, Enventor_Item *it)
//Scroller
Evas_Object *scroller = elm_scroller_add(enventor);
evas_object_smart_member_add(scroller, enventor);
elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO,
ELM_SCROLLER_POLICY_AUTO);
elm_object_focus_allow_set(scroller, EINA_FALSE);
@ -1850,6 +1851,12 @@ edit_is_main_file(edit_data *ed)
return ed->main;
}
void
edit_focus_set(edit_data *ed, Eina_Bool focus)
{
elm_object_focus_set(ed->en_edit, focus);
}
Eina_Bool
edit_focus_get(edit_data *ed)
{

View File

@ -284,6 +284,7 @@ int edit_cursor_pos_get(edit_data *ed);
const char *edit_selection_get(edit_data *ed);
Eina_Bool edit_is_main_file(edit_data *ed);
Eina_Bool edit_focus_get(edit_data *ed);
void edit_focus_set(edit_data *ed, Eina_Bool focus);
/* util */
void mem_fail_msg(void);

View File

@ -271,7 +271,7 @@ _enventor_object_efl_canvas_group_group_add(Eo *obj, Enventor_Object_Data *pd)
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_del(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
_enventor_object_efl_canvas_group_group_del(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
{
eina_stringshare_del(pd->font_name);
eina_stringshare_del(pd->font_style);
@ -289,149 +289,72 @@ _enventor_object_efl_canvas_group_group_del(Evas_Object *obj EINA_UNUSED, Envent
EOLIAN static void
_enventor_object_efl_canvas_group_group_member_add(Eo *obj, Enventor_Object_Data *pd EINA_UNUSED, Evas_Object *child)
{
efl_canvas_group_member_add(eo_super(obj, MY_CLASS), child);
//Don't go through elm_widget to avoid color set.
evas_object_data_set(child, "_elm_leaveme", (void*)1);
if (evas_object_visible_get(obj)) evas_object_show(child);
else evas_object_hide(child);
efl_canvas_group_member_add(eo_super(obj, MY_CLASS), child);
Evas_Coord x, y, w, h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
evas_object_move(child, x, y);
evas_object_resize(child, w, h);
evas_object_clip_set(child, evas_object_clip_get(obj));
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_move(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Coord x, Evas_Coord y)
_enventor_object_efl_canvas_group_group_move(Eo *obj, Enventor_Object_Data *pd EINA_UNUSED, Evas_Coord x, Evas_Coord y)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_move(o, x, y);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_move(o, x, y);
}
Eina_Iterator *it = evas_object_smart_iterator_new(obj);
Evas_Object *o;
EINA_ITERATOR_FOREACH(it, o)
evas_object_move(o, x, y);
eina_iterator_free(it);
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_resize(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Coord w, Evas_Coord h)
_enventor_object_efl_canvas_group_group_resize(Eo *obj, Enventor_Object_Data *pd EINA_UNUSED, Evas_Coord w, Evas_Coord h)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(pd->main_it->ed);
evas_object_resize(o, w, h);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_resize(o, w, h);
}
Eina_Iterator *it = evas_object_smart_iterator_new(obj);
Evas_Object *o;
EINA_ITERATOR_FOREACH(it, o)
evas_object_resize(o, w, h);
eina_iterator_free(it);
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_show(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
_enventor_object_efl_canvas_group_group_show(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(pd->main_it->ed);
evas_object_show(o);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_show(o);
}
if (!pd->focused_it) return;
Evas_Object *o = edit_obj_get(pd->focused_it->ed);
evas_object_show(o);
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_hide(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
_enventor_object_efl_canvas_group_group_hide(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(pd->main_it->ed);
evas_object_hide(o);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_hide(o);
}
if (!pd->focused_it) return;
Evas_Object *o = edit_obj_get(pd->focused_it->ed);
evas_object_hide(o);
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_clip_set(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Object *clip)
_enventor_object_efl_canvas_group_group_clip_set(Eo *obj, Enventor_Object_Data *pd EINA_UNUSED, Evas_Object *clip)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(pd->main_it->ed);
evas_object_clip_set(o, clip);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_clip_set(o, clip);
}
Eina_Iterator *it = evas_object_smart_iterator_new(obj);
Evas_Object *o;
EINA_ITERATOR_FOREACH(it, o)
evas_object_clip_set(o, clip);
eina_iterator_free(it);
}
EOLIAN static void
_enventor_object_efl_canvas_group_group_clip_unset(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
_enventor_object_efl_canvas_group_group_clip_unset(Eo *obj, Enventor_Object_Data *pd EINA_UNUSED)
{
Enventor_Item *it;
//Main Item
it = pd->main_it;
if (it)
{
Evas_Object *o = edit_obj_get(pd->main_it->ed);
evas_object_clip_unset(o);
}
//Sub Items
Eina_List *l;
EINA_LIST_FOREACH(pd->sub_its, l, it)
{
Evas_Object *o = edit_obj_get(it->ed);
evas_object_clip_unset(o);
}
Eina_Iterator *it = evas_object_smart_iterator_new(obj);
Evas_Object *o;
EINA_ITERATOR_FOREACH(it, o)
evas_object_clip_unset(o);
eina_iterator_free(it);
}
EOLIAN static Eo *
@ -740,12 +663,14 @@ _enventor_object_focus_set(Eo *obj EINA_UNUSED,
Enventor_Object_Data *pd EINA_UNUSED,
Eina_Bool focus)
{
elm_object_focus_set(edit_entry_get(pd->focused_it->ed), focus);
if (!pd->focused_it) return;
edit_focus_set(pd->focused_it->ed, focus);
}
EOLIAN static Eina_Bool
_enventor_object_focus_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
{
if (!pd->focused_it) return;
return edit_focus_get(pd->focused_it->ed);
}
@ -941,7 +866,7 @@ enventor_object_focused_item_get(const Enventor_Object *obj)
/* Enventor_Item Functions. */
///////////////////////////////////////////////////////////////////////////////
EAPI Eina_Bool
enventor_item_focus_set(Enventor_Item *it)
enventor_item_represent(Enventor_Item *it)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE);
@ -949,7 +874,11 @@ enventor_item_focus_set(Enventor_Item *it)
if (pd->focused_it == it) return EINA_TRUE;
if (pd->focused_it) edit_view_sync_cb_set(pd->focused_it->ed, NULL, NULL);
if (pd->focused_it)
{
edit_view_sync_cb_set(pd->focused_it->ed, NULL, NULL);
evas_object_hide(edit_obj_get(pd->focused_it->ed));
}
edit_view_sync_cb_set(it->ed, edit_view_sync_cb, it);
pd->focused_it = it;
@ -959,6 +888,9 @@ enventor_item_focus_set(Enventor_Item *it)
edit_font_scale_set(it->ed, pd->font_scale);
edit_disabled_set(it->ed, pd->disabled);
if (evas_object_visible_get(it->pd->obj))
evas_object_show(edit_obj_get(it->ed));
autocomp_target_set(it->ed);
return EINA_TRUE;