Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c e_fm.h 


Log Message:


the start of different display modes - just testing list mode...

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_fm.c      15 Jul 2006 17:32:32 -0000      1.4
+++ e_fm.c      15 Jul 2006 21:39:15 -0000      1.5
@@ -36,6 +36,7 @@
    Ecore_Job        *resize_job;
    DIR              *dir;
    unsigned char     no_case_sort : 1;
+   unsigned char     iconlist_changed : 1;
 //   unsigned char     no_dnd : 1;
 //   unsigned char     single_select : 1;
 //   unsigned char     single_click : 1;
@@ -56,11 +57,15 @@
    E_Fm2_Region     *region;
    Evas_Coord        x, y, w, h;
    Evas_Object      *obj;
+   int               saved_x, saved_y;
+   int               saved_rel;
    char             *file;
    char             *mime;
    unsigned char     realized : 1;
    unsigned char     selected : 1;
    unsigned char     thumb : 1;
+   unsigned char     saved_pos : 1;
+   unsigned char     odd : 1;
 //   unsigned char     single_click : 1;
 };
 
@@ -171,6 +176,8 @@
     * icons and we realize/unrealize whole regions at once when that region 
     * becomes visible - this saves of object  count and memory */
    sd->regions.member_max = 128;
+   sd->view_mode = E_FM2_VIEW_MODE_LIST;
+//   sd->view_mode = E_FM2_VIEW_MODE_ICONS;
    
    _e_fm2_scan_stop(obj);
    _e_fm2_queue_free(obj);
@@ -332,6 +339,7 @@
    /* create icon obj and append to unsorted list */
    ic = _e_fm2_icon_new(sd, file);
    sd->queue = evas_list_append(sd->queue, ic);
+   sd->iconlist_changed = 1;
 }
 
 static void
@@ -343,6 +351,7 @@
    if (!sd) return;
    /* find icon of file and remove from unsorted or main list */
    /* FIXME: find and remove */
+   sd->iconlist_changed = 1;
 }
 
 static void
@@ -511,27 +520,20 @@
        if ((!ic->region->realized) && (ic->realized))
          _e_fm2_icon_unrealize(ic);
      }
-   printf("pop\n");
    _e_fm2_obj_icons_place(sd);
    edje_thaw();
    evas_event_thaw(evas_object_evas_get(obj));
 }
 
 static void
-_e_fm2_icons_place(Evas_Object *obj)
+_e_fm2_icons_place_icons(E_Fm2_Smart_Data *sd)
 {
-   E_Fm2_Smart_Data *sd;
    Evas_List *l;
    E_Fm2_Icon *ic;
    Evas_Coord x, y, rh;
-   
-   sd = evas_object_smart_data_get(obj);
-   if (!sd) return;
-   /* take the icon list and find a location for them */
+
    x = 0; y = 0;
    rh = 0;
-   sd->max.w = 0;
-   sd->max.h = 0;
    for (l = sd->icons; l; l = l->next)
      {
        ic = l->data;
@@ -548,6 +550,157 @@
        if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
        if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
      }
+}
+
+static void
+_e_fm2_icons_place_grid_icons(E_Fm2_Smart_Data *sd)
+{
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   Evas_Coord x, y, gw, gh;
+
+   gw = 0; gh = 0;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if (ic->w > gw) gw = ic->w;
+       if (ic->h > gh) gh = ic->h;
+     }
+   x = 0; y = 0;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if ((x > 0) && ((x + ic->w) > sd->w))
+         {
+            x = 0;
+            y += gh;
+         }
+       ic->x = x + (gw - ic->w);
+       ic->y = y + (gh - ic->h);
+       x += gw;
+       if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
+       if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
+     }
+}
+
+static void
+_e_fm2_icons_place_custom_icons(E_Fm2_Smart_Data *sd)
+{
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+
+       if (!ic->saved_pos)
+         {
+            /* FIXME: place using smart place fn */
+         }
+       
+       if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
+       if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
+     }
+}
+
+static void
+_e_fm2_icons_place_custom_grid_icons(E_Fm2_Smart_Data *sd)
+{
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       
+       if (!ic->saved_pos)
+         {
+            /* FIXME: place using grid fn */
+         }
+       
+       if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
+       if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
+     }
+}
+
+static void
+_e_fm2_icons_place_custom_smart_grid_icons(E_Fm2_Smart_Data *sd)
+{
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       
+       if (!ic->saved_pos)
+         {
+            /* FIXME: place using smart grid fn */
+         }
+       
+       if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
+       if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
+     }
+}
+
+static void
+_e_fm2_icons_place_list(E_Fm2_Smart_Data *sd)
+{
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   Evas_Coord x, y;
+   int i;
+
+   x = y = 0;
+   for (i = 0, l = sd->icons; l; l = l->next, i++)
+     {
+       ic = l->data;
+       
+       /* FIXME: place in vertical list */
+       ic->x = x;
+       ic->y = y;
+       ic->w = sd->w;
+       y += ic->h;
+       ic->odd = (i & 0x01);
+       if ((ic->x + ic->w) > sd->max.w) sd->max.w = ic->x + ic->w;
+       if ((ic->y + ic->h) > sd->max.h) sd->max.h = ic->y + ic->h;
+     }
+}
+
+static void
+_e_fm2_icons_place(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   /* take the icon list and find a location for them */
+   sd->max.w = 0;
+   sd->max.h = 0;
+   switch (sd->view_mode)
+     {
+      case E_FM2_VIEW_MODE_ICONS:
+       _e_fm2_icons_place_icons(sd);
+       break;
+      case E_FM2_VIEW_MODE_GRID_ICONS:
+       _e_fm2_icons_place_grid_icons(sd);
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_ICONS:
+       _e_fm2_icons_place_custom_icons(sd);
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS:
+       _e_fm2_icons_place_custom_smart_grid_icons(sd);
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS:
+       _e_fm2_icons_place_custom_smart_grid_icons(sd);
+       break;
+      case E_FM2_VIEW_MODE_LIST:
+       _e_fm2_icons_place_list(sd);
+       break;
+      default:
+       break;
+     }
+   /* tell our parent scrollview - if any, that we have changed */
    evas_object_smart_callback_call(sd->obj, "changed", NULL);
 }
 
