Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_border.c e_container.c e_gadman.c e_gadman.h 


Log Message:


1 more todo item...

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.367
retrieving revision 1.368
diff -u -3 -r1.367 -r1.368
--- e_border.c  23 Aug 2005 06:52:42 -0000      1.367
+++ e_border.c  25 Aug 2005 07:42:44 -0000      1.368
@@ -2290,8 +2290,8 @@
 
    bd = data;
    e = ev;
-   printf("##- CONF REQ 0x%x , %iX%i+%i+%i\n",
-         e->win, e->w, e->h, e->x, e->y);
+//   printf("##- CONF REQ 0x%x , %iX%i+%i+%i\n",
+//       e->win, e->w, e->h, e->x, e->y);
    bd = e_border_find_by_client_window(e->win);
    if (!bd)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -3 -r1.78 -r1.79
--- e_container.c       24 Aug 2005 04:22:52 -0000      1.78
+++ e_container.c       25 Aug 2005 07:42:44 -0000      1.79
@@ -1094,6 +1094,8 @@
    
    ev = calloc(1, sizeof(E_Event_Container_Resize));
    ev->container = con;
+   
+   e_gadman_all_save(con->gadman);
 
    e_xinerama_update();
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadman.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- e_gadman.c  5 Aug 2005 07:19:26 -0000       1.43
+++ e_gadman.c  25 Aug 2005 07:42:44 -0000      1.44
@@ -13,7 +13,6 @@
 
 struct _Gadman_Client_Config
 {
-//   double ax, ay;
    struct {
       int x, y, w, h;
    } pos;
@@ -21,6 +20,10 @@
    int edge;
    int zone;
    int use_autow, use_autoh;
+   struct {
+      int w, h;
+      Evas_List *others;
+   } res;
 };
 
 static void _e_gadman_free(E_Gadman *gm);
@@ -70,6 +73,9 @@
 
 static void _e_gadman_cb_end_edit_mode(void *data, E_Menu *m, E_Menu_Item *mi);
 
+static void _e_gadman_config_free(Gadman_Client_Config *cf);
+static void _e_gadman_client_geom_store(E_Gadman_Client *gmc);
+
 static E_Config_DD *gadman_config_edd = NULL;
 
 /* externally accessible functions */
@@ -81,8 +87,6 @@
 #undef D
 #define T Gadman_Client_Config
 #define D gadman_config_edd
-//   E_CONFIG_VAL(D, T, ax, DOUBLE);
-//   E_CONFIG_VAL(D, T, ay, DOUBLE);
    E_CONFIG_VAL(D, T, pos.x, INT);
    E_CONFIG_VAL(D, T, pos.y, INT);
    E_CONFIG_VAL(D, T, pos.w, INT);
@@ -93,6 +97,9 @@
    E_CONFIG_VAL(D, T, zone, INT);
    E_CONFIG_VAL(D, T, use_autow, INT);
    E_CONFIG_VAL(D, T, use_autoh, INT);
+   E_CONFIG_VAL(D, T, res.w, INT);
+   E_CONFIG_VAL(D, T, res.h, INT);
+   E_CONFIG_LIST(D, T, res.others, gadman_config_edd);
    return 1;
 }
 
@@ -155,6 +162,21 @@
 }
 
 void
