Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h menus-misc.c menus.c menus.h 


Log Message:
No longer use convert (ImageMagick) to create scaled icons in menu generation,
but scale internally according to configuration setting.

===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.528
retrieving revision 1.529
diff -u -3 -r1.528 -r1.529
--- E.h 12 Jan 2006 21:33:37 -0000      1.528
+++ E.h 16 Jan 2006 12:45:55 -0000      1.529
@@ -369,6 +369,7 @@
       char                onscreen;
       char                warp;
       char                show_icons;
+      int                 icon_size;
       int                 opacity;
       struct
       {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus-misc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- menus-misc.c        7 Jan 2006 07:20:58 -0000       1.27
+++ menus-misc.c        16 Jan 2006 12:45:56 -0000      1.28
@@ -291,6 +291,8 @@
        return;
      }
 
+   MenuSetIconSize(m, 0);      /* Scale to default */
+
    count = 0;
    while (fgets(s, 4096, f))
      {
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -3 -r1.227 -r1.228
--- menus.c     8 Jan 2006 14:28:00 -0000       1.227
+++ menus.c     16 Jan 2006 12:45:56 -0000      1.228
@@ -94,6 +94,7 @@
    MenuItem          **items;
    Window              win;
    PmapMask            pmm;
+   int                 icon_size;
    char                internal;       /* Don't destroy when reloading */
    char                dynamic;        /* May be emptied on close */
    char                shown;
@@ -448,6 +449,14 @@
 }
 
 void
+MenuSetIconSize(Menu * m, int size)
+{
+   if (size > 48)
+      size = 48;
+   m->icon_size = size;
+}
+
+void
 MenuSetData(Menu * m, char *data)
 {
    if (m->data)
@@ -512,6 +521,7 @@
    MenuSetName(m, name);
    MenuSetTitle(m, title);
    MenuSetStyle(m, ms);
+   m->icon_size = -1;          /* Use image size */
 
    return m;
 }
@@ -667,19 +677,27 @@
             im = ImageclassGetImage(m->items[i]->icon_iclass, 0, 0, 0);
             if (im)
               {
-                 imlib_context_set_image(im);
+                 w = h = 0;
+                 if (m->icon_size > 0)
+                    w = h = m->icon_size;
+                 else if (m->icon_size == 0)
+                    w = h = Conf.menus.icon_size;
+                 if (w <= 0 || h <= 0)
+                   {
+                      imlib_context_set_image(im);
+                      w = imlib_image_get_width();
+                      h = imlib_image_get_height();
+                      imlib_free_image();
+                   }
+                 m->items[i]->icon_w = w;
+                 m->items[i]->icon_h = h;
                  m->items[i]->icon_win =
-                    ECreateWindow(m->items[i]->win, 0, 0,
-                                  imlib_image_get_width(),
-                                  imlib_image_get_height(), 0);
+                    ECreateWindow(m->items[i]->win, 0, 0, w, h, 0);
                  EMapWindow(m->items[i]->icon_win);
-                 m->items[i]->icon_w = imlib_image_get_width();
-                 m->items[i]->icon_h = imlib_image_get_height();
-                 if (imlib_image_get_height() > maxh)
-                    maxh = imlib_image_get_height();
-                 if (imlib_image_get_width() > maxx2)
-                    maxx2 = imlib_image_get_width();
-                 imlib_free_image();
+                 if (h > maxh)
+                    maxh = h;
+                 if (w > maxx2)
+                    maxx2 = w;
               }
             else
                m->items[i]->icon_iclass = NULL;
@@ -2096,6 +2114,7 @@
    CFG_ITEM_BOOL(Conf.menus, onscreen, 1),
    CFG_ITEM_BOOL(Conf.menus, warp, 1),
    CFG_ITEM_BOOL(Conf.menus, show_icons, 1),
+   CFG_ITEM_INT(Conf.menus, icon_size, 16),
    CFG_ITEM_INT(Conf.menus, opacity, 220),
    CFG_ITEM_INT(Conf.menus, key.left, XK_Left),
    CFG_ITEM_INT(Conf.menus, key.right, XK_Right),
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- menus.h     7 Jan 2006 07:20:58 -0000       1.4
+++ menus.h     16 Jan 2006 12:45:56 -0000      1.5
@@ -49,6 +49,7 @@
 void                MenuSetAlias(Menu * m, const char *alias);
 void                MenuSetStyle(Menu * m, MenuStyle * ms);
 void                MenuSetTitle(Menu * m, const char *title);
+void                MenuSetIconSize(Menu * m, int size);
 void                MenuSetData(Menu * m, char *data);
 void                MenuSetLoader(Menu * m, MenuLoader * loader);
 void                MenuSetTimestamp(Menu * m, time_t t);




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to