Revision: 55043
          http://brlcad.svn.sourceforge.net/brlcad/?rev=55043&view=rev
Author:   bob1961
Date:     2013-04-04 12:22:02 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
Added cadwidgets::Ged::validateRgb

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-04 05:12:45 UTC (rev 
55042)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl     2013-04-04 12:22:02 UTC (rev 
55043)
@@ -737,6 +737,7 @@
        proc validateDigit {_d}
        proc validateDigitMax {_d _max}
        proc validateDouble {_d}
+       proc validateRgb {_rgb}
     }
 
     protected {
@@ -5279,6 +5280,21 @@
 }
 
 
+::itcl::body cadwidgets::Ged::validateRgb {_rgb} {
+    set r [lindex $_rgb 0]
+    set g [lindex $_rgb 1]
+    set b [lindex $_rgb 2]
+
+    if {($r == "" || ([string is digit $r] && $r <= 255)) &&
+       ($g == "" || ([string is digit $g] && $g <= 255)) &&
+       ($b == "" || ([string is digit $b] && $b <= 255))} {
+       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.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to