Revision: 3359 http://vexi.svn.sourceforge.net/vexi/?rev=3359&view=rev Author: clrg Date: 2009-01-14 23:12:07 +0000 (Wed, 14 Jan 2009)
Log Message: ----------- Several small changes + fixes bundled together - fix whitespace edit reads - provide v_init mechanism for container widgets for initalizing properties at the end of the apply process - fix progress bar layout - a few other less noteworthy trivial updates Modified Paths: -------------- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/container.t trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/word.t trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/cell.t trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/textfield.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/cell.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/check.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/focusborder.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/item.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/menuitem.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/progressbar.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/radio.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/submenu.t trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/textfield.t trunk/widgets/org.vexi.widgets/src/vexi/widget/progressbar.t trunk/widgets/org.vexi.widgets/src_vunit/testutil.t Added Paths: ----------- trunk/widgets/org.vexi.widgets/src_vunit/test/widget/datefield.t Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/container.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/container.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/container.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -38,19 +38,13 @@ if (thisbox.v_fillbox and v_fillbox!=thisbox) { rdt..addRedirect(thisbox, v_fillbox, "fill", "tile"); } - if (thisbox.v_textbox) { - if (v_textbox!=thisbox) + if (thisbox.v_textbox and v_textbox!=thisbox) { rdt..addRedirect(thisbox, v_textbox, "font", "fontsize", "text", "textcolor"); - // do not auto-manage textalign i.e. edit widgets - if (thisbox.v_textbox_managed) - rdt..addRedirect(thisbox, v_textbox, "textalign"); - // redirect textalign property to v_textbox.align - else { - if (thisbox.textalign) v_textbox.align = textalign; - thisbox.textalign ++= static.textalignRead; - thisbox.textalign ++= static.textalignWrite; - } } + // initialize properties + if (thisbox.v_init!=null) { + for (var p in v_init) thisbox[p] = v_init[p]; + } }; // end </ui:box> Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/word.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/word.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/word.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -126,7 +126,7 @@ /** return textual content from internal text-box */ static.textRead = function() { if (trapee.chartype == 0) { - var l = trapee.text.length; + var l = cascade.length; var r = ""; for (var i=0; l>i; i+=4) r += tabchar; return r; @@ -157,7 +157,7 @@ /** handle textcolor using psuedonym wordcolor */ static.wordcolorWrite = function(v) { cascade = v; - trapee.wordcolorset = v==null; + trapee.wordcolorset = v!=null; if (!trapee.highlight) trapee.textcolor = trapee.wordcolor; } Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/cell.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/cell.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/cell.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -13,6 +13,12 @@ thisbox.v_container ++= static.containerWrite; </ui:box> + /** used to forward properties to v_content[0] */ + static.forwardToInner = function(v) { + cascade = v; + trapee[0][trapname] = v; + } + /** set up cell to handle incoming type */ static.containerWrite = function(v) { cascade = v; @@ -21,11 +27,15 @@ + vexi.ui.font.height(t.font, t.fontsize, "dy"); t[0] = vexi.box; t.v_textbox = t[0]; - t.v_content.align = "left"; - t.v_content.layout = "place"; + var c = t.v_content; + c.align = "left"; + c.layout = "place"; + c.align ++= static.forwardToInner; + c.orient ++= static.forwardToInner; switch (t.datatype) { case "bool": case "boolean": + c.align = "center"; t[0].shrink = true; t[0].fill = theme.image.check; t.selected ++= static.toggleSelectWrite; Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/textfield.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/textfield.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/textfield.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -16,6 +16,7 @@ thisbox.shadowtext = ""; thisbox.value = ""; thisbox.th_shadowtext; + thisbox.th_shadowwrap; KeyPressed ++= static.keypressEvent; password ++= static.passwordWrite; @@ -106,7 +107,7 @@ // normal textfield input } else { cascade = v; - trapee.th_shadowtext.display = edit.text == ""; + trapee.th_shadowwrap.display = edit.text == ""; } } @@ -129,7 +130,7 @@ static.textWrite = function(v) { var f = trapee.v_field; // only show shadowtext if field is empty - f.th_shadowtext.display = (v == "" or v == null); + f.th_shadowwrap.display = (v == "" or v == null); // hide text from user for passfields if (f.password) { var str = ""; Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/cell.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/cell.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/cell.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -6,5 +6,10 @@ <author>Charles Goodwin</author> </meta:doc> - <cell padding="2" textalign="left" /> + <cell> + thisbox.v_init = static.cellinit; + </cell> + + static.cellinit = { align:"left", layout:"place", padding:2 }; + </vexi> Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/check.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/check.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/check.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -7,7 +7,7 @@ </meta:doc> <lib:check /> - <ui:box redirect=":$content" margin="3" padding="0 5" shrink="true" textalign="left"> + <ui:box redirect=":$content" shrink="true"> <focusborder id="focus"> <bevel align="center" form="down" width="14" height="14"> <ui:box id="bg" fill="white" layout="place"> @@ -17,7 +17,8 @@ <ui:box id="content" /> </focusborder> - thisbox.th_bg = $bg; + thisbox.v_init = static.checkinit; + thisbox.th_bg = $bg; thisbox.th_check = $check; thisbox.th_focus = $focus; @@ -31,6 +32,8 @@ </ui:box> + static.checkinit = { margin:3, padding:"0 5", align:"left" }; + static.activeFunc = function(v) { trapee.th_bg.fill = "#d4d0c8"; cascade = v; } static.mixedFunc = function(v) { Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/focusborder.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/focusborder.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/focusborder.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -1,6 +1,7 @@ <!-- Copyright 2008 - see COPYING for details [LGPL] --> -<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme"> +<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme" + xmlns:rdt="vexi.util.redirect"> <meta:doc> <author>Charles Goodwin</author> </meta:doc> @@ -24,7 +25,7 @@ $w.display = v; } - vexi..vexi.util.redirect..addRedirect(thisbox, $content, "orient", "layout"); + rdt..addRedirect(thisbox, $content, "align", "orient", "layout"); </ui:box> Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/item.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/item.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/item.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -5,11 +5,13 @@ <author>Charles Goodwin</author> </meta:doc> - <item /> - <ui:box padding="3" textalign="left"> + <item> + thisbox.v_init = static.iteminit; thisbox.selected ++= static.selectWrite; - </ui:box> + </item> + static.iteminit = { padding:3, align:"left" }; + static.selectWrite = function(v) { cascade = v; if (trapee.selected) { Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/menuitem.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/menuitem.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/menuitem.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -6,13 +6,14 @@ </meta:doc> <menuitem /> - <ui:box redirect=":$content" margin="0" padding="2 3" textalign="left" vshrink="true"> + <ui:box redirect=":$content" vshrink="true"> <ui:box width="22" height="20"> <ui:box id="icon" shrink="true" /> </ui:box> <ui:box id="content" /> <ui:box id="mnemonic" shrink="true" /> + thisbox.v_init = static.menuinit; thisbox.th_icon = $icon; thisbox.enabled ++= static.enableWrite; @@ -20,6 +21,8 @@ </ui:box> + static.menuinit = { padding:"2 3", align:"left" }; + static.enableWrite = function(v) { cascade = v; trapee.textcolor = trapee.enabled ? "black" : "#888888"; Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -8,7 +8,7 @@ <lib:widget.option redirect=":$content" margin="3" maxlistheight="160" vshrink="true"> <bevel form="down"> - <focusborder id="focus" align="topleft" fill="white" layout="place"> + <focusborder id="focus" align="left" fill="white" layout="place"> <lib:layout.pad id="pad" padding="3"> <ui:box id="output" align="left" /> </lib:layout.pad> Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/progressbar.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/progressbar.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/progressbar.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -6,38 +6,65 @@ <author>Chares Goodwin</author> </meta:doc> - <bevel redirect=":$content" align="left" form="thindown" layout="layer" margin="5" padding="5" vshrink="true"> - <ui:box id="content" /> - <ui:box id="bar" align="left" fill="#d4d0c8" layout="place"> - <lay:pad id="barpad"> - <ui:box id="barmsg" align="left" textcolor="white" /> + <bevel redirect=":$content" align="left" form="thindown" margin="5" padding="3" vshrink="true"> + <ui:box align="left" layout="layer"> + <ui:box id="content" /> + <lay:pad id="bar" fill="darkblue" padding="3" width="0"> + <ui:box id="barmsg" align="left" layout="place" textcolor="white" /> </lay:pad> </ui:box> + thisbox.th_bar = $bar; + thisbox.th_barmsg = $barmsg; + thisbox.th_content = $content; + thisbox.v_init = static.barinit; + thisbox.amount = 0; thisbox.total = -1; thisbox.percent = 0; thisbox.units = null; - var update = function() { - $barpad.padding = padding; - if (total!=-1) { - $bar.width = vexi.math.ceil((amount/total)*$content.width); - var newpercent = vexi.math.floor((amount/total)*100)+"%"; - var msg = newpercent+" - "+amount +" / "+total; - if (units!=null) msg += units; - $barmsg.text = msg; - text = msg; - } else { - text = amount+(units==null?"":units); - } - }; + thisbox.amount ++= static.amountWrite; - thisbox.amount ++= function(v) { - cascade = v; - update(); - }; + // FIXME: doesn't invoke updateSize + // FIXME: padding traps don't cascade + thisbox.paddingtop ++= static.paddingWrite; + thisbox.paddingleft ++= static.paddingWrite; + thisbox.paddingright ++= static.paddingWrite; + thisbox.paddingbottom ++= static.paddingWrite; + thisbox.font ++= static.updateSize; + thisbox.fontsize ++= static.updateSize; + thisbox.v_container ++= static.updateSize; + </bevel> + + static.barinit = { align:"left", layout:"place" }; + + static.amountWrite = function(v) { + cascade = v; + if (trapee.total!=-1) { + trapee.th_bar.width = vexi.math.ceil((v/trapee.total)*trapee.th_content.width); + var newpercent = vexi.math.floor((v/trapee.total)*100)+"%"; + var msg = newpercent+" - "+v +" / "+trapee.total; + if (trapee.units!=null) msg += trapee.units; + trapee.th_barmsg.text = msg; + trapee.text = msg; + } else { + trapee.text = v+(trapee.units==null?"":trapee.units); + } + } + + /** keep overlay text padding the same as background text */ + static.paddingWrite = function(v) { trapee.th_bar[trapname] = v; return; } + + /** keep overlay text attributes in sync with background text */ + static.updateSize = function(v) { + cascade = v; + trapee.th_barmsg[trapname] = v; + trapee.th_content.minheight = trapee.paddingtop + trapee.paddingbottom + + vexi.ui.font.height(trapee.font, trapee.fontsize, "dy"); + } + </vexi> \ No newline at end of file Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/radio.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/radio.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/radio.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -2,8 +2,12 @@ <vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme" xmlns:lib="org.vexi.lib.widget"> + <meta:doc> + <author>Charles Goodwin</author> + </meta:doc> + <lib:radio /> - <ui:box redirect=":$content" margin="3" padding="0 5" textalign="left" vshrink="true"> + <ui:box redirect=":$content" vshrink="true"> <focusborder id="focus"> <ui:box width="14" height="14" layout="place" shrink="true"> <ui:box id="bg" shrink="true" /> @@ -12,6 +16,7 @@ <ui:box id="content" /> </focusborder> + thisbox.v_init = static.radioinit; thisbox.th_bg = $bg; thisbox.th_focus = $focus; thisbox.th_radio = $radio; @@ -26,6 +31,8 @@ </ui:box> + static.radioinit = { margin:3, padding:"0 5", align:"left" }; + static.activeFunc = function(v) { cascade = v; trapee.th_bg.fill = .image.radiobg_active; Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/submenu.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/submenu.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/submenu.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -7,7 +7,7 @@ </meta:doc> <lib:widget.submenu /> - <ui:box redirect=":$content" textalign="left" vshrink="true"> + <ui:box redirect=":$content" vshrink="true"> <lib:layout.pad padding="2 3"> <ui:box width="16" height="16" shrink="true"> <ui:box id="icon" /> @@ -20,11 +20,12 @@ <ui:box id="content" orient="vertical" fill="#d4d0c8" /> </bevel> - thisbox.th_icon = $icon; + thisbox.th_icon = $icon; thisbox.th_arrow = $arrow; thisbox.v_popbox = $popbox; + thisbox.v_init = static.submenuinit; - thisbox.popup ++= static.popupWrite; + thisbox.popup ++= static.popupWrite; thisbox.selected ++= static.selectWrite; thisbox.v_container ++= function(v) { @@ -34,6 +35,8 @@ </ui:box> + static.submenuinit = { align:"left" }; + static.popupWrite = function(v) { var t = trapee; var d = t.surface.frame.distanceto(t); Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/textfield.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/textfield.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/textfield.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -10,12 +10,15 @@ <bevel redirect=":$content" form="down" margin="3" padding="3" vshrink="true"> <ui:box id="inset" align="left" layout="place"> <ui:box id="content" /> - <lib:layout.pad id="pad" align="left" padding="3" vshrink="true"> - <ui:box id="shadow" shrink="true" textcolor="#999999" /> + <lib:layout.pad id="shadowpad" padding="3" vshrink="true"> + <ui:box align="left"> + <ui:box id="shadow" align="left" shrink="true" textcolor="#999999" /> + </ui:box> </lib:layout.pad> </ui:box> thisbox.th_shadowtext = $shadow; + thisbox.th_shadowwrap = $shadowpad; thisbox.th_viewport = $inset; thisbox.th_view = $content; thisbox.v_prevfill = .settings..fill; Modified: trunk/widgets/org.vexi.widgets/src/vexi/widget/progressbar.t =================================================================== --- trunk/widgets/org.vexi.widgets/src/vexi/widget/progressbar.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src/vexi/widget/progressbar.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -12,4 +12,6 @@ <margin /> <theme:progressbar /> + <pad /> + <container /> </vexi> \ No newline at end of file Added: trunk/widgets/org.vexi.widgets/src_vunit/test/widget/datefield.t =================================================================== --- trunk/widgets/org.vexi.widgets/src_vunit/test/widget/datefield.t (rev 0) +++ trunk/widgets/org.vexi.widgets/src_vunit/test/widget/datefield.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -0,0 +1,23 @@ +<vexi xmlns:meta="vexi://meta" xmlns:ui="vexi://ui" xmlns="vexi.widget"> + <meta:doc> + <author>Charles Goodwin</author> + </meta:doc> + + var vunit = vexi..vexi.test.vunit; + + static.test = function() { + /// Quick Suite + var suite = {}; + suite.testQ1 = function() { + var b = .datefield(vexi.box); + b.value = "2008-01-05"; + assert("2008-01-05", b.value); + }; + suite.name = "vexi.widget.datefield Tests"; + return suite; + }; + + <surface> + static.test().testQ1(); + </surface> +</vexi> \ No newline at end of file Modified: trunk/widgets/org.vexi.widgets/src_vunit/testutil.t =================================================================== --- trunk/widgets/org.vexi.widgets/src_vunit/testutil.t 2009-01-14 21:19:18 UTC (rev 3358) +++ trunk/widgets/org.vexi.widgets/src_vunit/testutil.t 2009-01-14 23:12:07 UTC (rev 3359) @@ -1,10 +1,13 @@ <vexi xmlns:meta="vexi://meta" xmlns:ui="vexi://ui"> - <meta:doc> Author: Mike </meta:doc> - - static.create = function(template, props){ - var r = template?template(vexi.box):vexi.box; - for(var k in props){ r[k] = props[k]; } + <meta:doc> + <author>Mike Goodwin</author> + </meta:doc> + + static.create = function(template, props) { + var r = template ? template(vexi.box) : vexi.box; + for (var k in props) { r[k] = props[k]; } return r; }; + <ui:box/> </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: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn