Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c e_fm.h e_widget_fsel.c e_widget_scrollframe.c 
        e_widget_scrollframe.h 


Log Message:


fm2 has some slightly better keyboard nav ability - needs to become better
with old efm typebuffer-like matching etc. etc.

added a seg fix for .desktop parse fails.

also fixed linuxtitan's error checking for stat()

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- e_fm.c      3 Sep 2006 17:23:43 -0000       1.52
+++ e_fm.c      14 Sep 2006 16:07:57 -0000      1.53
@@ -134,6 +134,7 @@
 static void _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, 
void *event_info);
 static void _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, 
void *event_info);
 static void _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void 
*event_info);
+static void _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
 static void _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
 static void _e_fm2_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
 static void _e_fm2_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void 
*event_info);
@@ -581,9 +582,6 @@
    if (h) *h = sd->max.h;
 }
 
-
-
-
 /* local subsystem functions */
 static const char *
 _e_fm2_dev_path_map(const char *dev, const char *path)
@@ -1736,7 +1734,6 @@
 _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
 {
    char buf[4096], key[256], val[4096];
-   FILE *f;
    Ecore_Desktop *desktop;
    
    if (ic->info.pseudo_link)
@@ -1796,7 +1793,6 @@
    ic->info.icon = NULL;
    ic->info.link = NULL;
    ic->info.pseudo_dir = NULL;
-   fclose(f);
    return 0;
 }
 
@@ -1993,7 +1989,7 @@
          _e_fm2_icon_deselect(ic);
        else
          _e_fm2_icon_select(ic);
-       evas_object_smart_callback_call(ic->sd->obj, "selection_change", NULL);
+       evas_object_smart_callback_call(ic->sd->obj, "selection_change", NULL);
        if ((!(S_ISDIR(ic->info.statinfo.st_mode)) ||
             (ic->sd->config->view.no_subdir_jump)) &&
            (ic->sd->config->view.single_click)
@@ -2055,7 +2051,276 @@
          edje_object_signal_emit(ic->obj, "e,action,thumb,gen", "e");
      }
 }
