Changeset 1373 for trunk/gui/scripts/heightmapviewer.tcl
- Timestamp:
- Apr 1, 2009, 4:55:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/heightmapviewer.tcl
r1349 r1373 62 62 # do nothing 63 63 } 64 public method drawer{what who}64 public method tab {what who} 65 65 public method camera {option args} 66 66 protected method Connect {} … … 71 71 protected method ReceiveImage { args } 72 72 private method _ReceiveLegend {tf vmin vmax size} 73 private method _Build SettingsDrawer{}74 private method _BuildCamera Drawer{}73 private method _BuildViewTab {} 74 private method _BuildCameraTab {} 75 75 private method _PanCamera {} 76 76 protected method _receive_echo {channel {data ""}} … … 99 99 private variable view_ ;# view params for 3D view 100 100 private common settings_ ;# Array used for checkbuttons and radiobuttons 101 private variable initialized_102 101 private common hardcopy_ 102 private variable headings_ 103 103 } 104 104 … … 161 161 rename -highlightbackground -controlbackground controlBackground Background 162 162 } 163 pack $itk_component(reset) -side top -padx 2 -pady { 20 }163 pack $itk_component(reset) -side top -padx 1 -pady { 4 0 } 164 164 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 165 165 … … 174 174 rename -highlightbackground -controlbackground controlBackground Background 175 175 } 176 pack $itk_component(zoomin) -side top -padx 2 -pady { 20 }176 pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 } 177 177 Rappture::Tooltip::for $itk_component(zoomin) "Zoom in" 178 178 … … 187 187 rename -highlightbackground -controlbackground controlBackground Background 188 188 } 189 pack $itk_component(zoomout) -side top -padx 2 -pady { 2 0}189 pack $itk_component(zoomout) -side top -padx 1 -pady { 4 } 190 190 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 191 191 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 230 194 231 195 # Legend 232 196 set _image(legend) [image create photo] 233 197 itk_component add legend { 234 canvas $itk_component( area).legend -width 30 -highlightthickness 0198 canvas $itk_component(plotarea).legend -width 30 -highlightthickness 0 235 199 } { 236 200 usual … … 238 202 rename -background -plotbackground plotBackground Background 239 203 } 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 242 209 bind $itk_component(legend) <Configure> \ 243 210 [list $_dispatcher event -idle !legend] … … 293 260 } 294 261 262 $itk_component(scroller) contents $itk_component(view_canvas) 263 $itk_component(title) configure -text "$headings_(view)" 295 264 set _image(download) [image create photo] 296 297 265 eval itk_initialize $args 298 299 266 Connect 300 267 } … … 483 450 coming { 484 451 if {[catch { 485 blt::winop snap $itk_component( area) $_image(download)452 blt::winop snap $itk_component(plotarea) $_image(download) 486 453 }]} { 487 454 $_image(download) configure -width 1 -height 1 … … 985 952 "legend" { 986 953 if { $settings_($this-legend) } { 987 pack $itk_component(legend) -side right -fill y954 pack $itk_component(legend) -side left -fill y 988 955 } else { 989 pack forget $itk_component(legend) 956 pack forget $itk_component(legend) 990 957 } 991 958 set lineht [expr [font metrics $itk_option(-font) -linespace] + 4] … … 1161 1128 } 1162 1129 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 \ 1130 itcl::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 \ 1178 1146 -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] 1184 1154 1185 1155 set fg [option get $itk_component(hull) font Font] 1186 1156 1187 set inner $itk_component( settings_frame)1157 set inner $itk_component(view_frame) 1188 1158 1189 1159 foreach { key value } { … … 1196 1166 set settings_($this-$key) $value 1197 1167 } 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) 1200 1169 checkbutton $inner.grid \ 1201 1170 -text "grid" \ … … 1226 1195 1227 1196 blt::table $inner \ 1228 0,0 $inner.title -anchor w -columnspan 2 \1229 1197 1,1 $inner.grid -anchor w \ 1230 1198 2,1 $inner.axes -anchor w \ … … 1233 1201 5,1 $inner.legend -anchor w 1234 1202 1235 blt::table configure $inner c0 -resize expand -width 21236 1203 blt::table configure $inner c2 -resize expand 1237 1204 blt::table configure $inner c1 -resize none … … 1239 1206 } 1240 1207 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 } 1208 itcl::body Rappture::HeightmapViewer::_BuildCameraTab {} { 1248 1209 1249 1210 itk_component add camera_canvas { 1250 canvas $itk_component( camera).canvas -highlightthickness 01211 canvas $itk_component(scroller).cameracanvas -highlightthickness 0 1251 1212 } { 1252 1213 ignore -highlightthickness 1253 1214 } 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" 1255 1220 1256 1221 itk_component add camera_frame { 1257 1222 frame $itk_component(camera_canvas).frame \ 1258 -highlightthickness 0 1259 } 1223 -highlightthickness 0 1224 } { 1225 usual 1226 ignore -background 1227 } 1260 1228 $itk_component(camera_canvas) create window 0 0 \ 1261 1229 -anchor nw -window $itk_component(camera_frame) 1262 1230 bind $itk_component(camera_frame) <Configure> \ 1263 [itcl::code $this drawerresize camera]1231 [itcl::code $this tab resize camera] 1264 1232 1265 1233 set inner $itk_component(camera_frame) 1266 1234 1267 label $inner.title -text "Camera Settings" -font "Arial 10 bold"1268 1269 1235 set labels { phi theta psi pan-x pan-y zoom } 1270 blt::table $inner \1271 0,0 $inner.title -anchor w -columnspan 41272 1236 set row 1 1273 1237 foreach tag $labels { … … 1282 1246 incr row 1283 1247 } 1284 bind $inner.title <Shift-ButtonPress> \1285 [itcl::code $this camera show]1286 blt::table configure $inner c0 -resize expand -width 41287 1248 blt::table configure $inner c1 c2 -resize none 1288 1249 blt::table configure $inner c3 -resize expand … … 1290 1251 } 1291 1252 1292 itcl::body Rappture::HeightmapViewer:: drawer{ what who } {1253 itcl::body Rappture::HeightmapViewer::tab { what who } { 1293 1254 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 1316 1263 } 1317 1264 "resize" {
Note: See TracChangeset
for help on using the changeset viewer.