Enlightenment CVS committal Author : rephorm Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_int_config_theme.c e_widget_aspect.c e_widget_aspect.h Log Message: use aspect widget for theme preview, so that it scales up to fit as large as it can, without losing aspect =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_theme.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -3 -r1.48 -r1.49 --- e_int_config_theme.c 17 Apr 2007 12:02:11 -0000 1.48 +++ e_int_config_theme.c 2 May 2007 02:18:39 -0000 1.49 @@ -425,16 +425,26 @@ _cb_import, cfdata, NULL); e_widget_list_object_append(il, o, 1, 0, 0.5); e_widget_list_object_append(of, il, 1, 0, 0.0); - - o = e_widget_preview_add(evas, 320, (320 * z->h) / z->w); - cfdata->o_preview = o; - if (cfdata->theme) - { - f = cfdata->theme; - e_widget_preview_edje_set(o, f, "e/desktop/background"); - } - e_widget_list_object_append(of, o, 0, 0, 0.5); - e_widget_table_object_append(ot, of, 1, 0, 1, 1, 0, 0, 0, 0); + + { + Evas_Object *oa; + int mw, mh; + + mw = 320; + mh = (mw * z->h) / z->w; + oa = e_widget_aspect_add(evas, mw, mh); + o = e_widget_preview_add(evas, mw, mh); + cfdata->o_preview = o; + if (cfdata->theme) + { + f = cfdata->theme; + e_widget_preview_edje_set(o, f, "e/desktop/background"); + } + e_widget_aspect_child_set(oa, o); + e_widget_list_object_append(of, oa, 1, 1, 0); + + } + e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); e_dialog_resizable_set(cfd->dia, 1); return ot; =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_aspect.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- e_widget_aspect.c 2 May 2007 02:06:39 -0000 1.3 +++ e_widget_aspect.c 2 May 2007 02:18:40 -0000 1.4 @@ -13,6 +13,7 @@ Evas_Object *child; int aspect_w, aspect_h; int aspect_preference; + double align_x, align_y; }; @@ -51,8 +52,8 @@ ch = (cw * wd->aspect_h) / wd->aspect_w; } - cx = px + ((pw - cw) / 2); - cy = py + ((ph - ch) / 2); + cx = px + (wd->align_x * (pw - cw)); + cy = py + (wd->align_y * (ph - ch)); printf("ASPECT RECONF - p: %d,%d %dx%d c: %d,%d %dx%d\n", px, py, pw, ph, cx, cy, cw, ch); evas_object_resize(wd->child, cw, ch); @@ -81,7 +82,11 @@ evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _cb_reconfigure, wd); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _cb_reconfigure, wd); - e_widget_aspect_aspect_set(obj, w, h); + wd->align_x = 0.5; + wd->align_y = 0.5; + wd->aspect_w = w; + wd->aspect_h = h; + _e_wid_reconfigure(wd); return obj; } @@ -96,6 +101,19 @@ wd->aspect_w = w; wd->aspect_h = h; + _e_wid_reconfigure(wd); +} + +void +e_widget_aspect_align_set(Evas_Object *obj, double align_x, double align_y) +{ + E_Widget_Data *wd; + + wd = e_widget_data_get(obj); + if (!wd) return; + + wd->align_x = align_x; + wd->align_y = align_y; _e_wid_reconfigure(wd); } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_aspect.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- e_widget_aspect.h 9 Oct 2006 19:06:43 -0000 1.1 +++ e_widget_aspect.h 2 May 2007 02:18:40 -0000 1.2 @@ -3,4 +3,5 @@ Evas_Object *e_widget_aspect_add(Evas *evas, int w, int h); void e_widget_aspect_aspect_set(Evas_Object *obj, int w, int h); void e_widget_aspect_child_set(Evas_Object *obj, Evas_Object *child); +void e_widget_aspect_align_set(Evas_Object *obj, double align_x, double align_y); #endif ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs