Revision: 55246
          http://sourceforge.net/p/brlcad/code/55246
Author:   bob1961
Date:     2013-04-25 16:50:01 +0000 (Thu, 25 Apr 2013)
Log Message:
-----------
Added validate2TupleNonZeroDigits and validate3TupleDoubles to cadwidgets::Ged

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/lib/Ged.tcl

Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl     2013-04-25 15:08:39 UTC (rev 
55245)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl     2013-04-25 16:50:01 UTC (rev 
55246)
@@ -738,6 +738,8 @@
        proc validateDigitMax {_d _max}
        proc validateDouble {_d}
        proc validateRgb {_rgb}
+       proc validate2TupleNonZeroDigits {_t}
+       proc validate3TupleDoubles {_t}
     }
 
     protected {
@@ -5281,6 +5283,10 @@
 
 
 ::itcl::body cadwidgets::Ged::validateRgb {_rgb} {
+    if {[llength $_rgb] > 3} {
+       return 0
+    }
+
     set r [lindex $_rgb 0]
     set g [lindex $_rgb 1]
     set b [lindex $_rgb 2]
@@ -5295,6 +5301,42 @@
 }
 
 
+::itcl::body cadwidgets::Ged::validate2TupleNonZeroDigits {_t} {
+    if {[llength $_t] > 2} {
+       return 0
+    }
+
+    set t1 [lindex $_t 0]
+    set t2 [lindex $_t 1]
+
+    if {([string is digit $t1] && $t1 > 0) &&
+       ([string is digit $t2] && $t2 > 0)} {
+       return 1
+    }
+
+    return 0
+}
+
+
+::itcl::body cadwidgets::Ged::validate3TupleDoubles {_t} {
+    if {[llength $_t] > 3} {
+       return 0
+    }
+
+    set t1 [lindex $_t 0]
+    set t2 [lindex $_t 1]
+    set t3 [lindex $_t 2]
+
+    if {[string is double $t1] &&
+       [string is double $t2] &&
+       [string is double $t3]} {
+       return 1
+    }
+
+    return 0
+}
+
+
 ############################### Commands that still need to be resolved 
###############################
 ::itcl::body cadwidgets::Ged::set_outputHandler {args} {
    eval set_output_script $args

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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to