Changeset 6340


Ignore:
Timestamp:
May 14, 2016, 6:13:27 PM (8 years ago)
Author:
ldelgass
Message:

merge fixes from trunk

Location:
branches/1.6
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/1.6

  • branches/1.6/gui/scripts/flowvisviewer.tcl

    r6305 r6340  
    28552855    radiobutton $inner.image_button -text "Image File" \
    28562856        -variable [itcl::scope _downloadPopup(format)] \
    2857         -font "Arial 9 " \
     2857        -font "Arial 9" \
    28582858        -value image
    28592859    Rappture::Tooltip::for $inner.image_button \
  • branches/1.6/gui/scripts/mesh.tcl

    r5679 r6340  
    211211        set result [ReadUnstructuredGrid $path]
    212212    } elseif {[$_mesh element "node"] != "" && [$_mesh element "element"] != ""} {
     213        puts stderr "WARNING: <node>/<element> mesh is deprecated.  Please use an unstructured mesh instead."
    213214        set result [ReadNodesElements $path]
    214215    }
     
    14381439    array set node2celltype {
    14391440        3 5
    1440         4 10
     1441        4 9
    14411442        8 12
    14421443        6 13
     
    14521453        set numNodes [llength $nodeList]
    14531454        if { ![info exists node2celltype($numNodes)] } {
    1454             puts stderr "WARNING: bad nodes/elements mesh \$path\": unknown number of indices \"$_numNodes\": should be 3, 4, 5, 6, or 8"
     1455            puts stderr "WARNING: bad node/element mesh \$path\": unknown number of nodes \"$numNodes\": should be 3, 4, 5, 6, or 8"
    14551456            return 0
    14561457        }
    14571458        set celltype $node2celltype($numNodes)
     1459        if { $_dim == 3 && $numNodes == 4 } {
     1460            # If mesh is 3D, assume a tetrahedron (default is quad)
     1461            # XXX: Does prophet output tets, and if so what is the node order?
     1462            set celltype 10
     1463        }
    14581464        append celltypes "$celltype\n"
    1459         if { $celltype == 12 } {
    1460             # Formerly used voxels instead of hexahedrons. We're converting
    1461             # it here to be backward compatible and still fault-tolerant of
    1462             # non-axis aligned cells.
     1465        if { $celltype == 9 } {
     1466            # Fix the node order for quad cells
     1467            # (this converts from PROPHET convention to VTK convention)
     1468            set newList {}
     1469            foreach i { 0 1 3 2 } {
     1470                lappend newList [lindex $nodeList $i]
     1471            }
     1472            set nodeList $newList
     1473        } elseif { $celltype == 12 } {
     1474            # Fix the node order for hexahedron cells
     1475            # (this converts from PROPHET convention to VTK convention)
    14631476            set newList {}
    14641477            foreach i { 0 1 3 2 4 5 7 6 } {
  • branches/1.6/gui/scripts/nanovisviewer.tcl

    r6309 r6340  
    21342134    radiobutton $inner.image_button -text "Image File" \
    21352135        -variable [itcl::scope _downloadPopup(format)] \
    2136         -font "Arial 9 " \
     2136        -font "Arial 9" \
    21372137        -value image
    21382138    Rappture::Tooltip::for $inner.image_button \
  • branches/1.6/gui/scripts/probdisteditor.tcl

    r5192 r6340  
    1919option add *ProbDistEditor*Entry.width 10 widgetDefault
    2020
    21     itcl::class Rappture::ProbDistEditor {
     21itcl::class Rappture::ProbDistEditor {
    2222    inherit itk::Widget
    2323
    2424    itk_option define -fillcolor fillColor FillColor ""
    2525
    26     constructor {args} { # defined below }
     26    constructor {args} {
     27        # defined below
     28    }
    2729    public method value {{newval ""}}
    2830    public method mode {{newval ""}}
     
    3335    protected method _apply {op {widget ""}}
    3436
    35     protected variable _dispatcher ""   ;# dispatcher for !events
    36     protected variable _mode ""         ;# type of distribution function
    37     protected variable _value           ;# data values for mode-detail
    38     protected variable _uvalue          ;# data values for mode-detail with units
    39     protected variable _umin             ;# minimum allowed value for tool with units
    40     protected variable _umax             ;# maximum allowed value for tool with units
    41     protected variable _units           ;# units for min and max
     37    protected variable _dispatcher ""# dispatcher for !events
     38    protected variable _mode "";        # type of distribution function
     39    protected variable _value;          # data values for mode-detail
     40    protected variable _uvalue;         # data values for mode-detail with units
     41    protected variable _umin;           # minimum allowed value for tool with units
     42    protected variable _umax;           # maximum allowed value for tool with units
     43    protected variable _units;          # units for min and max
    4244}
    4345
  • branches/1.6/gui/scripts/visviewer.tcl

    r6305 r6340  
    2020    itk_option define -receivecommand receiveCommand ReceiveCommand ""
    2121
    22     private common _servers;            # array of visualization server lists
    23     set _servers(nanovis) "localhost:2000"
    24     set _servers(pymol)   "localhost:2020"
    25     set _servers(vmdmds)  "localhost:2018"
    26     set _servers(vtkvis)  "localhost:2010"
    27 
    28     private common _done;               # Used to indicate status of send.
    29     private variable _buffer;           # buffer for incoming/outgoing commands
    30     private variable _outbuf;           # buffer for outgoing commands
    31     private variable _blockOnWrite 0;   # Should writes to socket block?
    32     private variable _initialized
    33     private variable _isOpen 0
    34     private variable _afterId -1
    35     private variable _icon 0
    36     private variable _trace 0;          # Protocol tracing for console
    37     private variable _logging 0;        # Command logging to file
    38     # Number of milliseconds to wait before idle timeout.  If greater than 0,
    39     # automatically disconnect from the visualization server when idle timeout
    40     # is reached.
    41     private variable _idleTimeout 43200000; # 12 hours
    42     #private variable _idleTimeout 5000;# 5 seconds
    43     #private variable _idleTimeout 0;   # No timeout
    44 
    45     protected variable _debug 0
    46     protected variable _serverType "???";# Type of server.
    47     protected variable _sid "";         # socket connection to server
    48     protected variable _maxConnects 100
    49     protected variable _buffering 0
    50     protected variable _cmdSeq 0;       # Command sequence number
    51     protected variable _dispatcher "";  # dispatcher for !events
    52     protected variable _hosts "";       # list of hosts for server
    53     protected variable _parser "";      # interpreter for incoming commands
    54     protected variable _image
    55     protected variable _hostname
    56     protected variable _numConnectTries 0
    57     protected variable _debugConsole 0
    58     protected variable _reportClientInfo 1
    59     # Number of milliscends to wait for server reply before displaying wait
    60     # dialog.  If set to 0, dialog is never displayed.
    61     protected variable _waitTimeout 0
    62 
    6322    constructor { args } {
    6423        # defined below
     
    6726        # defined below
    6827    }
    69     # Used internally only.
    70     private method BuildConsole {}
    71     private method DebugConsole {}
    72     private method HideConsole {}
    73     private method ReceiveHelper {}
    74     private method SendDebugCommand {}
    75     private method SendHelper {}
    76     private method ServerDown {}
    77     private method Shuffle { servers }
    78     private method TraceComm { channel {data {}} }
    79     private method WaitDialog { state }
    80     private method Waiting { option widget }
     28    public proc GetServerList { type } {
     29        return $_servers($type)
     30    }
     31    public proc SetServerList { type namelist } {
     32        # Convert the comma separated list into a Tcl list.  OGRE also adds
     33        # a trailing comma that we want to ignore.
     34        regsub -all "," $namelist " " namelist
     35        CheckNameList $namelist
     36        set _servers($type) $namelist
     37    }
     38    public proc RemoveServerFromList { type server } {
     39        if { ![info exists _servers($type)] } {
     40            error "unknown server type \"$type\""
     41        }
     42        set i [lsearch $_servers($type) $server]
     43        if { $i < 0 } {
     44            return
     45        }
     46        set _servers($type) [lreplace $_servers($type) $i $i]
     47    }
     48    public proc SetPymolServerList { namelist } {
     49        SetServerList "pymol" $namelist
     50    }
     51    public proc SetNanovisServerList { namelist } {
     52        SetServerList "nanovis" $namelist
     53    }
     54    public proc SetVtkServerList { namelist } {
     55        SetServerList "vtk" $namelist
     56    }
    8157
    8258    protected method CheckConnection {}
     
    11692    protected method ToggleConsole {}
    11793
     94    protected variable _debug 0
     95    protected variable _serverType "???";# Type of server.
     96    protected variable _sid "";         # socket connection to server
     97    protected variable _maxConnects 100
     98    protected variable _buffering 0
     99    protected variable _cmdSeq 0;       # Command sequence number
     100    protected variable _dispatcher "";  # dispatcher for !events
     101    protected variable _hosts "";       # list of hosts for server
     102    protected variable _parser "";      # interpreter for incoming commands
     103    protected variable _image
     104    protected variable _hostname
     105    protected variable _numConnectTries 0
     106    protected variable _debugConsole 0
     107    protected variable _reportClientInfo 1
     108    # Number of milliscends to wait for server reply before displaying wait
     109    # dialog.  If set to 0, dialog is never displayed.
     110    protected variable _waitTimeout 0
     111
     112    private method BuildConsole {}
     113    private method DebugConsole {}
     114    private method HideConsole {}
     115    private method ReceiveHelper {}
     116    private method SendDebugCommand {}
     117    private method SendHelper {}
     118    private method ServerDown {}
     119    private method Shuffle { servers }
     120    private method TraceComm { channel {data {}} }
     121    private method WaitDialog { state }
     122    private method Waiting { option widget }
     123
    118124    private proc CheckNameList { namelist }  {
    119125        foreach host $namelist {
     
    124130        }
    125131    }
    126     public proc GetServerList { type } {
    127         return $_servers($type)
    128     }
    129     public proc SetServerList { type namelist } {
    130         # Convert the comma separated list into a Tcl list.  OGRE also adds
    131         # a trailing comma that we want to ignore.
    132         regsub -all "," $namelist " " namelist
    133         CheckNameList $namelist
    134         set _servers($type) $namelist
    135     }
    136     public proc RemoveServerFromList { type server } {
    137         if { ![info exists _servers($type)] } {
    138             error "unknown server type \"$type\""
    139         }
    140         set i [lsearch $_servers($type) $server]
    141         if { $i < 0 } {
    142             return
    143         }
    144         set _servers($type) [lreplace $_servers($type) $i $i]
    145     }
    146     public proc SetPymolServerList { namelist } {
    147         SetServerList "pymol" $namelist
    148     }
    149     public proc SetNanovisServerList { namelist } {
    150         SetServerList "nanovis" $namelist
    151     }
    152     public proc SetVtkServerList { namelist } {
    153         SetServerList "vtk" $namelist
    154     }
     132
     133    private variable _buffer;           # buffer for incoming/outgoing commands
     134    private variable _outbuf;           # buffer for outgoing commands
     135    private variable _blockOnWrite 0;   # Should writes to socket block?
     136    private variable _initialized
     137    private variable _isOpen 0
     138    private variable _afterId -1
     139    private variable _icon 0
     140    private variable _trace 0;          # Protocol tracing for console
     141    private variable _logging 0;        # Command logging to file
     142    # Number of milliseconds to wait before idle timeout.  If greater than 0,
     143    # automatically disconnect from the visualization server when idle timeout
     144    # is reached.
     145    private variable _idleTimeout 43200000; # 12 hours
     146    #private variable _idleTimeout 5000;# 5 seconds
     147    #private variable _idleTimeout 0;   # No timeout
     148
     149    private common _servers;            # array of visualization server lists
     150    set _servers(nanovis) "localhost:2000"
     151    set _servers(pymol)   "localhost:2020"
     152    set _servers(vmdmds)  "localhost:2018"
     153    set _servers(vtkvis)  "localhost:2010"
     154    private common _done;               # Used to indicate status of send.
    155155}
    156156
     
    863863                -xscrollmode auto -yscrollmode auto
    864864            text $inner.scrl.text \
    865                 -font "Arial 9 " -background white -relief sunken -bd 1 \
     865                -font "Arial 9" -background white -relief sunken -bd 1 \
    866866                -height 5 -wrap word -width 60
    867867            $inner.scrl contents $inner.scrl.text
  • branches/1.6/gui/scripts/vtkglyphviewer.tcl

    r6305 r6340  
    9797    private method ReceiveDataset { args }
    9898    private method ReceiveImage { args }
    99     private method ReceiveLegend { colormap title vmin vmax size }
     99    private method ReceiveLegend { colormap title min max size }
    100100    private method RequestLegend {}
    101101    private method Rotate {option x y}
     
    144144    private variable _rotatePending 0
    145145    private variable _cutplanePending 0
    146     private variable _field      ""
    147146    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    148147    private variable _fields
     
    21102109                    SendCmd "camera zoom $_view($what)"
    21112110                }
    2112              }
     2111            }
    21132112        }
    21142113    }
     
    21442143    radiobutton $inner.vtk_button -text "VTK data file" \
    21452144        -variable [itcl::scope _downloadPopup(format)] \
    2146         -font "Arial 9 " \
     2145        -font "Arial 9" \
    21472146        -value vtk
    21482147    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    21492148    radiobutton $inner.image_button -text "Image File" \
    21502149        -variable [itcl::scope _downloadPopup(format)] \
    2151         -font "Arial 9 " \
     2150        -font "Arial 9" \
    21522151        -value image
    21532152    Rappture::Tooltip::for $inner.image_button \
  • branches/1.6/gui/scripts/vtkheightmapviewer.tcl

    r6305 r6340  
    7171    private method BuildDownloadPopup { widget command }
    7272    private method CameraReset {}
    73     private method Combo { option }
    7473    private method Connect {}
    7574    private method CurrentDatasets {args}
     
    8887    private method IsValidObject { dataobj }
    8988    private method LeaveLegend {}
     89    private method LegendTitleAction { option }
    9090    private method MotionLegend { x y }
    9191    private method Pan {option x y}
     
    214214
    215215    array set _settings {
    216         -axisflymode            "static"
     216        -axesvisible            1
    217217        -axislabels             1
    218218        -axisminorticks         1
    219         -axisvisible            1
     219        -axismode               "static"
    220220        -colormap               BCGYR
    221221        -colormapdiscrete       0
     
    243243    array set _changed {
    244244        -colormap               0
     245        -colormapdiscrete       0
     246        -colormapvisible        0
     247        -edges                  0
     248        -isolinecolor           0
     249        -isolinesvisible        0
    245250        -numisolines            0
    246251        -opacity                0
     252        -wireframe              0
    247253    }
    248254    itk_component add view {
     
    10141020                    -activeforeground $itk_option(-plotforeground) \
    10151021                    -font "Arial 8" \
    1016                     -command [itcl::code $this Combo invoke]
     1022                    -command [itcl::code $this LegendTitleAction save]
    10171023                set _fields($fname) [list $label $units $components]
    10181024                if { $_curFldName == "" } {
     
    10871093        PanCamera
    10881094        InitSettings -xgrid -ygrid -zgrid \
    1089             -axisvisible -axislabels -heightmapscale -field -isheightmap \
     1095            -axesvisible -axislabels -heightmapscale -field -isheightmap \
    10901096            -numisolines
    10911097        if { [array size _fields] < 2 } {
     
    13481354    }
    13491355    switch -- $what {
    1350         "-axisflymode" {
    1351             set mode [$itk_component(axisflymode) value]
    1352             set mode [$itk_component(axisflymode) translate $mode]
    1353             set _settings($what) $mode
    1354             SendCmd "axis flymode $mode"
     1356        "-axesvisible" {
     1357            set bool $_settings($what)
     1358            SendCmd "axis visible all $bool"
    13551359        }
    13561360        "-axislabels" {
     
    13621366            SendCmd "axis minticks all $bool"
    13631367        }
    1364         "-axisvisible" {
    1365             set bool $_settings($what)
    1366             SendCmd "axis visible all $bool"
     1368        "-axismode" {
     1369            set mode [$itk_component(axismode) value]
     1370            set mode [$itk_component(axismode) translate $mode]
     1371            set _settings($what) $mode
     1372            SendCmd "axis flymode $mode"
    13671373        }
    13681374        "-background" {
     
    13881394            if { $color == "none" } {
    13891395                if { $_settings(-colormapvisible) } {
     1396                    set _changed(-colormapvisible) 1
    13901397                    SendCmd "heightmap surface 0"
    13911398                    set _settings(-colormapvisible) 0
     
    13931400            } else {
    13941401                if { !$_settings(-colormapvisible) } {
     1402                    set _changed(-colormapvisible) 1
    13951403                    SendCmd "heightmap surface 1"
    13961404                    set _settings(-colormapvisible) 1
     
    14051413            EventuallyRequestLegend
    14061414        }
    1407         "-colormapvisible" {
    1408             set bool $_settings($what)
    1409             SendCmd "heightmap surface $bool"
    1410         }
    14111415        "-colormapdiscrete" {
     1416            set _changed($what) 1
    14121417            set bool $_settings($what)
    14131418            set numColors [expr $_settings(-numisolines) + 1]
     
    14251430            EventuallyRequestLegend
    14261431        }
     1432        "-colormapvisible" {
     1433            set _changed($what) 1
     1434            set bool $_settings($what)
     1435            SendCmd "heightmap surface $bool"
     1436        }
    14271437        "-edges" {
     1438            set _changed($what) 1
    14281439            set bool $_settings($what)
    14291440            SendCmd "heightmap edges $bool"
     
    15711582        }
    15721583        "-isolinecolor" {
     1584            set _changed($what) 1
    15731585            set color [$itk_component(isolinecolor) value]
    15741586            if { $color == "none" } {
    15751587                if { $_settings(-isolinesvisible) } {
     1588                    set _changed(-isolinesvisible) 1
    15761589                    SendCmd "heightmap isolines 0"
    15771590                    set _settings(-isolinesvisible) 0
    15781591                }
    15791592            } else {
     1593                set _settings($what) $color
    15801594                if { !$_settings(-isolinesvisible) } {
     1595                    set _changed(-isolinesvisible) 1
    15811596                    SendCmd "heightmap isolines 1"
    15821597                    set _settings(-isolinesvisible) 1
     
    15871602        }
    15881603        "-isolinesvisible" {
     1604            set _changed($what) 1
    15891605            set bool $_settings($what)
     1606            if { $bool } {
     1607                $itk_component(isolinecolor) value $_settings(-isolinecolor)
     1608            }
    15901609            SendCmd "heightmap isolines $bool"
    15911610            DrawLegend
     
    16311650        }
    16321651        "-outline" {
     1652            set _changed($what) 1
    16331653            if { $_settings(-isheightmap) } {
    16341654                SendCmd "outline visible 0"
     
    16541674        }
    16551675        "-wireframe" {
     1676            set _changed($what) 1
    16561677            set bool $_settings($what)
    16571678            SendCmd "heightmap wireframe $bool"
     
    17141735        set cmap $_currentColormap
    17151736        if { ![info exists _colormaps($cmap)] } {
    1716            BuildColormap $cmap
    1717            set _colormaps($cmap) 1
     1737            BuildColormap $cmap
     1738            set _colormaps($cmap) 1
    17181739        }
    17191740        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     
    20312052    checkbutton $inner.visible \
    20322053        -text "Axes" \
    2033         -variable [itcl::scope _settings(-axisvisible)] \
    2034         -command [itcl::code $this AdjustSetting -axisvisible] \
     2054        -variable [itcl::scope _settings(-axesvisible)] \
     2055        -command [itcl::code $this AdjustSetting -axesvisible] \
    20352056        -font "Arial 9"
    20362057    checkbutton $inner.labels \
     
    20632084    label $inner.mode_l -text "Mode" -font "Arial 9"
    20642085
    2065     itk_component add axisflymode {
     2086    itk_component add axismode {
    20662087        Rappture::Combobox $inner.mode -width 10 -editable 0
    20672088    }
     
    20712092        "furthest_triad"  "farthest" \
    20722093        "outer_edges"     "outer"
    2073     $itk_component(axisflymode) value $_settings(-axisflymode)
    2074     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     2094    $itk_component(axismode) value $_settings(-axismode)
     2095    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    20752096
    20762097    blt::table $inner \
     
    22092230    radiobutton $inner.vtk_button -text "VTK data file" \
    22102231        -variable [itcl::scope _downloadPopup(format)] \
    2211         -font "Arial 9 " \
     2232        -font "Arial 9" \
    22122233        -value vtk
    22132234    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22142235    radiobutton $inner.image_button -text "Image File" \
    22152236        -variable [itcl::scope _downloadPopup(format)] \
    2216         -font "Arial 9 " \
     2237        -font "Arial 9" \
    22172238        -value image
    22182239    Rappture::Tooltip::for $inner.image_button \
     
    22552276    set tag $dataobj-$comp
    22562277    array set style {
    2257         -color BCGYR
    2258         -levels 10
    2259         -opacity 1.0
     2278        -color           BCGYR
     2279        -colormapvisible 1
     2280        -edgecolor       black
     2281        -edges           0
     2282        -isolinecolor    black
     2283        -isolinesvisible 1
     2284        -isolinewidth    1.0
     2285        -levels          10
     2286        -linewidth       1.0
     2287        -opacity         1.0
     2288        -outline         0
     2289        -wireframe       0
    22602290    }
    22612291    set stylelist [$dataobj style $comp]
     
    22952325        DrawLegend
    22962326    }
     2327    foreach setting {-edges -outline -wireframe \
     2328                     -colormapvisible -isolinecolor -isolinesvisible} {
     2329        if {$_changed($setting)} {
     2330            # User-modified UI setting overrides style
     2331            set style($setting) $_settings($setting)
     2332        } else {
     2333            # Set UI control to style setting (tool provided or default)
     2334            set _settings($setting) $style($setting)
     2335        }
     2336    }
     2337
    22972338    SendCmd "outline add $tag"
    22982339    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
    2299     SendCmd "outline visible $_settings(-outline) $tag"
     2340    SendCmd "outline visible $style(-outline) $tag"
     2341
    23002342    set scale [GetHeightmapScale]
    23012343    SendCmd "[list heightmap add contourlist $_contourList $scale $tag]"
    23022344    set _comp2scale($tag) $_settings(-heightmapscale)
    2303     SendCmd "heightmap edges $_settings(-edges) $tag"
    2304     SendCmd "heightmap wireframe $_settings(-wireframe) $tag"
     2345    SendCmd "heightmap edges $style(-edges) $tag"
     2346    SendCmd "heightmap linecolor [Color2RGB $style(-edgecolor)] $tag"
     2347    SendCmd "heightmap linewidth $style(-linewidth) $tag"
     2348    SendCmd "heightmap wireframe $style(-wireframe) $tag"
    23052349    SetCurrentColormap $style(-color)
    2306     set color [$itk_component(isolinecolor) value]
    2307     SendCmd "heightmap isolinecolor [Color2RGB $color] $tag"
     2350    SendCmd "heightmap isolinecolor [Color2RGB $style(-isolinecolor)] $tag"
     2351    $itk_component(isolinecolor) value $style(-isolinecolor)
     2352    SendCmd "heightmap isolinewidth $style(-isolinewidth) $tag"
    23082353    SendCmd "heightmap lighting $_settings(-isheightmap) $tag"
    2309     SendCmd "heightmap isolines $_settings(-isolinesvisible) $tag"
    2310     SendCmd "heightmap surface $_settings(-colormapvisible) $tag"
     2354    SendCmd "heightmap isolines $style(-isolinesvisible) $tag"
     2355    SendCmd "heightmap surface $style(-colormapvisible) $tag"
    23112356    SendCmd "heightmap opacity $style(-opacity) $tag"
    23122357    set _settings(-opacity) [expr $style(-opacity) * 100.0]
     
    24342479    }
    24352480
    2436     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2437     $c bind title <Enter> [itcl::code $this Combo activate]
    2438     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2481    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2482    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2483    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    24392484    # Reset the item coordinates according the current size of the plot.
    24402485    if { [info exists _limits($_curFldName)] } {
     
    25502595
    25512596# ----------------------------------------------------------------------
    2552 # USAGE: _dropdown post
    2553 # USAGE: _dropdown unpost
    2554 # USAGE: _dropdown select
    2555 #
    2556 # Used internally to handle the dropdown list for this combobox.  The
    2557 # post/unpost options are invoked when the list is posted or unposted
    2558 # to manage the relief of the controlling button.  The select option
    2559 # is invoked whenever there is a selection from the list, to assign
    2560 # the value back to the gauge.
    2561 # ----------------------------------------------------------------------
    2562 itcl::body Rappture::VtkHeightmapViewer::Combo {option} {
     2597# USAGE: LegendTitleAction post
     2598# USAGE: LegendTitleAction enter
     2599# USAGE: LegendTitleAction leave
     2600# USAGE: LegendTitleAction save
     2601#
     2602# Used internally to handle the dropdown list for the fields menu combobox.
     2603# The post option is invoked when the field title is pressed to launch the
     2604# dropdown.  The enter option is invoked when the user mouses over the field
     2605# title. The leave option is invoked when the user moves the mouse away
     2606# from the field title.  The save option is invoked whenever there is a
     2607# selection from the list, to alert the visualization server.
     2608# ----------------------------------------------------------------------
     2609itcl::body Rappture::VtkHeightmapViewer::LegendTitleAction {option} {
    25632610    set c $itk_component(view)
    25642611    switch -- $option {
     
    25702617            tk_popup $itk_component(fieldmenu) $x $y
    25712618        }
    2572         activate {
     2619        enter {
    25732620            $c itemconfigure title -fill red
    25742621        }
    2575         deactivate {
     2622        leave {
    25762623            $c itemconfigure title -fill $itk_option(-plotforeground)
    25772624        }
    2578         invoke {
     2625        save {
    25792626            $itk_component(field) value $_curFldLabel
    25802627            AdjustSetting -field
    25812628        }
    25822629        default {
    2583             error "bad option \"$option\": should be post, unpost, select"
     2630            error "bad option \"$option\": should be post, enter, leave or save"
    25842631        }
    25852632    }
  • branches/1.6/gui/scripts/vtkimageviewer.tcl

    r6305 r6340  
    7070    private method BuildImageTab {}
    7171    private method BuildDownloadPopup { widget command }
    72     private method Combo { option }
    7372    private method Connect {}
    7473    private method CurrentDatasets {args}
     
    8685    private method IsValidObject { dataobj }
    8786    private method LeaveLegend {}
     87    private method LegendTitleAction { option }
    8888    private method MotionLegend { x y }
    8989    private method Pan {option x y}
     
    209209
    210210    array set _settings {
    211         -axisflymode            "static"
     211        -axesvisible            1
    212212        -axislabels             1
    213213        -axisminorticks         1
    214         -axisvisible            1
     214        -axismode               "static"
    215215        -backingcolor           white
    216216        -backingvisible         1
     
    987987                    -activeforeground $itk_option(-plotforeground) \
    988988                    -font "Arial 8" \
    989                     -command [itcl::code $this Combo invoke]
     989                    -command [itcl::code $this LegendTitleAction save]
    990990                set _fields($fname) [list $label $units $components]
    991991                if { $_curFldName == "" } {
     
    10441044        PanCamera
    10451045        InitSettings -xgrid -ygrid -zgrid \
    1046             -axisvisible -axislabels -field -view3d
     1046            -axesvisible -axislabels -field -view3d
    10471047        if { [array size _fields] < 2 } {
    10481048            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
     
    12951295    }
    12961296    switch -- $what {
    1297         "-axisflymode" {
    1298             set mode [$itk_component(axisflymode) value]
    1299             set mode [$itk_component(axisflymode) translate $mode]
    1300             set _settings($what) $mode
    1301             SendCmd "axis flymode $mode"
     1297        "-axesvisible" {
     1298            set bool $_settings($what)
     1299            SendCmd "axis visible all $bool"
    13021300        }
    13031301        "-axislabels" {
     
    13091307            SendCmd "axis minticks all $bool"
    13101308        }
    1311         "-axisvisible" {
    1312             set bool $_settings($what)
    1313             SendCmd "axis visible all $bool"
     1309        "-axismode" {
     1310            set mode [$itk_component(axismode) value]
     1311            set mode [$itk_component(axismode) translate $mode]
     1312            set _settings($what) $mode
     1313            SendCmd "axis flymode $mode"
    13141314        }
    13151315        "-background" {
     
    13931393            SendCmd "camera reset"
    13941394            DrawLegend
     1395        }
     1396        "-legendvisible" {
     1397            if { !$_settings($what) } {
     1398                $itk_component(view) delete legend
     1399            }
     1400            DrawLegend
     1401        }
     1402        "-level" {
     1403            set val $_settings($what)
     1404            SendCmd "image level $val"
     1405        }
     1406        "-opacity" {
     1407            set _changed($what) 1
     1408            if { $_settings(-view3d) } {
     1409                set _settings(-saveopacity) $_settings($what)
     1410                set val [expr $_settings($what) * 0.01]
     1411                SendCmd "image opacity $val"
     1412            } else {
     1413                SendCmd "image opacity 1.0"
     1414            }
     1415        }
     1416        "-outline" {
     1417            set bool $_settings($what)
     1418            SendCmd "outline visible $bool"
     1419        }
     1420        "-stretchtofit" {
     1421            set bool $_settings($what)
     1422            if { $bool } {
     1423                if { $_settings(-view3d) } {
     1424                    SendCmd "camera aspect native"
     1425                } else {
     1426                    SendCmd "camera aspect window"
     1427                }
     1428            } else {
     1429                SendCmd "camera aspect native"
     1430            }
    13951431        }
    13961432        "-view3d" {
     
    14481484            set val $_settings($what)
    14491485            SendCmd "image window $val"
    1450         }
    1451         "-level" {
    1452             set val $_settings($what)
    1453             SendCmd "image level $val"
    1454         }
    1455         "-legendvisible" {
    1456             if { !$_settings($what) } {
    1457                 $itk_component(view) delete legend
    1458             }
    1459             DrawLegend
    1460         }
    1461         "-opacity" {
    1462             set _changed($what) 1
    1463             if { $_settings(-view3d) } {
    1464                 set _settings(-saveopacity) $_settings($what)
    1465                 set val [expr $_settings($what) * 0.01]
    1466                 SendCmd "image opacity $val"
    1467             } else {
    1468                 SendCmd "image opacity 1.0"
    1469             }
    1470         }
    1471         "-outline" {
    1472             set bool $_settings($what)
    1473             SendCmd "outline visible $bool"
    1474         }
    1475         "-stretchtofit" {
    1476             set bool $_settings($what)
    1477             if { $bool } {
    1478                 if { $_settings(-view3d) } {
    1479                     SendCmd "camera aspect native"
    1480                 } else {
    1481                     SendCmd "camera aspect window"
    1482                 }
    1483             } else {
    1484                 SendCmd "camera aspect native"
    1485             }
    14861486        }
    14871487        "-xgrid" - "-ygrid" - "-zgrid" {
     
    17951795    checkbutton $inner.visible \
    17961796        -text "Axes" \
    1797         -variable [itcl::scope _settings(-axisvisible)] \
    1798         -command [itcl::code $this AdjustSetting -axisvisible] \
     1797        -variable [itcl::scope _settings(-axesvisible)] \
     1798        -command [itcl::code $this AdjustSetting -axesvisible] \
    17991799        -font "Arial 9"
    18001800    checkbutton $inner.labels \
     
    18271827    label $inner.mode_l -text "Mode" -font "Arial 9"
    18281828
    1829     itk_component add axisflymode {
     1829    itk_component add axismode {
    18301830        Rappture::Combobox $inner.mode -width 10 -editable 0
    18311831    }
     
    18351835        "furthest_triad"  "farthest" \
    18361836        "outer_edges"     "outer"
    1837     $itk_component(axisflymode) value $_settings(-axisflymode)
    1838     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1837    $itk_component(axismode) value $_settings(-axismode)
     1838    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    18391839
    18401840    blt::table $inner \
     
    19731973    radiobutton $inner.vtk_button -text "VTK data file" \
    19741974        -variable [itcl::scope _downloadPopup(format)] \
    1975         -font "Arial 9 " \
     1975        -font "Arial 9" \
    19761976        -value vtk
    19771977    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    19781978    radiobutton $inner.image_button -text "Image File" \
    19791979        -variable [itcl::scope _downloadPopup(format)] \
    1980         -font "Arial 9 " \
     1980        -font "Arial 9" \
    19811981        -value image
    19821982    Rappture::Tooltip::for $inner.image_button \
     
    21532153    set x1 [expr $x2 - ($iw*12)/10]
    21542154
    2155     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2156     $c bind title <Enter> [itcl::code $this Combo activate]
    2157     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2155    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2156    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2157    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21582158    # Reset the item coordinates according the current size of the plot.
    21592159    if { [info exists _limits($_curFldName)] } {
     
    22692269
    22702270# ----------------------------------------------------------------------
    2271 # USAGE: _dropdown post
    2272 # USAGE: _dropdown unpost
    2273 # USAGE: _dropdown select
    2274 #
    2275 # Used internally to handle the dropdown list for this combobox.  The
    2276 # post/unpost options are invoked when the list is posted or unposted
    2277 # to manage the relief of the controlling button.  The select option
    2278 # is invoked whenever there is a selection from the list, to assign
    2279 # the value back to the gauge.
    2280 # ----------------------------------------------------------------------
    2281 itcl::body Rappture::VtkImageViewer::Combo {option} {
     2271# USAGE: LegendTitleAction post
     2272# USAGE: LegendTitleAction enter
     2273# USAGE: LegendTitleAction leave
     2274# USAGE: LegendTitleAction save
     2275#
     2276# Used internally to handle the dropdown list for the fields menu combobox.
     2277# The post option is invoked when the field title is pressed to launch the
     2278# dropdown.  The enter option is invoked when the user mouses over the field
     2279# title. The leave option is invoked when the user moves the mouse away
     2280# from the field title.  The save option is invoked whenever there is a
     2281# selection from the list, to alert the visualization server.
     2282# ----------------------------------------------------------------------
     2283itcl::body Rappture::VtkImageViewer::LegendTitleAction {option} {
    22822284    set c $itk_component(view)
    22832285    switch -- $option {
     
    22892291            tk_popup $itk_component(fieldmenu) $x $y
    22902292        }
    2291         activate {
     2293        enter {
    22922294            $c itemconfigure title -fill red
    22932295        }
    2294         deactivate {
     2296        leave {
    22952297            $c itemconfigure title -fill $itk_option(-plotforeground)
    22962298        }
    2297         invoke {
     2299        save {
    22982300            $itk_component(field) value $_curFldLabel
    22992301            AdjustSetting -field
    23002302        }
    23012303        default {
    2302             error "bad option \"$option\": should be post, unpost, select"
     2304            error "bad option \"$option\": should be post, enter, leave or save"
    23032305        }
    23042306    }
  • branches/1.6/gui/scripts/vtkisosurfaceviewer.tcl

    r6305 r6340  
    107107    private method ReceiveDataset { args }
    108108    private method ReceiveImage { args }
    109     private method ReceiveLegend { colormap title vmin vmax size }
     109    private method ReceiveLegend { colormap title min max size }
    110110    private method RequestLegend {}
    111111    private method Rotate {option x y}
     
    160160    private variable _rotatePending 0
    161161    private variable _cutplanePending 0
    162     private variable _field      ""
    163162    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    164163    private variable _fields
     
    15021501        }
    15031502        "-isolinecolor" {
    1504             set color [$itk_component(isolineColor) value]
     1503            set color [$itk_component(isolinecolor) value]
    15051504            set _settings($what) $color
    15061505            DrawLegend
     
    17381737
    17391738    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1740     itk_component add isolineColor {
     1739    itk_component add isolinecolor {
    17411740        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    17421741    }
     
    17531752        "none"               "none"
    17541753
    1755     $itk_component(isolineColor) value "white"
     1754    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    17561755    bind $inner.linecolor <<Value>> \
    17571756        [itcl::code $this AdjustSetting -isolinecolor]
     
    21812180                    SendCmd "camera zoom $_view($what)"
    21822181                }
    2183              }
     2182            }
    21842183        }
    21852184    }
     
    22152214    radiobutton $inner.vtk_button -text "VTK data file" \
    22162215        -variable [itcl::scope _downloadPopup(format)] \
    2217         -font "Arial 9 " \
     2216        -font "Arial 9" \
    22182217        -value vtk
    22192218    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    22202219    radiobutton $inner.image_button -text "Image File" \
    22212220        -variable [itcl::scope _downloadPopup(format)] \
    2222         -font "Arial 9 " \
     2221        -font "Arial 9" \
    22232222        -value image
    22242223    Rappture::Tooltip::for $inner.image_button \
     
    22562255    array set style {
    22572256        -color                  BCGYR
     2257        -constcolor             white
    22582258        -cutplaneedges          0
    22592259        -cutplanelighting       1
     
    22812281        set style(-opacity) 1.0
    22822282    }
     2283    set style(-constcolor) $itk_option(-plotforeground)
    22832284    array set style [$dataobj style $comp]
    22842285    #DebugTrace [array get style]
     
    23122313    }
    23132314    if { $_currentColormap == "" } {
    2314         SetCurrentColormap $style(-color)
    23152315        $itk_component(colormap) value $style(-color)
    23162316    }
     
    23402340
    23412341    SendCmd "cutplane add $tag"
    2342     SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
     2342    SendCmd "cutplane color [Color2RGB $style(-constcolor)] $tag"
    23432343    foreach axis {x y z} {
    23442344        set pos [expr $style(-${axis}cutplaneposition) * 0.01]
     
    23562356
    23572357    SendCmd "outline add $tag"
    2358     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     2358    SendCmd "outline color [Color2RGB $style(-constcolor)] $tag"
    23592359    SendCmd "outline visible $style(-outline) $tag"
    23602360
     
    23642364    SendCmd "contour3d edges $style(-edges) $tag"
    23652365    set _settings(-isosurfaceedges) $style(-edges)
    2366     #SendCmd "contour3d color [Color2RGB $style(-color)] $tag"
     2366    #SendCmd "contour3d color [Color2RGB $style(-constcolor)] $tag"
    23672367    SendCmd "contour3d lighting $style(-lighting) $tag"
    23682368    set _settings(-isosurfacelighting) $style(-lighting)
  • branches/1.6/gui/scripts/vtkmeshviewer.tcl

    r6305 r6340  
    14641464    radiobutton $inner.vtk_button -text "VTK data file" \
    14651465        -variable [itcl::scope _downloadPopup(format)] \
    1466         -font "Helvetica 9 " \
     1466        -font "Arial 9" \
    14671467        -value vtk
    14681468    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
  • branches/1.6/gui/scripts/vtkstreamlinesviewer.tcl

    r6305 r6340  
    7272    private method BuildSurfaceTab {}
    7373    private method DrawLegend {}
    74     private method Combo { option }
    7574    private method Connect {}
    7675    private method CurrentDatasets {args}
     
    9190    private method IsValidObject { dataobj }
    9291    private method LeaveLegend {}
     92    private method LegendTitleAction { option }
    9393    private method MotionLegend { x y }
    9494    private method Pan {option x y}
     
    101101    private method ReceiveDataset { args }
    102102    private method ReceiveImage { args }
    103     private method ReceiveLegend { colormap title vmin vmax size }
     103    private method ReceiveLegend { colormap title min max size }
    104104    private method RequestLegend {}
    105105    private method Rotate {option x y}
     
    145145    private variable _curFldName ""
    146146    private variable _curFldLabel ""
    147     private variable _field ""
    148147    private variable _streamlinesLength 0
    149148    private variable _numSeeds 200
     
    10431042                    -activeforeground $itk_option(-plotforeground) \
    10441043                    -font "Arial 8" \
    1045                     -command [itcl::code $this Combo invoke]
     1044                    -command [itcl::code $this LegendTitleAction save]
    10461045                set _fields($fname) [list $label $units $components]
    10471046                if { $_curFldName == "" && $components == 3 } {
     
    20652064    radiobutton $inner.vtk_button -text "VTK data file" \
    20662065        -variable [itcl::scope _downloadPopup(format)] \
    2067         -font "Helvetica 9 " \
     2066        -font "Arial 9" \
    20682067        -value vtk
    20692068    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    21822181
    21832182# ----------------------------------------------------------------------
    2184 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2183# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    21852184#
    21862185# Invoked automatically whenever the "legend" command comes in from
     
    21882187# specified <size> will follow.
    21892188# ----------------------------------------------------------------------
    2190 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {
     2189itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } {
    21912190    set _legendPending 0
    21922191    set _title $title
     
    22522251            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    22532252        }
    2254         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2255         $c bind title <Enter> [itcl::code $this Combo activate]
    2256         $c bind title <Leave> [itcl::code $this Combo deactivate]
     2253        $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2254        $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2255        $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    22572256        # Reset the item coordinates according the current size of the plot.
    22582257        $c itemconfigure title -text $title
     
    23772376
    23782377# ----------------------------------------------------------------------
    2379 # USAGE: _dropdown post
    2380 # USAGE: _dropdown unpost
    2381 # USAGE: _dropdown select
    2382 #
    2383 # Used internally to handle the dropdown list for this combobox.  The
    2384 # post/unpost options are invoked when the list is posted or unposted
    2385 # to manage the relief of the controlling button.  The select option
    2386 # is invoked whenever there is a selection from the list, to assign
    2387 # the value back to the gauge.
    2388 # ----------------------------------------------------------------------
    2389 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} {
     2378# USAGE: LegendTitleAction post
     2379# USAGE: LegendTitleAction enter
     2380# USAGE: LegendTitleAction leave
     2381# USAGE: LegendTitleAction save
     2382#
     2383# Used internally to handle the dropdown list for the fields menu combobox.
     2384# The post option is invoked when the field title is pressed to launch the
     2385# dropdown.  The enter option is invoked when the user mouses over the field
     2386# title. The leave option is invoked when the user moves the mouse away
     2387# from the field title.  The save option is invoked whenever there is a
     2388# selection from the list, to alert the visualization server.
     2389# ----------------------------------------------------------------------
     2390itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} {
    23902391    set c $itk_component(view)
    23912392    switch -- $option {
     
    23972398            tk_popup $itk_component(fieldmenu) $x $y
    23982399        }
    2399         activate {
     2400        enter {
    24002401            $c itemconfigure title -fill red
    24012402        }
    2402         deactivate {
     2403        leave {
    24032404            $c itemconfigure title -fill white
    24042405        }
    2405         invoke {
     2406        save {
    24062407            $itk_component(field) value $_curFldLabel
    24072408            AdjustSetting -field
    24082409        }
    24092410        default {
    2410             error "bad option \"$option\": should be post, unpost, select"
     2411            error "bad option \"$option\": should be post, enter, leave or save"
    24112412        }
    24122413    }
  • branches/1.6/gui/scripts/vtksurfaceviewer.tcl

    r6305 r6340  
    6969    private method BuildDownloadPopup { widget command }
    7070    private method BuildSurfaceTab {}
    71     private method Combo { option }
    7271    private method Connect {}
    7372    private method CurrentDatasets {args}
     
    8584    private method IsValidObject { dataobj }
    8685    private method LeaveLegend {}
     86    private method LegendTitleAction { option }
    8787    private method MotionLegend { x y }
    8888    private method Pan {option x y}
     
    9595    private method ReceiveDataset { args }
    9696    private method ReceiveImage { args }
    97     private method ReceiveLegend { colormap title vmin vmax size }
     97    private method ReceiveLegend { colormap title min max size }
    9898    private method RequestLegend {}
    9999    private method Rotate {option x y}
     
    139139    private variable _legendPending 0
    140140    private variable _rotatePending 0
    141     private variable _field ""
    142141    private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar)
    143142    private variable _fields
     
    13151314        "-isolinecolor" {
    13161315            set _changed($what) 1
    1317             set color [$itk_component(isolineColor) value]
     1316            set color [$itk_component(isolinecolor) value]
    13181317            set _settings($what) $color
    13191318            SendCmd "contour2d linecolor [Color2RGB $color]"
     
    15431542
    15441543    label $inner.linecolor_l -text "Isolines" -font "Arial 9"
    1545     itk_component add isolineColor {
     1544    itk_component add isolinecolor {
    15461545        Rappture::Combobox $inner.linecolor -width 10 -editable 0
    15471546    }
     
    15581557        "none"               "none"
    15591558
    1560     $itk_component(isolineColor) value "white"
     1559    $itk_component(isolinecolor) value $_settings(-isolinecolor)
    15611560    bind $inner.linecolor <<Value>> \
    15621561        [itcl::code $this AdjustSetting -isolinecolor]
     
    17941793                    SendCmd "camera zoom $_view($what)"
    17951794                }
    1796              }
     1795            }
    17971796        }
    17981797    }
     
    18281827    radiobutton $inner.vtk_button -text "VTK data file" \
    18291828        -variable [itcl::scope _downloadPopup(format)] \
    1830         -font "Arial 9 " \
     1829        -font "Arial 9" \
    18311830        -value vtk
    18321831    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
    18331832    radiobutton $inner.image_button -text "Image File" \
    18341833        -variable [itcl::scope _downloadPopup(format)] \
    1835         -font "Arial 9 " \
     1834        -font "Arial 9" \
    18361835        -value image
    18371836    Rappture::Tooltip::for $inner.image_button \
     
    21672166    }
    21682167
    2169     $c bind title <ButtonPress> [itcl::code $this Combo post]
    2170     $c bind title <Enter> [itcl::code $this Combo activate]
    2171     $c bind title <Leave> [itcl::code $this Combo deactivate]
     2168    $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2169    $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2170    $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    21722171    # Reset the item coordinates according the current size of the plot.
    21732172    $c itemconfigure title -text $title
     
    21942193
    21952194# ----------------------------------------------------------------------
    2196 # USAGE: _dropdown post
    2197 # USAGE: _dropdown unpost
    2198 # USAGE: _dropdown select
    2199 #
    2200 # Used internally to handle the dropdown list for this combobox.  The
    2201 # post/unpost options are invoked when the list is posted or unposted
    2202 # to manage the relief of the controlling button.  The select option
    2203 # is invoked whenever there is a selection from the list, to assign
    2204 # the value back to the gauge.
    2205 # ----------------------------------------------------------------------
    2206 itcl::body Rappture::VtkSurfaceViewer::Combo {option} {
     2195# USAGE: LegendTitleAction post
     2196# USAGE: LegendTitleAction enter
     2197# USAGE: LegendTitleAction leave
     2198# USAGE: LegendTitleAction save
     2199#
     2200# Used internally to handle the dropdown list for the fields menu combobox.
     2201# The post option is invoked when the field title is pressed to launch the
     2202# dropdown.  The enter option is invoked when the user mouses over the field
     2203# title. The leave option is invoked when the user moves the mouse away
     2204# from the field title.  The save option is invoked whenever there is a
     2205# selection from the list, to alert the visualization server.
     2206# ----------------------------------------------------------------------
     2207itcl::body Rappture::VtkSurfaceViewer::LegendTitleAction {option} {
    22072208    set c $itk_component(view)
    22082209    switch -- $option {
     
    22162217            tk_popup $itk_component(fieldmenu) $x $y
    22172218        }
    2218         activate {
     2219        enter {
    22192220            $c itemconfigure title -fill red
    22202221        }
    2221         deactivate {
     2222        leave {
    22222223            $c itemconfigure title -fill $itk_option(-plotforeground)
    22232224        }
    2224         invoke {
     2225        save {
    22252226            $itk_component(field) value $_curFldLabel
    22262227            AdjustSetting -field
    22272228        }
    22282229        default {
    2229             error "bad option \"$option\": should be post, unpost, select"
     2230            error "bad option \"$option\": should be post, enter, leave or save"
    22302231        }
    22312232    }
     
    23172318                -activeforeground $itk_option(-plotforeground) \
    23182319                -font "Arial 8" \
    2319                 -command [itcl::code $this Combo invoke]
     2320                -command [itcl::code $this LegendTitleAction save]
    23202321            set _fields($fname) [list $label $units $components]
    23212322            if { $_curFldName == "" } {
  • branches/1.6/gui/scripts/vtkviewer.tcl

    r6305 r6340  
    104104    private method ReceiveDataset { args }
    105105    private method ReceiveImage { args }
    106     private method ReceiveLegend { colormap title vmin vmax size }
     106    private method ReceiveLegend { colormap title min max size }
    107107    private method RequestLegend {}
    108108    private method Rotate {option x y}
     
    25852585    radiobutton $inner.vtk_button -text "VTK data file" \
    25862586        -variable [itcl::scope _downloadPopup(format)] \
    2587         -font "Helvetica 9 " \
     2587        -font "Arial 9" \
    25882588        -value vtk
    25892589    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    28632863
    28642864# ----------------------------------------------------------------------
    2865 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2865# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    28662866#
    28672867# Invoked automatically whenever the "legend" command comes in from
     
    28692869# specified <size> will follow.
    28702870# ----------------------------------------------------------------------
    2871 itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title vmin vmax size } {
    2872     set _limits(vmin) $vmin
    2873     set _limits(vmax) $vmax
     2871itcl::body Rappture::VtkViewer::ReceiveLegend { colormap title min max size } {
     2872    set _limits(vmin) $min
     2873    set _limits(vmax) $max
    28742874    set _title $title
    28752875    if { [IsConnected] } {
  • branches/1.6/gui/scripts/vtkvolumeviewer.tcl

    r6305 r6340  
    7373    private method BuildVolumeTab {}
    7474    private method ChangeColormap { dataobj comp color }
    75     private method Combo { option }
    7675    private method Connect {}
    7776    private method CurrentDatasets {args}
     
    9190    private method IsValidObject { dataobj }
    9291    private method LeaveLegend {}
     92    private method LegendTitleAction { option }
    9393    private method MotionLegend { x y }
    9494    private method Pan {option x y}
     
    101101    private method ReceiveDataset { args }
    102102    private method ReceiveImage { args }
    103     private method ReceiveLegend { colormap title vmin vmax size }
     103    private method ReceiveLegend { colormap title min max size }
    104104    private method RequestLegend {}
    105105    private method Rotate {option x y}
     
    224224    array set _settings {
    225225        -axesvisible            1
    226         -axisflymode            static
    227226        -axislabels             1
    228227        -axisminorticks         1
     228        -axismode               "static"
    229229        -background             black
    230230        -color                  BCGYR
     
    970970        set _first ""
    971971        InitSettings -background \
    972             -xgrid -ygrid -zgrid -axisflymode \
     972            -xgrid -ygrid -zgrid -axismode \
    973973            -axesvisible -axislabels -axisminorticks
    974974        StopBufferingCommands
     
    10521052                        -activeforeground $itk_option(-plotforeground) \
    10531053                        -font "Arial 8" \
    1054                         -command [itcl::code $this Combo invoke]
     1054                        -command [itcl::code $this LegendTitleAction save]
    10551055                    set _fields($fname) [list $label $units $components]
    10561056                    if { $_curFldName == "" } {
     
    13161316    }
    13171317    switch -- $what {
     1318        "-axesvisible" {
     1319            set bool $_settings($what)
     1320            SendCmd "axis visible all $bool"
     1321        }
     1322        "-axislabels" {
     1323            set bool $_settings($what)
     1324            SendCmd "axis labels all $bool"
     1325        }
     1326        "-axisminorticks" {
     1327            set bool $_settings($what)
     1328            SendCmd "axis minticks all $bool"
     1329        }
     1330        "-axismode" {
     1331            set mode [$itk_component(axismode) value]
     1332            set mode [$itk_component(axismode) translate $mode]
     1333            set _settings($what) $mode
     1334            SendCmd "axis flymode $mode"
     1335        }
    13181336        "-background" {
    13191337            set bgcolor [$itk_component(background) value]
     
    13291347            DrawLegend
    13301348        }
    1331         "-volumeoutline" {
    1332             set bool $_settings($what)
    1333             SendCmd "outline visible 0"
    1334             foreach tag [CurrentDatasets -visible] {
    1335                 SendCmd "outline visible $bool $tag"
    1336             }
    1337         }
    1338         "-legendvisible" {
    1339             DrawLegend
    1340         }
    1341         "-volumevisible" {
    1342             set bool $_settings($what)
    1343             foreach tag [CurrentDatasets -visible] {
    1344                 SendCmd "volume visible $bool $tag"
    1345             }
    1346             if { $bool } {
    1347                 Rappture::Tooltip::for $itk_component(volume) \
    1348                     "Hide the volume"
    1349             } else {
    1350                 Rappture::Tooltip::for $itk_component(volume) \
    1351                     "Show the volume"
    1352             }
    1353         }
    1354         "-volumematerial" {
    1355             set val $_settings($what)
    1356             set diffuse [expr {0.01*$val}]
    1357             set specular [expr {0.01*$val}]
    1358             #set power [expr {sqrt(160*$val+1.0)}]
    1359             set power [expr {$val+1.0}]
    1360             foreach tag [CurrentDatasets -visible] {
    1361                 SendCmd "volume shading diffuse $diffuse $tag"
    1362                 SendCmd "volume shading specular $specular $power $tag"
    1363             }
    1364         }
    1365         "-volumelighting" {
    1366             set bool $_settings($what)
    1367             foreach tag [CurrentDatasets -visible] {
    1368                 SendCmd "volume lighting $bool $tag"
    1369             }
    1370         }
    1371         "-volumeopacity" {
    1372             set val $_settings($what)
    1373             set val [expr {0.01*$val}]
    1374             foreach tag [CurrentDatasets -visible] {
    1375                 SendCmd "volume opacity $val $tag"
    1376             }
    1377         }
    1378         "-volumequality" {
    1379             set val $_settings($what)
    1380             set val [expr {0.01*$val}]
    1381             foreach tag [CurrentDatasets -visible] {
    1382                 SendCmd "volume quality $val $tag"
    1383             }
    1384         }
    1385         "-axesvisible" {
    1386             set bool $_settings($what)
    1387             SendCmd "axis visible all $bool"
    1388         }
    1389         "-axislabels" {
    1390             set bool $_settings($what)
    1391             SendCmd "axis labels all $bool"
    1392         }
    1393         "-axisminorticks" {
    1394             set bool $_settings($what)
    1395             SendCmd "axis minticks all $bool"
    1396         }
    1397         "-xgrid" - "-ygrid" - "-zgrid" {
    1398             set axis [string range $what 1 1]
    1399             set bool $_settings($what)
    1400             SendCmd "axis grid $axis $bool"
    1401         }
    1402         "-axisflymode" {
    1403             set mode [$itk_component(axismode) value]
    1404             set mode [$itk_component(axismode) translate $mode]
    1405             set _settings($what) $mode
    1406             SendCmd "axis flymode $mode"
    1407         }
    1408         "-cutplanesvisible" {
    1409             set bool $_settings($what)
    1410             foreach dataset [CurrentDatasets -visible] {
    1411                 SendCmd "$_cutplaneCmd visible $bool $dataset"
    1412             }
     1349        "-color" {
     1350            set color [$itk_component(colormap) value]
     1351            set _settings($what) $color
     1352            foreach dataset [CurrentDatasets -visible $_first] {
     1353                foreach {dataobj comp} [split $dataset -] break
     1354                ChangeColormap $dataobj $comp $color
     1355            }
     1356            EventuallyRequestLegend
    14131357        }
    14141358        "-cutplanelighting" {
     
    14361380            }
    14371381        }
    1438         "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
    1439             set axis [string range $what 1 1]
     1382        "-cutplanesvisible" {
    14401383            set bool $_settings($what)
    1441             if { $bool } {
    1442                 $itk_component(${axis}CutScale) configure -state normal \
    1443                     -troughcolor white
    1444             } else {
    1445                 $itk_component(${axis}CutScale) configure -state disabled \
    1446                     -troughcolor grey82
    1447             }
    14481384            foreach dataset [CurrentDatasets -visible] {
    1449                 SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
    1450             }
    1451         }
    1452         "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
    1453             set axis [string range $what 1 1]
    1454             set pos [expr $_settings($what) * 0.01]
    1455             foreach dataset [CurrentDatasets -visible] {
    1456                 SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
    1457             }
    1458             set _cutplanePending 0
    1459         }
    1460         "-color" {
    1461             set color [$itk_component(colormap) value]
    1462             set _settings($what) $color
    1463             foreach dataset [CurrentDatasets -visible $_first] {
    1464                 foreach {dataobj comp} [split $dataset -] break
    1465                 ChangeColormap $dataobj $comp $color
    1466             }
    1467             EventuallyRequestLegend
     1385                SendCmd "$_cutplaneCmd visible $bool $dataset"
     1386            }
    14681387        }
    14691388        "-field" {
     
    14951414            SendCmd "camera reset"
    14961415            DrawLegend
     1416        }
     1417        "-legendvisible" {
     1418            DrawLegend
     1419        }
     1420        "-volumematerial" {
     1421            set val $_settings($what)
     1422            set diffuse [expr {0.01*$val}]
     1423            set specular [expr {0.01*$val}]
     1424            #set power [expr {sqrt(160*$val+1.0)}]
     1425            set power [expr {$val+1.0}]
     1426            foreach tag [CurrentDatasets -visible] {
     1427                SendCmd "volume shading diffuse $diffuse $tag"
     1428                SendCmd "volume shading specular $specular $power $tag"
     1429            }
     1430        }
     1431        "-volumelighting" {
     1432            set bool $_settings($what)
     1433            foreach tag [CurrentDatasets -visible] {
     1434                SendCmd "volume lighting $bool $tag"
     1435            }
     1436        }
     1437        "-volumeopacity" {
     1438            set val $_settings($what)
     1439            set val [expr {0.01*$val}]
     1440            foreach tag [CurrentDatasets -visible] {
     1441                SendCmd "volume opacity $val $tag"
     1442            }
     1443        }
     1444        "-volumeoutline" {
     1445            set bool $_settings($what)
     1446            SendCmd "outline visible 0"
     1447            foreach tag [CurrentDatasets -visible] {
     1448                SendCmd "outline visible $bool $tag"
     1449            }
     1450        }
     1451        "-volumequality" {
     1452            set val $_settings($what)
     1453            set val [expr {0.01*$val}]
     1454            foreach tag [CurrentDatasets -visible] {
     1455                SendCmd "volume quality $val $tag"
     1456            }
     1457        }
     1458        "-volumevisible" {
     1459            set bool $_settings($what)
     1460            foreach tag [CurrentDatasets -visible] {
     1461                SendCmd "volume visible $bool $tag"
     1462            }
     1463            if { $bool } {
     1464                Rappture::Tooltip::for $itk_component(volume) \
     1465                    "Hide the volume"
     1466            } else {
     1467                Rappture::Tooltip::for $itk_component(volume) \
     1468                    "Show the volume"
     1469            }
     1470        }
     1471        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
     1472            set axis [string range $what 1 1]
     1473            set bool $_settings($what)
     1474            if { $bool } {
     1475                $itk_component(${axis}CutScale) configure -state normal \
     1476                    -troughcolor white
     1477            } else {
     1478                $itk_component(${axis}CutScale) configure -state disabled \
     1479                    -troughcolor grey82
     1480            }
     1481            foreach dataset [CurrentDatasets -visible] {
     1482                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
     1483            }
     1484        }
     1485        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1486            set axis [string range $what 1 1]
     1487            set pos [expr $_settings($what) * 0.01]
     1488            foreach dataset [CurrentDatasets -visible] {
     1489                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
     1490            }
     1491            set _cutplanePending 0
     1492        }
     1493        "-xgrid" - "-ygrid" - "-zgrid" {
     1494            set axis [string range $what 1 1]
     1495            set bool $_settings($what)
     1496            SendCmd "axis grid $axis $bool"
    14971497        }
    14981498        default {
     
    18071807        "furthest_triad"  "farthest" \
    18081808        "outer_edges"     "outer"
    1809     $itk_component(axismode) value $_settings(-axisflymode)
    1810     bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
     1809    $itk_component(axismode) value $_settings(-axismode)
     1810    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
    18111811
    18121812    blt::table $inner \
     
    20732073    radiobutton $inner.vtk_button -text "VTK data file" \
    20742074        -variable [itcl::scope _downloadPopup(format)] \
    2075         -font "Helvetica 9 " \
     2075        -font "Arial 9" \
    20762076        -value vtk
    20772077    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    21482148
    21492149# ----------------------------------------------------------------------
    2150 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2150# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    21512151#
    21522152# Invoked automatically whenever the "legend" command comes in from
     
    21542154# specified <size> will follow.
    21552155# ----------------------------------------------------------------------
    2156 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
     2156itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title min max size } {
    21572157    if { [isconnected] } {
    21582158        set bytes [ReceiveBytes $size]
     
    23412341
    23422342# ----------------------------------------------------------------------
    2343 # USAGE: _dropdown post
    2344 # USAGE: _dropdown unpost
    2345 # USAGE: _dropdown select
    2346 #
    2347 # Used internally to handle the dropdown list for this combobox.  The
    2348 # post/unpost options are invoked when the list is posted or unposted
    2349 # to manage the relief of the controlling button.  The select option
    2350 # is invoked whenever there is a selection from the list, to assign
    2351 # the value back to the gauge.
    2352 # ----------------------------------------------------------------------
    2353 itcl::body Rappture::VtkVolumeViewer::Combo {option} {
     2343# USAGE: LegendTitleAction post
     2344# USAGE: LegendTitleAction enter
     2345# USAGE: LegendTitleAction leave
     2346# USAGE: LegendTitleAction save
     2347#
     2348# Used internally to handle the dropdown list for the fields menu combobox.
     2349# The post option is invoked when the field title is pressed to launch the
     2350# dropdown.  The enter option is invoked when the user mouses over the field
     2351# title. The leave option is invoked when the user moves the mouse away
     2352# from the field title.  The save option is invoked whenever there is a
     2353# selection from the list, to alert the visualization server.
     2354# ----------------------------------------------------------------------
     2355itcl::body Rappture::VtkVolumeViewer::LegendTitleAction {option} {
    23542356    set c $itk_component(view)
    23552357    switch -- $option {
     
    23612363            tk_popup $itk_component(fieldmenu) $x $y
    23622364        }
    2363         activate {
     2365        enter {
    23642366            $c itemconfigure title -fill red
    23652367        }
    2366         deactivate {
     2368        leave {
    23672369            $c itemconfigure title -fill $itk_option(-plotforeground)
    23682370        }
    2369         invoke {
     2371        save {
    23702372            $itk_component(field) value $_curFldLabel
    23712373            AdjustSetting -field
    23722374        }
    23732375        default {
    2374             error "bad option \"$option\": should be post, unpost, select"
     2376            error "bad option \"$option\": should be post, enter, leave or save"
    23752377        }
    23762378    }
Note: See TracChangeset for help on using the changeset viewer.