Ignore:
Timestamp:
Apr 1, 2009, 4:55:25 PM (16 years ago)
Author:
gah
Message:

First pass at changes to visualization widgets.

nanovisview.tcl use png icons.
visviewer.tcl change to sidebar layout
molvisviewer.tcl use png icons, fixed for sidebar layout.
heightmapviewer.tcl use png icons, fixed for sidebar layout.
flowvisviewer.tcl use png icons, fixed for sidebar layout.

resultviewer.tcl recognize flow data
field.tcl recognize unirect3d mesh.
field3dresult.tcl load FlowvisViewer? component description.
panes.tcl added horizontal panes. Need cursor fix. Must specify

correct cursor from options.

unirect2d.tcl added "axisorder" tag to specify order of field data.

Changed name to Unirect2d from UniRect2d.

unirect3d.tcl added "axisorder" tag to specify order of field data.

Right now, this is a test platform for me for flow
visualizations.

File:
1 edited

Legend:

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

    r1349 r1373  
    6262        # do nothing
    6363    }
    64     public method drawer {what who}
     64    public method tab {what who}
    6565    public method camera {option args}
    6666    protected method Connect {}
     
    7171    protected method ReceiveImage { args }
    7272    private method _ReceiveLegend {tf vmin vmax size}
    73     private method _BuildSettingsDrawer {}
    74     private method _BuildCameraDrawer {}
     73    private method _BuildViewTab {}
     74    private method _BuildCameraTab {}
    7575    private method _PanCamera {}
    7676    protected method _receive_echo {channel {data ""}}
     
    9999    private variable view_         ;# view params for 3D view
    100100    private common settings_      ;# Array used for checkbuttons and radiobuttons
    101     private variable initialized_
    102101    private common hardcopy_
     102    private variable headings_
    103103}
    104104
     
    161161        rename -highlightbackground -controlbackground controlBackground Background
    162162    }
    163     pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
     163    pack $itk_component(reset) -side top -padx 1 -pady { 4 0 }
    164164    Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
    165165
     
    174174        rename -highlightbackground -controlbackground controlBackground Background
    175175    }
    176     pack $itk_component(zoomin) -side top -padx 2 -pady { 2 0 }
     176    pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 }
    177177    Rappture::Tooltip::for $itk_component(zoomin) "Zoom in"
    178178
     
    187187        rename -highlightbackground -controlbackground controlBackground Background
    188188    }
    189     pack $itk_component(zoomout) -side top -padx 2 -pady { 2 0 }
     189    pack $itk_component(zoomout) -side top -padx 1 -pady { 4 }
    190190    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    191191
    192     itk_component add settings_button {
    193         label $itk_component(controls).settingsbutton \
    194             -borderwidth 1 -padx 1 -pady 1 \
    195             -relief "raised" -image [Rappture::icon wrench]
    196     } {
    197         usual
    198         ignore -borderwidth
    199         rename -highlightbackground -controlbackground controlBackground \
    200             Background
    201     }
    202     pack $itk_component(settings_button) -padx 2 -pady { 0 2 } \
    203         -ipadx 1 -ipady 1
    204     Rappture::Tooltip::for $itk_component(settings_button) \
    205         "Configure settings"
    206     bind $itk_component(settings_button) <ButtonPress> \
    207         [itcl::code $this drawer toggle settings]
    208     pack $itk_component(settings_button) -side bottom \
    209         -padx 2 -pady 2 -anchor e
    210 
    211     itk_component add camera_button {
    212         label $itk_component(controls).camerabutton \
    213             -borderwidth 1 -padx 1 -pady 1 \
    214             -relief "raised" -image [Rappture::icon camera]
    215     } {
    216         usual
    217         ignore -borderwidth
    218         rename -highlightbackground -controlbackground controlBackground \
    219             Background
    220     }
    221     Rappture::Tooltip::for $itk_component(camera_button) \
    222         "Camera settings"
    223     bind $itk_component(camera_button) <ButtonPress> \
    224         [itcl::code $this drawer toggle camera]
    225     pack $itk_component(camera_button) -side bottom \
    226         -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
    227 
    228     _BuildSettingsDrawer
    229     _BuildCameraDrawer
     192    _BuildViewTab
     193    _BuildCameraTab
    230194
    231195    # Legend
    232196    set _image(legend) [image create photo]
    233197    itk_component add legend {
    234         canvas $itk_component(area).legend -width 30 -highlightthickness 0
     198        canvas $itk_component(plotarea).legend -width 30 -highlightthickness 0
    235199    } {
    236200        usual
     
    238202        rename -background -plotbackground plotBackground Background
    239203    }
    240     pack $itk_component(legend) -side right -fill y
    241     pack $itk_component(3dview) -side left -expand yes -fill both
     204    set w [expr [winfo reqwidth $itk_component(hull)] - 80]
     205    pack forget $itk_component(3dview)
     206    pack $itk_component(3dview) -side left -fill both -expand yes
     207    pack $itk_component(legend) -side left -fill y
     208
    242209    bind $itk_component(legend) <Configure> \
    243210        [list $_dispatcher event -idle !legend]
     
    293260    }
    294261
     262    $itk_component(scroller) contents $itk_component(view_canvas)
     263    $itk_component(title) configure -text "$headings_(view)"
    295264    set _image(download) [image create photo]
    296 
    297265    eval itk_initialize $args
    298 
    299266    Connect
    300267}
     
    483450        coming {
    484451            if {[catch {
    485                 blt::winop snap $itk_component(area) $_image(download)
     452                blt::winop snap $itk_component(plotarea) $_image(download)
    486453            }]} {
    487454                $_image(download) configure -width 1 -height 1
     
    985952        "legend" {
    986953            if { $settings_($this-legend) } {
    987                 pack $itk_component(legend) -side right -fill y
     954                pack $itk_component(legend) -side left -fill y
    988955            } else {
    989                 pack forget $itk_component(legend) 
     956                pack forget $itk_component(legend)
    990957            }
    991958            set lineht [expr [font metrics $itk_option(-font) -linespace] + 4]
     
    11611128}
    11621129
    1163 itcl::body Rappture::HeightmapViewer::_BuildSettingsDrawer {} {
    1164 
    1165     itk_component add settings {
    1166         Rappture::Scroller $itk_component(drawer).scrl \
    1167             -xscrollmode auto -yscrollmode auto \
    1168             -width 200 -height 100
    1169     }
    1170 
    1171     itk_component add settings_canvas {
    1172         canvas $itk_component(settings).canvas -highlightthickness 0
    1173     }
    1174     $itk_component(settings) contents $itk_component(settings_canvas)
    1175 
    1176     itk_component add settings_frame {
    1177         frame $itk_component(settings_canvas).frame -bg white \
     1130itcl::body Rappture::HeightmapViewer::_BuildViewTab {} {
     1131
     1132    itk_component add view_canvas {
     1133        canvas $itk_component(scroller).viewcanvas -highlightthickness 0
     1134    } {
     1135        ignore -highlightthickness
     1136    }
     1137    $itk_component(sidebar) insert end "view" \
     1138        -image [Rappture::icon wrench] -text "" -padx 0 -pady 0 \
     1139        -ipadx 0 -ipady 0 \
     1140        -command [itcl::code $this tab select "view"]
     1141
     1142    set headings_(view) "View Settings"
     1143
     1144    itk_component add view_frame {
     1145        frame $itk_component(view_canvas).frame \
    11781146            -highlightthickness 0
    1179     }
    1180     $itk_component(settings_canvas) create window 0 0 \
    1181         -anchor nw -window $itk_component(settings_frame)
    1182     bind $itk_component(settings_frame) <Configure> \
    1183         [itcl::code $this drawer resize settings]
     1147    } {
     1148        ignore -background
     1149    }
     1150    $itk_component(view_canvas) create window 0 0 \
     1151        -anchor nw -window $itk_component(view_frame)
     1152    bind $itk_component(view_frame) <Configure> \
     1153        [itcl::code $this tab resize view]
    11841154
    11851155    set fg [option get $itk_component(hull) font Font]
    11861156
    1187     set inner $itk_component(settings_frame)
     1157    set inner $itk_component(view_frame)
    11881158
    11891159    foreach { key value } {
     
    11961166        set settings_($this-$key) $value
    11971167    }
    1198     set inner $itk_component(settings_frame)
    1199     label $inner.title -text "View Settings" -font "Arial 10 bold"
     1168    set inner $itk_component(view_frame)
    12001169    checkbutton $inner.grid \
    12011170        -text "grid" \
     
    12261195
    12271196    blt::table $inner \
    1228         0,0 $inner.title -anchor w -columnspan 2 \
    12291197        1,1 $inner.grid -anchor w  \
    12301198        2,1 $inner.axes -anchor w \
     
    12331201        5,1 $inner.legend -anchor w
    12341202
    1235     blt::table configure $inner c0 -resize expand -width 2
    12361203    blt::table configure $inner c2 -resize expand
    12371204    blt::table configure $inner c1 -resize none
     
    12391206}
    12401207
    1241 itcl::body Rappture::HeightmapViewer::_BuildCameraDrawer {} {
    1242 
    1243     itk_component add camera {
    1244         Rappture::Scroller $itk_component(drawer).camerascrl \
    1245             -xscrollmode auto -yscrollmode auto \
    1246             -highlightthickness 0
    1247     }
     1208itcl::body Rappture::HeightmapViewer::_BuildCameraTab {} {
    12481209
    12491210    itk_component add camera_canvas {
    1250         canvas $itk_component(camera).canvas -highlightthickness 0
     1211        canvas $itk_component(scroller).cameracanvas -highlightthickness 0
    12511212    } {
    12521213        ignore -highlightthickness
    12531214    }
    1254     $itk_component(camera) contents $itk_component(camera_canvas)
     1215    $itk_component(sidebar) insert end "camera" \
     1216        -image [Rappture::icon camera] -text ""  -padx 0 -pady 0 \
     1217        -ipadx 0 -ipady 0 \
     1218        -command [itcl::code $this tab select "camera"]
     1219    set headings_(camera) "Camera Settings"
    12551220
    12561221    itk_component add camera_frame {
    12571222        frame $itk_component(camera_canvas).frame \
    1258             -highlightthickness 0
    1259     }
     1223            -highlightthickness 0
     1224    } {
     1225        usual
     1226        ignore -background
     1227    }
    12601228    $itk_component(camera_canvas) create window 0 0 \
    12611229        -anchor nw -window $itk_component(camera_frame)
    12621230    bind $itk_component(camera_frame) <Configure> \
    1263         [itcl::code $this drawer resize camera]
     1231        [itcl::code $this tab resize camera]
    12641232
    12651233    set inner $itk_component(camera_frame)
    12661234
    1267     label $inner.title -text "Camera Settings" -font "Arial 10 bold"
    1268 
    12691235    set labels { phi theta psi pan-x pan-y zoom }
    1270     blt::table $inner \
    1271         0,0 $inner.title -anchor w  -columnspan 4
    12721236    set row 1
    12731237    foreach tag $labels {
     
    12821246        incr row
    12831247    }
    1284     bind $inner.title <Shift-ButtonPress> \
    1285         [itcl::code $this camera show]
    1286     blt::table configure $inner c0 -resize expand -width 4
    12871248    blt::table configure $inner c1 c2 -resize none
    12881249    blt::table configure $inner c3 -resize expand
     
    12901251}
    12911252
    1292 itcl::body Rappture::HeightmapViewer::drawer { what who } {
     1253itcl::body Rappture::HeightmapViewer::tab { what who } {
    12931254    switch -- ${what} {
    1294         "activate" {
    1295             $itk_component(drawer) add $itk_component($who) -sticky nsew
    1296             after idle [list focus $itk_component($who)]
    1297             if { ![info exists initialized_($who)] } {
    1298                 set w [winfo width $itk_component(drawer)]
    1299                 set x [expr $w - 120]
    1300                 $itk_component(drawer) sash place 0 $x 0
    1301                 set initialized_($who) 1
    1302             }
    1303             $itk_component(${who}_button) configure -relief sunken
    1304         }
    1305         "deactivate" {
    1306             $itk_component(drawer) forget $itk_component($who)
    1307             $itk_component(${who}_button) configure -relief raised
    1308         }
    1309         "toggle" {
    1310             set slaves [$itk_component(drawer) panes]
    1311             if { [lsearch $slaves $itk_component($who)] >= 0 } {
    1312                 drawer deactivate $who
    1313             } else {
    1314                 drawer activate $who
    1315             }
     1255        "select" {
     1256            $itk_component(scroller) contents $itk_component(${who}_canvas)
     1257            after idle [list focus $itk_component(${who}_canvas)]
     1258            $itk_component(title) configure -text "$headings_($who)"
     1259            drawer open
     1260        }
     1261        "deselect" {
     1262            drawer close
    13161263        }
    13171264        "resize" {
Note: See TracChangeset for help on using the changeset viewer.