Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/iconbar

Dir     : e17/apps/iconbar/src


Modified Files:
        container.c iconbar.c 


Log Message:


iconbar changes container direction based on whether its width or height is larger now.

scrolling works for both directions.

fixed bug where container lost elements when their size went to 0.



===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/container.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- container.c 11 Aug 2003 23:40:28 -0000      1.3
+++ container.c 12 Aug 2003 00:10:55 -0000      1.4
@@ -59,6 +59,9 @@
   cont = _container_fetch(container);
   if (!cont) return;
 
+//  if (cont->direction == direction) return;
+
+  printf("*********** direction: %d\n", direction);
   cont->direction = direction;
   _container_elements_fix(cont);
 }
@@ -326,6 +329,7 @@
 _container_element_new(Container *cont, Evas_Object *obj)
 {
   Container_Element *el;
+  double w, h;
 
   if (!obj) return NULL;
 
@@ -335,6 +339,10 @@
   evas_object_data_set(obj, "Container_Element", el);
   evas_object_show(obj);
 
+  evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+  el->orig_w = w;
+  el->orig_h = h;
+
   el->grabber = evas_object_rectangle_add(evas_object_evas_get(obj));
   evas_object_repeat_events_set(el->grabber, 1);
   evas_object_color_set(el->grabber, 0, 0, 0, 0);
@@ -386,6 +394,8 @@
       continue;
     }
     evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
+    if (ew == 0) ew = el->orig_w;
+    if (eh == 0) eh = el->orig_h;
 
     evas_object_resize(el->grabber, ew, eh);
 
@@ -456,26 +466,27 @@
       {
         if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
         {
-          ih = ah;
-          iw = ew * ih/eh;
+          iw = (aw - cont->spacing * (num - 1) ) / num;
+          ih = eh * iw/ew;
         }
         else
         {
-          ih = ah;
-          iw = ew;
+          iw = (aw - cont->spacing * (num - 1) ) / num;
+          ih = eh;
         }
       }
       else if (cont->fill & CONTAINER_FILL_POLICY_FILL_Y)
       {
         if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
         {
-          iw = (aw - cont->spacing * (num - 1) ) / num;
-          ih = eh * iw/ew;
+          ih = ah;
+          iw = ew * ih/eh;
+          printf("**** ih: %f, eh: %f, iw: %f\n", ih, eh, iw);
         }
         else
         {
-          iw = (aw - cont->spacing * (num - 1) ) / num;
-          ih = eh;
+          ih = ah;
+          iw = ew;
         }
       }
       else
@@ -487,13 +498,16 @@
       if (cont->align == CONTAINER_ALIGN_TOP)
         iy = ay;
       else if (cont->align == CONTAINER_ALIGN_CENTER)
-        ix = ay + (ah - eh) / 2;
+        iy = ay + (ah - eh) / 2;
       else if (cont->align == CONTAINER_ALIGN_BOTTOM)
         iy = ay + ah - eh;
-        
+
+      printf("**********ix: %f, iw: %f, cont->spacing: %d\n", ix, iw, cont->spacing);
       evas_object_move(el->obj, ix, iy);
+      evas_object_resize(el->obj, iw, ih);
       evas_object_move(el->grabber, ix, iy);
-      ix += ew + cont->spacing;
+      evas_object_resize(el->grabber, iw, ih);
+      ix += iw + cont->spacing;
     }
 
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/iconbar.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- iconbar.c   11 Aug 2003 23:40:28 -0000      1.3
+++ iconbar.c   12 Aug 2003 00:10:55 -0000      1.4
@@ -235,7 +235,21 @@
   if (ib->gui)
     evas_object_resize(ib->gui, w, h);
 
-//  iconbar_icons_fix(ib);
+  if (w > h)
+  {
+    printf("**** HORIZONTAL ****\n");
+    e_container_direction_set(ib->cont, 0);
+    e_container_fill_policy_set(ib->cont, CONTAINER_FILL_POLICY_FILL_Y |
+                                          CONTAINER_FILL_POLICY_KEEP_ASPECT);
+    e_container_padding_set(ib->cont, 5, 5, 11, 11);
+  }
+  else
+  {
+    e_container_direction_set(ib->cont, 1);
+    e_container_fill_policy_set(ib->cont, CONTAINER_FILL_POLICY_FILL_X |
+                                          CONTAINER_FILL_POLICY_KEEP_ASPECT);
+    e_container_padding_set(ib->cont, 11, 11, 5, 5);
+  }
 }
 
 void
@@ -309,8 +323,16 @@
     
   ib->scroll += 8;
 
-  e_container_padding_get(ib->cont, &l, &r, &t, &b);
-  e_container_padding_set(ib->cont, l, r, ib->scroll, b);
+  if (e_container_direction_get(ib->cont))
+  {
+    e_container_padding_get(ib->cont, &l, &r, &t, &b);
+    e_container_padding_set(ib->cont, l, r, ib->scroll, b);
+  }
+  else
+  {
+    e_container_padding_get(ib->cont, &l, &r, &t, &b);
+    e_container_padding_set(ib->cont, ib->scroll, r, t, b);
+  }
 //  iconbar_icons_fix(ib);
   return(1);
 }
@@ -328,8 +350,17 @@
     
   ib->scroll -= 8;
 
-  e_container_padding_get(ib->cont, &l, &r, &t, &b);
-  e_container_padding_set(ib->cont, l, r, ib->scroll, b);
+  if (e_container_direction_get(ib->cont))
+  {
+    e_container_padding_get(ib->cont, &l, &r, &t, &b);
+    e_container_padding_set(ib->cont, l, r, ib->scroll, b);
+  }
+  else
+  {
+    e_container_padding_get(ib->cont, &l, &r, &t, &b);
+    e_container_padding_set(ib->cont, ib->scroll, r, t, b);
+  }
+
 
 //  iconbar_icons_fix(ib);
 




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to