+e_gadman_all_save(E_Gadman *gm)
+{
+   Evas_List *l;
+   
+   E_OBJECT_CHECK(gm);
+   for (l = gm->clients; l; l = l->next)
+     {
+       E_Gadman_Client *gmc;
+       
+       gmc = l->data;
+       e_gadman_client_save(gmc);
+     }
+}
+
+void
 e_gadman_container_resize(E_Gadman *gm)
 {
    Evas_List *l;
@@ -165,22 +187,7 @@
        E_Gadman_Client *gmc;
        
        gmc = l->data;
-       if (gmc->use_autow)
-         {
-            gmc->w = gmc->autow;
-            gmc->x = gmc->zone->x + ((gmc->zone->w - gmc->w) * gmc->ax);
-         }
-       if (gmc->use_autoh)
-         {
-            gmc->h = gmc->autoh;
-            gmc->y = gmc->zone->y + ((gmc->zone->h - gmc->h) * gmc->ay);
-         }
-       if (gmc->w > gmc->zone->w) gmc->w = gmc->zone->w;
-       if (gmc->h > gmc->zone->h) gmc->h = gmc->zone->h;
-       gmc->x = gmc->zone->x + ((gmc->zone->w - gmc->w) * gmc->ax);
-       gmc->y = gmc->zone->y + ((gmc->zone->h - gmc->h) * gmc->ay);
-       _e_gadman_client_overlap_deny(gmc);
-       _e_gadman_client_callback_call(gmc, E_GADMAN_CHANGE_MOVE_RESIZE);
+       e_gadman_client_load(gmc);
      }
 }
 
@@ -212,40 +219,77 @@
 void
 e_gadman_client_save(E_Gadman_Client *gmc)
 {
-   Gadman_Client_Config cf;
+   Gadman_Client_Config *cf, *cf2;
+   Evas_List *l;
    char buf[1024];
+   int found_res = 0;
    
    E_OBJECT_CHECK(gmc);
    E_OBJECT_TYPE_CHECK(gmc, E_GADMAN_CLIENT_TYPE);
    /* save all values */
-   cf.pos.x = gmc->x - gmc->zone->x;
-   cf.pos.y = gmc->y - gmc->zone->y;
-   cf.pos.w = gmc->zone->w;
-   cf.pos.h = gmc->zone->h;
-   cf.w = gmc->w;
-   cf.h = gmc->h;
-   cf.edge = gmc->edge;
-   cf.zone = gmc->zone->num;
-   cf.use_autow = gmc->use_autow;
-   cf.use_autoh = gmc->use_autoh;
+   if (!gmc->config)
+     {
+       cf = calloc(1, sizeof(Gadman_Client_Config));
+       gmc->config = cf;
+     }
+   cf = gmc->config;
+   _e_gadman_client_geom_store(gmc);
+   cf->res.w = gmc->zone->w;
+   cf->res.h = gmc->zone->h;
    snprintf(buf, sizeof(buf), "gadman.%s.%i", gmc->domain, gmc->instance);
-   e_config_domain_save(buf, gadman_config_edd, &cf);
+   for (l = cf->res.others; l; l = l->next)
+     {
+       cf2 = (Gadman_Client_Config *)l->data;
+       if ((cf2->res.w == cf->res.w) && (cf2->res.h == cf->res.h))
+         {
+            *cf2 = *cf;
+            cf2->res.others = NULL;
+            found_res = 1;
+            break;
+         }
+     }
+   if (!found_res)
+     {
+       cf2 = calloc(1, sizeof(Gadman_Client_Config));
+       cf->res.others = evas_list_prepend(cf->res.others, cf2);
+       *cf2 = *cf;
+       cf2->res.others = NULL;
+     }
+   e_config_domain_save(buf, gadman_config_edd, cf);
 }
 
 void
 e_gadman_client_load(E_Gadman_Client *gmc)
 {
-   Gadman_Client_Config *cf;
+   Gadman_Client_Config *cf, *cf2;
+   Evas_List *l;
    char buf[1024];
    
    E_OBJECT_CHECK(gmc);
    E_OBJECT_TYPE_CHECK(gmc, E_GADMAN_CLIENT_TYPE);
+   if (gmc->config)
+     {
+       _e_gadman_config_free(gmc->config);
+       gmc->config = NULL;
+     }
    snprintf(buf, sizeof(buf), "gadman.%s.%i", gmc->domain, gmc->instance);
    cf = e_config_domain_load(buf, gadman_config_edd);
    if (cf)
      {
        E_Zone *zone;
        
+       for (l = cf->res.others; l; l = l->next)
+         {
+            cf2 = (Gadman_Client_Config *)l->data;
+            zone = e_container_zone_number_get(gmc->zone->container, 
cf2->zone);
+            if ((zone->w == cf2->res.w) && (zone->h == cf2->res.h))
+              {
+                 l = cf->res.others;
+                 *cf = *cf2;
+                 cf->res.others = l;
+                 break;
+              }
+         }
        E_CONFIG_LIMIT(cf->pos.x, 0, 10000);
        E_CONFIG_LIMIT(cf->pos.y, 0, 10000);
        E_CONFIG_LIMIT(cf->pos.w, 1, 10000);
@@ -290,10 +334,13 @@
          gmc->y = gmc->zone->y + ((cf->pos.y * (gmc->zone->h - gmc->h)) / 
(cf->pos.h - gmc->h));
        else
          gmc->y = gmc->zone->y;
-       free(cf);
+       gmc->config = cf;
      }
    else
      {
+       cf = calloc(1, sizeof(Gadman_Client_Config));
+       gmc->config = cf;
+       _e_gadman_client_geom_store(gmc);
      }
    _e_gadman_client_overlap_deny(gmc);
    e_object_ref(E_OBJECT(gmc));
@@ -655,6 +702,7 @@
    if (gmc->event_object) evas_object_del(gmc->event_object);
    gmc->gadman->clients = evas_list_remove(gmc->gadman->clients, gmc);
    if (gmc->domain) free(gmc->domain);
+   _e_gadman_config_free(gmc->config);
    free(gmc);
 }
 
