Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/modules/ibar
Modified Files:
e_mod_main.c e_mod_main.h
Log Message:
- Make the drop object the right size.
- Correct drop position.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- e_mod_main.c 2 Jun 2005 09:49:07 -0000 1.56
+++ e_mod_main.c 8 Jun 2005 13:08:37 -0000 1.57
@@ -482,18 +482,30 @@
evas_object_resize(ibb->bar_object, 1000, 1000);
edje_object_calc_force(ibb->bar_object);
edje_object_part_geometry_get(ibb->bar_object, "items", &x, &y, &w, &h);
- ibb->inset.l = x;
- ibb->inset.r = 1000 - (x + w);
- ibb->inset.t = y;
- ibb->inset.b = 1000 - (y + h);
+ ibb->bar_inset.l = x;
+ ibb->bar_inset.r = 1000 - (x + w);
+ ibb->bar_inset.t = y;
+ ibb->bar_inset.b = 1000 - (y + h);
+
+ o = edje_object_add(ibb->evas);
+ e_theme_edje_object_set(o, "base/theme/modules/ibar",
+ "modules/ibar/icon");
+ evas_object_resize(o, 100, 100);
+ edje_object_calc_force(o);
+ edje_object_part_geometry_get(o, "item", &x, &y, &w, &h);
+ ibb->icon_inset.l = x;
+ ibb->icon_inset.r = 100 - (x + w);
+ ibb->icon_inset.t = y;
+ ibb->icon_inset.b = 100 - (y + h);
+ evas_object_del(o);
ibb->drop_handler = e_drop_handler_add(ibb,
_ibar_bar_cb_enter, _ibar_bar_cb_move,
_ibar_bar_cb_leave, _ibar_bar_cb_drop,
"enlightenment/eapp",
- ibb->x + ibb->inset.l, ibb->y +
ibb->inset.t,
- ibb->w - (ibb->inset.l +
ibb->inset.r),
- ibb->h - (ibb->inset.t +
ibb->inset.b));
+ ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
+ ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
+ ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
ibb->gmc = e_gadman_client_new(ibb->con->gadman);
e_gadman_client_domain_set(ibb->gmc, "module.ibar", bar_count++);
@@ -505,7 +517,7 @@
e_gadman_client_max_size_set(ibb->gmc, 3200, 3200);
e_gadman_client_auto_size_set(ibb->gmc, -1, -1);
e_gadman_client_align_set(ibb->gmc, 0.5, 1.0);
- e_gadman_client_resize(ibb->gmc, 400, 32 + ibb->inset.t + ibb->inset.b);
+ e_gadman_client_resize(ibb->gmc, 400, 32 + ibb->bar_inset.t +
ibb->bar_inset.b);
e_gadman_client_change_func_set(ibb->gmc, _ibar_bar_cb_gmc_change, ibb);
e_gadman_client_edge_set(ibb->gmc, E_GADMAN_EDGE_BOTTOM);
e_gadman_client_load(ibb->gmc);
@@ -603,7 +615,7 @@
IBar_Icon *ic;
char *str;
Evas_Object *o;
- Evas_Coord bw, bh;
+ Evas_Coord w, h;
ic = E_NEW(IBar_Icon, 1);
if (!ic) return NULL;
@@ -635,10 +647,9 @@
o = edje_object_add(ibb->evas);
ic->icon_object = o;
+ evas_object_resize(o, ibb->ibar->conf->iconsize, ibb->ibar->conf->iconsize);
edje_object_file_set(o, ic->app->path, "icon");
- edje_extern_object_min_size_set(o, ibb->ibar->conf->iconsize,
ibb->ibar->conf->iconsize);
edje_object_part_swallow(ic->bg_object, "item", o);
- edje_object_size_min_calc(ic->bg_object, &bw, &bh);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
@@ -659,13 +670,15 @@
evas_object_raise(ic->event_object);
+ w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r;
+ h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b;
e_box_pack_end(ibb->box_object, ic->bg_object);
e_box_pack_options_set(ic->bg_object,
1, 1, /* fill */
0, 0, /* expand */
0.5, 0.5, /* align */
- bw, bh, /* min */
- bw, bh /* max */
+ w, h, /* min */
+ w, h /* max */
);
str = (char *)edje_object_data_get(ic->icon_object, "raise_on_hilight");
@@ -856,7 +869,7 @@
static void
_ibar_icon_reorder_after(IBar_Icon *ic, IBar_Icon *after)
{
- Evas_Coord bw, bh;
+ Evas_Coord w, h;
e_box_freeze(ic->ibb->box_object);
e_box_unpack(ic->bg_object);
@@ -871,13 +884,14 @@
ic->ibb->icons = evas_list_append(ic->ibb->icons, ic);
e_box_pack_end(ic->ibb->box_object, ic->bg_object);
}
- edje_object_size_min_calc(ic->bg_object, &bw, &bh);
+ w = ic->ibb->ibar->conf->iconsize + ic->ibb->icon_inset.l +
ic->ibb->icon_inset.r;
+ h = ic->ibb->ibar->conf->iconsize + ic->ibb->icon_inset.t +
ic->ibb->icon_inset.b;
e_box_pack_options_set(ic->bg_object,
1, 1, /* fill */
0, 0, /* expand */
0.5, 0.5, /* align */
- bw, bh, /* min */
- bw, bh /* max */
+ w, h, /* min */
+ w, h /* max */
);
e_box_thaw(ic->ibb->box_object);
}
@@ -931,7 +945,7 @@
_ibar_bar_edge_change(IBar_Bar *ibb, int edge)
{
Evas_List *l;
- Evas_Coord bw, bh, tmp;
+ Evas_Coord w, h, tmp;
Evas_Object *o;
E_Gadman_Policy policy;
int changed;
@@ -955,18 +969,19 @@
o = ic->bg_object;
edje_object_signal_emit(o, "set_orientation",
_ibar_main_orientation[edge]);
edje_object_message_signal_process(o);
- edje_object_size_min_calc(ic->bg_object, &bw, &bh);
o = ic->overlay_object;
edje_object_signal_emit(o, "set_orientation",
_ibar_main_orientation[edge]);
edje_object_message_signal_process(o);
+ w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r;
+ h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b;
e_box_pack_options_set(ic->bg_object,
1, 1, /* fill */
0, 0, /* expand */
0.5, 0.5, /* align */
- bw, bh, /* min */
- bw, bh /* max */
+ w, h, /* min */
+ w, h /* max */
);
}
@@ -1400,6 +1415,10 @@
E_Event_Dnd_Enter *ev;
Evas_Object *o;
IBar_Bar *ibb;
+ IBar_Icon *ic;
+ Evas_Coord x, y, w, h;
+ double iw;
+ int pos;
ev = event;
ibb = data;
@@ -1407,7 +1426,48 @@
o = evas_object_rectangle_add(ibb->evas);
ibb->drag_object = o;
evas_object_color_set(o, 255, 0, 0, 255);
- evas_object_resize(o, 32, 32);
+ evas_object_resize(o, ibb->ibar->conf->iconsize, ibb->ibar->conf->iconsize);
+
+ if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
+ (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
+ {
+ iw = w / (double) e_box_pack_count_get(ibb->box_object);
+ pos = x / iw;
+ }
+ else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) ||
+ (e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT))
+ {
+ iw = h / (double) e_box_pack_count_get(ibb->box_object);
+ pos = y / iw;
+ }
+
+ ic = evas_list_nth(ibb->icons, pos);
+
+ e_box_freeze(ibb->box_object);
+ evas_object_show(ibb->drag_object);
+ e_box_unpack(ibb->drag_object);
+ if (ic)
+ {
+ /* Add new eapp before this icon */
+ e_box_pack_before(ibb->box_object, ibb->drag_object, ic->bg_object);
+ }
+ else
+ {
+ /* Add at the end */
+ e_box_pack_end(ibb->box_object, ibb->drag_object);
+ }
+ w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r;
+ h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b;
+ e_box_pack_options_set(ibb->drag_object,
+ 1, 1, /* fill */
+ 0, 0, /* expand */
+ 0.5, 0.5, /* align */
+ w, h, /* min */
+ w, h /* max */
+ );
+ e_box_thaw(ibb->box_object);
+
+ _ibar_bar_frame_resize(ibb);
}
static void
@@ -1423,25 +1483,23 @@
ev = event;
ibb = data;
- x = ev->x - (ibb->x + ibb->inset.l);
- y = ev->y - (ibb->y + ibb->inset.t);
- w = ibb->w - (ibb->inset.l + ibb->inset.r);
- h = ibb->h - (ibb->inset.t + ibb->inset.b);
+ x = ev->x - (ibb->x + ibb->bar_inset.l);
+ y = ev->y - (ibb->y + ibb->bar_inset.t);
+ w = ibb->w - (ibb->bar_inset.l + ibb->bar_inset.r);
+ h = ibb->h - (ibb->bar_inset.t + ibb->bar_inset.b);
if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
{
- iw = w / (double) evas_list_count(ibb->icons);
- pos = round(x / iw);
+ iw = w / (double) e_box_pack_count_get(ibb->box_object);
+ pos = x / iw;
}
else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT))
{
- iw = h / (double) evas_list_count(ibb->icons);
- pos = round(y / iw);
+ iw = h / (double) e_box_pack_count_get(ibb->box_object);
+ pos = y / iw;
}
- else
- return;
ic = evas_list_nth(ibb->icons, pos);
@@ -1458,13 +1516,14 @@
/* Add at the end */
e_box_pack_end(ibb->box_object, ibb->drag_object);
}
- edje_object_size_min_calc(ibb->drag_object, &w, &h);
+ w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r;
+ h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b;
e_box_pack_options_set(ibb->drag_object,
1, 1, /* fill */
0, 0, /* expand */
0.5, 0.5, /* align */
- 32, 32, /* min */
- 32, 32 /* max */
+ w, h, /* min */
+ w, h /* max */
);
e_box_thaw(ibb->box_object);
@@ -1512,25 +1571,23 @@
_ibar_bar_frame_resize(ibb);
/* add dropped element */
- x = ev->x - (ibb->x + ibb->inset.l);
- y = ev->y - (ibb->y + ibb->inset.t);
- w = ibb->w - (ibb->inset.l + ibb->inset.r);
- h = ibb->h - (ibb->inset.t + ibb->inset.b);
+ x = ev->x - (ibb->x + ibb->bar_inset.l);
+ y = ev->y - (ibb->y + ibb->bar_inset.t);
+ w = ibb->w - (ibb->bar_inset.l + ibb->bar_inset.r);
+ h = ibb->h - (ibb->bar_inset.t + ibb->bar_inset.b);
if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_BOTTOM) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_TOP))
{
iw = w / (double) evas_list_count(ibb->icons);
- pos = round(x / iw);
+ pos = x / iw;
}
else if ((e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_LEFT) ||
(e_gadman_client_edge_get(ibb->gmc) == E_GADMAN_EDGE_RIGHT))
{
iw = h / (double) evas_list_count(ibb->icons);
- pos = round(y / iw);
+ pos = y / iw;
}
- else
- return;
ic = evas_list_nth(ibb->icons, pos);
if (ic)
@@ -1576,9 +1633,9 @@
_ibar_bar_timer_handle(ibb);
e_drop_handler_geometry_set(ibb->drop_handler,
- ibb->x + ibb->inset.l, ibb->y +
ibb->inset.t,
- ibb->w - (ibb->inset.l + ibb->inset.r),
- ibb->h - (ibb->inset.t + ibb->inset.b));
+ ibb->x + ibb->bar_inset.l, ibb->y +
ibb->bar_inset.t,
+ ibb->w - (ibb->bar_inset.l +
ibb->bar_inset.r),
+ ibb->h - (ibb->bar_inset.t +
ibb->bar_inset.b));
break;
case E_GADMAN_CHANGE_EDGE:
_ibar_bar_edge_change(ibb, e_gadman_client_edge_get(ibb->gmc));
@@ -1635,23 +1692,22 @@
{
IBar_Icon *ic;
Evas_Object *o;
- Evas_Coord bw, bh;
+ Evas_Coord w, h;
ic = l->data;
o = ic->icon_object;
- edje_extern_object_min_size_set(o, ibb->ibar->conf->iconsize,
ibb->ibar->conf->iconsize);
evas_object_resize(o, ibb->ibar->conf->iconsize,
ibb->ibar->conf->iconsize);
-
edje_object_part_swallow(ic->bg_object, "item", o);
- edje_object_size_min_calc(ic->bg_object, &bw, &bh);
+ w = ibb->ibar->conf->iconsize + ibb->icon_inset.l + ibb->icon_inset.r;
+ h = ibb->ibar->conf->iconsize + ibb->icon_inset.t + ibb->icon_inset.b;
e_box_pack_options_set(ic->bg_object,
1, 1, /* fill */
0, 0, /* expand */
0.5, 0.5, /* align */
- bw, bh, /* min */
- bw, bh /* max */
+ w, h, /* min */
+ w, h /* max */
);
}
e_box_thaw(ibb->box_object);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/modules/ibar/e_mod_main.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_mod_main.h 14 May 2005 14:06:09 -0000 1.15
+++ e_mod_main.h 8 Jun 2005 13:08:44 -0000 1.16
@@ -62,7 +62,10 @@
Evas_Coord x, y, w, h;
struct {
Evas_Coord l, r, t, b;
- } inset;
+ } bar_inset;
+ struct {
+ Evas_Coord l, r, t, b;
+ } icon_inset;
E_Gadman_Client *gmc;
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs