Revision: 2488
          http://vexi.svn.sourceforge.net/vexi/?rev=2488&view=rev
Author:   clrg
Date:     2007-10-17 13:26:39 -0700 (Wed, 17 Oct 2007)

Log Message:
-----------
More text widget clean up

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.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      
2007-10-17 19:20:18 UTC (rev 2487)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/default.t      
2007-10-17 20:26:39 UTC (rev 2488)
@@ -8,7 +8,7 @@
     
     <ui:box layout="layer">
         <ui:box>
-            <text.edit id="edit" />
+            <text.edit id="edit" align="topleft" />
             <ui:box shrink="true" width="1" />
         </ui:box>
         <role.repeatable id="cursor" align="topleft" display="false" 
fill="black" interval="300" width="1">

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        
2007-10-17 19:20:18 UTC (rev 2487)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/text/field.t        
2007-10-17 20:26:39 UTC (rev 2488)
@@ -1,6 +1,6 @@
 <!-- Copyright 2007 - see COPYING for details [LGPL] -->
 
-<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta">
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" 
xmlns:rdt="vexi.util.redirect">
     <meta:doc>
         <author>Charles Goodwin</author>
         <todo>
@@ -11,8 +11,8 @@
     <ui:box>
         
         thisbox.caretposition;
-        thisbox.editable      = true;
-        thisbox.enabled       = true;
+        thisbox.editable = true;
+        thisbox.enabled = true;
         thisbox.focused;
         thisbox.selectonfocus = true;
         thisbox.th_cursor;
@@ -21,9 +21,11 @@
         thisbox.th_viewport;
         
         // assign named trap functions
-        caretposition ++= static.caretPosReadFunc;
-        caretposition ++= static.caretPosWriteFunc;
-        focused       ++= static.focusFunc;
+        caretposition ++= static.caretposRead;
+        caretposition ++= static.caretposWrite;
+        focused ++= static.focusWrite;
+        visible ++= static.visibleWrite;
+        th_view ++= static.viewWrite;
         
         /** sync the textfield with the cursor pos so it is always visible */
         thisbox.syncViewWithCursor = function(v) {
@@ -39,14 +41,18 @@
             else if (viewtoedit > porttocursor) {
                 th_view.x = -th_cursor.x;
             // cursor too far to the right
-            } else if (porttocursor + th_cursor.width > th_viewport.width - 
vieweditend)
+            } else if (porttocursor + th_cursor.width > th_viewport.width - 
vieweditend) {
                 th_view.x = th_viewport.width - vieweditend - th_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) {
+                th_view.x = th_viewport.width - th_view.width;
+            }
         }
         
     </ui:box>
     
     /** retrieve a integer offset of where the cursor is within the textfield 
*/
-    static.caretPosReadFunc = function() {
+    static.caretposRead = function() {
         var cw = trapee.th_edit.getCWord();
         if (!cw) return 0;
         
@@ -59,7 +65,7 @@
     }
     
     /** set the cursor position within the textfield */
-    static.caretPosWriteFunc = function(v) {
+    static.caretposWrite = function(v) {
         cascade = v;
         // current does not work
         if (!trapee.th_edit.cWord) return;
@@ -77,7 +83,7 @@
     }
     
     /** on focus, focus content edit */
-    static.focusFunc = function(v) {
+    static.focusWrite = function(v) {
         cascade = v;
         var edit = trapee.th_edit;
         var cursor = trapee.th_cursor;
@@ -99,4 +105,17 @@
         }
     }
     
+    /** make sure the viewport is the right size on display */
+    static.viewWrite = function(v) {
+        cascade = v;
+        var t = trapee;
+        v.height ++= function(v) { t.th_viewport.height = v; cascade = v; }
+    }
+    
+    /** make sure the viewport is the right size on display */
+    static.visibleWrite = function(v) {
+        cascade = v;
+        if (v) trapee.forcereflow();
+    }
+    
 </vexi>

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t  
2007-10-17 19:20:18 UTC (rev 2487)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textarea.t  
2007-10-17 20:26:39 UTC (rev 2488)
@@ -13,7 +13,7 @@
     <bevel form="down" margin="3">
         <scrollpane id="scroll" redirect="null" autohidehorizontal="true" 
autohidevertical="true">
             <lay:pad id="pad" fill="white" padding="3">
-                <lib:text.default id="edit" minheight="30" multiline="true" />
+                <lib:text.default id="edit"minheight="30" multiline="true" />
             </lay:pad>
         </scrollpane>
         

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t 
2007-10-17 19:20:18 UTC (rev 2487)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/win2k/textfield.t 
2007-10-17 20:26:39 UTC (rev 2488)
@@ -3,7 +3,7 @@
 <vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme"
     xmlns:lay="vexi.layout"
     xmlns:lib="org.vexi.lib"
-    xmlns:rdrt="vexi.util.redirect">
+    xmlns:rdt="vexi.util.redirect">
     <meta:doc>
         <author>Charles Goodwin</author>
     </meta:doc>
@@ -25,12 +25,8 @@
         
         thisbox.enabled ++= static.enabledFunc;
         
-        /** keep viewport right height */
-        $pad.height ++= function(v) { th_viewport.height = v; cascade = v; }
+        rdt..addRedirect(thisbox, $pad, "padding", "paddingtop", 
"paddingbottom", "paddingleft", "paddingright");
         
-        rdrt..addRedirect(thisbox, $pad,
-            "padding", "paddingtop", "paddingbottom", "paddingleft", 
"paddingright");
-        
     </bevel>
     
     /** set visual enabled effect */


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to