Revision: 3830
          http://vexi.svn.sourceforge.net/vexi/?rev=3830&view=rev
Author:   clrg
Date:     2010-03-30 16:04:02 +0000 (Tue, 30 Mar 2010)

Log Message:
-----------
Some code style stuff

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/edit.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/tabpane.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t      
2010-03-30 16:02:48 UTC (rev 3829)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t      
2010-03-30 16:04:02 UTC (rev 3830)
@@ -23,8 +23,10 @@
                         counter = 1;
                         display = true;
                     
-                    // blink
-                    } else display = (counter != 0);
+                    } else {
+                        // blink
+                        display = (counter != 0);
+                    }
                     // reset moved;
                     moved = false;
                     cascade = v;
@@ -44,9 +46,12 @@
             var cBlock = $edit.getCBlock();
             var cWord = $edit.getCWord();
             var cPos = $edit.getCPos();
-            if (cBlock == null) throw "error - cBlock should never be null";
-            // calculate cursor pos according to cWord
+            if (cBlock == null) {
+                throw "error - cBlock should never be null";
+            }
+            
             if (cWord) {
+                // calculate cursor pos according to cWord
                 $cursor.height = vexi.ui.font.height(cWord.font, 
cWord.fontsize, "dy");
                 var d = $edit.distanceto(cWord);
                 if (1>=cWord.chartype and cWord.width == 0 and 
cBlock.indexof(cWord) == cBlock.numchildren-1) {
@@ -58,8 +63,8 @@
                     $cursor.y = d.y;
                 }
             
-            // place cursor at start of cBlock
             } else {
+                // place cursor at start of cBlock
                 var d = $edit.distanceto(cBlock);
                 $cursor.x = d.x;
                 $cursor.y = d.y;

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/edit.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/edit.t 2010-03-30 
16:02:48 UTC (rev 3829)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/edit.t 2010-03-30 
16:04:02 UTC (rev 3830)
@@ -657,19 +657,22 @@
                         //aBlock = aBlock;
                         aPos = 0;
                         aWord = aBlock[aBlock.indexof(aWord)+1];
+                    
                     } else {
                         // place cursor in word
                         //aBlock = aBlock;
                         aPos = ci;
                         //aWord = aWord;
                     }
