Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_config.c e_config.h e_gadcon.c e_gadcon.h e_shelf.c 
        e_shelf.h 


Log Message:


add frame object selection ability - broke move of the framed "ibar" test.
need to fix framed gadcon clients to account for frame size.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -3 -r1.163 -r1.164
--- e_config.c  3 Apr 2006 14:01:00 -0000       1.163
+++ e_config.c  4 Apr 2006 15:42:25 -0000       1.164
@@ -38,7 +38,6 @@
 static E_Config_DD *_e_config_gadcon_edd = NULL;
 static E_Config_DD *_e_config_gadcon_client_edd = NULL;
 static E_Config_DD *_e_config_shelf_edd = NULL;
-static E_Config_DD *_e_config_shelf_config_edd = NULL;
 
 
 /* externally accessible functions */
@@ -90,6 +89,8 @@
    E_CONFIG_VAL(D, T, geom.pos, INT);
    E_CONFIG_VAL(D, T, geom.size, INT);
    E_CONFIG_VAL(D, T, geom.res, INT);
+   E_CONFIG_VAL(D, T, style, STR);
+   E_CONFIG_VAL(D, T, autoscroll, UCHAR);
    
    _e_config_gadcon_edd = E_CONFIG_DD_NEW("E_Config_Gadcon", E_Config_Gadcon);
 #undef T
@@ -100,22 +101,6 @@
    E_CONFIG_VAL(D, T, id, STR);
    E_CONFIG_LIST(D, T, clients, _e_config_gadcon_client_edd);
    
-   _e_config_shelf_config_edd = E_CONFIG_DD_NEW("E_Config_Shelf_Config", 
E_Config_Shelf_Config);
-#undef T
-#undef D
-#define T E_Config_Shelf_Config
-#define D _e_config_shelf_config_edd
-   E_CONFIG_VAL(D, T, res.w, INT);
-   E_CONFIG_VAL(D, T, res.h, INT);
-   E_CONFIG_VAL(D, T, x, INT);
-   E_CONFIG_VAL(D, T, y, INT);
-   E_CONFIG_VAL(D, T, w, INT);
-   E_CONFIG_VAL(D, T, h, INT);
-   E_CONFIG_VAL(D, T, orient, INT);
-   E_CONFIG_VAL(D, T, style, STR);
-   E_CONFIG_VAL(D, T, fit_along, UCHAR);
-   E_CONFIG_VAL(D, T, fit_size, UCHAR);
-   
    _e_config_shelf_edd = E_CONFIG_DD_NEW("E_Config_Shelf", E_Config_Shelf);
 #undef T
 #undef D
@@ -126,7 +111,11 @@
    E_CONFIG_VAL(D, T, zone, INT);
    E_CONFIG_VAL(D, T, layer, INT);
    E_CONFIG_VAL(D, T, popup, UCHAR);
-   E_CONFIG_LIST(D, T, configs, _e_config_shelf_config_edd);
+   E_CONFIG_VAL(D, T, orient, INT);
+   E_CONFIG_VAL(D, T, fit_along, UCHAR);
+   E_CONFIG_VAL(D, T, fit_size, UCHAR);
+   E_CONFIG_VAL(D, T, style, STR);
+   E_CONFIG_VAL(D, T, size, INT);
    
    _e_config_desktop_bg_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Background", 
E_Config_Desktop_Background);
 #undef T
@@ -1026,10 +1015,14 @@
                      E_BINDING_MODIFIER_ALT, 0,
                      "desk_linear_flip_by", "1");
      }