@@ -602,9 +755,36 @@
    ic = E_NEW(E_Fm2_Icon, 1);
    ic->sd = sd;
    ic->file = strdup(file);
-   ic->w = 64;
-   ic->h = 64;
-   printf("FM: IC+ %s\n", ic->file);
+   /* FIXME: have many icon size policies. fixed, max, auto-calc etc. */
+   switch (sd->view_mode)
+     {
+      case E_FM2_VIEW_MODE_ICONS:
+       ic->w = 64;
+       ic->h = 64;
+       break;
+      case E_FM2_VIEW_MODE_GRID_ICONS:
+       ic->w = 64;
+       ic->h = 64;
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_ICONS:
+       ic->w = 64;
+       ic->h = 64;
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS:
+       ic->w = 64;
+       ic->h = 64;
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS:
+       ic->w = 64;
+       ic->h = 64;
+       break;
+      case E_FM2_VIEW_MODE_LIST:
+       ic->w = sd->w;
+       ic->h = 24;
+       break;
+      default:
+       break;
+     }
    return ic;
 }
 
@@ -627,14 +807,27 @@
    ic->obj = edje_object_add(evas_object_evas_get(ic->sd->obj));
    edje_object_freeze(ic->obj);
    evas_object_smart_member_add(ic->obj, ic->sd->obj);
-   e_theme_edje_object_set(ic->obj, "base/theme/fileman",
-                          "fileman/icon_normal");
+   if (ic->sd->view_mode == E_FM2_VIEW_MODE_LIST)
+     {
+       if (ic->odd)
+         e_theme_edje_object_set(ic->obj, "base/theme/widgets",
+                                 "widgets/ilist_odd");
+       else
+         e_theme_edje_object_set(ic->obj, "base/theme/widgets",
+                                 "widgets/ilist");
+       edje_object_part_text_set(ic->obj, "label", ic->file);
+     }
+   else
+     {
+       e_theme_edje_object_set(ic->obj, "base/theme/fileman",
+                               "fileman/icon_normal");
+       edje_object_part_text_set(ic->obj, "icon_title", ic->file);
+     }
    evas_object_clip_set(ic->obj, ic->sd->clip);
    evas_object_move(ic->obj,
                    ic->sd->x + ic->x - ic->sd->pos.x,
                    ic->sd->y + ic->y - ic->sd->pos.y);
    evas_object_resize(ic->obj, ic->w, ic->h);
-   edje_object_part_text_set(ic->obj, "icon_title", ic->file);
    edje_object_thaw(ic->obj);
    evas_event_thaw(evas_object_evas_get(ic->sd->obj));
    evas_object_show(ic->obj);
@@ -754,17 +947,48 @@
 _e_fm2_cb_resize_job(void *data)
 {
    E_Fm2_Smart_Data *sd;
+   Evas_List *l;
+   E_Fm2_Icon *ic;
    
    sd = evas_object_smart_data_get(data);
    if (!sd) return;
    sd->resize_job = NULL;
    evas_event_freeze(evas_object_evas_get(sd->obj));
    edje_freeze();
-   _e_fm2_regions_free(sd->obj);
-   _e_fm2_icons_place(sd->obj);
-   _e_fm2_regions_populate(sd->obj);
+   switch (sd->view_mode)
+     {
+      case E_FM2_VIEW_MODE_ICONS:
+       _e_fm2_regions_free(sd->obj);
+       _e_fm2_icons_place(sd->obj);
+       _e_fm2_regions_populate(sd->obj);
+       break;
+      case E_FM2_VIEW_MODE_GRID_ICONS:
+       _e_fm2_regions_free(sd->obj);
+       _e_fm2_icons_place(sd->obj);
+       _e_fm2_regions_populate(sd->obj);
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_ICONS:
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS:
+       break;
+      case E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS:
+       break;
+      case E_FM2_VIEW_MODE_LIST:
+       if (sd->iconlist_changed)
+         {
+            for (l = sd->icons; l; l = l->next)
+              _e_fm2_icon_unrealize(ic);
+         }
+        _e_fm2_regions_free(sd->obj);
+       _e_fm2_icons_place(sd->obj);
+        _e_fm2_regions_populate(sd->obj);
+       break;
+      default:
+       break;
+     }
    edje_thaw();
    evas_event_thaw(evas_object_evas_get(sd->obj));
+   sd->iconlist_changed = 0;
 }
 
 static int
@@ -844,16 +1068,6 @@
    _e_fm2_queue_process(data);
    if (!sd->scan_idler)
      {
-       Evas_List *l;
-       
-       /* we finished scanning! */
-       for (l = sd->icons; l; l = l->next)
-         {
-            E_Fm2_Icon *ic;
-            
-            ic = l->data;
-            printf("FM: IC: %i %i, %s\n", ic->x, ic->y, ic->file);
-         }
        sd->scan_timer = NULL;
        return 0;
      }
@@ -879,9 +1093,12 @@
               {
                  ic = ll->data;
                  if (ic->realized)
-                   evas_object_move(ic->obj, 
-                                    sd->x + ic->x - sd->pos.x, 
-                                    sd->y + ic->y - sd->pos.y);
+                   {
+                      evas_object_move(ic->obj, 
+                                       sd->x + ic->x - sd->pos.x, 
+                                       sd->y + ic->y - sd->pos.y);
+                      evas_object_resize(ic->obj, ic->w, ic->h);
+                   }
               }
          }
      }
@@ -942,7 +1159,6 @@
    sd->x = x;
    sd->y = y;
    evas_object_move(sd->clip, x, y);
-   printf("mov\n");
    _e_fm2_obj_icons_place(sd);
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_fm.h      15 Jul 2006 16:29:14 -0000      1.2
+++ e_fm.h      15 Jul 2006 21:39:15 -0000      1.3
@@ -7,8 +7,12 @@
 
 typedef enum _E_Fm2_View_Mode
 {
-   E_FM2_VIEW_MODE_ICONS,
-   E_FM2_VIEW_MODE_LIST
+   E_FM2_VIEW_MODE_ICONS, /* regular layout row by row like text */
+   E_FM2_VIEW_MODE_GRID_ICONS, /* regular grid layout */
+   E_FM2_VIEW_MODE_CUSTOM_ICONS, /* icons go anywhere u drop them (desktop) */
+   E_FM2_VIEW_MODE_CUSTOM_GRID_ICONS, /* icons go anywhere u drop them but 
align to a grid */
+   E_FM2_VIEW_MODE_CUSTOM_SMART_GRID_ICONS, /* icons go anywhere u drop them 
but try align to icons nearby */
+   E_FM2_VIEW_MODE_LIST /* vertical fileselector list */
 } E_Fm2_View_Mode;
 
 #else




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to