use aspect widget for theme preview, so that it scales up to fit as large as it can, without losing aspect

SVN revision: 29795
devs/princeamd/enlightenment-0.17-elive
rephorm 16 years ago committed by rephorm
parent e48b1cb1f7
commit 4de21d59b3
  1. 30
      src/bin/e_int_config_theme.c
  2. 24
      src/bin/e_widget_aspect.c
  3. 1
      src/bin/e_widget_aspect.h

@ -425,16 +425,26 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
_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;

@ -13,6 +13,7 @@ struct _E_Widget_Data
Evas_Object *child;
int aspect_w, aspect_h;
int aspect_preference;
double align_x, align_y;
};
@ -51,8 +52,8 @@ _e_wid_reconfigure(E_Widget_Data *wd)
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 @@ e_widget_aspect_add(Evas *evas, int w, int h)
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;
}
@ -99,6 +104,19 @@ e_widget_aspect_aspect_set(Evas_Object *obj, int w, int 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);
}
void
e_widget_aspect_child_set(Evas_Object *obj, Evas_Object *child)
{

@ -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

Loading…
Cancel
Save