+   IFCFGEND;
+   /* yes - this causes a small leak - i know. it is for testing temporarily 
x*/
+   e_config->shelves = NULL;
+   e_config->gadcons = NULL;
+//   IFCFG(0x008e); /* the version # where this value(s) was introduced */
 #if 1 // this is liable to change
      {
        E_Config_Shelf *cf_es;
-       E_Config_Shelf_Config *cf_escf;
        
        cf_es = E_NEW(E_Config_Shelf, 1);
        cf_es->name = evas_stringshare_add("shelf");
@@ -1037,20 +1030,12 @@
        cf_es->zone = 0;
        cf_es->popup = 1;
        cf_es->layer = 200;
+       cf_es->orient = E_GADCON_ORIENT_TOP;
+       cf_es->fit_along = 1;
+       cf_es->fit_size = 0;
+       cf_es->style = evas_stringshare_add("default");
+       cf_es->size = 40;
        e_config->shelves = evas_list_append(e_config->shelves, cf_es);
-       
-       cf_escf = E_NEW(E_Config_Shelf_Config, 1);
-       cf_escf->res.w = 800;
-       cf_escf->res.h = 600;
-       cf_escf->x = 0;
-       cf_escf->y = 0;
-       cf_escf->w = 800;
-       cf_escf->h = 40;
-       cf_escf->orient = E_GADCON_ORIENT_TOP;
-       cf_escf->fit_along = 1;
-       cf_escf->fit_size = 0;
-       cf_escf->style = evas_stringshare_add("default");
-       cf_es->configs = evas_list_append(cf_es->configs, cf_escf);
      }
      {
        E_Config_Gadcon *cf_gc;
@@ -1067,6 +1052,8 @@
        cf_gcc->geom.res = 800;
        cf_gcc->geom.size = 200;
        cf_gcc->geom.pos = 400 - (cf_gcc->geom.size / 2);
+       cf_gcc->style = evas_stringshare_add("inset");
+       cf_gcc->autoscroll = 0;
        cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
        
        cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
@@ -1075,6 +1062,8 @@
        cf_gcc->geom.res = 800;
        cf_gcc->geom.size = 32;
        cf_gcc->geom.pos = 800 - (cf_gcc->geom.size);
+       cf_gcc->style = NULL;
+       cf_gcc->autoscroll = 0;
        cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
        
        cf_gcc = E_NEW(E_Config_Gadcon_Client, 1);
@@ -1083,10 +1072,12 @@
        cf_gcc->geom.res = 800;
        cf_gcc->geom.size = 32;
        cf_gcc->geom.pos = 0;
+       cf_gcc->style = NULL;
+       cf_gcc->autoscroll = 0;
        cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc);
      }
 #endif
-   IFCFGEND;
+//   IFCFGEND;
    
 #if 0 /* example of new config */
    IFCFG(0x008e); /* the version # where this value(s) was introduced */
@@ -1201,7 +1192,6 @@
    E_CONFIG_DD_FREE(_e_config_gadcon_edd);
    E_CONFIG_DD_FREE(_e_config_gadcon_client_edd);
    E_CONFIG_DD_FREE(_e_config_shelf_edd);
-   E_CONFIG_DD_FREE(_e_config_shelf_config_edd);
    return 1;
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -3 -r1.93 -r1.94
--- e_config.h  3 Apr 2006 14:01:00 -0000       1.93
+++ e_config.h  4 Apr 2006 15:42:25 -0000       1.94
@@ -36,7 +36,6 @@
 typedef struct _E_Config_Gadcon             E_Config_Gadcon;
 typedef struct _E_Config_Gadcon_Client      E_Config_Gadcon_Client;
 typedef struct _E_Config_Shelf              E_Config_Shelf;
-typedef struct _E_Config_Shelf_Config       E_Config_Shelf_Config;
 
 typedef Eet_Data_Descriptor                 E_Config_DD;
 
@@ -316,6 +315,8 @@
    struct {
       int pos, size, res;
    } geom;
+   const char   *style;
+   unsigned char autoscroll;
 };
 
 struct _E_Config_Shelf
@@ -324,19 +325,11 @@
    int container, zone;
    int layer;
    unsigned char popup;
-   Evas_List *configs;
-};
-
-struct _E_Config_Shelf_Config
-{
-   struct {
-      int w, h;
-   } res;
-   int x, y, w, h;
    int orient;
-   const char *style;
    unsigned char fit_along;
    unsigned char fit_size;
+   const char *style;
+   int size;
 };
 
 EAPI int        e_config_init(void);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- e_gadcon.c  4 Apr 2006 09:54:50 -0000       1.14
+++ e_gadcon.c  4 Apr 2006 15:42:25 -0000       1.15
@@ -8,7 +8,7 @@
 
 static void _e_gadcon_client_save(E_Gadcon_Client *gcc);
 
