forked from enlightenment/enlightenment
Added transition preview widget.
Added widget to the transition dialog. SVN revision: 26489
This commit is contained in:
parent
999ea7f86b
commit
aaba28d390
|
@ -174,7 +174,8 @@ e_obj_dialog.h \
|
||||||
e_int_config_transitions.h \
|
e_int_config_transitions.h \
|
||||||
e_fwin.h \
|
e_fwin.h \
|
||||||
e_widget_aspect.h \
|
e_widget_aspect.h \
|
||||||
e_widget_desk_preview.h
|
e_widget_desk_preview.h \
|
||||||
|
e_widget_trans_preview.h
|
||||||
|
|
||||||
enlightenment_src = \
|
enlightenment_src = \
|
||||||
e_user.c \
|
e_user.c \
|
||||||
|
@ -325,6 +326,7 @@ e_obj_dialog.c \
|
||||||
e_fwin.c \
|
e_fwin.c \
|
||||||
e_widget_aspect.c \
|
e_widget_aspect.c \
|
||||||
e_widget_desk_preview.c \
|
e_widget_desk_preview.c \
|
||||||
|
e_widget_trans_preview.c \
|
||||||
$(ENLIGHTENMENTHEADERS)
|
$(ENLIGHTENMENTHEADERS)
|
||||||
|
|
||||||
enlightenment_SOURCES = \
|
enlightenment_SOURCES = \
|
||||||
|
|
|
@ -151,3 +151,4 @@
|
||||||
#include "e_fwin.h"
|
#include "e_fwin.h"
|
||||||
#include "e_widget_aspect.h"
|
#include "e_widget_aspect.h"
|
||||||
#include "e_widget_desk_preview.h"
|
#include "e_widget_desk_preview.h"
|
||||||
|
#include "e_widget_trans_preview.h"
|
||||||
|
|
|
@ -281,5 +281,4 @@ _cb_slider_change(void *data, Evas_Object *obj)
|
||||||
E_Config_Dialog_Data *cfdata = data;
|
E_Config_Dialog_Data *cfdata = data;
|
||||||
|
|
||||||
e_widget_desk_preview_num_desks_set(cfdata->preview, cfdata->x, cfdata->y);
|
e_widget_desk_preview_num_desks_set(cfdata->preview, cfdata->x, cfdata->y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ struct _E_Config_Dialog_Data
|
||||||
|
|
||||||
Evas_Object *event_list;
|
Evas_Object *event_list;
|
||||||
Evas_Object *trans_list;
|
Evas_Object *trans_list;
|
||||||
|
Evas_Object *tp;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI E_Config_Dialog *
|
EAPI E_Config_Dialog *
|
||||||
|
@ -104,9 +105,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ot, *il;
|
E_Zone *zone;
|
||||||
|
Evas_Object *o, *of, *ot, *il, *ob;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
|
zone = e_zone_current_get(cfd->con);
|
||||||
|
|
||||||
o = e_widget_list_add(evas, 1, 0);
|
o = e_widget_list_add(evas, 1, 0);
|
||||||
ot = e_widget_table_add(evas, 0);
|
ot = e_widget_table_add(evas, 0);
|
||||||
|
@ -114,7 +118,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
of = e_widget_framelist_add(evas, _("Events"), 0);
|
of = e_widget_framelist_add(evas, _("Events"), 0);
|
||||||
il = e_widget_ilist_add(evas, 48, 48, NULL);
|
il = e_widget_ilist_add(evas, 48, 48, NULL);
|
||||||
cfdata->event_list = il;
|
cfdata->event_list = il;
|
||||||
e_widget_min_size_set(il, 160, 200);
|
e_widget_min_size_set(il, 160, 225);
|
||||||
e_widget_ilist_append(il, NULL, _("Startup"), _event_cb_changed, cfdata, NULL);
|
e_widget_ilist_append(il, NULL, _("Startup"), _event_cb_changed, cfdata, NULL);
|
||||||
e_widget_ilist_append(il, NULL, _("Desk Change"), _event_cb_changed, cfdata, NULL);
|
e_widget_ilist_append(il, NULL, _("Desk Change"), _event_cb_changed, cfdata, NULL);
|
||||||
e_widget_ilist_append(il, NULL, _("Background Change"), _event_cb_changed, cfdata, NULL);
|
e_widget_ilist_append(il, NULL, _("Background Change"), _event_cb_changed, cfdata, NULL);
|
||||||
|
@ -125,7 +129,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
of = e_widget_framelist_add(evas, _("Transitions"), 0);
|
of = e_widget_framelist_add(evas, _("Transitions"), 0);
|
||||||
il = e_widget_ilist_add(evas, 48, 48, NULL);
|
il = e_widget_ilist_add(evas, 48, 48, NULL);
|
||||||
cfdata->trans_list = il;
|
cfdata->trans_list = il;
|
||||||
e_widget_min_size_set(il, 160, 200);
|
e_widget_min_size_set(il, 160, 225);
|
||||||
|
|
||||||
e_widget_ilist_append(il, NULL, _("None"), _trans_cb_changed, cfdata, NULL);
|
e_widget_ilist_append(il, NULL, _("None"), _trans_cb_changed, cfdata, NULL);
|
||||||
l = e_theme_transition_list();
|
l = e_theme_transition_list();
|
||||||
|
@ -140,6 +144,12 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
e_widget_framelist_object_append(of, il);
|
e_widget_framelist_object_append(of, il);
|
||||||
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Preview"), 0);
|
||||||
|
ob = e_widget_trans_preview_add(evas, 300, ((300 * zone->h) / zone->w));
|
||||||
|
cfdata->tp = ob;
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_table_object_append(ot, of, 2, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
|
@ -223,4 +233,6 @@ _trans_cb_changed(void *data)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!t) return;
|
||||||
|
e_widget_trans_preview_trans_set(cfdata->tp, t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
typedef struct _E_Widget_Data E_Widget_Data;
|
||||||
|
struct _E_Widget_Data
|
||||||
|
{
|
||||||
|
Evas_Object *obj, *o_frame, *o_clip;
|
||||||
|
Evas_Object *prev_bg, *bg, *o_trans;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void _e_wid_del_hook(Evas_Object *obj);
|
||||||
|
static void _e_wid_done(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||||
|
|
||||||
|
EAPI Evas_Object *
|
||||||
|
e_widget_trans_preview_add(Evas *evas, int minw, int minh)
|
||||||
|
{
|
||||||
|
Evas_Object *obj, *o;
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
obj = e_widget_add(evas);
|
||||||
|
e_widget_del_hook_set(obj, _e_wid_del_hook);
|
||||||
|
|
||||||
|
wd = calloc(1, sizeof(E_Widget_Data));
|
||||||
|
wd->obj = obj;
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->o_frame = o;
|
||||||
|
e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/preview");
|
||||||
|
evas_object_show(o);
|
||||||
|
e_widget_sub_object_add(obj, o);
|
||||||
|
e_widget_resize_object_set(obj, o);
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->prev_bg = o;
|
||||||
|
e_theme_edje_object_set(o, "base/theme/backgrounds", "e/desktop/background");
|
||||||
|
evas_object_layer_set(o, -1);
|
||||||
|
evas_object_clip_set(o, wd->o_frame);
|
||||||
|
evas_object_show(o);
|
||||||
|
edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->prev_bg);
|
||||||
|
|
||||||
|
e_widget_data_set(obj, wd);
|
||||||
|
e_widget_can_focus_set(obj, 0);
|
||||||
|
e_widget_min_size_set(obj, minw, minh);
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_widget_trans_preview_trans_set(Evas_Object *obj, const char *trans)
|
||||||
|
{
|
||||||
|
Evas *evas;
|
||||||
|
Evas_Object *o;
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
evas = evas_object_evas_get(wd->o_frame);
|
||||||
|
|
||||||
|
if (wd->o_trans)
|
||||||
|
evas_object_del(wd->o_trans);
|
||||||
|
if (wd->bg)
|
||||||
|
evas_object_del(wd->bg);
|
||||||
|
if (wd->prev_bg)
|
||||||
|
evas_object_del(wd->prev_bg);
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "e/transitions/%s", trans);
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->o_trans = o;
|
||||||
|
e_theme_edje_object_set(wd->o_trans, "base/theme/transitions", buf);
|
||||||
|
edje_object_signal_callback_add(o, "e,state,done", "*", _e_wid_done, wd);
|
||||||
|
evas_object_layer_set(o, -1);
|
||||||
|
evas_object_clip_set(o, wd->o_frame);
|
||||||
|
evas_object_show(o);
|
||||||
|
edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->o_trans);
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->bg = o;
|
||||||
|
e_theme_edje_object_set(o, "base/theme/icons", "e/icons/enlightenment/e");
|
||||||
|
evas_object_layer_set(o, -1);
|
||||||
|
evas_object_clip_set(o, wd->o_frame);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->prev_bg = o;
|
||||||
|
e_theme_edje_object_set(o, "base/theme/backgrounds", "e/desktop/background");
|
||||||
|
evas_object_layer_set(o, -1);
|
||||||
|
evas_object_clip_set(o, wd->o_frame);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
edje_object_part_swallow(wd->o_trans, "e.swallow.bg.old", wd->prev_bg);
|
||||||
|
edje_object_part_swallow(wd->o_trans, "e.swallow.bg.new", wd->bg);
|
||||||
|
edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->o_trans);
|
||||||
|
|
||||||
|
edje_object_signal_emit(wd->o_trans, "e,action,start", "e");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_wid_del_hook(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
|
||||||
|
wd = e_widget_data_get(obj);
|
||||||
|
if (wd->o_frame)
|
||||||
|
evas_object_del(wd->o_frame);
|
||||||
|
if (wd->o_trans)
|
||||||
|
evas_object_del(wd->o_trans);
|
||||||
|
if (wd->bg)
|
||||||
|
evas_object_del(wd->bg);
|
||||||
|
if (wd->prev_bg)
|
||||||
|
evas_object_del(wd->prev_bg);
|
||||||
|
E_FREE(wd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_wid_done(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||||
|
{
|
||||||
|
E_Widget_Data *wd;
|
||||||
|
Evas_Object *o;
|
||||||
|
Evas *evas;
|
||||||
|
|
||||||
|
wd = data;
|
||||||
|
evas = evas_object_evas_get(wd->o_frame);
|
||||||
|
|
||||||
|
if (wd->o_trans)
|
||||||
|
evas_object_del(wd->o_trans);
|
||||||
|
if (wd->bg)
|
||||||
|
evas_object_del(wd->bg);
|
||||||
|
if (wd->prev_bg)
|
||||||
|
evas_object_del(wd->prev_bg);
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
wd->prev_bg = o;
|
||||||
|
e_theme_edje_object_set(o, "base/theme/backgrounds", "e/desktop/background");
|
||||||
|
evas_object_layer_set(o, -1);
|
||||||
|
evas_object_clip_set(o, wd->o_frame);
|
||||||
|
evas_object_show(o);
|
||||||
|
edje_object_part_swallow(wd->o_frame, "e.swallow.content", wd->prev_bg);
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef E_WIDGET_TRANS_PREVIEW_H
|
||||||
|
#define E_WIDGET_TRANS_PREVIEW_H
|
||||||
|
|
||||||
|
Evas_Object *e_widget_trans_preview_add(Evas *evas, int minw, int minh);
|
||||||
|
void e_widget_trans_preview_trans_set(Evas_Object *obj, const char *trans);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue