Index: branches/1.4/gui/scripts/vtkisosurfaceviewer.tcl
===================================================================
--- branches/1.4/gui/scripts/vtkisosurfaceviewer.tcl	(revision 5063)
+++ branches/1.4/gui/scripts/vtkisosurfaceviewer.tcl	(revision 5079)
@@ -87,5 +87,5 @@
     private method GetImage { args }
     private method GetVtkData { args }
-    private method InitSettings { args  }
+    private method InitSettings { args }
     private method IsValidObject { dataobj }
     private method LeaveLegend {}
@@ -293,7 +293,23 @@
     array set _changed {
         -colormap                0
+        -cutplaneedges           0
+        -cutplanelighting        0
+        -cutplaneopacity         0
+        -cutplanepreinterp       0
+        -cutplanesvisible        0
+        -cutplanewireframe       0
+        -isosurfaceedges         0
+        -isosurfacelighting      0
         -isosurfaceopacity       0
-        -cutplaneopacity         0
+        -isosurfacevisible       0
+        -isosurfacewireframe     0
         -numcontours             0
+        -outline                 0
+        -xcutplaneposition       0
+        -xcutplanevisible        0
+        -ycutplaneposition       0
+        -ycutplanevisible        0
+        -zcutplaneposition       0
+        -zcutplanevisible        0
     }
     array set _widget {
@@ -1416,20 +1432,25 @@
         }
         "-cutplaneedges" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "cutplane edges $bool"
         }
         "-cutplanelighting" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "cutplane lighting $bool"
         }
         "-cutplaneopacity" {
+            set _changed($what) 1
             set _settings($what) [expr $_widget($what) * 0.01]
             SendCmd "cutplane opacity $_settings($what)"
         }
         "-cutplanepreinterp" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "cutplane preinterp $bool"
         }
         "-cutplanesvisible" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "cutplane visible 0"
@@ -1448,4 +1469,5 @@
         }
         "-cutplanewireframe" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "cutplane wireframe $bool"
@@ -1516,16 +1538,20 @@
         }
         "-isosurfaceedges" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "contour3d edges $bool"
         }
         "-isosurfacelighting" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "contour3d lighting $bool"
         }
         "-isosurfaceopacity" {
+            set _changed($what) 1
             set _settings($what) [expr $_widget($what) * 0.01]
             SendCmd "contour3d opacity $_settings($what)"
         }
         "-isosurfacevisible" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "contour3d visible 0"
@@ -1544,4 +1570,5 @@
         }
         "-isosurfacewireframe" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "contour3d wireframe $bool"
@@ -1554,4 +1581,5 @@
         }
         "-numcontours" {
+            set _changed($what) 1
             set _settings($what) [$itk_component(numcontours) value]
             if { $_contourList(numLevels) != $_settings($what) } {
@@ -1569,4 +1597,5 @@
         }
         "-outline" {
+            set _changed($what) 1
             set bool $_settings($what)
             SendCmd "outline visible 0"
@@ -1590,4 +1619,5 @@
         }
         "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
+            set _changed($what) 1
             set axis [string tolower [string range $what 1 1]]
             set bool $_settings($what)
@@ -1602,4 +1632,5 @@
         }
         "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
+            set _changed($what) 1
             set axis [string tolower [string range $what 1 1]]
             set pos [expr $_settings($what) * 0.01]
@@ -1821,5 +1852,5 @@
     }
     itk_component add min {
-        Rappture::Gauge $inner.min \
+        Rappture::Gauge $inner.min -font "Arial 9" \
             -validatecommand [itcl::code $this LegendRangeValidate "" vmin]
     }
@@ -1831,5 +1862,5 @@
     }
     itk_component add max {
-        Rappture::Gauge $inner.max \
+        Rappture::Gauge $inner.max -font "Arial 9" \
             -validatecommand [itcl::code $this LegendRangeValidate "" vmax]
     }
