From: Enlightenment S. <no-...@en...> - 2008-10-04 22:50:25
|
Log: edje_viewer sort-of works again. the edje display now uses mdi windows instead of the canvas some problems (also listed in the TODO) that need to be addressed: * put the mdi_area into a scroll view, so that dragging mdi windows does not resize the whole window * there's a bug where clicking on the title of the mdi_window moves it * somehow change the bg of the mdi_area to the checkers I'd appreciate some help with those things, if anyone has the spare time Author: urandom Date: 2008-10-04 15:47:42 -0700 (Sat, 04 Oct 2008) New Revision: 36438 Removed: trunk/edje_viewer/data/images/border.png Modified: trunk/edje_viewer/TODO trunk/edje_viewer/data/images/Makefile.am trunk/edje_viewer/src/bin/edje_etk.c trunk/edje_viewer/src/bin/edje_etk.h trunk/edje_viewer/src/bin/etk_gui.c trunk/edje_viewer/src/bin/etk_gui.h Modified: trunk/edje_viewer/TODO =================================================================== --- trunk/edje_viewer/TODO 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/TODO 2008-10-04 22:47:42 UTC (rev 36438) @@ -1,3 +1,10 @@ +[todo] Need to put the mdi_area into a scrollview, so that the window doesn't resize when you move the mdi_windows to the edje + +[bug] The mdi_window jumps on mouse-down + +[todo] change the mdi_area background to the checkers again + +================ Old bugs ===================== [bug] the edje part grows when its hidden and shown again (evas_object_geometry_get doesn't seem to return the correct values); [bug] make the edje parts move/resize with the canvas Modified: trunk/edje_viewer/data/images/Makefile.am =================================================================== --- trunk/edje_viewer/data/images/Makefile.am 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/data/images/Makefile.am 2008-10-04 22:47:42 UTC (rev 36438) @@ -1,4 +1,4 @@ -FILES = bg.png border.png shadow.png +FILES = bg.png shadow.png imgdir = $(pkgdatadir)/data/images img_DATA = $(FILES) Deleted: trunk/edje_viewer/data/images/border.png Modified: trunk/edje_viewer/src/bin/edje_etk.c =================================================================== --- trunk/edje_viewer/src/bin/edje_etk.c 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/src/bin/edje_etk.c 2008-10-04 22:47:42 UTC (rev 36438) @@ -25,19 +25,6 @@ #define FREE(ptr) do { if(ptr) { free(ptr); ptr = NULL; }} while (0); -static void edje_move_resize(Demo_Edje *de, Evas_Coord xx, Evas_Coord yy, - Evas_Coord ww, Evas_Coord hh); -static void top_down_cb(void *data, Evas *e, Evas_Object *obj, - void *event_info); -static void top_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); -static void top_move_cb(void *data, Evas *e, Evas_Object *obj, - void *event_info); -static void bottom_down_cb(void *data, Evas *e, Evas_Object *obj, - void *event_info); -static void bottom_up_cb(void *data, Evas *e, Evas_Object *obj, - void *event_info); -static void bottom_move_cb(void *data, Evas *e, Evas_Object *obj, - void *event_info); static void signal_cb(void *data, Evas_Object *o, const char *sig, const char *src); static void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, @@ -92,485 +79,41 @@ etk_canvas_object_add(canvas, o); } -void canvas_resize_cb(Etk_Object *canvas, const char *property_name __UNUSED__, void *data __UNUSED__) -{ - Evas *evas; - Evas_Coord x, y, w, h; - Evas_Coord xx, yy, ww, hh; - - evas = etk_widget_toplevel_evas_get(ETK_WIDGET(canvas)); - if (!evas) return; - - etk_widget_geometry_get(ETK_WIDGET(canvas), &x, &y, &w, &h); - xx = 10 + x; - yy = 10 + y; - ww = w/3 - 40; - hh = h/3 - 50; - - evas_object_resize(o_bg, w, h); - evas_object_move(o_bg, x, y); - evas_object_resize(o_shadow, w, h); - evas_object_move(o_shadow, x, y); - evas_object_image_fill_set(o_shadow, 0, 0, w, h); -} - -void list_entries(const char *file, Etk_Tree *tree, - Etk_Canvas *canvas __UNUSED__) -{ - Evas_List *entries; - Evas_List *collections = NULL; - Etk_Tree_Col *col1; - Etk_Tree_Row *row; - Etk_Bool sort_parts; - - entries = edje_file_collection_list(file); - col1 = etk_tree_nth_col_get(tree, 0); - - if (entries) - { - Evas_List *l; - - etk_tree_clear(tree); - - for (l = entries; l; l = l->next) - { - char *name; - Collection *co; - - name = l->data; - co = calloc(1, sizeof(Collection)); - collections = evas_list_append(collections, co); - co->file = strdup(file); - co->part = strdup(name); - co->de = NULL; - - row = etk_tree_row_append(tree, NULL, col1, name, NULL); - etk_tree_row_data_set(row, co); - } - edje_file_collection_list_free(entries); - edje_viewer_config_recent_set(file); - edje_viewer_config_last_set(file); - sort_parts = edje_viewer_config_sort_parts_get(); - if (sort_parts) - etk_tree_col_sort_set(col1, gui_part_col_sort_cb, NULL); - } -} - -Demo_Edje *edje_part_create(Etk_Tree *output, Etk_Canvas *canvas, +Demo_Edje *edje_part_create(Etk_Tree *output, Etk_Mdi_Area *mdi_area, const char *file, char *name) { + Etk_Widget *mdi_window; Evas_Object *o; Demo_Edje *de; - Evas_Coord xx, yy, ww, hh; - Evas_Coord cx, cy, cw, ch; Evas *evas; - evas = etk_widget_toplevel_evas_get(ETK_WIDGET(canvas)); - if (!evas) return NULL; - de = calloc(1, sizeof(Demo_Edje)); de->name = strdup(name); - etk_widget_geometry_get(ETK_WIDGET(canvas), &cx, &cy, &cw, &ch); - xx = 10 + cx; - yy = 10 + cy; - ww = cw/3 - 40; - hh = ch/3 - 50; - o = evas_object_image_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_image_file_set(o, DAT"data/images/border.png", NULL); - evas_object_image_smooth_scale_set(o, 0); - evas_object_color_set(o, 255, 255, 255, 255); - evas_object_image_border_set(o, 26, 26, 26, 26); - evas_object_image_fill_set(o, 0, 0, ww, hh); - evas_object_pass_events_set(o, 1); - de->image = o; + de->mdi_window = mdi_window = etk_mdi_window_new(); + etk_mdi_area_put(mdi_area, mdi_window, 20, 30); + etk_mdi_window_title_set(ETK_MDI_WINDOW(mdi_window), name); - o = evas_object_rectangle_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, top_down_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, top_up_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, top_move_cb, de); + evas = etk_widget_toplevel_evas_get(mdi_window); + if (!evas) return NULL; - de->top = o; - - o = evas_object_rectangle_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, - bottom_down_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, - bottom_up_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, - bottom_move_cb, de); - de->bottom = o; - - o = evas_object_rectangle_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, - bottom_down_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, - bottom_up_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, - bottom_move_cb, de); - de->left = 0; - - o = evas_object_rectangle_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, - bottom_down_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, - bottom_up_cb, de); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, - bottom_move_cb, de); - - de->right = o; - - o = evas_object_rectangle_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 255, 255, 255, 255); - evas_object_pass_events_set(o, 1); - de->title_clip = o; - - o = evas_object_text_add(evas); - etk_canvas_object_add(canvas, o); - evas_object_color_set(o, 0, 0, 0, 255); - evas_object_text_text_set(o, name); - evas_object_text_font_set(o, "Vera", 10); - evas_object_pass_events_set(o, 1); - evas_object_clip_set(o, de->title_clip); - de->title = o; - o = edje_object_add(evas); - etk_canvas_object_add(canvas, o); edje_object_message_handler_set(o, message_cb, output); edje_object_signal_callback_add(o, "*", "*", signal_cb, output); edje_object_file_set(o, file, name); edje_object_part_drag_size_set(o, "dragable", 0.01, 0.5); edje_object_part_drag_step_set(o, "dragable", 0.1, 0.1); edje_object_part_drag_page_set(o, "dragable", 0.2, 0.2); - de->edje = o; - de->first_run = ETK_TRUE; + de->etk_evas = etk_evas_object_new_from_object(o); + etk_bin_child_set(ETK_BIN(mdi_window), de->etk_evas); + etk_widget_size_request_set(mdi_window, 200, 130); return de; } -void edje_part_show(Etk_Canvas *canvas, Demo_Edje *de) +static void signal_cb(void *data, Evas_Object *o, const char *sig, const char *src) { - Evas_Coord x, y, w, h, xx, yy, ww, hh; - - etk_widget_geometry_get(ETK_WIDGET(canvas), &x, &y, &w, &h); - if (de->first_run) - { - xx = 10 + x; - yy = 10 + y; - ww = w/3 - 40; - hh = h/3 - 50; - de->cx = x; - de->cy = y; - de->cw = w; - de->ch = h; - - edje_move_resize(de, xx, yy, ww, hh); - de->first_run = ETK_FALSE; - } - - evas_object_show(de->image); - evas_object_show(de->top); - evas_object_show(de->bottom); - evas_object_show(de->left); - evas_object_show(de->right); - evas_object_show(de->title_clip); - evas_object_show(de->title); - evas_object_show(de->edje); - - edje_part_resize(de); - visible_elements = evas_list_append(visible_elements, de); -} - -void edje_part_hide(Demo_Edje *de) -{ - evas_object_hide(de->edje); - evas_object_hide(de->left); - evas_object_hide(de->right); - evas_object_hide(de->top); - evas_object_hide(de->bottom); - evas_object_hide(de->image); - evas_object_hide(de->title_clip); - evas_object_hide(de->title); - - visible_elements = evas_list_remove(visible_elements, de); -} - -void edje_part_resize(Demo_Edje *de) -{ - Evas_Coord x, y, w, h, tw, th; - Evas_Coord minw, minh; - - evas_object_geometry_get(de->edje, &x, &y, &w, &h); - x -= 10; - y -= 20; - w += 20; - h += 30; - minw = 20 + de->minw; - minh = 30 + de->minh; - evas_object_move(de->left, x, y + 20); - evas_object_resize(de->left, 10, h - 30); - evas_object_move(de->right, x + w - 10, y + 20); - evas_object_resize(de->right, 10, h - 30); - evas_object_move(de->top, x, y); - evas_object_resize(de->top, w, 20); - evas_object_move(de->bottom, x, y + (h - 10)); - evas_object_resize(de->bottom, w, 10); - evas_object_move(de->title_clip, x + 20, y); - evas_object_resize(de->title_clip, w - 40, 20); - evas_object_geometry_get(de->title, NULL, NULL, &tw, &th); - evas_object_move(de->title, x + ((w - tw) / 2), y + 4 + ((16 - th) / 2)); - evas_object_move(de->image, x, y); - evas_object_resize(de->image, w, h); - evas_object_image_fill_set(de->image, 0, 0, w, h); - evas_object_move(de->edje, x + 10, y + 20); - evas_object_resize(de->edje, w - 20, h - 30); -} - -static void edje_move_resize(Demo_Edje *de, Evas_Coord xx, Evas_Coord yy, - Evas_Coord ww, Evas_Coord hh) -{ - Evas_Coord tw, th, ew, eh; - - evas_object_move(de->image, xx, yy); - evas_object_resize(de->image, ww, hh); - evas_object_show(de->image); - - evas_object_move(de->top, xx, yy); - evas_object_resize(de->top, ww, 20); - evas_object_show(de->top); - - evas_object_move(de->bottom, xx, yy + hh - 10); - evas_object_resize(de->bottom, ww, 10); - evas_object_show(de->bottom); - - evas_object_move(de->left, xx, yy + 20); - evas_object_resize(de->left, 10, hh - 20 - 10); - evas_object_show(de->left); - - evas_object_move(de->right, xx + ww - 10, yy + 20); - evas_object_resize(de->right, 10, hh - 20 - 10); - evas_object_show(de->right); - - evas_object_move(de->title_clip, xx + 20, yy); - evas_object_resize(de->title_clip, ww - 20 - 20, 20); - evas_object_show(de->title_clip); - - evas_object_geometry_get(de->title, NULL, NULL, &tw, &th); - evas_object_move(de->title, xx + ((ww - tw) / 2), yy + 4 + ((16 - th) / 2)); - evas_object_show(de->title); - - ew = ww; - eh = hh; - edje_object_size_min_get(de->edje, &(de->minw), &(de->minh)); - if (ww < de->minw) ew = de->minw; - if (hh < de->minh) eh = de->minh; - edje_object_size_max_get(de->edje, &(de->maxw), &(de->maxh)); - if (de->maxw > 0) - { - if (ww > de->maxw) ew = de->maxw; - } - if (de->maxh > 0) - { - if (hh > de->maxh) eh = de->maxh; - } - evas_object_move(de->edje, xx + 10, yy + 20); - evas_object_resize(de->edje, ew, eh); - evas_object_show(de->edje); - -} - -static void bottom_down_cb -(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Demo_Edje *de; - Evas_Event_Mouse_Down *ev; - Evas_Coord x, y, w, h; - int hdir, vdir; - - de = data; - ev = event_info; - de->down_bottom = 1; - evas_object_geometry_get(de->edje, &x, &y, &w, &h); - hdir = 1; - vdir = 1; - x -= 10; - y -= 20; - w += 20; - h += 30; - if ((ev->canvas.x - x) < (w / 2)) hdir = 0; - if ((ev->canvas.y - y) < (h / 2)) vdir = 0; - de->hdir = hdir; - de->vdir = vdir; -} - -static void top_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Demo_Edje *de; - - de = data; - de->down_top = 1; - evas_object_raise(de->image); - evas_object_raise(de->top); - evas_object_raise(de->bottom); - evas_object_raise(de->left); - evas_object_raise(de->right); - evas_object_raise(de->title_clip); - evas_object_raise(de->title); - evas_object_raise(de->edje); -} - -static void top_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Demo_Edje *de; - - de = data; - de->down_top = 0; -} - -static void top_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Demo_Edje *de; - Evas_Event_Mouse_Move *ev; - - de = data; - ev = event_info; - if (de->down_top) - { - Evas_Coord x, y; - - evas_object_geometry_get(de->left, &x, &y, NULL, NULL); - evas_object_move(de->left, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->right, &x, &y, NULL, NULL); - evas_object_move(de->right, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->top, &x, &y, NULL, NULL); - evas_object_move(de->top, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->bottom, &x, &y, NULL, NULL); - evas_object_move(de->bottom, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->title_clip, &x, &y, NULL, NULL); - evas_object_move(de->title_clip, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->title, &x, &y, NULL, NULL); - evas_object_move(de->title, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->image, &x, &y, NULL, NULL); - evas_object_move(de->image, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - evas_object_geometry_get(de->edje, &x, &y, NULL, NULL); - evas_object_move(de->edje, - x + ev->cur.canvas.x - ev->prev.canvas.x, - y + ev->cur.canvas.y - ev->prev.canvas.y); - } -} - -static void bottom_up_cb -(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Demo_Edje *de; - - de = data; - de->down_bottom = 0; -} - -static void bottom_move_cb -(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) -{ - Demo_Edje *de; - Evas_Event_Mouse_Move *ev; - - de = data; - ev = event_info; - if (de->down_bottom) - { - Evas_Coord x, y, w, h; - Evas_Coord minw, minh; - Evas_Coord maxw, maxh; - int hdir, vdir; - - evas_object_geometry_get(de->edje, &x, &y, &w, &h); - hdir = de->hdir; - vdir = de->vdir; - x -= 10; - y -= 20; - w += 20; - h += 30; - minw = 20 + de->minw; - minh = 30 + de->minh; - maxw = 20 + de->maxw; - maxh = 30 + de->maxh; - - if (hdir > 0) - { - w += ev->cur.canvas.x - ev->prev.canvas.x; - if (w < minw) w = minw; - else if (w > maxw) w = maxw; - } - else - { - w -= ev->cur.canvas.x - ev->prev.canvas.x; - x += ev->cur.canvas.x - ev->prev.canvas.x; - if (w < minw) - { - x += w - minw; - w = minw; - } - if (w > maxw) - { - x -= w - maxw; - w = maxw; - } - } - if (vdir > 0) - { - h += ev->cur.canvas.y - ev->prev.canvas.y; - if (h < minh) h = minh; - if (h > maxh) h = maxh; - } - else - { - h -= ev->cur.canvas.y - ev->prev.canvas.y; - y += ev->cur.canvas.y - ev->prev.canvas.y; - if (h < minh) - { - y += h - minh; - h = minh; - } - if (h > maxh) - { - y -= h - maxh; - h = maxh; - } - } - evas_object_move(de->edje, x + 10, y + 20); - evas_object_resize(de->edje, w - 20, h - 30); - edje_part_resize(de); - } -} - -static void signal_cb -(void *data, Evas_Object *o, const char *sig, const char *src) -{ Etk_Tree *output; Etk_Tree_Col *col; Etk_Tree_Row *row; @@ -616,8 +159,8 @@ } -static void message_cb -(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg) +static void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, + int id, void *msg) { Etk_Tree *output; Etk_Tree_Col *col; Modified: trunk/edje_viewer/src/bin/edje_etk.h =================================================================== --- trunk/edje_viewer/src/bin/edje_etk.h 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/src/bin/edje_etk.h 2008-10-04 22:47:42 UTC (rev 36438) @@ -3,24 +3,14 @@ struct _Demo_Edje { - Evas_Object *edje; - Evas_Object *left; - Evas_Object *right; - Evas_Object *top; - Evas_Object *bottom; - Evas_Object *title; - Evas_Object *title_clip; - Evas_Object *image; - Evas_Coord minw, minh; - Evas_Coord maxw, maxh; - Evas_Coord cx, cy, cw, ch; - int hdir; - int vdir; - char down_top : 1; - char down_bottom : 1; - char *name; - - Etk_Bool first_run; + Etk_Widget *mdi_window; + Etk_Widget *etk_evas; + Etk_Tree_Col *tree_col; + Etk_Tree_Row *tree_row; + Evas_Coord minw, minh; + Evas_Coord maxw, maxh; + char *name; + void *data; }; struct _Collection @@ -39,13 +29,7 @@ Evas_List *visible_elements_get(void); void bg_setup(Etk_Canvas *canvas); -void canvas_resize_cb(Etk_Object *canvas, const char *property_name, - void *data); -void list_entries(const char *file, Etk_Tree *tree, Etk_Canvas *canvas); -Demo_Edje *edje_part_create(Etk_Tree *output, Etk_Canvas *canvas, +Demo_Edje *edje_part_create(Etk_Tree *output, Etk_Mdi_Area *mdi_area, const char *file, char *name); -void edje_part_show(Etk_Canvas *canvas, Demo_Edje *de); -void edje_part_hide(Demo_Edje *de); -void edje_part_resize(Demo_Edje *de); Modified: trunk/edje_viewer/src/bin/etk_gui.c =================================================================== --- trunk/edje_viewer/src/bin/etk_gui.c 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/src/bin/etk_gui.c 2008-10-04 22:47:42 UTC (rev 36438) @@ -34,6 +34,7 @@ static Etk_Bool _gui_tree_search(Gui *gui, Tree_Search direction); static void _open_edje_file(Gui *gui); +static void _list_entries(const char *file, Etk_Tree *tree); static Etk_Bool _gui_open_last_clicked_cb(Etk_Object *obj, void *data); static Etk_Bool _gui_sort_parts_clicked_cb(Etk_Object *obj, void *data); @@ -46,6 +47,7 @@ static Etk_Bool _gui_menu_item_open_edje_file_cb(Etk_Menu_Item *item, Gui *gui); static Etk_Bool _gui_fm_ok_clicked_cb(Etk_Button *btn, Gui *gui); static Etk_Bool _gui_fm_cancel_clicked_cb(Etk_Button *btn, Gui *gui); +static Etk_Bool _gui_mdi_window_delete_event_cb(Etk_Mdi_Window *mdi, Demo_Edje *de); static Etk_Bool _gui_main_window_deleted_cb(Etk_Window *obj, Gui *gui); static Etk_Bool _gui_tree_checkbox_toggled_cb(Etk_Object *obj, Etk_Tree_Row *row, void *data); @@ -173,11 +175,8 @@ ETK_CALLBACK(_gui_tree_key_down_cb), gui); etk_paned_child1_set(ETK_PANED(paned), gui->tree, ETK_FALSE); - gui->canvas = etk_canvas_new(); - etk_widget_size_request_set(gui->canvas, 500, 500); - etk_object_notification_callback_add(ETK_OBJECT(gui->canvas), "geometry", - canvas_resize_cb, NULL); - etk_paned_child2_set(ETK_PANED(paned), gui->canvas, ETK_TRUE); + gui->mdi_area = etk_mdi_area_new(); + etk_paned_child2_set(ETK_PANED(paned), gui->mdi_area, ETK_TRUE); gui->output = etk_tree_new(); etk_tree_headers_visible_set(ETK_TREE(gui->output), ETK_TRUE); @@ -220,7 +219,7 @@ ETK_OBJECT(send_button), ETK_CALLBACK(_gui_emit_signal_cb), gui); - bg_setup(ETK_CANVAS(gui->canvas)); +/* bg_setup(ETK_CANVAS(gui->canvas));*/ etk_widget_show_all(gui->win); check = edje_viewer_config_open_last_get(); @@ -347,10 +346,51 @@ static void _open_edje_file(Gui *gui) { - list_entries(gui->path, ETK_TREE(gui->tree), ETK_CANVAS(gui->canvas)); + _list_entries(gui->path, ETK_TREE(gui->tree)); etk_window_title_set(ETK_WINDOW(gui->win), gui->path); } +static void _list_entries(const char *file, Etk_Tree *tree) +{ + Evas_List *entries; + Evas_List *collections = NULL; + Etk_Tree_Col *col1; + Etk_Tree_Row *row; + Etk_Bool sort_parts; + + entries = edje_file_collection_list(file); + col1 = etk_tree_nth_col_get(tree, 0); + + if (entries) + { + Evas_List *l; + + etk_tree_clear(tree); + + for (l = entries; l; l = l->next) + { + char *name; + Collection *co; + + name = l->data; + co = calloc(1, sizeof(Collection)); + collections = evas_list_append(collections, co); + co->file = strdup(file); + co->part = strdup(name); + co->de = NULL; + + row = etk_tree_row_append(tree, NULL, col1, name, NULL); + etk_tree_row_data_set(row, co); + } + edje_file_collection_list_free(entries); + edje_viewer_config_recent_set(file); + edje_viewer_config_last_set(file); + sort_parts = edje_viewer_config_sort_parts_get(); + if (sort_parts) + etk_tree_col_sort_set(col1, gui_part_col_sort_cb, NULL); + } +} + static Etk_Bool _gui_open_last_clicked_cb(Etk_Object *obj, void *data) { Etk_Menu_Item_Check *item; @@ -583,6 +623,12 @@ return ETK_TRUE; } +static Etk_Bool _gui_mdi_window_delete_event_cb(Etk_Mdi_Window *mdi __UNUSED__, Demo_Edje *de) +{ + etk_tree_row_fields_set(de->tree_row, ETK_TRUE, de->tree_col, ETK_FALSE, NULL); + return ETK_FALSE; +} + static Etk_Bool _gui_tree_checkbox_toggled_cb(Etk_Object *obj, Etk_Tree_Row *row, void *data) @@ -590,22 +636,32 @@ Collection *co; Etk_Bool checked; Etk_Tree_Col *col; + Etk_Widget *mdi_win; Gui *gui; if (!(co = etk_tree_row_data_get(row))) return ETK_TRUE; if (!(col = ETK_TREE_COL(obj)) || !row) return ETK_TRUE; if (!(gui = data)) return ETK_TRUE; - if (!co->de) + if (!co->de) { co->de = edje_part_create(ETK_TREE(gui->output), - ETK_CANVAS(gui->canvas), co->file, co->part); + ETK_MDI_AREA(gui->mdi_area), co->file, co->part); + co->de->tree_col = col; + co->de->tree_row = row; + co->de->data = data; + } etk_tree_row_fields_get(row, col, &checked, NULL); + + mdi_win = co->de->mdi_window; if (checked) - edje_part_show(ETK_CANVAS(gui->canvas), co->de); + etk_widget_show_all(mdi_win); else - edje_part_hide(co->de); + etk_widget_hide(mdi_win); + etk_signal_connect_by_code(ETK_MDI_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(mdi_win), + ETK_CALLBACK(_gui_mdi_window_delete_event_cb), co->de); + return ETK_TRUE; } @@ -627,7 +683,7 @@ de = l->data; if (!de) continue; - edje_object_signal_emit(de->edje, sig, src); + edje_object_signal_emit(etk_evas_object_get(ETK_EVAS_OBJECT(de->etk_evas)), sig, src); } return ETK_TRUE; Modified: trunk/edje_viewer/src/bin/etk_gui.h =================================================================== --- trunk/edje_viewer/src/bin/etk_gui.h 2008-10-04 20:50:01 UTC (rev 36437) +++ trunk/edje_viewer/src/bin/etk_gui.h 2008-10-04 22:47:42 UTC (rev 36438) @@ -16,7 +16,7 @@ { Etk_Widget *win; Etk_Widget *tree; - Etk_Widget *canvas; + Etk_Widget *mdi_area; Etk_Widget *output; Etk_Widget *signal_entry; Etk_Widget *source_entry; |