Revision: 3754
          http://vexi.svn.sourceforge.net/vexi/?rev=3754&view=rev
Author:   clrg
Date:     2009-11-12 02:42:49 +0000 (Thu, 12 Nov 2009)

Log Message:
-----------
Code beautitication

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/numfield.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t        
2009-11-12 02:39:16 UTC (rev 3753)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t        
2009-11-12 02:42:49 UTC (rev 3754)
@@ -34,17 +34,20 @@
             var viewtoedit   = th_view.distanceto(v_edit).x;
             var porttocursor = th_viewport.distanceto(v_cursor).x;
             var vieweditend  = th_view.width - v_edit.width - viewtoedit;
-            // no word - set to 0
             if (v_edit.getCWord() == null or th_viewport.width >= 
th_view.width) {
+                // no word - set to 0
                 th_view.x = 0;
-            // cursor too far to the left
+                
             } else if (viewtoedit > porttocursor) {
+                // cursor too far to the left
                 th_view.x = -v_cursor.x;
-            // cursor too far to the right
+                
             } else if (porttocursor + v_cursor.width > th_viewport.width) {
+                // cursor too far to the right
                 th_view.x = th_viewport.width - vieweditend - v_cursor.x - 
viewtoedit;
-            // cursor visible but view is too far to the left 
+                
             } else if (0 > th_view.x and th_viewport.width > th_view.width + 
th_view.x) {
+                // cursor visible but view is too far to the left 
                 th_view.x = th_viewport.width - th_view.width;
             }
         }
@@ -53,35 +56,42 @@
     
     static.keypressWrite = function(v) {
         var edit = trapee.v_edit;
-        // limit amount of text
         if (!edit.select and v.length == 1 and trapee.maxlength > 0 and 
edit.text.length >= trapee.maxlength) {
+            // limit amount of text
             var cBlock = edit.getCBlock();
             var cWord = edit.getCWord();
             var cPos = edit.getCPos();
             if (edit.insert or
-                (cWord ? (cBlock.numchildren-1 == cBlock.indexof(cWord)) : 
true) and
-                (cWord ? (cPos == cWord.text.length) : true))
+                    (cWord ? (cBlock.numchildren-1 == cBlock.indexof(cWord)) : 
true) and
+                    (cWord ? (cPos == cWord.text.length) : true)) {
                 // conditions met
                 return;
+            }
         }
         
-        // fire action
         if (v == "enter" || v == "ENTER") {
+            // fire action
             trapee.action = true;
             trapee.value = trapee.value;
-        // pass to edit
-        } else edit.KeyPressed = v;
+        } else {
+            // pass to edit
+            edit.KeyPressed = v;
+        }
     }
     
     /** retrieve a integer offset of where the cursor is within the textfield 
*/
     static.caretposRead = function() {
         var cw = trapee.v_edit.getCWord();
-        if (!cw) return 0;
+        if (cw==null) {
+            return 0;
+        }
         
         var pos = 0;
         var cb = trapee.v_edit.getCBlock();
         var cp = trapee.v_edit.getCPos();
-        for (var i=0; cb[i] != cw; i++) pos += cb[i].text.length;
+        for (var i=0; cb[i] != cw; i++) {
+            pos += cb[i].text.length;
+        }
         pos += cp;
         return pos;
     }
@@ -90,7 +100,9 @@
     static.caretposWrite = function(v) {
         cascade = v;
         // current does not work
-        if (!trapee.v_edit.cWord) return;
+        if (!trapee.v_edit.cWord) {
+            return;
+        }
         
         var numchars = 0;
         var wind = -1;
@@ -98,7 +110,9 @@
         var n = cb.numchildren;
         while (n > ++wind) {
             numchars += cb[wind].text.length;
-            if (numchars > v) break;
+            if (numchars > v) {
+                break;
+            }
         }
         trapee.v_edit.cWord = cb[wind];
         trapee.v_edit.cPos = trapee.v_edit.cWord.text.length - (numchars-v);
@@ -113,13 +127,17 @@
         var sync = trapee.syncViewWithCursor;
         edit.focused = f;
         if (f) {
-            if (trapee.selectonfocus) edit.selectAll();
+            if (trapee.selectonfocus) {
+                edit.selectAll();
+            }
             if (cursor and sync) {
                 cursor.x ++= sync;
                 trapee.th_viewport.width ++= sync;
             }
         } else {
-            if (trapee.selectonfocus) edit.unselectAll();
+            if (trapee.selectonfocus) {
+                edit.unselectAll();
+            }
             if (cursor and sync) {
                 cursor.x --= sync;
                 trapee.th_viewport.width --= sync;
@@ -140,7 +158,9 @@
     /** make sure the viewport is the right size on display */
     static.visibleWrite = function(v) {
         cascade = v;
-        if (v) trapee.forcereflow();
+        if (v) {
+            trapee.forcereflow();
+        }
     }
     
 </vexi>

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/numfield.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/numfield.t   
2009-11-12 02:39:16 UTC (rev 3753)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/numfield.t   
2009-11-12 02:42:49 UTC (rev 3754)
@@ -35,14 +35,14 @@
     
     var modifyVal = function(val,i,key) {
         switch (key) {
-            case "delete":
-                return val.attemptRemove(i);
-            case "back_space":
-                return val.attemptRemove(i-1);
-            //case "escape": ...
-            case "left": case "right": case "up": case "down": 
-            case "home": case "end":
-                return null;
+        case "delete":
+            return val.attemptRemove(i);
+        case "back_space":
+            return val.attemptRemove(i-1);
+        //case "escape": ...
+        case "left": case "right": case "up": case "down": 
+        case "home": case "end":
+            return null;
         }
         return val.attemptInsert(i,key);
     };
@@ -62,7 +62,7 @@
         var cpos = e.getCursorCharIndex();
         
         var prev = val;
-        val = modifyVal(val,cpos,v);
+        val = modifyVal(val, cpos, v);
         if (val==null) {
             cascade = v;
             return;


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to