Revision: 4676
          http://sourceforge.net/p/vexi/code/4676
Author:   clrg
Date:     2014-03-17 16:36:28 +0000 (Mon, 17 Mar 2014)
Log Message:
-----------
Support more extensions with image preloader

Modified Paths:
--------------
    
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/settings.t
    branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/preload.t

Modified: 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/settings.t
===================================================================
--- 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/settings.t 
    2014-03-17 16:35:57 UTC (rev 4675)
+++ 
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/settings.t 
    2014-03-17 16:36:28 UTC (rev 4676)
@@ -1,10 +1,13 @@
-<!-- Copyright 2011 - see COPYING for details [LGPL] -->
+<!-- Copyright (c) - see COPYING for details [LGPL] -->
 
-<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.util">
-    <meta:doc>
-        <author>Charles Goodwin</author>
-    </meta:doc>
+<vexi xmlns:ui="vexi://ui"
+      xmlns:ut="vexi.util"
+      xmlns="vexi.theme">
     
+    /* Default settings for the theme; widgets will pick
+     * up their settings i.e. colours from here
+     */
+    
     <ui:box />
     
     static.buttonfill = "#d4d0c8";
@@ -25,6 +28,6 @@
     static.widgetfill = "#d4d0c8";
     
     // preload images so they don't get dropped
-    static.imagecache = .preload(vexi.box);
+    static.imagecache = new ut.preload(.image);
     
 </vexi>

Modified: branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/preload.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/preload.t   
2014-03-17 16:35:57 UTC (rev 4675)
+++ branches/vexi3/org.vexi-vexi.widgets/src_main/vexi/util/preload.t   
2014-03-17 16:36:28 UTC (rev 4676)
@@ -1,13 +1,12 @@
-<!-- Copyright 2011 - see COPYING for details [LGPL] -->
+<!-- Copyright (c) - see COPYING for details [LGPL] -->
 
-<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" 
xmlns="org.vexi.theme.classic">
-    <meta:doc>
-        <author>Charles Goodwin</author>
-        <about>
-            Used to preload all the theme's images
-        </about>
-    </meta:doc>
+<vexi xmlns:ui="vexi://ui">
     
+    /* Used to preload all images for all the given arguments;
+     * it will load image files as fills and also drops into
+     * any subdirectories to also preload those files
+     */
+    
     <ui:box>
         
         var loadImages = function(res) {
@@ -15,17 +14,23 @@
                 if (k.charAt(0)=='.') {
                     continue;
                 }
-                var i = k.lastIndexOf('.png'); 
-                if (i>0 and i==k.length-4) {
-                    thisbox[0] = vexi.box;
-                    thisbox[0].fill = res[k];
-                } else {
-                    callee(res[k]);
+                const parts = k.split('.');
+                if (parts.length>1) {
+                    var ext = parts[1];
+                    if (ext == "png" or ext == "gif" or ext == "jpg") {
+                        const b = vexi.box;
+                        b.fill = res[k];
+                        thisbox.add(b);
+                    }
+                    continue;
                 }
+                // probably a subdirectory
+                callee(res[k]);
             }
         }
         
-        loadImages(.image);
+        for (var i,arg in arguments)
+            loadImages(arg);
         
     </ui:box>
 </vexi>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to