+                
                 } else while (true) {
                     // place cursor as close to the mouse position as possible
                     var d = thisbox.distanceto(aBlock);
                     var dY = d.y;
                     var dX = d.x;
-                    // mouse is above aBlock
+                    
                     if (dY > aY) {
+                        // mouse is above aBlock
                         var i = thisbox.indexof(aBlock);
                         for (i--; i >= 0; i--) {
                             aBlock = thisbox[i];
@@ -682,8 +685,8 @@
                             break;
                         }
                     
-                    // mouse is below aBlock
                     } else if (aY > dY+aBlock.height) {
+                        // mouse is below aBlock
                         var n = thisbox.numchildren;
                         dY += aBlock.height;
                         var i = thisbox.indexof(aBlock);
@@ -700,13 +703,13 @@
                     }
                     // else working within the current block
                     
-                    // empty block
                     if (aBlock.numchildren == 0) {
+                        // empty block
                         aWord = null;
                         aPos = 0;
                     
-                    // block with children
                     } else {
+                        // block with children
                         var ind1 = 0;
                         var ind2 = aBlock.numchildren-1;
                         var indm = 0;
@@ -741,6 +744,7 @@
                             }
                             aWord = aBlock[indm];
                             aPos = aWord ? aWord.text.length : 0;
+                        
                         } else {
                             // to the left, find word at the start of the line
                             while (indm-1 >= 0 and aBlock[indm].y == 
aBlock[indm-1].y) {
@@ -769,6 +773,7 @@
                     // select words prior to assigning a* to c*
                     selectWords();
                 }
+                
                 if (!cursorLock) {
                     // update c* to a*
                     cBlock = aBlock;
@@ -800,8 +805,13 @@
         /** request the findCurPosInBlock thread function */
         var findCurThreadRequest = function(v) {
             var s = surface;
-            if (s == null) return;
-            if (frameToThis == null) frameToThis = s.frame.distanceto(thisbox);
+            if (s == null) {
+                return;
+            }
+            if (frameToThis == null) {
+                // reusable frame distanceto object
+                frameToThis = s.frame.distanceto(thisbox);
+            }
             var m = s.frame.mouse;
             if (tip) {
                 // thread already in progress - notify we want it to repeat
@@ -811,6 +821,7 @@
                 nX = m.x-frameToThis.x;
                 nY = m.y-frameToThis.y;
                 updateCurPos = true;
+            
             } else {
                 // prepare vars for thread and initiate
                 aBlock = mBlock;

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t     
2010-03-30 16:02:48 UTC (rev 3829)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/option.t     
2010-03-30 16:04:02 UTC (rev 3830)
@@ -26,7 +26,7 @@
                 value = v.value;
             }
         }
-   
+        
         // make accessible 
         thisbox.selecteditem ++= static.selecteditemRead;
         

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t 
2010-03-30 16:02:48 UTC (rev 3829)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t 
2010-03-30 16:04:02 UTC (rev 3830)
@@ -195,8 +195,9 @@
     
     /** set the view x offset */
     static.viewxWrite = function(v) {
-        var ox = max(0, min(v, trapee.th_viewport[0].width - 
trapee.th_viewport.width));
-        trapee.th_viewport[0].x = -ox;
+        var vp = trapee.th_viewport;
+        var ox = max(0, min(v, vp[0].width - vp.width));
+        vp[0].x = -ox;
         return;
     }
     
@@ -205,8 +206,9 @@
     
     /** set the view y offset */
     static.viewyWrite = function(v) {
-        var oy = max(0, min(v, trapee.th_viewport[0].height - 
trapee.th_viewport.height));
-        trapee.th_viewport[0].y = -oy;
+        var vp = trapee.th_viewport;
+        var oy = max(0, min(v, vp[0].height - vp.height));
+        vp[0].y = -oy;
         return;
     }
     

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/tabpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/tabpane.t    
2010-03-30 16:02:48 UTC (rev 3829)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/tabpane.t    
2010-03-30 16:04:02 UTC (rev 3830)
@@ -22,17 +22,14 @@
         thisbox.v_content;
         thisbox.v_tabwidthtotal = 0;
         
-        var newtab = wi.tab;
-        var newitem = wi.item;
         var tabgroup = null;
         
         /** (un)displays the close buttons */
         thisbox.closeable ++= function(v) {
             cascade = v;
-            var n = v_content.numchildren;
-            for (var i=0; n>i; i++) {
-                var c = v_content[i].closeable;
-                v_content[i].v_tab.closeable = c==null ? v : c;
+            for (var i,child in v_content) {
+                var c = child.closeable;
+                child.v_tab.closeable = c==null ? v : c;
             }
         }
             
@@ -40,8 +37,9 @@
         thisbox.show ++= function(v) {
             var s = show;
             cascade = v;
-            if (show.display and !show.v_tab.selected)
+            if (show.display and !show.v_tab.selected) {
                 show.v_tab.selected = true;
+            }
             taborder.unshift(show);
         }
         
@@ -61,8 +59,9 @@
                 // display as many as will fit, recently displayed first
                 var c = taborder.first;
                 for (var cw = 0; c!=null; c = taborder.after(c)) {
-                    if (cw > 0 and cw + c.v_tab.width > hw)
+                    if (cw > 0 and cw + c.v_tab.width > hw) {
                         break;
+                    }
                     c.v_tab.display = true;
                     c.v_tabitem.text = "* "+c.tabtext;
                     cw += c.v_tab.width;
@@ -84,7 +83,9 @@
         
         thisbox.tabpolicy ++= function(v) {
             cascade = v;
-            if (!th_headwrap or !th_head) return;
+            if (!th_headwrap or !th_head) {
+                return;
+            }
             switch(v) {
                 case "expand":
                     // disable tablist
@@ -131,8 +132,9 @@
         var tabselectWrite = function(v) {
             cascade = v;
             var t = trapee;
-            if (t.selected and !t.v_card.display)
+            if (t.selected and !t.v_card.display) {
                 show = t.v_card;
+            }
         }
         
         /** sets up the cardpane content */
@@ -140,17 +142,25 @@
             cascade = v;
             // only assign once
             surface --= callee;
-            // set default policy
-            if (tabpolicy==null) tabpolicy = "list";
+            if (tabpolicy==null) {
+                // set default policy
+                tabpolicy = "list";
+            }
             
             /** assign tabs to new cards */
             v_content.Children ++= function(c) {
                 if (c) {
-                    // create the tab if needed
                     var t = c.v_tab;
-                    if (!t) { c.v_tab = newtab(vexi.box); t = c.v_tab; }
-                    // go with default closeable setting if not set
-                    if (c.closeable == null) t.closeable = closeable;
+                    if (t==null) {
+                        // create the tab if needed
+                        c.v_tab = new wi.tab();
+                        t = c.v_tab;
+                    }
+                    
+                    if (c.closeable == null) {
+                        // go with default closeable setting if not set
+                        t.closeable = closeable;
+                    }
                     // group assignment
                     if (!tabgroup) {
                         tabgroup = t.group;
@@ -168,7 +178,7 @@
                     th_head[trapname] = t;
                     // tab overflow policy
                     if (!c.v_tabitem) {
-                        var i = new newitem();
+                        var i = new wi.item();
                         i.text = c.tabtext;
                         i.value = c;
                         c.v_tabitem = i;
@@ -195,12 +205,16 @@
         /** select a tab from the tablist option */
         var tablistShow = function(v) {
             cascade = v;
-            if (v and v!=show) show = v;
+            if (v and v!=show) {
+                show = v;
+            }
         }
         
         thisbox.th_tablist ++= function(v) {
             cascade = v;
-            if (v) v.value ++= tablistShow;
+            if (v) {
+                v.value ++= tablistShow;
+            }
         }
         
         thisbox.th_next ++= function(v) {


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

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to