-static void _e_gadcon_cb_size_request(void *data, Evas *e, Evas_Object *obj, 
void *event_info);
+static void _e_gadcon_cb_size_request(void *data, Evas_Object *obj, void 
*event_info);
 static void _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, 
void *event_info);
 static void _e_gadcon_cb_mouse_up(void *data, Evas *evas, Evas_Object *obj, 
void *event_info);
 static void _e_gadcon_cb_mouse_in(void *data, Evas *evas, Evas_Object *obj, 
void *event_info);
@@ -51,17 +51,17 @@
 static Evas_List *gadcons = NULL;
    
 static E_Gadcon_Client *
-__test(E_Gadcon *gc, char *name, char *id)
+__test(E_Gadcon *gc, char *name, char *id, char *style)
 {
    Evas_Object *o;
    E_Gadcon_Client *gcc;
    
-   printf("create gadcon client \"%s\" \"%s\" for \"%s\" \"%s\"\n",
-         name, id, 
+   printf("create gadcon client \"%s\" \"%s\" \"%s\" for \"%s\" \"%s\"\n",
+         name, id, style,
          gc->name, gc->id);
    o = evas_object_rectangle_add(gc->evas);
    evas_object_color_set(o, rand() & 0xff, rand() & 0xff, rand() & 0xff, 150);
-   gcc = e_gadcon_client_new(gc, name, id, o);
+   gcc = e_gadcon_client_new(gc, name, id, style, o);
    gcc->data = NULL; // this is where a module would hook private data
    return gcc;
 }
@@ -182,6 +182,16 @@
 }
 
 EAPI void
+e_gadcon_frame_request_callback_set(E_Gadcon *gc, Evas_Object *(*func) (void 
*data, E_Gadcon_Client *gcc, const char *style), void *data)
+{
+   E_OBJECT_CHECK(gc);
+   E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
+   
+   gc->frame_request.func = func;
+   gc->frame_request.data = data;
+}
+
+EAPI void
 e_gadcon_layout_policy_set(E_Gadcon *gc, E_Gadcon_Layout_Policy layout_policy)
 {
    E_OBJECT_CHECK(gc);
@@ -227,17 +237,24 @@
               {
                  E_Gadcon_Client *gcc;
                  
-                 gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id);
+                 gcc = cc->func.init(gc, cf_gcc->name, cf_gcc->id,
+                                     cf_gcc->style);
                  if (gcc)
                    {
                       gcc->client_class = *cc;
                       gcc->config.pos = cf_gcc->geom.pos;
                       gcc->config.size = cf_gcc->geom.size;
                       gcc->config.res = cf_gcc->geom.res;
-                      e_gadcon_layout_pack_options_set(gcc->o_base,
-                                                       gcc->config.pos, 
-                                                       gcc->config.size,
-                                                       gcc->config.res);
+                      if (gcc->o_frame)
+                        e_gadcon_layout_pack_options_set(gcc->o_frame,
+                                                         gcc->config.pos, 
+                                                         gcc->config.size,
+                                                         gcc->config.res);
+                      else
+                        e_gadcon_layout_pack_options_set(gcc->o_base,
+                                                         gcc->config.pos, 
+                                                         gcc->config.size,
+                                                         gcc->config.res);
                       if (gcc->client_class.func.orient)
                         gcc->client_class.func.orient(gcc);
                    }
@@ -372,7 +389,7 @@
 }
 
 EAPI E_Gadcon_Client *
-e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, Evas_Object *base_obj)
+e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, char *style, 
Evas_Object *base_obj)
 {
    E_Gadcon_Client *gcc;
    
@@ -385,7 +402,20 @@
    gcc->name = evas_stringshare_add(name);
    gcc->id = evas_stringshare_add(id);
    gc->clients = evas_list_append(gc->clients, gcc);
-   e_gadcon_layout_pack(gc->o_container, gcc->o_base);
+   if ((gc->frame_request.func) && (style))
+     {
+       gcc->o_frame = gc->frame_request.func(gc->frame_request.data, gcc,
+                                             style);
+       if (gcc->o_frame)
+         {
+            edje_object_part_swallow(gcc->o_frame, "items", gcc->o_base);
+            evas_object_show(gcc->o_frame);
+         }
+     }
+   if (gcc->o_frame)
+     e_gadcon_layout_pack(gc->o_container, gcc->o_frame);
+   else
+     e_gadcon_layout_pack(gc->o_container, gcc->o_base);
    evas_object_show(gcc->o_base);
    return gcc;
 }
@@ -402,7 +432,10 @@
    
    gcc->o_control = edje_object_add(gcc->gadcon->evas);
    evas_object_layer_set(gcc->o_control, 100);
-   evas_object_geometry_get(gcc->o_base, &x, &y, &w, &h);
+   if (gcc->o_frame)
+     evas_object_geometry_get(gcc->o_frame, &x, &y, &w, &h);
+   else
+     evas_object_geometry_get(gcc->o_base, &x, &y, &w, &h);
    evas_object_move(gcc->o_control, x, y);
    evas_object_resize(gcc->o_control, w, h);
    e_theme_edje_object_set(gcc->o_control, "base/theme/gadman",
@@ -467,6 +500,10 @@
 {
    E_OBJECT_CHECK(gcc);
    E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
+   
+   evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_MOVE, 
_e_gadcon_cb_move);
+   evas_object_event_callback_del(gcc->o_base, EVAS_CALLBACK_RESIZE, 
_e_gadcon_cb_resize);
+   
    if (gcc->moving)
      {
        gcc->moving = 0;
@@ -488,12 +525,18 @@
       case E_GADCON_ORIENT_HORIZ:
       case E_GADCON_ORIENT_TOP:
       case E_GADCON_ORIENT_BOTTOM:
-       e_gadcon_layout_pack_size_set(gcc->o_base, w);
+       if (gcc->o_frame)
+         e_gadcon_layout_pack_size_set(gcc->o_frame, w);
+       else
+         e_gadcon_layout_pack_size_set(gcc->o_base, w);
        break;
       case E_GADCON_ORIENT_VERT:
       case E_GADCON_ORIENT_LEFT:
       case E_GADCON_ORIENT_RIGHT:
-       e_gadcon_layout_pack_size_set(gcc->o_base, h);
+       if (gcc->o_frame)
+         e_gadcon_layout_pack_size_set(gcc->o_frame, h);
+       else
+         e_gadcon_layout_pack_size_set(gcc->o_base, h);
        break;
       case E_GADCON_ORIENT_FLOAT:
       case E_GADCON_ORIENT_CORNER_TL:
@@ -510,7 +553,10 @@
 {
    E_OBJECT_CHECK(gcc);
    E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
-   e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h);
+   if (gcc->o_frame)
+     e_gadcon_layout_pack_min_size_set(gcc->o_frame, w, h);
+   else
+     e_gadcon_layout_pack_min_size_set(gcc->o_base, w, h);
 }
 
 EAPI void
@@ -518,7 +564,10 @@
 {
    E_OBJECT_CHECK(gcc);
    E_OBJECT_TYPE_CHECK(gcc, E_GADCON_CLIENT_TYPE);
-   e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h);
+   if (gcc->o_frame)
+     e_gadcon_layout_pack_aspect_set(gcc->o_frame, w, h);
+   else
+     e_gadcon_layout_pack_aspect_set(gcc->o_base, w, h);
 }
 
 /* local subsystem functions */
@@ -536,7 +585,9 @@
 static void
 _e_gadcon_client_free(E_Gadcon_Client *gcc)
 {
+   e_gadcon_client_edit_end(gcc);
    gcc->gadcon->clients = evas_list_remove(gcc->gadcon->clients, gcc);
+   if (gcc->o_frame) evas_object_del(gcc->o_frame);
    evas_stringshare_del(gcc->name);
    evas_stringshare_del(gcc->id);
    free(gcc);
@@ -598,7 +649,7 @@
 }
 
 static void
-_e_gadcon_cb_size_request(void *data, Evas *e, Evas_Object *obj, void 
*event_info)
+_e_gadcon_cb_size_request(void *data, Evas_Object *obj, void *event_info)
 {
    E_Gadcon *gc;
    
@@ -722,7 +773,10 @@
    evas_object_geometry_get(gcc->o_base, NULL, NULL, &w, &h);
    if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
      {
-       e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, w);
+       if (gcc->o_frame)
+         e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sx + x, w);
+       else
+         e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sx + x, w);
        gcc->config.pos = gcc->sx + x;
        gcc->config.size = w;
        evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