-    
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_make_visible(E_Fm2_Icon *ic)
+{
+   if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
+     {
+       if (
+           ((ic->y - ic->sd->pos.y) >= 0) &&
+           ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h))
+           )
+         return;
+       if ((ic->y - ic->sd->pos.y) < 0)
+         e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y);
+       else
+         e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y - ic->sd->h + ic->h);
+     }
+   else
+     {
+       Evas_Coord x, y;
+       
+       if (
+           ((ic->y - ic->sd->pos.y) >= 0) &&
+           ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) &&
+           ((ic->x - ic->sd->pos.x) >= 0) &&
+           ((ic->x + ic->w - ic->sd->pos.x) <= (ic->sd->w))
+           )
+         return;
+       x = ic->sd->pos.x;
+       if ((ic->x - ic->sd->pos.x) < 0)
+         x = ic->x;
+       else if ((ic->x + ic->w - ic->sd->pos.x) > (ic->sd->w))
+         x = ic->x + ic->w - ic->sd->w;
+       y = ic->sd->pos.y;
+       if ((ic->y - ic->sd->pos.y) < 0)
+         y = ic->y;
+       else if ((ic->y + ic->h - ic->sd->pos.y) > (ic->sd->h))
+         y = ic->y + ic->h - ic->sd->h;
+       e_fm2_pan_set(ic->sd->obj, x, y);
+     }
+   evas_object_smart_callback_call(ic->sd->obj, "pan_changed", NULL);
+}
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_desel_any(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if (ic->selected) _e_fm2_icon_deselect(ic);
+     }
+}
+
+/* FIXME: prototype */
+static E_Fm2_Icon *
+_e_fm2_icon_first_selected_find(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return NULL;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if (ic->selected) return ic;
+     }
+   return NULL;
+}
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_sel_first(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->icons) return;
+   _e_fm2_icon_desel_any(obj);
+   ic = sd->icons->data;
+   _e_fm2_icon_select(ic);
+   evas_object_smart_callback_call(sd->obj, "selection_change", NULL);
+   _e_fm2_icon_make_visible(ic);
+}
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_sel_last(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->icons) return;
+   _e_fm2_icon_desel_any(obj);
+   ic = evas_list_last(sd->icons)->data;
+   _e_fm2_icon_select(ic);
+   evas_object_smart_callback_call(sd->obj, "selection_change", NULL);
+   _e_fm2_icon_make_visible(ic);
+}
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_sel_prev(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->icons) return;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if (ic->selected)
+         {
+            if (!l->prev) return;
+            ic = l->prev->data;
+            break;
+         }
+     }
+   if (!ic)
+     {
+       _e_fm2_icon_sel_last(obj);
+       return;
+     }
+   _e_fm2_icon_desel_any(obj);
+   _e_fm2_icon_select(ic);
+   evas_object_smart_callback_call(sd->obj, "selection_change", NULL);
+   _e_fm2_icon_make_visible(ic);
+}
+
+/* FIXME: prototype */
+static void
+_e_fm2_icon_sel_next(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   Evas_List *l;
+   E_Fm2_Icon *ic;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->icons) return;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       if (ic->selected)
+         {
+            if (!l->next) return;
+            ic = l->next->data;
+            break;
+         }
+     }
+   if (!ic)
+     {
+       _e_fm2_icon_sel_first(obj);
+       return;
+     }
+   _e_fm2_icon_desel_any(obj);
+   _e_fm2_icon_select(ic);
+   evas_object_smart_callback_call(sd->obj, "selection_change", NULL);
+   _e_fm2_icon_make_visible(ic);
+}
+
+static void
+_e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Key_Down *ev;
+   E_Fm2_Smart_Data *sd;
+   E_Fm2_Icon *ic;
+//   Evas_Coord x = 0, y = 0, w = 0, h = 0;
+   
+   sd = data;
+   ev = event_info;
+   /* FIXME: handle key navigation, searching etc. etc. */
+   if (!strcmp(ev->keyname, "Left"))
+     { 
+       /* list mode: scroll left n pix
+        * icon mode: prev icon
+        */
+       _e_fm2_icon_sel_prev(obj);
+    }
+   else if (!strcmp(ev->keyname, "Right"))
+     {
+       /* list mode: scroll right n pix
+        * icon mode: next icon
+        */
+       _e_fm2_icon_sel_next(obj);
+     }
+   else if (!strcmp(ev->keyname, "Up"))
+     {
+       /* list mode: prev icon
+        * icon mode: up an icon
+        */
+       _e_fm2_icon_sel_prev(obj);
+     }
+   else if (!strcmp(ev->keyname, "Home"))
+     {
+       /* go to first icon */
+       _e_fm2_icon_sel_first(obj);
+     }
+   else if (!strcmp(ev->keyname, "End"))
+     {
+       /* go to last icon */
+       _e_fm2_icon_sel_last(obj);
+     }
+   else if (!strcmp(ev->keyname, "Down"))
+     {
+       /* list mode: next icon
+        * icon mode: down an icon
+        */
+       _e_fm2_icon_sel_next(obj);
+     }
+   else if (!strcmp(ev->keyname, "Prior"))
+     {
+       /* up h * n pixels */
+       e_fm2_pan_set(obj, sd->pos.x, sd->pos.y - sd->h);
+       evas_object_smart_callback_call(sd->obj, "pan_changed", NULL);
+     }
+   else if (!strcmp(ev->keyname, "Next"))
+     {
+       /* down h * n pixels */
+       e_fm2_pan_set(obj, sd->pos.x, sd->pos.y + sd->h);
+       evas_object_smart_callback_call(sd->obj, "pan_changed", NULL);
+     }
+   else if (!strcmp(ev->keyname, "Escape"))
+     {
+       _e_fm2_icon_desel_any(obj);
+     }
+   else if (!strcmp(ev->keyname, "Return"))
+     {
+       /* selected */
+       ic = _e_fm2_icon_first_selected_find(obj);
+       if (ic)
+         evas_object_smart_callback_call(ic->sd->obj, "selected", NULL);
+     }
+   else if (!strcmp(ev->keyname, "Insert"))
+     {
+       /* dunno what to do with this yet */
+     }
+   else if (!strcmp(ev->keyname, "Tab"))
+     {
+       /* tab complete possible completes of typebuffer */
+     }
+   else if (!strcmp(ev->keyname, "Backspace"))
+     {
+       /* erase from typebuffer */
+     }
+   else if (!strcmp(ev->keyname, "Delete"))
+     {
+       /* delete file dialog */
+     }
+   else
+     {
+       /* just start typing a filename - a tmp match buffer jumps to first 
match (type a glob) ot typedfile* */
+     }
+}
+
 static void
 _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
@@ -2360,6 +2625,7 @@
    evas_object_color_set(sd->underlay, 0, 0, 0, 0);
    evas_object_show(sd->underlay);
 
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, 
_e_fm2_cb_key_down, sd);
    evas_object_event_callback_add(sd->underlay, EVAS_CALLBACK_MOUSE_DOWN, 
_e_fm2_cb_mouse_down, sd);
    evas_object_event_callback_add(sd->underlay, EVAS_CALLBACK_MOUSE_UP, 
_e_fm2_cb_mouse_up, sd);
    evas_object_event_callback_add(sd->underlay, EVAS_CALLBACK_MOUSE_MOVE, 
_e_fm2_cb_mouse_move, sd);
@@ -2383,7 +2649,7 @@
 
    sd = evas_object_smart_data_get(obj);
    if (!sd) return;
-   
+  
    _e_fm2_scan_stop(obj);
    _e_fm2_queue_free(obj);
    _e_fm2_regions_free(obj);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- e_fm.h      3 Sep 2006 15:57:13 -0000       1.19
+++ e_fm.h      14 Sep 2006 16:07:57 -0000      1.20
@@ -122,6 +122,5 @@
 EAPI void                  e_fm2_pan_max_get(Evas_Object *obj, Evas_Coord *x, 
Evas_Coord *y);
 EAPI void                  e_fm2_pan_child_size_get(Evas_Object *obj, 
Evas_Coord *w, Evas_Coord *h);
 
-
 #endif
 #endif
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_fsel.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- e_widget_fsel.c     9 Sep 2006 16:41:00 -0000       1.36
+++ e_widget_fsel.c     14 Sep 2006 16:07:57 -0000      1.37
@@ -78,15 +78,15 @@
    wd = data1;
    current_path = e_fm2_real_path_get(wd->o_files_fm);
    snprintf(dest_path, PATH_MAX, "%s/.e/e/fileman/favorites/%s", 
-                                     getenv("HOME"), basename(current_path));
+           getenv("HOME"), basename(current_path));
    if (stat(dest_path, &st) < 0) symlink(current_path, dest_path);
    else
      {
-        while(stat(dest_path, &st) == 0)
+        while (stat(dest_path, &st) == 0)
          {
             snprintf(dest_path, PATH_MAX, "%s/.e/e/fileman/favorites/%s-%d",
-                                            getenv("HOME"), 
-                                            basename(current_path), i);
+                     getenv("HOME"), 
+                     basename(current_path), i);
             i++;
          }
        symlink(current_path, dest_path);  
@@ -211,13 +211,14 @@
                 realpath, ici->file);
      }
    wd->path = strdup(buf);
-   if (wd->preview)
-      _e_wid_fsel_preview_file(wd);
-   stat(wd->path, &st);
-   if (!S_ISDIR(st.st_mode))
-      e_widget_entry_text_set(wd->o_entry, ici->file);
-   else
-      e_widget_entry_text_set(wd->o_entry, wd->path);
+   if (stat(wd->path, &st) == 0)
+     {
+       if (wd->preview) _e_wid_fsel_preview_file(wd);
+       if (!S_ISDIR(st.st_mode))
+         e_widget_entry_text_set(wd->o_entry, ici->file);
+       else
+         e_widget_entry_text_set(wd->o_entry, wd->path);
+     }
    evas_list_free(selected);
    if (wd->chg_func) wd->chg_func(wd->chg_data, wd->obj);
 }
@@ -399,6 +400,9 @@
                                    e_fm2_pan_get,
                                    e_fm2_pan_max_get, 
                                    e_fm2_pan_child_size_get);
+   evas_object_propagate_events_set(wd->o_favorites_fm, 0);
+   e_widget_scrollframe_focus_object_set(o, wd->o_favorites_fm);
+   
    wd->o_favorites_frame = o;
    e_widget_sub_object_add(obj, o);
    e_widget_min_size_set(o, 128, 128);
@@ -439,6 +443,9 @@
                                    e_fm2_pan_get,
                                    e_fm2_pan_max_get,
                                    e_fm2_pan_child_size_get);
+   evas_object_propagate_events_set(wd->o_files_fm, 0);
+   e_widget_scrollframe_focus_object_set(o, wd->o_files_fm);
+   
    wd->o_files_frame = o;
    e_widget_sub_object_add(obj, o);
    e_widget_min_size_set(o, 128, 128);
@@ -535,7 +542,7 @@
    char *size, *owner, *perms, *mtime;
    struct stat st;
  
-   stat(wd->path, &st);
+   if (stat(wd->path, &st) < 0) return;
 
    size =  _e_wid_file_size_get(st.st_size);
    owner = _e_wid_file_user_get(st.st_uid);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_scrollframe.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_widget_scrollframe.c      22 Aug 2006 07:39:10 -0000      1.6
+++ e_widget_scrollframe.c      14 Sep 2006 16:07:57 -0000      1.7
@@ -6,7 +6,7 @@
 typedef struct _E_Widget_Data E_Widget_Data;
 struct _E_Widget_Data
 {
-   Evas_Object *o_scrollframe, *o_child;
+   Evas_Object *o_scrollframe, *o_child, *o_fobj;
 };
 
 static void _e_wid_del_hook(Evas_Object *obj);
@@ -101,6 +101,24 @@
    e_scrollframe_child_region_show(wd->o_scrollframe, x, y, w, h);
 }
 
+EAPI void
+e_widget_scrollframe_focus_object_set(Evas_Object *obj, Evas_Object *fobj)
+{
+   E_Widget_Data *wd;
+   
+   wd = e_widget_data_get(obj);
+   wd->o_fobj = fobj;
+}
+
+EAPI Evas_Object *
+e_widget_scrollframe_object_get(Evas_Object *obj)
+{
+   E_Widget_Data *wd;
+   
+   wd = e_widget_data_get(obj);
+   return wd->o_scrollframe;
+}
+
 /* Private functions */
 static void
 _e_wid_del_hook(Evas_Object *obj)
@@ -120,11 +138,13 @@
    if (e_widget_focus_get(obj))
      {
        
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), 
"e,state,focused", "e");
-       evas_object_focus_set(wd->o_scrollframe, 1);
+       if (wd->o_fobj) evas_object_focus_set(wd->o_fobj, 1);
+       else evas_object_focus_set(wd->o_scrollframe, 1);
      }
    else
      {
        
edje_object_signal_emit(e_scrollframe_edje_object_get(wd->o_scrollframe), 
"e,state,unfocused", "e");
+       if (wd->o_fobj) evas_object_focus_set(wd->o_fobj, 0);
        evas_object_focus_set(wd->o_scrollframe, 0);
      }
 }
@@ -138,14 +158,14 @@
 static void
 _e_wid_cb_scrollframe_resize(void *data, Evas *e, Evas_Object *obj, void 
*event_info)
 {
-    Evas_Coord mw, mh, vw, vh, w, h;    
-
-    e_scrollframe_child_viewport_size_get(obj, &vw, &vh);
-    e_widget_min_size_get(data, &mw, &mh);
-    evas_object_geometry_get(data, NULL, NULL, &w, &h);
-    if (vw >= mw)
-    {
-       if (w != vw) evas_object_resize(data, vw, h);
-    }
+   Evas_Coord mw, mh, vw, vh, w, h;    
+   
+   e_scrollframe_child_viewport_size_get(obj, &vw, &vh);
+   e_widget_min_size_get(data, &mw, &mh);
+   evas_object_geometry_get(data, NULL, NULL, &w, &h);
+   if (vw >= mw)
+     {
+       if (w != vw) evas_object_resize(data, vw, h);
+     }
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_scrollframe.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_widget_scrollframe.h      12 Aug 2006 21:53:26 -0000      1.3
+++ e_widget_scrollframe.h      14 Sep 2006 16:07:57 -0000      1.4
@@ -11,6 +11,8 @@
 EAPI void e_widget_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, 
Evas_Coord y);
 EAPI void e_widget_scrollframe_child_pos_get(Evas_Object *obj, Evas_Coord *x, 
Evas_Coord *y);
 EAPI void e_widget_scrollframe_child_region_show(Evas_Object *obj, Evas_Coord 
x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
-
+EAPI void e_widget_scrollframe_focus_object_set(Evas_Object *obj, Evas_Object 
*fobj);
+EAPI Evas_Object *e_widget_scrollframe_object_get(Evas_Object *obj);
+    
 #endif
 #endif



-------------------------------------------------------------------------
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