Revision: 4451 http://vexi.svn.sourceforge.net/vexi/?rev=4451&view=rev Author: clrg Date: 2012-10-24 00:18:30 +0000 (Wed, 24 Oct 2012) Log Message: ----------- Minor refactor / fix
Modified Paths: -------------- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/surface.t Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/surface.t =================================================================== --- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/surface.t 2012-10-12 02:59:52 UTC (rev 4450) +++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/surface.t 2012-10-24 00:18:30 UTC (rev 4451) @@ -82,8 +82,7 @@ <theme.surface /> /** access to the theme parameter setting */ - const getTheme = function() { - var themestr = vexi.params["vexi.theme"]; + const getThemeRes = function(themestr) { var themeres = null; if (themestr != null) { var sub = themestr.split('.'); @@ -93,16 +92,23 @@ } themeres = res; } + // string doesn't resolve if (themeres == null) { + vexi.log.debug("could not resolve '"+themestr+"', lookign in .conf.theme"); if (.conf.theme[""]!=null) { themeres = .conf.theme..location; } } - var ret = themeres != null ? themeres : vexi..org.vexi.theme.classic; + if (themeres == null) { + vexi.log.debug("no theme found, defaulting to classic"); + themeres = vexi..org.vexi.theme.classic; + } var str = (""+ret); str = str.substring(0, str.indexOf('$')); - vexi.log.debug("using theme "+ret.settings..themename+": "+str); - return ret; + var themename; + try { themename = ret.settings..themename; } catch(e) { } + vexi.log.debug("using theme "+(themename?" ("+str+")":str)); + return themeres; } /** access to the icon parameter setting */ @@ -122,21 +128,40 @@ iconres = .conf.icon..location; } } - var ret = iconres != null ? iconres : .theme.settings..iconlocation; + if (iconres == null) { + try { iconres = .theme.settings..iconlocation; } catch(e) { } + } var str = (""+ret); str = str.substring(0, str.indexOf('$')); vexi.log.debug("using icon set: "+str); - return ret; + return iconres; } /* * THEME HANDLING */ + static.theme ++= function(newtheme) { + if (typeof newtheme == "string") { + static.theme = getThemeRes(newtheme); + return; + } + if (static.theme) { + .theme --= static.theme; + } + try { + .theme ++= newtheme; + cascade = newtheme; + } catch(e) { + vexi.trace("Unable to apply theme"); + vexi.trace(e); + } + } + try { - var theme = getTheme(); + const theme = getThemeRes(vexi.params["vexi.theme"]); // theme specified - .theme ++= theme; + static.theme = theme; } catch(e) { vexi.trace("Unable to establish theme, most widgets will not work"); vexi.trace(e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn