edj_viewer: don't update views if they were deactivated.

This fixes the wireframe issue that deactivated views' wireframes are appeared
when the file is updated.

This is only happened if edc collections is consisted with multiple edc files.
If edj file is updated, all generated views will be updated.
and wireframes will be also updated and appeared.

but we don't need to update the deactivated views even if the edj is
updated. we could this with an activated boolean and this will be much
optimized way for many generated views.
This commit is contained in:
Hermet Park 2016-08-18 00:27:56 +09:00
parent fa929055a2
commit b5b39617f2
3 changed files with 42 additions and 4 deletions

View File

@ -197,8 +197,11 @@ edj_mgr_view_switch_to(view_data *vd)
ecore_timer_del(prev_edj->timer);
prev_edj->timer = ecore_timer_add(VIEW_CACHING_TIME, view_del_timer_cb,
prev_edj->vd);
view_activated_set(prev_edj->vd, EINA_FALSE);
}
em->edj = view_data_get(vd);
view_activated_set(vd, EINA_TRUE);
}
Evas_Object *

View File

@ -52,6 +52,8 @@ struct viewer_s
Eina_Bool edj_reload_need : 1;
Eina_Bool file_set_finished : 1;
Eina_Bool activated: 1;
Eina_Bool view_update_call_request : 1;
};
const char *PART_NAME = "part_name";
@ -374,7 +376,7 @@ view_obj_parts_callbacks_set(view_data *vd)
}
static void
update_edj_file_internal(view_data *vd)
update_view(view_data *vd)
{
view_images_monitor_set(vd);
view_obj_min_update(vd);
@ -382,6 +384,7 @@ update_edj_file_internal(view_data *vd)
dummy_obj_update(vd->layout);
wireframes_obj_update(vd->layout);
view_mirror_mode_update(vd);
if (vd->changed_part.part)
edje_edit_part_selected_state_set(vd->layout, vd->changed_part.part,
vd->changed_part.desc,
@ -389,10 +392,25 @@ update_edj_file_internal(view_data *vd)
view_obj_parts_callbacks_set(vd);
wireframes_obj_callbacks_set(vd->layout);
if (vd->view_update_call_request)
{
evas_object_smart_callback_call(vd->enventor,
SIG_LIVE_VIEW_UPDATED, vd->it);
vd->view_update_call_request = EINA_FALSE;
}
}
static void
update_edj_file_internal(view_data *vd)
{
vd->view_update_call_request = EINA_TRUE;
vd->edj_reload_need = EINA_FALSE;
vd->file_set_finished = EINA_TRUE;
evas_object_smart_callback_call(vd->enventor, SIG_LIVE_VIEW_UPDATED, vd->it);
if (!vd->activated) return;
update_view(vd);
}
static Eina_Bool
@ -431,8 +449,11 @@ exe_del_event_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
//Failed to load edj? I have no idea. Try again.
if (!edje_object_file_set(vd->layout, build_edj_path_get(), vd->group_name))
{
dummy_obj_update(vd->layout);
wireframes_obj_update(vd->layout);
if (vd->activated)
{
dummy_obj_update(vd->layout);
wireframes_obj_update(vd->layout);
}
ecore_timer_del(vd->update_edj_timer);
vd->file_set_finished = EINA_FALSE;
vd->update_edj_timer = ecore_timer_add(0.25, update_edj_file, vd);
@ -949,3 +970,16 @@ view_item_get(view_data *vd)
if (!vd) return NULL;
return vd->it;
}
void
view_activated_set(view_data *vd, Eina_Bool activated)
{
if (!vd) return;
activated = !!activated;
if (activated == vd->activated) return;
vd->activated = activated;
if (!activated) return;
update_view(vd);
}

View File

@ -220,6 +220,7 @@ void view_part_state_set(view_data *vd, const char *part, const char *descriptio
void view_obj_need_reload_set(view_data *vd);
Edje_Part_Type view_part_type_get(view_data *vd, const char *part);
Enventor_Item *view_item_get(view_data *vd);
void view_activated_set(view_data *vd, Eina_Bool activated);
/* template */
Eina_Bool template_part_insert(edit_data *ed, Edje_Part_Type part_type, Enventor_Template_Insert_Type insert_type, Eina_Bool fixed_w, Eina_Bool fixed_h, char *rel1_x_to, char *rel1_y_to, char *rel2_x_to, char *rel2_y_to, float align_x, float align_y, int min_w, int min_h,