rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=4e262475b852cd78a5b0618661ca96ed5fe1c561
commit 4e262475b852cd78a5b0618661ca96ed5fe1c561 Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Wed Jul 8 17:18:22 2015 +0300 remove GET_OBJ macro --- src/bin/common/common_macro.h | 37 ------------------------------- src/bin/project_manager/project_manager.c | 9 +++----- src/bin/ui/editors/colorclass_manager.c | 8 ++----- src/bin/ui/editors/image_editor.c | 20 +++++------------ src/bin/ui/editors/sound_editor.c | 31 ++++++++------------------ src/bin/ui/editors/style_editor.c | 20 +++++------------ 6 files changed, 26 insertions(+), 99 deletions(-) diff --git a/src/bin/common/common_macro.h b/src/bin/common/common_macro.h index 1f516c7..055abdb 100644 --- a/src/bin/common/common_macro.h +++ b/src/bin/common/common_macro.h @@ -77,43 +77,6 @@ struct _Uns_List elm_object_text_set(lb, date); \ } -/* Getting first object from project. Needed to access top-level blocks */ -#define GET_OBJ(PROJECT, EDJE_OBJECT) \ - Eina_Inlist *_styles, *_classes, *_widgets = NULL; \ - Widget *_widget; \ - Class *_class; \ - Style *_style = NULL; \ - if (PROJECT->current_style) EDJE_OBJECT = PROJECT->current_style->obj; \ - else \ - { \ - _widgets = PROJECT->widgets; \ - if (!_widgets) EDJE_OBJECT = NULL; \ - else\ - { \ - _widget = EINA_INLIST_CONTAINER_GET(_widgets, Widget); \ - _classes = _widget->classes; \ - if (!_classes) EDJE_OBJECT = NULL; \ - else \ - { \ - _class = EINA_INLIST_CONTAINER_GET(_classes, Class); \ - _styles = _class->styles; \ - if (!_styles) EDJE_OBJECT = NULL; \ - else\ - { \ - _style = EINA_INLIST_CONTAINER_GET(_styles, Style); \ - EDJE_OBJECT = _style->obj; \ - } \ - } \ - } \ - if ((!EDJE_OBJECT) && (PROJECT->layouts)) \ - { \ - _style = EINA_INLIST_CONTAINER_GET(PROJECT->layouts, Style); \ - EDJE_OBJECT = _style->obj;\ - } \ - if (_style->isAlias) \ - EDJE_OBJECT = _style->main_group->obj; \ - } - #define GET_STYLE(PROJECT, STYLE) \ Eina_Inlist *_styles, *_classes, *_widgets = NULL; \ Widget *_widget; \ diff --git a/src/bin/project_manager/project_manager.c b/src/bin/project_manager/project_manager.c index 6a5af54..c1f73fa 100644 --- a/src/bin/project_manager/project_manager.c +++ b/src/bin/project_manager/project_manager.c @@ -749,7 +749,7 @@ _project_save(void *data, Evas_Object *edje_edit_obj; worker = (Project_Thread *)data; - GET_OBJ(worker->project, edje_edit_obj); + edje_edit_obj = worker->project->global_object; PROGRESS_SEND("Saving..."); ecore_thread_main_loop_begin(); @@ -1362,8 +1362,7 @@ pm_project_source_code_export(Project *pro, const char *dir_path) int value = -1, k = 0; const char *pos = NULL; char str[100]; - Evas_Object *edje_edit_obj; - GET_OBJ(pro, edje_edit_obj); + Evas_Object *edje_edit_obj = pro->global_object; path = eina_stringshare_printf("%s/%s.edc", dir_path, pro->name); f = fopen(path, "w"); @@ -1512,15 +1511,13 @@ _develop_export(void *data, Eina_Thread *thread __UNUSED__) { Project_Thread *worker; - Evas_Object *edje_edit_obj; worker = (Project_Thread *)data; PROGRESS_SEND(_("Export edj...")); WORKER_LOCK_TAKE; - GET_OBJ(worker->project, edje_edit_obj); - edje_edit_save_all(edje_edit_obj); + edje_edit_save_all(worker->project->global_object); eina_file_copy(worker->project->dev, worker->edj, EINA_FILE_COPY_PERMISSION | EINA_FILE_COPY_XATTR, NULL, NULL); diff --git a/src/bin/ui/editors/colorclass_manager.c b/src/bin/ui/editors/colorclass_manager.c index e2e616b..df9a333 100644 --- a/src/bin/ui/editors/colorclass_manager.c +++ b/src/bin/ui/editors/colorclass_manager.c @@ -50,7 +50,6 @@ struct _Colorclasses_Manager Evas_Object *mwin; Evas_Object *layout; Evas_Object *genlist; - Evas_Object *edit_obj; Evas_Object *edje_preview, *preview_layout; Evas_Object *colorsel1, *colorsel2, *colorsel3; Evas_Object *entry, *popup; @@ -657,16 +656,13 @@ _colorclass_manager_init(Colorclasses_Manager *edit) Eina_List *cclist = NULL; Eina_List *l = NULL; Colorclass_Item *it = NULL; - Evas_Object *edje_edit_obj = NULL; - GET_OBJ(edit->pr, edje_edit_obj); - edit->edit_obj = edje_edit_obj; - cclist = edje_edit_color_classes_list_get(edje_edit_obj); + cclist = edje_edit_color_classes_list_get(edit->pr->global_object); EINA_LIST_FOREACH(cclist, l, ccname) { it = (Colorclass_Item *)mem_calloc(1, sizeof(Colorclass_Item)); - if (!edje_edit_color_class_colors_get(edje_edit_obj, ccname, + if (!edje_edit_color_class_colors_get(edit->pr->global_object, ccname, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)) diff --git a/src/bin/ui/editors/image_editor.c b/src/bin/ui/editors/image_editor.c index d67775f..b4012ff 100644 --- a/src/bin/ui/editors/image_editor.c +++ b/src/bin/ui/editors/image_editor.c @@ -418,17 +418,14 @@ _image_info_usage_update(Image_Editor *img_edit) Evas_Object *list; Elm_Object_Item *it_group, *it_part; Edje_Part_Image_Use *image; - Evas_Object *edje_edit_obj; const char *cur_group = NULL; const char *cur_part = NULL; Eina_Stringshare *state_name; if (!img_edit->image_data_fields.image_name) return; - GET_OBJ(img_edit->pr, edje_edit_obj); - usage_list = - edje_edit_image_usage_list_get(edje_edit_obj, + edje_edit_image_usage_list_get(img_edit->pr->global_object, img_edit->image_data_fields.image_name, false); if (!eina_list_count(usage_list)) @@ -478,15 +475,12 @@ static void _image_info_setup(Image_Editor *img_edit, const Item* it) { - Evas_Object *edje_edit_obj = NULL; Eina_Stringshare *str; Evas_Object *image; Edje_Edit_Image_Comp comp; Eina_List *usage_list; int w, h; - GET_OBJ(img_edit->pr, edje_edit_obj); - _image_info_reset(img_edit); img_edit->image_data_fields.image_name = it->image_name; @@ -496,7 +490,7 @@ _image_info_setup(Image_Editor *img_edit, img_edit->image_data_fields.image = image; evas_object_show(image); - comp = edje_edit_image_compression_type_get(edje_edit_obj, it->image_name); + comp = edje_edit_image_compression_type_get(img_edit->pr->global_object, it->image_name); if (comp != EDJE_EDIT_IMAGE_COMP_USER) { @@ -513,7 +507,7 @@ _image_info_setup(Image_Editor *img_edit, if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY) { - int quality = edje_edit_image_compression_rate_get(edje_edit_obj, + int quality = edje_edit_image_compression_rate_get(img_edit->pr->global_object, it->image_name); elm_spinner_value_set(img_edit->image_data_fields.quality, quality); } @@ -532,7 +526,7 @@ _image_info_setup(Image_Editor *img_edit, _image_info_type_setup(img_edit->image_data_fields.layout, it->image_name); - usage_list = edje_edit_image_usage_list_get(edje_edit_obj, + usage_list = edje_edit_image_usage_list_get(img_edit->pr->global_object, it->image_name, false); _image_info_update_usage_info(img_edit, eina_list_count(usage_list)); _image_info_usage_update(img_edit); @@ -1059,13 +1053,11 @@ _image_editor_init(Image_Editor *img_edit) const char* image_name = NULL; Eina_List *images = NULL; int counter = 0; - Evas_Object *edje_edit_obj = NULL; if (!img_edit) return false; - GET_OBJ(img_edit->pr, edje_edit_obj); _image_editor_gengrid_group_items_add(img_edit); - images = edje_edit_images_list_get(edje_edit_obj); + images = edje_edit_images_list_get(img_edit->pr->global_object); if (images) { @@ -1077,7 +1069,7 @@ _image_editor_init(Image_Editor *img_edit) ERR("name not found for image #%d",counter); continue; } - it = _image_editor_gengrid_item_data_create(edje_edit_obj, + it = _image_editor_gengrid_item_data_create(img_edit->pr->global_object, image_name); if (it->comp_type == EDJE_EDIT_IMAGE_COMP_USER) elm_gengrid_item_insert_before(img_edit->gengrid, gic, it, diff --git a/src/bin/ui/editors/sound_editor.c b/src/bin/ui/editors/sound_editor.c index d06c0f0..8d935f8 100644 --- a/src/bin/ui/editors/sound_editor.c +++ b/src/bin/ui/editors/sound_editor.c @@ -625,14 +625,12 @@ _on_quit_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Evas_Object *edje_edit_obj; Eina_List *l, *l_next; Sound *snd; Sound_Editor *edit = (Sound_Editor *)data; if ((edit->pr->added_sounds) && (edit->sound_was_added)) { - GET_OBJ(edit->pr, edje_edit_obj); EINA_LIST_REVERSE_FOREACH_SAFE(edit->pr->added_sounds, l, l_next, snd) { if (!snd->is_saved) @@ -656,7 +654,6 @@ _on_ok_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Evas_Object *edje_edit_obj; Eina_List *l; Sound *snd; Eina_Bool multiselect; @@ -665,13 +662,12 @@ _on_ok_cb(void *data, Sound_Editor *edit = (Sound_Editor *)data; if ((edit->pr->added_sounds) && (edit->sound_was_added)) { - GET_OBJ(edit->pr, edje_edit_obj); EINA_LIST_FOREACH(edit->pr->added_sounds, l, snd) { if (!snd->tone_frq) - edje_edit_sound_sample_add(edje_edit_obj, snd->name, snd->src); + edje_edit_sound_sample_add(edit->pr->global_object, snd->name, snd->src); else - edje_edit_sound_tone_add(edje_edit_obj, snd->name, snd->tone_frq); + edje_edit_sound_tone_add(edit->pr->global_object, snd->name, snd->tone_frq); snd->is_saved = true; } @@ -966,7 +962,6 @@ _grid_sel_sample(void *data, Eina_List *l; Sound *snd; const char *snd_src; - Evas_Object *edje_edit_obj; double len = 0.0; const Item *item; Sound_Editor *edit = (Sound_Editor *)data; @@ -991,7 +986,6 @@ _grid_sel_sample(void *data, { item = elm_object_item_data_get(eina_list_data_get(sel_list)); edit->selected = eina_stringshare_add(item->sound_name); - GET_OBJ(edit->pr, edje_edit_obj); if ((edit->pr->added_sounds)) { @@ -1018,7 +1012,7 @@ _grid_sel_sample(void *data, } #ifdef HAVE_AUDIO - edit->io.buf = edje_edit_sound_samplebuffer_get(edje_edit_obj, edit->selected); + edit->io.buf = edje_edit_sound_samplebuffer_get(edit->pr->global_object, edit->selected); edit->io.data = eina_binbuf_string_get(edit->io.buf); edit->io.length = eina_binbuf_length_get(edit->io.buf); _initialize_io_data(edit); @@ -1027,7 +1021,7 @@ _grid_sel_sample(void *data, elm_slider_min_max_set(edit->rewind, 0, len); elm_slider_value_set(edit->rewind, 0.0); #endif - snd_src = edje_edit_sound_samplesource_get(edje_edit_obj, edit->selected); + snd_src = edje_edit_sound_samplesource_get(edit->pr->global_object, edit->selected); _sample_info_setup(edit, item, snd_src, len); eina_stringshare_del(snd_src); @@ -1096,7 +1090,7 @@ _gengrid_content_fill(Sound_Editor *edit) const char* sound_name, *snd_src; Evas_Object *edje_edit_obj; - GET_OBJ(edit->pr, edje_edit_obj); + edje_edit_obj = edit->pr->global_object; sounds = edje_edit_sound_samples_list_get(edje_edit_obj); tones = edje_edit_sound_tones_list_get(edje_edit_obj); @@ -1210,7 +1204,6 @@ _add_sample_done(void *data, Evas_Object *obj, void *event_info) { - Evas_Object *edje_edit_obj; Sound *snd; Item *it; Eina_Stringshare *sound_name, *tmp_sound_name; @@ -1225,10 +1218,9 @@ _add_sample_done(void *data, if ((ecore_file_exists(selected)) && (!ecore_file_is_dir(selected))) { - GET_OBJ(edit->pr, edje_edit_obj); sound_name = eina_stringshare_add(ecore_file_file_get(selected)); - samples_list = edje_edit_sound_samples_list_get(edje_edit_obj); + samples_list = edje_edit_sound_samples_list_get(edit->pr->global_object); EINA_LIST_FOREACH(samples_list, l, tmp_sound_name) if (tmp_sound_name == sound_name) /* they both are stringshares */ { @@ -1299,7 +1291,6 @@ _add_tone_done(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Evas_Object *edje_edit_obj; Sound *snd; Item *it; Eina_Stringshare *tone_name, *tmp_tone_name; @@ -1321,9 +1312,8 @@ _add_tone_done(void *data, } tone_name = eina_stringshare_add(elm_entry_entry_get(edit->tone_entry)); - GET_OBJ(edit->pr, edje_edit_obj); - tones_list = edje_edit_sound_samples_list_get(edje_edit_obj); + tones_list = edje_edit_sound_samples_list_get(edit->pr->global_object); EINA_LIST_FOREACH(tones_list, l, tmp_tone_name) if (tmp_tone_name == tone_name) /* they both are stringshares */ { @@ -1469,7 +1459,6 @@ _on_delete_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Evas_Object *edje_edit_obj; Elm_Object_Item *grid_it; Item *item; Sound *snd; @@ -1478,8 +1467,6 @@ _on_delete_clicked_cb(void *data, int selected, deleted = 0; Sound_Editor *edit = (Sound_Editor *)data; - GET_OBJ(edit->pr, edje_edit_obj); - list = (Eina_List *)elm_gengrid_selected_items_get(edit->gengrid); selected = eina_list_count(list); @@ -1495,9 +1482,9 @@ _on_delete_clicked_cb(void *data, if (!item->is_added) { if (!item->tone_frq) - edje_edit_sound_sample_del(edje_edit_obj, item->sound_name); + edje_edit_sound_sample_del(edit->pr->global_object, item->sound_name); else - edje_edit_sound_tone_del(edje_edit_obj, item->sound_name); + edje_edit_sound_tone_del(edit->pr->global_object, item->sound_name); deleted++; } else diff --git a/src/bin/ui/editors/style_editor.c b/src/bin/ui/editors/style_editor.c index f626343..7937b01 100644 --- a/src/bin/ui/editors/style_editor.c +++ b/src/bin/ui/editors/style_editor.c @@ -287,7 +287,7 @@ _on_glit_selected(void *data, Elm_Object_Item *glit = (Elm_Object_Item *)event_info; Elm_Object_Item *glit_parent = elm_genlist_item_parent_get(glit); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; if (!glit_parent) { @@ -378,7 +378,7 @@ _on_st_add_bt_ok(void *data, const char *style_name = elm_entry_entry_get(POPUP.name); App_Data *ap = app_data_get(); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; if ((!style_name) || (strcmp(style_name, "") == 0)) { @@ -440,7 +440,7 @@ _on_tag_add_bt_ok(void *data, Evas_Object *edje_edit_obj = NULL; const char *style_name = elm_object_item_data_get(style_edit->tag); const char *tag_name = elm_entry_entry_get(POPUP.name); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; if ((!tag_name) || (strcmp(tag_name, "") == 0)) { @@ -577,7 +577,7 @@ _on_bt_del(void *data, Elm_Object_Item *glit = elm_genlist_selected_item_get(style_edit->glist); if (!glit) return; Elm_Object_Item *glit_parent = elm_genlist_item_parent_get(glit); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; if (!glit_parent) { @@ -766,7 +766,7 @@ _form_left_side(Style_Editor *style_edit) EVAS_HINT_FILL); evas_object_size_hint_weight_set(style_edit->glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; styles = edje_edit_styles_list_get(edje_edit_obj); @@ -864,7 +864,7 @@ _tag_parse(Style_Editor *style_edit, const char *value, const char *text) int i = 0, k = 0, exist = 0, style_length = 0; eina_strbuf_append(tag, CURRENT.stvalue); - GET_OBJ(style_edit->pr, edje_edit_obj); + edje_edit_obj = style_edit->pr->global_object; stolen_buf = eina_strbuf_string_steal(tag); token = strtok(stolen_buf, " =+"); while (token) @@ -1317,7 +1317,6 @@ ITEM_COLOR_ADD(underline2_color, "underline2_color", "underline2_color") static void _text_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, const char *value) { - Evas_Object *edje_edit_obj = NULL; Evas_Object *layout; Evas_Object *fonts_list, *font_size; Evas_Object *font_weight; @@ -1331,7 +1330,6 @@ _text_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, SCROLLER_ADD(style_edit->mwin, scr); elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO); - GET_OBJ(style_edit->pr, edje_edit_obj); layout = elm_layout_add(style_edit->mwin); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1403,7 +1401,6 @@ _text_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, static void _format_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, const char *value) { - Evas_Object *edje_edit_obj = NULL; Evas_Object *box_frames, *frame1, *frame2, *layout1, *layout2; Evas_Object *font_align, *font_lmargin, *font_valign, *font_rmargin; Evas_Object *text_tabstops, *line_size, *rel_size; @@ -1418,7 +1415,6 @@ _format_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *i BOX_ADD(scr, box_frames, EINA_FALSE, EINA_FALSE) elm_box_align_set(box_frames, 0.5, 0.0); elm_object_content_set(scr, box_frames); - GET_OBJ(style_edit->pr, edje_edit_obj); FRAME_ADD(box_frames, frame1, false, _("Positioning option")) evas_object_size_hint_weight_set(frame1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1547,7 +1543,6 @@ _format_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *i static void _glow_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, const char *value) { - Evas_Object *edje_edit_obj = NULL; Evas_Object *layout, *item; Evas_Object *font_style, *shadow_color, *inner_glow, *outer_glow; int r, g, b, a; @@ -1558,7 +1553,6 @@ _glow_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, int count = 0, direction = DEFAULT_DIRECTION; SCROLLER_ADD(style_edit->mwin, scr); - GET_OBJ(style_edit->pr, edje_edit_obj); layout = elm_layout_add(style_edit->mwin); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1687,7 +1681,6 @@ _glow_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, static void _lines_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it, const char *value) { - Evas_Object *edje_edit_obj = NULL; Evas_Object *layout; Evas_Object *font_strikethrough, *strikethrough_color; Evas_Object *font_underline, *underline_style, *underline_color, *underline2_color; @@ -1698,7 +1691,6 @@ _lines_tab_update(Style_Editor *style_edit, Evas_Object *tabs, Ewe_Tabs_Item *it Evas_Object *scr; SCROLLER_ADD(style_edit->mwin, scr); - GET_OBJ(style_edit->pr, edje_edit_obj); layout = elm_layout_add(style_edit->mwin); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); --