Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_config_dialog.c e_menu.c e_menu.h 


Log Message:


metrics keynav patches in

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_config_dialog.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- e_config_dialog.c   8 Oct 2006 08:04:17 -0000       1.30
+++ e_config_dialog.c   8 Oct 2006 08:25:08 -0000       1.31
@@ -91,10 +91,10 @@
          {
             E_Zone *z;
 
+            z = e_util_zone_current_get(e_manager_current_get());
             e_border_uniconify(cfd->dia->win->border);
             e_dialog_show(cfd->dia);
             e_win_raise(cfd->dia->win);
-            z = e_util_zone_current_get(e_manager_current_get());
             if (z->container == cfd->dia->win->border->zone->container)
               e_border_desk_set(cfd->dia->win->border, e_desk_current_get(z));
             else
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- e_menu.c    8 Oct 2006 06:43:31 -0000       1.70
+++ e_menu.c    8 Oct 2006 08:25:08 -0000       1.71
@@ -53,6 +53,7 @@
 static void _e_menu_item_activate_first           (void);
 static void _e_menu_item_activate_last            (void);
 static void _e_menu_item_activate_nth             (int n);
+static void _e_menu_item_activate_char            (char * key_compose);
 static void _e_menu_activate_next                 (void);
 static void _e_menu_activate_previous             (void);
 static void _e_menu_activate_first                (void);
@@ -60,6 +61,7 @@
 static void _e_menu_activate_nth                  (int n);
 static E_Menu *_e_menu_active_get                 (void);
 static E_Menu_Item *_e_menu_item_active_get       (void);
+static Evas_List * _e_menu_list_item_active_get   (void);
 static int  _e_menu_outside_bounds_get            (int xdir, int ydir);
 static void _e_menu_scroll_by                     (int dx, int dy);
 static void _e_menu_mouse_autoscroll_check        (void);
@@ -536,6 +538,7 @@
    mi = E_OBJECT_ALLOC(E_Menu_Item, E_MENU_ITEM_TYPE, _e_menu_item_free);
    mi->menu = m;
    mi->menu->items = evas_list_append(mi->menu->items, mi);
+   mi->list_position = evas_list_last(mi->menu->items);
    return mi;
 }
 
@@ -1941,118 +1944,68 @@
 static void
 _e_menu_item_activate_next(void)
 {
-   E_Menu *m;
+   E_Menu_Item *mi;
+   Evas_List *ll;
 
-   /* FIXME: inefficient. should track active item */
-   m = _e_menu_active_get();
-   if (m)
+   ll = _e_menu_list_item_active_get();
+   mi = _e_menu_item_active_get();
+   if (ll && mi) 
      {
-       Evas_List *ll;
-       
-       for (ll = m->items; ll; ll = ll->next)
-         {
-            E_Menu_Item *mi;
-            
+       /* Look at the next item and then cycle until we're not on
+        * a separator. */
+       if (!(ll->next)) 
+         ll = mi->menu->items;
+       else
+          ll = ll->next;
+       mi = ll->data;
+       while (mi->separator)
+         { 
+            if (!(ll->next)) 
+              ll = mi->menu->items;
+            else
+              ll = ll->next;
             mi = ll->data;
-            if (mi->active) 
-              {
-                 if (ll->next)
-                   {
-                      ll = ll->next;
-                      mi = ll->data;
-                      while ((mi->separator) && (ll->next))
-                        {
-                           ll = ll->next;
-                           mi = ll->data;
-                        }
-                      if ((mi->separator) && (!ll->next))
-                        {
-                           ll = m->items;
-                           mi = ll->data;
-                           while ((mi->separator) && (ll->next))
-                             {
-                                ll = ll->next;
-                                mi = ll->data;
-                             }
-                        }
-                      e_menu_item_active_set(mi, 1);
-                      _e_menu_item_ensure_onscreen(mi);
-                   }
-                 else
-                   {
-                      ll = m->items;
-                      mi = ll->data;
-                      while ((mi->separator) && (ll->next))
-                        {
-                           ll = ll->next;
-                           mi = ll->data;
-                        }
-                      e_menu_item_active_set(mi, 1);
-                      _e_menu_item_ensure_onscreen(mi);
-                   }
-                 return;
-              }
          }
+
+       e_menu_item_active_set(mi, 1);
+       _e_menu_item_ensure_onscreen(mi);
+       return;
      }
+
    _e_menu_activate_first();
 }
 
 static void
 _e_menu_item_activate_previous(void)
 {
-   E_Menu *m;
+   E_Menu_Item *mi;
+   Evas_List *ll;
 
-   /* FIXME: inefficient. should track active item */
-   m = _e_menu_active_get();
-   if (m)
+   ll = _e_menu_list_item_active_get();
+   mi = _e_menu_item_active_get();
+   if (ll && mi) 
      {
-       Evas_List *ll;
-       
-       for (ll = m->items; ll; ll = ll->next)
-         {
-            E_Menu_Item *mi;
-            
+       /* Look at the prev item and then cycle until we're not on
+        * a separator. */
+       if (!(ll->prev)) 
+         ll = evas_list_last(ll);
+       else
+          ll = ll->prev;
+       mi = ll->data;
+       while (mi->separator)
+         { 
+            if (!(ll->prev)) 
+              ll = evas_list_last(ll);
+            else
+              ll = ll->prev;
             mi = ll->data;
-            if (mi->active) 
-              {
-                 if (ll->prev)
-                   {
-                      ll = ll->prev;
-                      mi = ll->data;
-                      while ((mi->separator) && (ll->prev))
-                        {
-                           ll = ll->prev;
-                           mi = ll->data;
-                        }
-                      if ((mi->separator) && (!ll->prev))
-                        {
-                           ll = m->items;
-                           mi = ll->data;
-                           while ((mi->separator) && (ll->prev))
-                             {
-                                ll = ll->prev;
-                                mi = ll->data;
-                             }
-                        }
-                      e_menu_item_active_set(mi, 1);
-                      _e_menu_item_ensure_onscreen(mi);
-                   }
-                 else
-                   {
-                      ll = evas_list_last(m->items);
-                      mi = ll->data;
-                      while ((mi->separator) && (ll->prev))
-                        {
-                           ll = ll->prev;
-                           mi = ll->data;
-                        }
-                      e_menu_item_active_set(mi, 1);
-                      _e_menu_item_ensure_onscreen(mi);
-                   }
-                 return;
-              }
          }
+
+       e_menu_item_active_set(mi, 1);
+       _e_menu_item_ensure_onscreen(mi);
+       return;
      }
+
    _e_menu_activate_first();
 }
 
@@ -2133,6 +2086,75 @@
 }
 
 static void
+_e_menu_item_activate_char(char * key_compose)
+{
+   E_Menu *m;
+   E_Menu_Item *mi;
+   Evas_List *ll, *ll_orig;
+
+   /* Ignore modifiers and such. */
+   if (!key_compose) return;
+
+   /* Check we've got a menu and it's active. */
+   m = _e_menu_active_get();
+   if (!m) 
+     {
+       if (!_e_active_menus) return;
+       m = _e_active_menus->data;
+       if (!m) return;
+     }
+
+   ll = _e_menu_list_item_active_get();
+   /* If we don't have an active item, start from the top of the list. */
+   if (!ll)
+     {
+       ll = m->items;
+       mi = ll->data;
+       /* Only check the current item if it wasn't active before. */
+       if (!mi->separator && mi->label && !strncasecmp(key_compose, mi->label, 
strlen(key_compose))) 
+         {
+            e_menu_item_active_set(mi, 1);
+            _e_menu_item_ensure_onscreen(mi);
+            return;
+         }
+     }
+
+   ll_orig = ll;
+
+   mi = ll->data;
+   if (!(ll->next)) 
+     ll = mi->menu->items;
+   else
+     ll = ll->next;
+   mi = ll->data;
+
+   /* While we don't have a label OR we don't match  AND we haven't
+    * wrapped around */
+   while ((!mi->label || strncasecmp(key_compose, mi->label, 
strlen(key_compose))) 
+        && ll != ll_orig)
+     {
+       if (!(ll->next)) 
+         ll = mi->menu->items;
+       else
+         ll = ll->next;
+       mi = ll->data;
+
+       while (mi->separator)
+         { 
+            if (!(ll->next)) 
+              ll = mi->menu->items;
+            else
+              ll = ll->next;
+            mi = ll->data;
+         }
+     }
+
+   e_menu_item_active_set(mi, 1);
+   _e_menu_item_ensure_onscreen(mi);
+   return;
+}
+
+static void
 _e_menu_activate_next(void)
 {
    E_Menu_Item *mi;
@@ -2261,6 +2283,15 @@
    return _e_active_menu_item;
 }
 
+static Evas_List * 
+_e_menu_list_item_active_get(void)
+{
+   if (_e_active_menu_item)
+      return _e_active_menu_item->list_position;
+   else
+     return NULL;
+}
+
 static int
 _e_menu_outside_bounds_get(int xdir, int ydir)
 {
@@ -2585,6 +2616,8 @@
      _e_menu_item_activate_nth(8);
    else if ((!strcmp(ev->keysymbol, "0")) || (!strcmp(ev->keysymbol, "KP_0")))
      _e_menu_item_activate_last();
+   else if (ev->key_compose)
+     _e_menu_item_activate_char(ev->key_compose);
    return 1;
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_menu.h    3 Sep 2006 11:32:13 -0000       1.24
+++ e_menu.h    8 Oct 2006 08:25:08 -0000       1.25
@@ -102,6 +102,8 @@
    Evas_Object   *event_object;
 
    E_App         *app;  /* For when this item is used for an app.  
Experimental, if this makes it into cvs, kill onefang. */
+
+   Evas_List    *list_position;
    
    int            label_w, label_h;
    int            icon_w, icon_h;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to