@@ -730,7 +784,10 @@
      }
    else
      {
-       e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, h);
+       if (gcc->o_frame)
+         e_gadcon_layout_pack_request_set(gcc->o_frame, gcc->sy + y, h);
+       else
+         e_gadcon_layout_pack_request_set(gcc->o_base, gcc->sy + y, h);
        gcc->config.pos = gcc->sy + y;
        gcc->config.size = h;
        evas_object_geometry_get(gcc->gadcon->o_container, NULL, NULL, &w, &h);
@@ -947,12 +1004,17 @@
 e_gadcon_layout_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
 {
    E_Smart_Data *sd;
+/*   
    Evas_List *l;
    Evas_Coord tw = 0, th = 0;
+ */
    
    sd = evas_object_smart_data_get(obj);
    if (!sd) return;
-   
+
+   if (w) *w = sd->minw;
+   if (h) *h = sd->minh;
+/*   
    for (l = sd->items; l; l = l->next)
      {
        E_Gadcon_Layout_Item *bi;
@@ -973,6 +1035,7 @@
      }
    if (w) *w = tw;
    if (h) *h = th;
+ */
 }
 
 static void
@@ -1266,10 +1329,14 @@
             if (sd->horizontal)
               {
                  bi->ask.size2 = (h * bi->aspect.w) / bi->aspect.h;
+                 if (bi->ask.size2 > bi->min.w)
+                   min += (bi->ask.size2 - bi->min.w);
               }
             else 
               {
                  bi->ask.size2 = (w * bi->aspect.h) / bi->aspect.w;
+                 if (bi->ask.size2 > bi->min.h)
+                   min += (bi->ask.size2 - bi->min.h);
               }
          }
      }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_gadcon.h  4 Apr 2006 09:54:50 -0000       1.11
+++ e_gadcon.h  4 Apr 2006 15:42:25 -0000       1.12
@@ -62,6 +62,10 @@
       void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
       void *data;
    } resize_request;
+   struct {
+      Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char 
*style);
+      void *data;
+   } frame_request;
 };
 
 #define GADCON_CLIENT_CLASS_VERSION 1
@@ -70,7 +74,7 @@
    int   version;
    char *name;
    struct {
-      E_Gadcon_Client *(*init)     (E_Gadcon *gc, char *name, char *id);
+      E_Gadcon_Client *(*init)     (E_Gadcon *gc, char *name, char *id, char 
*style);
       void             (*shutdown) (E_Gadcon_Client *gcc);
       void             (*orient)   (E_Gadcon_Client *gcc);
    } func;
@@ -83,6 +87,7 @@
    char                  *name;
    char                  *id;
    Evas_Object           *o_base;
+   Evas_Object           *o_frame;
    Evas_Object           *o_control;
    Evas_Object           *o_event;
    E_Gadcon_Client_Class  client_class;
@@ -102,6 +107,7 @@
 EAPI E_Gadcon        *e_gadcon_swallowed_new(const char *name, char *id, 
Evas_Object *obj, char *swallow_name);
 EAPI void             e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord 
w, Evas_Coord h);
 EAPI void             e_gadcon_size_request_callback_set(E_Gadcon *gc, void 
(*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data);
+EAPI void             e_gadcon_frame_request_callback_set(E_Gadcon *gc, 
Evas_Object *(*func) (void *data, E_Gadcon_Client *gcc, const char *style), 
void *data);
 EAPI void             e_gadcon_layout_policy_set(E_Gadcon *gc, 
E_Gadcon_Layout_Policy layout_policy);
 EAPI void             e_gadcon_populate(E_Gadcon *gc);
 EAPI void             e_gadcon_orient(E_Gadcon *gc, E_Gadcon_Orient orient);
@@ -114,7 +120,7 @@
 EAPI void             e_gadcon_ecore_evas_set(E_Gadcon *gc, Ecore_Evas *ee);
 EAPI int              e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, 
int *y, int *w, int *h);
     
-EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, 
Evas_Object *base_obj);
+EAPI E_Gadcon_Client *e_gadcon_client_new(E_Gadcon *gc, char *name, char *id, 
char *style, Evas_Object *base_obj);
 EAPI void             e_gadcon_client_size_request(E_Gadcon_Client *gcc, 
Evas_Coord w, Evas_Coord h);
 EAPI void             e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, 
Evas_Coord w, Evas_Coord h);
 EAPI void             e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, 
int h);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- e_shelf.c   4 Apr 2006 09:54:50 -0000       1.11
+++ e_shelf.c   4 Apr 2006 15:42:25 -0000       1.12
@@ -4,8 +4,9 @@
 #include "e.h"
 
 static void _e_shelf_free(E_Shelf *es);
-static void _e_shelf_config_port(E_Config_Shelf_Config *cf1, 
E_Config_Shelf_Config *cf2);
+static void _e_shelf_position_calc(E_Shelf *es);
 static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord 
w, Evas_Coord h);
+static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client 
*gcc, const char *style);
 
 static Evas_List *shelves = NULL;
 static int shelf_id = 0;
@@ -38,7 +39,6 @@
    for (l = e_config->shelves; l; l = l->next)
      {
        E_Config_Shelf *cf_es;
-       E_Config_Shelf_Config *cf_escf, *cf_escf2;
        E_Zone *zone;
        int closeness;
        
@@ -46,60 +46,17 @@
        zone = e_util_container_zone_number_get(cf_es->container, cf_es->zone);
        if (zone)
          {
-            cf_escf2 = NULL;
-            closeness = 0x7fffffff;
-            for (l2 = cf_es->configs; l2; l2 = l2->next)
-              {
-                 cf_escf = l2->data;
-                 if ((cf_escf->res.w == zone->w) &&
-                     (cf_escf->res.h == zone->h))
-                   {
-                      cf_escf2 = cf_escf;
-                      closeness = 0;
-                      break;
-                   }
-                 else
-                   {
-                      int difx, dify;
-                      
-                      difx = cf_escf->res.w - zone->w;
-                      if (difx < 0) difx = -difx;
-                      dify = cf_escf->res.h - zone->h;
-                      if (dify < 0) dify = -dify;
-                      difx = difx * dify;
-                      if (difx < closeness)
-                        {
-                           closeness = difx;
-                           cf_escf2 = cf_escf;
-                        }
-                   }
-              }
-            if ((closeness != 0) && (cf_escf2))
-              {
-                 cf_escf = E_NEW(E_Config_Shelf_Config, 1);
-                 cf_escf->res.w = zone->w;
-                 cf_escf->res.h = zone->h;
-                 cf_escf->orient = cf_escf2->orient;
-                 cf_escf->style = evas_stringshare_add(cf_escf2->style);
-                 _e_shelf_config_port(cf_escf2, cf_escf);
-                 cf_escf2 = cf_escf;
-                 e_config_save_queue();
-              }
-            if (cf_escf2)
+            E_Shelf *es;
+            
+            es = e_shelf_zone_new(zone, cf_es->name, cf_es->style,
+                                  cf_es->popup, cf_es->layer);
+            if (es)
               {
-                 E_Shelf *es;
-                 
-                 es = e_shelf_zone_new(zone, cf_es->name, cf_escf2->style,
-                                       cf_es->popup, cf_es->layer);
-                 if (es)
-                   {
-                      es->cfg = cf_es;
-                      e_shelf_move_resize(es, cf_escf2->x, cf_escf2->y,
-                                          cf_escf2->w, cf_escf2->h);
-                      e_shelf_orient(es, cf_escf2->orient);
-                      e_shelf_populate(es);
-                      e_shelf_show(es);
-                   }
+                 es->cfg = cf_es;
+                 e_shelf_orient(es, cf_es->orient);
+                 _e_shelf_position_calc(es);
+                 e_shelf_populate(es);
+                 e_shelf_show(es);
               }
          }
      }
@@ -156,8 +113,12 @@
    snprintf(buf, sizeof(buf), "%i", shelf_id);
    shelf_id++;
    es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items");