@@ -2257,5 +2288,10 @@
     array set style {
         -color                  BCGYR
+        -cutplaneedges          0
+        -cutplanelighting       1
+        -cutplaneopacity        1.0
+        -cutplanepreinterp      1
         -cutplanesvisible       0
+        -cutplanewireframe      0
         -edgecolor              black
         -edges                  0
@@ -2288,6 +2324,15 @@
     # the code to handle aberrant cases.
 
+    if { $_changed(-isosurfaceedges) } {
+        set style(-edges) $_settings(-isosurfaceedges)
+    }
+    if { $_changed(-isosurfacelighting) } {
+        set style(-lighting) $_settings(-isosurfacelighting)
+    }
     if { $_changed(-isosurfaceopacity) } {
         set style(-opacity) $_settings(-isosurfaceopacity)
+    }
+    if { $_changed(-isosurfacewireframe) } {
+        set style(-wireframe) $_settings(-isosurfacewireframe)
     }
     if { $_changed(-numcontours) } {
@@ -2311,21 +2356,31 @@
         EventuallyChangeContourLevels
     }
-    set _settings(-isosurfacevisible) $style(-isosurfacevisible)
-    set _settings(-cutplanesvisible)  $style(-cutplanesvisible)
-    set _settings(-xcutplanevisible)  $style(-xcutplanevisible)
-    set _settings(-ycutplanevisible)  $style(-ycutplanevisible)
-    set _settings(-zcutplanevisible)  $style(-zcutplanevisible)
-    set _settings(-xcutplaneposition) $style(-xcutplaneposition)
-    set _settings(-ycutplaneposition) $style(-ycutplaneposition)
-    set _settings(-zcutplaneposition) $style(-zcutplaneposition)
+    foreach setting {-outline -isosurfacevisible -cutplanesvisible \
+                     -xcutplanevisible -ycutplanevisible -zcutplanevisible \
+                     -xcutplaneposition -ycutplaneposition -zcutplaneposition \
+                     -cutplaneedges -cutplanelighting -cutplaneopacity \
+                     -cutplanepreinterp -cutplanewireframe} {
+        if {$_changed($setting)} {
+            # User-modified UI setting overrides style
+            set style($setting) $_settings($setting)
+        } else {
+            # Set UI control to style setting (tool provided or default)
+            set _settings($setting) $style($setting)
+        }
+    }
 
     SendCmd "cutplane add $tag"
     SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
     foreach axis {x y z} {
-        set pos [expr $_settings(-${axis}cutplaneposition) * 0.01]
-        set visible $_settings(-${axis}cutplanevisible)
+        set pos [expr $style(-${axis}cutplaneposition) * 0.01]
+        set visible $style(-${axis}cutplanevisible)
         SendCmd "cutplane slice $axis $pos $tag"
         SendCmd "cutplane axis $axis $visible $tag"
     }
+    SendCmd "cutplane edges $style(-cutplaneedges) $tag"
+    SendCmd "cutplane lighting $style(-cutplanelighting) $tag"
+    SendCmd "cutplane opacity $style(-cutplaneopacity) $tag"
+    SendCmd "cutplane preinterp $style(-cutplanepreinterp) $tag"
+    SendCmd "cutplane wireframe $style(-cutplanewireframe) $tag"
     SendCmd "cutplane visible $style(-cutplanesvisible) $tag"
 
@@ -2333,5 +2388,4 @@
     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     SendCmd "outline visible $style(-outline) $tag"
-    set _settings(-outline) $style(-outline)
 
     GenerateContourList
@@ -2340,5 +2394,5 @@
     SendCmd "contour3d edges $style(-edges) $tag"
     set _settings(-isosurfaceedges) $style(-edges)
-    #SendCmd "contour3d color [Color2RGB $settings(-color)] $tag"
+    #SendCmd "contour3d color [Color2RGB $style(-color)] $tag"
     SendCmd "contour3d lighting $style(-lighting) $tag"
     set _settings(-isosurfacelighting) $style(-lighting)
@@ -2417,5 +2471,4 @@
 }
 
-
 # ----------------------------------------------------------------------
 # USAGE: LegendPointToValue <x> <y>
@@ -2449,5 +2502,4 @@
 }
 
-
 # ----------------------------------------------------------------------
 # USAGE: LegendProbeSingleContour <x> <y>
@@ -2461,5 +2513,4 @@
     SendCmd [list contour3d contourlist $value]
 }
-
 
 #
@@ -2819,5 +2870,4 @@
 }
 
-
 itcl::body Rappture::VtkIsosurfaceViewer::MouseOver2Which {} {
     switch -- $_mouseOver {
@@ -2834,5 +2884,4 @@
     return $which
 }
-
 
 # ----------------------------------------------------------------------
@@ -2926,5 +2975,4 @@
 }
 
-
 # ----------------------------------------------------------------------
 # USAGE: ToggleCustomRange
@@ -2983,5 +3031,4 @@
     AdjustSetting -range
 }
-
 
 # ----------------------------------------------------------------------
@@ -3019,5 +3066,4 @@
 }
 
-
 #
 # SetCurrentColormap --
@@ -3082,16 +3128,12 @@
         set values $_contourList(reqValues)
     } else {
-        # use the field limits to calculate the contour list values
-        foreach { vmin vmax } $_limits($_curFldName) break
-
-        # if custom range has been set and are within the field's
-        # range, use the custom min and max to generate contour list values
+        # if custom range has been set, use the custom min and max
+        # to generate contour list values
         if { $_settings(-customrange) } {
-            if { [$itk_component(min) value] > $vmin } {
-                set vmin [$itk_component(min) value]
-            }
-            if { [$itk_component(max) value] < $vmax } {
-                set vmax [$itk_component(max) value]
-            }
+            set vmin [$itk_component(min) value]
+            set vmax [$itk_component(max) value]
+        } else {
+            # use the field limits to calculate the contour list values
+            foreach { vmin vmax } $_limits($_curFldName) break
         }
 
@@ -3134,8 +3176,6 @@
     }
     $itk_component(field) value $_curFldLabel
-    if { ![info exists _limits($_curFldName)] } {
-        SendCmd "dataset maprange all"
-    } else {
-        set limits $_limits($_curFldName)
+    if { $_settings(-customrange) } {
+        set limits [list [$itk_component(min) value] [$itk_component(max) value]]
         SendCmd "dataset maprange explicit $limits $_curFldName"
         if { $limits != $_currentLimits } {
@@ -3143,4 +3183,15 @@
             EventuallyChangeContourLevels
         }
-    }
-}
+    } else {
+        if { ![info exists _limits($_curFldName)] } {
+            SendCmd "dataset maprange all"
+        } else {
+            set limits $_limits($_curFldName)
+            SendCmd "dataset maprange explicit $limits $_curFldName"
+            if { $limits != $_currentLimits } {
+                set _currentLimits $limits
+                EventuallyChangeContourLevels
+            }
+        }
+    }
+}
