Changeset 1711


Ignore:
Timestamp:
May 14, 2010, 8:22:20 AM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/molvisviewer.tcl

    r1567 r1711  
    4040
    4141    itk_option define -device device Device ""
     42
     43    private variable _icon 0
     44
     45    private variable _mevent;           # info used for mouse event operations
     46    private variable _rocker;           # info used for rock operations
     47    private variable _dlist "";         # list of dataobj objects
     48    private variable _dataobjs;         # data objects on server
     49    private variable _dobj2transparency;# maps dataobj => transparency
     50    private variable _dobj2raise;       # maps dataobj => raise flag 0/1
     51
     52    private variable _active;           # array of active models.
     53    private variable _obj2models;       # array containing list of models
     54                                        # for each data object.
     55
     56    private variable _view
     57    private variable _click
     58
     59    private variable _model
     60    private variable _mlist
     61    private variable _mrepresentation "ballnstick"
     62
     63    private variable _imagecache
     64    private variable _state
     65    private variable _labels  "default"
     66    private variable _cacheid ""
     67    private variable _cacheimage ""
     68
     69    private variable _delta1 10
     70    private variable _delta2 2
     71
     72    private common _settings  ;         # Array of settings for all known
     73                                        # widgets
     74    private variable _initialized
     75
     76    private common _downloadPopup;      # Download options from popup
     77    private variable _pdbdata;          # PDB data from run file sent to pymol
     78    private common _hardcopy
     79    private variable _nextToken 0
     80    private variable _outbuf "";
     81    private variable _buffering 0;
     82    private variable _resizePending 0;
     83    private variable _width
     84    private variable _height
     85    private variable _restore 1;        # Restore camera settings
    4286
    4387    constructor { hostlist args } {
     
    92136    private method EnableDownload { popup what }
    93137
    94     private variable _icon 0
    95 
    96     private variable _mevent;           # info used for mouse event operations
    97     private variable _rocker;           # info used for rock operations
    98     private variable _dlist "";         # list of dataobj objects
    99     private variable _dataobjs;         # data objects on server
    100     private variable _dobj2transparency;# maps dataobj => transparency
    101     private variable _dobj2raise;       # maps dataobj => raise flag 0/1
    102 
    103     private variable _active;           # array of active models.
    104     private variable _obj2models;       # array containing list of models
    105                                         # for each data object.
    106 
    107     private variable _view
    108     private variable _click
    109 
    110     private variable _model
    111     private variable _mlist
    112     private variable _mrepresentation "ballnstick"
    113 
    114     private variable _imagecache
    115     private variable _state
    116     private variable _labels  "default"
    117     private variable _cacheid ""
    118     private variable _cacheimage ""
    119 
    120     private variable _delta1 10
    121     private variable _delta2 2
    122 
    123     private common _settings  ;         # Array of settings for all known
    124                                         # widgets
    125     private variable _initialized
    126 
    127     private common _downloadPopup;      # Download options from popup
    128     private variable _pdbdata;          # PDB data from run file sent to pymol
    129     private common _hardcopy
    130     private variable _nextToken 0
    131     private variable _outbuf "";
    132     private variable _buffering 0;
    133     private variable _resizePending 0;
    134     private variable _width
    135     private variable _height
    136138}
    137139
     
    179181    set _state(client) 1
    180182    set _hostlist $hostlist
     183    set _restore 1
    181184
    182185    array set _view {
     
    595598        return 0
    596599    }
     600    set _restore 1
    597601    set result [VisViewer::Connect $hosts]
    598602    if { $result } {
     
    665669    global count
    666670    incr count
    667     debug "$count: cacheid=$cacheid frame=$frame\n"
    668671    if { $cacheid != $_cacheid } {
    669672        array unset _imagecache
     
    702705    set _buffering 1
    703706
    704     set _rocker(server) 0
    705     set _cacheid 0
    706     SendCmd "raw -defer {set auto_color,0}"
    707     SendCmd "raw -defer {set auto_show_lines,0}"
    708 
     707    if { $_restore } {
     708        set _rocker(server) 0
     709        set _cacheid 0
     710        SendCmd "raw -defer {set auto_color,0}"
     711        SendCmd "raw -defer {set auto_show_lines,0}"
     712        SendCmd "raw -defer {set connect_mode,1}"
     713    }
    709714    set dlist [get]
    710715    foreach dataobj $dlist {
     
    797802            set _mlist($model) 1
    798803        }
    799 
    800804        if { $_mlist($model) == 1 } {
    801805            if {  [info exists _model($model-newtransparency)] ||
     
    842846        Update
    843847    }
    844     # Reset viewing parameters
    845     set w  [winfo width $itk_component(3dview)]
    846     set h  [winfo height $itk_component(3dview)]
    847     SendCmd [subst {
    848         reset
    849         screen $w $h
    850         rotate $_view(mx) $_view(my) $_view(mz)
    851         pan $_view(x) $_view(y)
    852         zoom $_view(zoom)
    853     }]
    854     debug "rebuild: rotate $_view(mx) $_view(my) $_view(mz)"
    855 
    856     # foreach all models
    857     spherescale update
    858     stickradius update
    859     labels update
    860     opacity update
    861     cartoontrace update
    862 
    863     projection update
    864     representation update
     848    if { $_restore } {
     849        # Set or restore viewing parameters.  We do this for the first
     850        # model and assume this works for everything else.
     851        set w  [winfo width $itk_component(3dview)]
     852        set h  [winfo height $itk_component(3dview)]
     853        SendCmd [subst {
     854            reset
     855            screen $w $h
     856            rotate $_view(mx) $_view(my) $_view(mz)
     857            pan $_view(x) $_view(y)
     858            zoom $_view(zoom)
     859        }]
     860        debug "rebuild: rotate $_view(mx) $_view(my) $_view(mz)"
     861        # foreach all models
     862        spherescale update
     863        stickradius update
     864        labels update
     865        opacity update
     866        cartoontrace update
     867       
     868        projection update
     869        representation update
     870        set _restore 0
     871    }
    865872
    866873    set _buffering 0;                   # Turn off buffering.
     
    9991006        after cancel $_rocker(afterid)
    10001007        unset _rocker(afterid)
     1008    }
     1009    if { ![winfo viewable $itk_component(3dview)] } {
     1010        return
    10011011    }
    10021012    set _rocker(on) $_settings($this-rock)
     
    13561366        }
    13571367        set _dobj2raise($dataobj) $params(-raise)
     1368        debug "setting parameters for $dataobj\n"
    13581369
    13591370        if { [isconnected] } {
     1371            debug "calling rebuild\n"
    13601372            $_dispatcher event -idle !rebuild
    13611373        }
     
    16141626    set _settings($this-spherescale) $radius
    16151627    if { $models == "all" } {
    1616         set models [array names _mlist]
     1628        SendCmd "spherescale -model all $radius"
     1629        return
    16171630    }
    16181631    set overrideradius [expr $radius * 0.8]
     
    16491662    set _settings($this-stickradius) $radius
    16501663    if { $models == "all" } {
    1651         set models [array names _mlist]
     1664        SendCmd "stickradius -model all $radius"
     1665        return
    16521666    }
    16531667    set overrideradius [expr $radius * 0.8]
     
    16831697    }
    16841698    set _settings($this-opacity) $opacity
     1699    set transparency [expr 1.0 - $opacity]
    16851700    if { $models == "all" } {
    1686         set models [array names _mlist]
     1701        SendCmd "transparency -model all $transparency"
     1702        return
    16871703    }
    16881704    set overridetransparency 0.60
    1689     set transparency [expr 1.0 - $opacity]
    16901705    SendCmd "transparency -model all $overridetransparency"
    16911706    foreach model $models {
     
    17141729    set _settings($this-showlabels) $showlabels
    17151730    if { $models == "all" } {
    1716         set models [array names _mlist]
     1731        SendCmd "label -model all $showlabels"
     1732        return
    17171733    }
    17181734    SendCmd "label -model all off"
     
    17441760    set _settings($this-cartoontrace) $trace
    17451761    if { $models == "all" } {
    1746         set models [array names _mlist]
     1762        SendCmd "cartoontrace -model all $trace"
     1763        return
    17471764    }
    17481765    SendCmd "cartoontrace -model all off"
     
    18491866    }
    18501867}
     1868
Note: See TracChangeset for help on using the changeset viewer.