-   e_gadcon_size_request_callback_set(es->gadcon, _e_shelf_gadcon_size_request,
+   e_gadcon_size_request_callback_set(es->gadcon,
+                                     _e_shelf_gadcon_size_request,
                                      es);
+   e_gadcon_frame_request_callback_set(es->gadcon,
+                                      _e_shelf_gadcon_frame_request,
+                                      es);
    e_gadcon_orient(es->gadcon, E_GADCON_ORIENT_TOP);
    edje_object_signal_emit(es->o_base, "set_orientation", "top");
    e_gadcon_zone_set(es->gadcon, zone);
@@ -266,42 +227,13 @@
    E_OBJECT_TYPE_CHECK(es, E_GADMAN_SHELF_TYPE);
    if (es->cfg)
      {
-       Evas_List *l;
-       E_Config_Shelf_Config *cf_escf = NULL;
-       
-       for (l = es->cfg->configs; l; l = l->next)
-         {
-            cf_escf = l->data;
-            if ((cf_escf->res.w == es->zone->w) &&
-                (cf_escf->res.h == es->zone->h))
-              break;
-            cf_escf = NULL;
-         }
-       if (!cf_escf)
-         {
-             cf_escf = E_NEW(E_Config_Shelf_Config, 1);
-            if (cf_escf)
-              {
-                 cf_escf->res.w = es->zone->w;
-                 cf_escf->res.h = es->zone->h;
-                 es->cfg->configs = evas_list_append(es->cfg->configs, 
cf_escf);
-              }
-         }
-       if (cf_escf)
-         {
-            cf_escf->x = es->x;
-            cf_escf->y = es->y;
-            cf_escf->w = es->w;
-            cf_escf->h = es->h;
-            cf_escf->orient = es->gadcon->orient;
-            if (cf_escf->style) evas_stringshare_del(cf_escf->style);
-            cf_escf->style = evas_stringshare_add(es->style);
-         }
+       es->cfg->orient = es->gadcon->orient;
+       if (es->cfg->style) evas_stringshare_del(es->cfg->style);
+       es->cfg->style = evas_stringshare_add(es->style);
      }
    else
      {
        E_Config_Shelf *cf_es;
-       E_Config_Shelf_Config *cf_escf = NULL;
        
        cf_es = E_NEW(E_Config_Shelf, 1);
        cf_es->name = evas_stringshare_add(es->name);
@@ -310,18 +242,11 @@
        if (es->popup) cf_es->popup = 1;
        cf_es->layer = es->layer;
        e_config->shelves = evas_list_append(e_config->shelves, cf_es);
+       cf_es->orient = es->gadcon->orient;
+       cf_es->style = evas_stringshare_add(es->style);
+       cf_es->fit_along = es->fit_along;
+       cf_es->fit_size = es->fit_size;
        es->cfg = cf_es;
-       
-       cf_escf = E_NEW(E_Config_Shelf_Config, 1);
-       cf_escf->res.w = es->zone->w;
-       cf_escf->res.h = es->zone->h;
-       cf_escf->x = es->x;
-       cf_escf->y = es->y;
-       cf_escf->w = es->w;
-       cf_escf->h = es->h;
-       cf_escf->orient = es->gadcon->orient;
-       cf_escf->style = evas_stringshare_add(es->style);
-       cf_es->configs = evas_list_append(cf_es->configs, cf_escf);
      }
    e_config_save_queue();
 }
@@ -335,15 +260,7 @@
      {
        e_config->shelves = evas_list_remove(e_config->shelves, es->cfg);
        evas_stringshare_del(es->cfg->name);
-       while (es->cfg->configs)
-         {
-            E_Config_Shelf_Config *cf_escf;
-            
-            cf_escf = es->cfg->configs->data;
-            if (cf_escf->style) evas_stringshare_del(cf_escf->style);
-            free(cf_escf);
-            es->cfg->configs = evas_list_remove_list(es->cfg->configs, 
es->cfg->configs);
-         }
+       if (es->cfg->style) evas_stringshare_del(es->cfg->style);
        free(es->cfg);
      }
 }
@@ -408,43 +325,54 @@
 }
 
 static void
