summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2011-09-17 17:15:32 +0000
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2011-09-17 17:15:32 +0000
commit791c8cb3deb6a34d3ea15c19815ab6186a850fee (patch)
tree5e6a204f53dc5fdf840285684aca4011f14fbbf9
parent8020dd62f400001cbe79b0b9c0edd8b0a620b1b3 (diff)
E-MODULES-EXTRA/elfe: Add scroll to background when scrolling desktop and small changes to default theme
SVN revision: 63451
-rw-r--r--data/themes/default/default.edc12
-rw-r--r--data/themes/default/images/desk_selected.pngbin941 -> 711 bytes
-rw-r--r--data/themes/default/images/mainmenu_bg_bottom.pngbin3789 -> 3237 bytes
-rwxr-xr-xlaunch.sh2
-rw-r--r--src/desktop.c12
-rw-r--r--src/main.c88
-rw-r--r--src/main.h1
7 files changed, 85 insertions, 30 deletions
diff --git a/data/themes/default/default.edc b/data/themes/default/default.edc
index 46d3848..683ef0b 100644
--- a/data/themes/default/default.edc
+++ b/data/themes/default/default.edc
@@ -105,14 +105,11 @@ collections
105 parts { 105 parts {
106 /* background */ 106 /* background */
107 part { 107 part {
108 type: IMAGE; 108 name: "elfe.swallow.background";
109 type: SWALLOW;
109 mouse_events: 0; 110 mouse_events: 0;
110 description { 111 description {
111 state: "default" 0.0; 112 state: "default" 0.0;
112 visible: 0;
113 image {
114 normal: "bg.png";
115 }
116 } 113 }
117 } 114 }
118 part { 115 part {
@@ -827,8 +824,10 @@ collections
827 824
828 group { 825 group {
829 name: "elfe/dock/layout"; 826 name: "elfe/dock/layout";
827 images {
828 image: "engage_im0.png" COMP;
829 }
830 parts { 830 parts {
831
832 part { 831 part {
833 name: "menu.background.bottom"; 832 name: "menu.background.bottom";
834 mouse_events: 1; 833 mouse_events: 1;
@@ -837,6 +836,7 @@ collections
837 state: "default" 0.0; 836 state: "default" 0.0;
838 image.normal: "mainmenu_bg_bottom.png"; 837 image.normal: "mainmenu_bg_bottom.png";
839 image.border: 0 0 2 0; 838 image.border: 0 0 2 0;
839 color: 255 255 255 200;
840 } 840 }
841 } 841 }
842 842
diff --git a/data/themes/default/images/desk_selected.png b/data/themes/default/images/desk_selected.png
index e89caaa..bcfaa6c 100644
--- a/data/themes/default/images/desk_selected.png
+++ b/data/themes/default/images/desk_selected.png
Binary files differ
diff --git a/data/themes/default/images/mainmenu_bg_bottom.png b/data/themes/default/images/mainmenu_bg_bottom.png
index 4c97606..abb117f 100644
--- a/data/themes/default/images/mainmenu_bg_bottom.png
+++ b/data/themes/default/images/mainmenu_bg_bottom.png
Binary files differ
diff --git a/launch.sh b/launch.sh
index c09f707..aa7c887 100755
--- a/launch.sh
+++ b/launch.sh
@@ -1,2 +1,2 @@
1#!/bin/sh 1#!/bin/sh
2x-ui.sh --profile=illume-home --screen=320x480 \ No newline at end of file 2x-ui.sh --profile=illume --screen=480x800 \ No newline at end of file
diff --git a/src/desktop.c b/src/desktop.c
index abfdc33..e833f54 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -62,6 +62,17 @@ _scroller_scroll_anim_stop_cb(void *data , Evas_Object *obj __UNUSED__, void *ev
62 } 62 }
63} 63}
64 64
65static void
66_scroller_scroll_cb(void *data , Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
67{
68 Elfe_Desktop *desk = data;
69 Evas_Coord x, y, w, h;
70
71
72 elm_scroller_region_get(desk->sc, &x, &y, &w, &h);
73 evas_object_smart_callback_call(desk->layout, "scroll", &x);
74}
75
65static Eina_Bool 76static Eina_Bool
66_longpress_timer_cb(void *data) 77_longpress_timer_cb(void *data)
67{ 78{
@@ -470,6 +481,7 @@ elfe_desktop_add(Evas_Object *parent, E_Zone *zone)
470 /* evas_object_size_hint_max_set(desk->dock, 9999, 80); */ 481 /* evas_object_size_hint_max_set(desk->dock, 9999, 80); */
471 482
472 evas_object_smart_callback_add(desk->sc, "scroll,anim,stop", _scroller_scroll_anim_stop_cb, desk); 483 evas_object_smart_callback_add(desk->sc, "scroll,anim,stop", _scroller_scroll_anim_stop_cb, desk);
484 evas_object_smart_callback_add(desk->sc, "scroll", _scroller_scroll_cb, desk);
473 485
474 evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_MOVE, _scroller_mouse_move_cb, desk); 486 evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_MOVE, _scroller_mouse_move_cb, desk);
475 evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_UP, _scroller_mouse_up_cb, desk); 487 evas_object_event_callback_add(desk->sc, EVAS_CALLBACK_MOUSE_UP, _scroller_mouse_up_cb, desk);
diff --git a/src/main.c b/src/main.c
index e284e5c..bb860a7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -105,6 +105,31 @@ elfe_home_win_cfg_update(void)
105} 105}
106 106
107static void 107static void
108_scroll_anim_cb(void *data , Evas_Object *obj, void *event_info)
109{
110 Elfe_Home_Win *hwin = data;
111
112 int *x = (int*)event_info;
113 Evas_Coord w;
114 double pos;
115
116 evas_object_geometry_get(hwin->o_bg, NULL, NULL, &w, NULL);
117 pos = (double)((double)(*x) * (double)((double)(w - hwin->zone->w) /
118 (double)(hwin->zone->w * 4)));
119 elm_scroller_region_show(hwin->bg_scroller, pos, 0, hwin->zone->w, hwin->zone->h);
120}
121static void
122_cb_bg_resize(void *data , Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
123{
124 /* Elfe_Home_Win *hwin = data; */
125 /* Evas_Coord x, y, w, h; */
126
127 /* edje_object_parts_extends_calc(hwin->o_bg, &x, &y, &w, &h); */
128 /* evas_object_size_hint_min_set(hwin->o_bg, w, h); */
129 /* evas_object_size_hint_min_set(obj, w, h); */
130}
131
132static void
108_elfe_home_win_new(E_Zone *zone) 133_elfe_home_win_new(E_Zone *zone)
109{ 134{
110 135
@@ -112,9 +137,9 @@ _elfe_home_win_new(E_Zone *zone)
112 E_Desk *desk; 137 E_Desk *desk;
113 char buf[PATH_MAX]; 138 char buf[PATH_MAX];
114 const char *bgfile; 139 const char *bgfile;
115
116 Evas_Object *o_edje;
117 const char *file; 140 const char *file;
141 Evas_Object *rect;
142 Evas_Coord w, h;
118 143
119 hwin = E_OBJECT_ALLOC(Elfe_Home_Win, ELFE_HOME_WIN_TYPE, _elfe_home_win_cb_free); 144 hwin = E_OBJECT_ALLOC(Elfe_Home_Win, ELFE_HOME_WIN_TYPE, _elfe_home_win_cb_free);
120 if (!hwin) return; 145 if (!hwin) return;
@@ -137,49 +162,57 @@ _elfe_home_win_new(E_Zone *zone)
137 elfe_home_cfg->mod_dir); 162 elfe_home_cfg->mod_dir);
138 163
139 evas = e_win_evas_get(hwin->win); 164 evas = e_win_evas_get(hwin->win);
140 165 rect = evas_object_rectangle_add(evas);
141 desk = e_desk_current_get(zone); 166 evas_object_color_set(rect, 0, 0, 0, 255);
142 if (desk) 167 evas_object_move(rect, 0, 0);
143 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y); 168 evas_object_resize(rect, zone->w, zone->h);
144 else 169 evas_object_show(rect);
145 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
146
147 hwin->o_bg = edje_object_add(evas);
148 edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
149 evas_object_move(hwin->o_bg, 0, 0);
150 evas_object_show(hwin->o_bg);
151
152 printf("Create layout\n");
153 170
154 171
155 /* Specific ELM initialisation */ 172 /* Specific ELM initialisation */
156 elm_init(0, NULL); 173 elm_init(0, NULL);
157 elm_need_efreet(); 174 elm_need_efreet();
158 175
159 176 hwin->layout = elm_layout_add(rect);
160 hwin->layout = elm_layout_add(hwin->o_bg);
161 /* Try default theme first */ 177 /* Try default theme first */
162 file = e_theme_edje_file_get("base/theme/modules/elfe", "module/elfe/main"); 178 file = e_theme_edje_file_get("base/theme/modules/elfe", "module/elfe/main");
163 printf("file : %s\n", file);
164 if (file && file[0]) 179 if (file && file[0])
165 elm_layout_file_set(hwin->layout, file, "module/elfe/main"); 180 elm_layout_file_set(hwin->layout, file, "module/elfe/main");
166 else /* specific module theme otherwise */ 181 else /* specific module theme otherwise */
167 { 182 {
168 printf("specific file : %s\n", buf);
169 if (!elm_layout_file_set(hwin->layout, buf, "module/elfe/main")) 183 if (!elm_layout_file_set(hwin->layout, buf, "module/elfe/main"))
170 { 184 {
171 printf("Error loading group %s in %s theme file\n", "module/elfe/main", buf); 185 printf("Error loading group %s in %s theme file\n", "module/elfe/main", buf);
172 } 186 }
173 } 187 }
174 o_edje = elm_layout_edje_get(hwin->layout);
175 188
176 elfe_theme = elm_theme_new(); 189 elfe_theme = elm_theme_new();
177 /* Use specific module theme as elm theme overlay */ 190 /* Use specific module theme as elm theme overlay */
178 elm_theme_overlay_add(elfe_theme, buf); 191 elm_theme_overlay_add(elfe_theme, buf);
179 elm_object_theme_set(hwin->layout, elfe_theme); 192 elm_object_theme_set(hwin->layout, elfe_theme);
180 193
194 hwin->bg_scroller = elm_scroller_add(hwin->layout);
195
196 desk = e_desk_current_get(zone);
197 if (desk)
198 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
199 else
200 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
201
202 hwin->o_bg = edje_object_add(evas);
203 edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
204 evas_object_show(hwin->o_bg);
205 evas_object_event_callback_add(hwin->o_bg, EVAS_CALLBACK_RESIZE,
206 _cb_bg_resize, hwin);
207
208 elm_scroller_content_set(hwin->bg_scroller, hwin->o_bg);
209 evas_object_show(hwin->bg_scroller);
210 elm_layout_content_set(hwin->layout, "elfe.swallow.background", hwin->bg_scroller);
211
181 hwin->desktop = elfe_desktop_add(hwin->layout, hwin->zone); 212 hwin->desktop = elfe_desktop_add(hwin->layout, hwin->zone);
182 elm_layout_content_set(hwin->layout, "elfe.swallow.desktop", hwin->desktop); 213 elm_layout_content_set(hwin->layout, "elfe.swallow.desktop", hwin->desktop);
214 evas_object_smart_callback_add(hwin->desktop, "scroll", _scroll_anim_cb, hwin);
215
183 216
184 evas_object_move(hwin->layout, 0, 0); 217 evas_object_move(hwin->layout, 0, 0);
185 evas_object_show(hwin->layout); 218 evas_object_show(hwin->layout);
@@ -198,6 +231,7 @@ _elfe_home_win_new(E_Zone *zone)
198static void 231static void
199_elfe_home_win_cb_free(Elfe_Home_Win *hwin) 232_elfe_home_win_cb_free(Elfe_Home_Win *hwin)
200{ 233{
234 printf("CB FREE\n");
201 if (hwin->win->evas_win) e_drop_xdnd_register_set(hwin->win->evas_win, 0); 235 if (hwin->win->evas_win) e_drop_xdnd_register_set(hwin->win->evas_win, 0);
202 if (hwin->o_bg) evas_object_del(hwin->o_bg); 236 if (hwin->o_bg) evas_object_del(hwin->o_bg);
203 if (hwin->layout) evas_object_del(hwin->layout); 237 if (hwin->layout) evas_object_del(hwin->layout);
@@ -209,9 +243,14 @@ static void
209_elfe_home_win_cb_resize(E_Win *win) 243_elfe_home_win_cb_resize(E_Win *win)
210{ 244{
211 Elfe_Home_Win *hwin; 245 Elfe_Home_Win *hwin;
212 246 Evas_Coord w, h;
213 if (!(hwin = win->data)) return; 247 if (!(hwin = win->data)) return;
214 if (hwin->o_bg) evas_object_resize(hwin->o_bg, win->w, win->h); 248 if (hwin->o_bg)
249 {
250 evas_object_size_hint_min_set(hwin->o_bg, win->w, win->h);
251 edje_object_parts_extends_calc(hwin->o_bg, NULL, NULL, &w, &h);
252 evas_object_size_hint_min_set(hwin->o_bg, w, h);
253 }
215 if (hwin->layout) evas_object_resize(hwin->layout, win->w, win->h); 254 if (hwin->layout) evas_object_resize(hwin->layout, win->w, win->h);
216} 255}
217 256
@@ -228,6 +267,7 @@ _elfe_home_cb_bg_change(void *data __UNUSED__, int type, void *event __UNUSED__)
228 E_Zone *zone; 267 E_Zone *zone;
229 E_Desk *desk; 268 E_Desk *desk;
230 const char *bgfile; 269 const char *bgfile;
270 Evas_Coord w, h;
231 271
232 zone = hwin->zone; 272 zone = hwin->zone;
233 desk = e_desk_current_get(zone); 273 desk = e_desk_current_get(zone);
@@ -235,7 +275,9 @@ _elfe_home_cb_bg_change(void *data __UNUSED__, int type, void *event __UNUSED__)
235 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y); 275 bgfile = e_bg_file_get(zone->container->num, zone->num, desk->x, desk->y);
236 else 276 else
237 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1); 277 bgfile = e_bg_file_get(zone->container->num, zone->num, -1, -1);
238 edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background"); 278 edje_object_file_set(hwin->o_bg, bgfile, "e/desktop/background");
279 edje_object_parts_extends_calc(hwin->o_bg, NULL, NULL, &w, &h);
280 evas_object_size_hint_min_set(hwin->o_bg, w, h);
239 } 281 }
240 282
241 return ECORE_CALLBACK_PASS_ON; 283 return ECORE_CALLBACK_PASS_ON;
diff --git a/src/main.h b/src/main.h
index 43e1d98..e82fd70 100644
--- a/src/main.h
+++ b/src/main.h
@@ -13,6 +13,7 @@ struct _Elfe_Home_Win
13 13
14 E_Win *win; 14 E_Win *win;
15 Evas_Object *o_bg; 15 Evas_Object *o_bg;
16 Evas_Object *bg_scroller;
16 Evas_Object *layout; 17 Evas_Object *layout;
17 Evas_Object *desktop; 18 Evas_Object *desktop;
18 19