@@ -1890,3 +1938,32 @@
    gmc = data;
    e_gadman_mode_set(gmc->gadman, E_GADMAN_MODE_NORMAL);
 }
+
+static void
+_e_gadman_config_free(Gadman_Client_Config *cf)
+{
+   while (cf->res.others)
+     {
+       _e_gadman_config_free(cf->res.others->data);
+       cf->res.others = evas_list_remove_list(cf->res.others, cf->res.others);
+     }
+   free(cf);
+}
+
+static void
+_e_gadman_client_geom_store(E_Gadman_Client *gmc)
+{
+   Gadman_Client_Config *cf;
+   
+   cf = gmc->config;
+   cf->pos.x = gmc->x - gmc->zone->x;
+   cf->pos.y = gmc->y - gmc->zone->y;
+   cf->pos.w = gmc->zone->w;
+   cf->pos.h = gmc->zone->h;
+   cf->w = gmc->w;
+   cf->h = gmc->h;
+   cf->edge = gmc->edge;
+   cf->zone = gmc->zone->num;
+   cf->use_autow = gmc->use_autow;
+   cf->use_autoh = gmc->use_autoh;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_gadman.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- e_gadman.h  8 Jul 2005 09:45:54 -0000       1.13
+++ e_gadman.h  25 Aug 2005 07:42:44 -0000      1.14
@@ -85,6 +85,7 @@
    double               mina, maxa;
    void               (*func) (void *data, E_Gadman_Client *gmc, 
E_Gadman_Change change);
    void                *data;
+   void                *config;
 };
 
 EAPI int              e_gadman_init(void);
@@ -92,6 +93,7 @@
 EAPI E_Gadman        *e_gadman_new(E_Container *con);
 EAPI void             e_gadman_mode_set(E_Gadman *gm, E_Gadman_Mode mode);
 EAPI E_Gadman_Mode    e_gadman_mode_get(E_Gadman *gm);
+EAPI void             e_gadman_all_save(E_Gadman *gm);
 EAPI void             e_gadman_container_resize(E_Gadman *gm);
 EAPI E_Gadman_Client *e_gadman_client_new(E_Gadman *gm);
 EAPI void             e_gadman_client_save(E_Gadman_Client *gmc);




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to