-_e_shelf_config_port(E_Config_Shelf_Config *cf1, E_Config_Shelf_Config *cf2)
+_e_shelf_position_calc(E_Shelf *es)
 {
-   int px[4], py[4];
-   int i;
+   E_Gadcon_Orient orient = E_GADCON_ORIENT_FLOAT;
+   int size = 40;
    
-   /* 
-    * We have 4 corners. figure out what gravity zone (3x3 grid) they are in
-    * then lock them in relative to the edge or middle of that zone and re
-    * calculate it all then.
-    */
-   px[0] = cf1->x;
-   px[1] = cf1->x + cf1->w - 1;
-   px[2] = cf1->x;
-   px[3] = cf1->x + cf1->w - 1;
-   py[0] = cf1->y;
-   py[1] = cf1->y;
-   py[2] = cf1->y + cf1->h - 1;
-   py[3] = cf1->y + cf1->h - 1;
-   for (i = 0; i < 4; i++)
-     {
-       if (px[i] < (cf1->res.w / 3))
-         px[i] = px[i];
-       else if (px[i] > ((2 * cf1->res.w) / 3))
-         px[i] = (cf2->res.w) + (px[i] - cf1->res.w);
-       else
-         px[i] = (cf2->res.w / 2) + (px[i] - (cf1->res.w / 2));
-       if (py[i] < (cf1->res.h / 3))
-         py[i] = py[i];
-       else if (py[i] > ((2 * cf1->res.h) / 3))
-         py[i] = (cf2->res.h) + (py[i] - cf1->res.h);
-       else
-         py[i] = (cf2->res.h / 2) + (py[i] - (cf1->res.h / 2));
-     }
-   cf2->x = px[0];
-   cf2->y = py[0];
-   cf2->w = px[3] - px[0] + 1;
-   cf2->h = py[3] = py[0] + 1;
+   if (es->cfg)
+     {
+       orient = es->cfg->orient;
+       size = es->cfg->size;
+     }
+   else
+     orient = es->gadcon->orient;
+   switch (orient)
+     {
+      case E_GADCON_ORIENT_FLOAT:
+       break;
+      case E_GADCON_ORIENT_HORIZ:
+       break;
+      case E_GADCON_ORIENT_VERT:
+       break;
+      case E_GADCON_ORIENT_LEFT:
+       break;
+      case E_GADCON_ORIENT_RIGHT:
+       break;
+      case E_GADCON_ORIENT_TOP:
+       if (!es->fit_along) es->w = es->zone->w;
+       if (!es->fit_size) es->h = size;
+       es->x = (es->zone->w - es->w) / 2;
+       es->y = 0;
+       break;
+      case E_GADCON_ORIENT_BOTTOM:
+       if (!es->fit_along) es->w = es->zone->w;
+       if (!es->fit_size) es->h = size;
+       es->x = (es->zone->w - es->w) / 2;
+       es->y = es->zone->h - es->h;
+       break;
+      case E_GADCON_ORIENT_CORNER_TL:
+       break;
+      case E_GADCON_ORIENT_CORNER_TR:
+       break;
+      case E_GADCON_ORIENT_CORNER_BL:
+       break;
+      case E_GADCON_ORIENT_CORNER_BR:
+       break;
+      default:
+       break;
+     }
+   e_shelf_move_resize(es, es->x, es->y, es->w, es->h);
 }
 
 static void
@@ -536,4 +464,22 @@
        break;
      }
    e_shelf_move_resize(es, nx, ny, nw, nh);
+}
+
+static Evas_Object *
+_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char 
*style)
+{
+   E_Shelf *es;
+   Evas_Object *o;
+   char buf[4096];
+   
+   es = data;
+   o = edje_object_add(gcc->gadcon->evas);
+   snprintf(buf, sizeof(buf), "shelf/%s/%s", es->style, style);
+   if (!e_theme_edje_object_set(o, "base/theme/shelf", buf))
+     {
+       evas_object_del(o);
+       return NULL;
+     }
+   return o;
 }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_shelf.h   3 Apr 2006 14:01:00 -0000       1.8
+++ e_shelf.h   4 Apr 2006 15:42:25 -0000       1.9
@@ -27,6 +27,7 @@
    E_Config_Shelf      *cfg;
    unsigned char        fit_along : 1;
    unsigned char        fit_size : 1;
+   int                  size;
 };
 
 EAPI int              e_shelf_init(void);




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to