|
From: <enl...@li...> - 2005-01-17 10:26:32
|
Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_gadman.c
Log Message:
respect bounds on resize too (some fixme's)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadman.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_gadman.c 17 Jan 2005 10:05:15 -0000 1.4
+++ e_gadman.c 17 Jan 2005 10:26:17 -0000 1.5
@@ -289,11 +289,12 @@
gmc = data;
if (!gmc->moving) return;
evas_pointer_canvas_xy_get(gmc->gadman->container->bg_evas, &x, &y);
- printf("%i %i\n", x, y);
gmc->x = gmc->down_store_x + (x - gmc->down_x);
gmc->y = gmc->down_store_y + (y - gmc->down_y);
gmc->w = gmc->down_store_w;
gmc->h = gmc->down_store_h;
+ /* FIXME: limit to zone, edge, or handle zone jump */
+ /* limit to the zone */
if (gmc->x < gmc->zone->x)
gmc->x = gmc->zone->x;
else if ((gmc->x + gmc->w) > (gmc->zone->x + gmc->zone->w))
@@ -346,6 +347,29 @@
gmc->y = gmc->down_store_y;
gmc->w = gmc->down_store_w - (x - gmc->down_x);
gmc->h = gmc->down_store_h;
+ /* limit to zone left edge */
+ if (gmc->x < gmc->zone->x)
+ {
+ gmc->w = (gmc->down_store_x + gmc->down_store_w) - gmc->zone->x;
+ gmc->x = gmc->zone->x;
+ }
+ /* limit to min size */
+ if (gmc->w < gmc->minw)
+ {
+ gmc->x += (gmc->minw - gmc->w);
+ gmc->w = gmc->minw;
+ }
+ /* limit to max size */
+ if (gmc->maxw > 0)
+ {
+ if (gmc->w > gmc->minw)
+ {
+ gmc->x -= (gmc->maxw - gmc->w);
+ gmc->w = gmc->maxw;
+ }
+ }
+ /* FIXME: detect that the user ALMOST resized to full zone width/height */
+ /* and jump to it */
evas_object_move(gmc->control_object, gmc->x, gmc->y);
evas_object_resize(gmc->control_object, gmc->w, gmc->h);
}
@@ -390,6 +414,26 @@
gmc->y = gmc->down_store_y;
gmc->w = gmc->down_store_w + (x - gmc->down_x);
gmc->h = gmc->down_store_h;
+ /* limit to zone right edge */
+ if ((gmc->x + gmc->w) > (gmc->zone->x + gmc->zone->w))
+ {
+ gmc->w = (gmc->zone->x + gmc->zone->w) - gmc->x;
+ }
+ /* limit to min size */
+ if (gmc->w < gmc->minw)
+ {
+ gmc->w = gmc->minw;
+ }
+ /* limit to max size */
+ if (gmc->maxw > 0)
+ {
+ if (gmc->w > gmc->maxw)
+ {
+ gmc->w = gmc->maxw;
+ }
+ }
+ /* FIXME: detect that the user ALMOST resized to full zone width/height */
+ /* and jump to it */
evas_object_move(gmc->control_object, gmc->x, gmc->y);
evas_object_resize(gmc->control_object, gmc->w, gmc->h);
}
@@ -434,6 +478,29 @@
gmc->y = gmc->down_store_y + (y - gmc->down_y);
gmc->w = gmc->down_store_w;
gmc->h = gmc->down_store_h - (y - gmc->down_y);
+ /* limit to zone top edge */
+ if (gmc->y < gmc->zone->y)
+ {
+ gmc->h = (gmc->down_store_y + gmc->down_store_h) - gmc->zone->y;
+ gmc->y = gmc->zone->y;
+ }
+ /* limit to min size */
+ if (gmc->h < gmc->minh)
+ {
+ gmc->y += (gmc->minh - gmc->h);
+ gmc->h = gmc->minh;
+ }
+ /* limit to max size */
+ if (gmc->maxh > 0)
+ {
+ if (gmc->h > gmc->minh)
+ {
+ gmc->y -= (gmc->maxh - gmc->h);
+ gmc->h = gmc->maxh;
+ }
+ }
+ /* FIXME: detect that the user ALMOST resized to full zone width/height */
+ /* and jump to it */
evas_object_move(gmc->control_object, gmc->x, gmc->y);
evas_object_resize(gmc->control_object, gmc->w, gmc->h);
}
@@ -478,6 +545,26 @@
gmc->y = gmc->down_store_y;
gmc->w = gmc->down_store_w;
gmc->h = gmc->down_store_h + (y - gmc->down_y);
+ /* limit to zone right bottom */
+ if ((gmc->y + gmc->h) > (gmc->zone->y + gmc->zone->h))
+ {
+ gmc->h = (gmc->zone->y + gmc->zone->h) - gmc->y;
+ }
+ /* limit to min size */
+ if (gmc->h < gmc->minh)
+ {
+ gmc->h = gmc->minh;
+ }
+ /* limit to max size */
+ if (gmc->maxh > 0)
+ {
+ if (gmc->h > gmc->maxh)
+ {
+ gmc->h = gmc->maxh;
+ }
+ }
+ /* FIXME: detect that the user ALMOST resized to full zone width/height */
+ /* and jump to it */
evas_object_move(gmc->control_object, gmc->x, gmc->y);
evas_object_resize(gmc->control_object, gmc->w, gmc->h);
}
|