Revision: 3202
          http://vexi.svn.sourceforge.net/vexi/?rev=3202&view=rev
Author:   clrg
Date:     2008-11-14 15:38:34 +0000 (Fri, 14 Nov 2008)

Log Message:
-----------
Automatic icon/theme location (just specify vexi.conf.theme/icon..location)

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/surface.t

Added Paths:
-----------
    trunk/widgets/org.vexi.widgets/src/vexi/conf/
    trunk/widgets/org.vexi.widgets/src/vexi/conf/theme.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t       
2008-11-14 15:37:55 UTC (rev 3201)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t       
2008-11-14 15:38:34 UTC (rev 3202)
@@ -61,14 +61,14 @@
     static.listicon32 = {};
     static.listicon16 = {};
     
-    for (var k in icon.i32) {
+    for (var k in icon.icon32) {
         var d = k.indexOf('.');
         if (d==0) continue;
         if (d>=1) k = k.substring(0, d);
         listicon32[k] = true;
     }
     
-    for (var k in icon.i16) {
+    for (var k in icon.icon16) {
         var d = k.indexOf('.');
         if (d==0) continue;
         if (d>=1) k = k.substring(0, d);

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/surface.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/surface.t      
2008-11-14 15:37:55 UTC (rev 3201)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/surface.t      
2008-11-14 15:38:34 UTC (rev 3202)
@@ -69,10 +69,16 @@
         
         // stops warnings about an undeclared property
         thisbox.theme;
-        // no theme has been specified by the user
-        if (thisbox.theme == null) theme = static.theme;
-        // set up the theme redirect
+        // no theme/icons have been specified by the user
+        if (theme == null) theme = static.theme;
+        // set up the theme/icons redirects
         vexi..vexi.theme ++= theme;
+        
+        // do the same for icons
+        thisbox.icons;
+        if (icons == null) icons = static.icon;
+        if (icons) vexi..vexi.icon ++= icons;
+        
         // apply the theme surface template
         vexi..vexi.theme.surface(thisbox);
         
@@ -89,6 +95,10 @@
                 res = res[sub[i]];
             themeres = res;
         }
+        if (themeres == null) {
+            if (vexi..vexi.conf.theme[""]!=null)
+                themeres = vexi..vexi.conf.theme..location;
+        }
         var ret = themeres != null ? themeres : vexi..org.vexi.theme.classic;
         var str = (""+ret);
         str = str.substring(0, str.indexOf('$'));
@@ -96,4 +106,26 @@
         return ret;
     }
     
+    /** access to the icon parameter setting */
+    static.icon ++= function() {
+        var iconstr = vexi.params["vexi.icon"];
+        var iconres = null;
+        if (iconstr != null) {
+            var sub = iconstr.split('.');
+            var res = vexi[""];
+            for (var i=0; sub.length>i; i++)
+                res = res[sub[i]];
+            iconres = res;
+        }
+        if (iconres == null) {
+            if (vexi..vexi.conf.icon[""]!=null)
+                themeres = vexi..vexi.conf.icon..location;
+        }
+        var ret = iconres != null ? iconres : 
vexi..vexi.theme.settings..iconlocation;
+        var str = (""+ret);
+        str = str.substring(0, str.indexOf('$'));
+        vexi.log.debug("using icon set: "+str);
+        return ret;
+    }
+    
 </vexi>

Added: trunk/widgets/org.vexi.widgets/src/vexi/conf/theme.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/vexi/conf/theme.t                        
        (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/vexi/conf/theme.t        2008-11-14 
15:38:34 UTC (rev 3202)
@@ -0,0 +1,5 @@
+<!-- provides the location to look for the theme -->
+<vexi xmlns:ui="vexi://ui">
+    <ui:box />
+    static.location = vexi..org.vexi.theme.classic;
+</vexi>
\ No newline at end of file


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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to