Changeset 2653
- Timestamp:
- Nov 3, 2011, 12:50:14 PM (13 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r2616 r2653 503 503 itcl::body Rappture::Field::hints {{keyword ""}} { 504 504 foreach {key path} { 505 group about.group 506 label about.label 507 color about.color 508 style about.style 509 scale about.scale 510 seeds about.seeds 511 scalars about.scalars 512 vectors about.vectors 513 default about.default 514 units units 515 updir updir 516 camera camera.position 517 type about.type 505 camera camera.position 506 color about.color 507 default about.default 508 group about.group 509 label about.label 510 scalars about.scalars 511 scale about.scale 512 seeds about.seeds 513 style about.style 514 toolId tool.id 515 toolName tool.name 516 toolRevision tool.version.application.revision 517 type about.type 518 units units 519 updir updir 520 vectors about.vectors 518 521 } { 519 522 set str [$_field get $path] -
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r2652 r2653 1047 1047 } 1048 1048 1049 if 0 { 1050 # Tell the server the name of the tool, the version, and dataset 1051 # that we are rendering. Have to do it here because we don't know 1052 # what data objects are using the renderer until be get here. 1053 set args "" 1054 lappend args tool [$_first hints toolId] 1055 lappend args version [$_first hints toolRevision] 1056 lappend args dataset [$_first hints label] 1057 SendCmd "clientinfo $args" 1058 } 1059 1049 1060 foreach axis { x y z } { 1050 1061 set label [$_first hints ${axis}label] -
trunk/gui/scripts/xyprint.tcl
r2006 r2653 74 74 private method GetAxisType { axis } 75 75 private method restore { toolName plotName data } 76 77 # Same dialog may be used for different graphs 76 78 private common _settings 77 private common _fonts78 79 private common _wait 79 80 } … … 99 100 ignore -highlightthickness -borderwidth -background 100 101 } 102 set inner [frame $itk_interior.frame -bg grey] 101 103 itk_component add preview { 102 label $i tk_interior.preview \104 label $inner.preview \ 103 105 -highlightthickness 0 -bd 0 -image $_preview -width 2.5i \ 104 -height 2. 25i -background grey -padx 10 -pady 10106 -height 2.5i -background grey 105 107 } { 106 108 ignore -background … … 121 123 } 122 124 blt::table $itk_interior \ 123 0,0 $itk_component(preview) -cspan 2 -fill both \ 124 1,0 $itk_component(tabs) -fill both -cspan 2 \ 125 2,1 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \ 126 2,0 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 127 blt::table configure $itk_interior r1 -resize none 128 blt::table configure $itk_interior r1 -resize both 129 125 0,0 $inner -fill both \ 126 0,1 $itk_component(tabs) -fill both -cspan 2 \ 127 1,2 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \ 128 1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 129 blt::table $inner \ 130 0,0 $itk_component(preview) -fill both -padx 10 -pady 10 131 132 #blt::table configure $itk_interior c1 c2 -resize none 133 blt::table configure $itk_interior c0 -resize both 130 134 BuildGeneralTab 131 135 BuildAxisTab … … 148 152 set _clone "" 149 153 set _graph "" 150 foreach font [array names _fonts] {151 font delete $font152 }153 array unset _fonts154 154 } 155 155 … … 358 358 set _settings($this-layout-width) [Pixels2Inches [$_clone cget -width]] 359 359 set _settings($this-layout-height) [Pixels2Inches [$_clone cget -height]] 360 set _fonts(legend) [font create legend \ 361 -family helvetica -size 10 -weight normal] 362 update 360 361 set _settings($this-legend-fontfamily) helvetica 362 set _settings($this-legend-fontsize) 10 363 set _settings($this-legend-fontweight) normal 364 set _settings($this-legend-fontslant) roman 365 set font "helvetica 10 normal roman" 363 366 $_clone legend configure \ 364 367 -position right \ 365 -font $ _fonts(legend)\368 -font $font \ 366 369 -hide yes -borderwidth 0 -background white -relief solid \ 367 370 -anchor nw -activeborderwidth 0 368 371 # 372 set _settings($this-axis-ticks-fontfamily) helvetica 373 set _settings($this-axis-ticks-fontsize) 10 374 set _settings($this-axis-ticks-fontweight) normal 375 set _settings($this-axis-ticks-fontslant) roman 376 set _settings($this-axis-title-fontfamily) helvetica 377 set _settings($this-axis-title-fontsize) 10 378 set _settings($this-axis-title-fontweight) normal 379 set _settings($this-axis-title-fontslant) roman 369 380 foreach axis [$_clone axis names] { 370 381 if { [$_clone axis cget $axis -hide] } { 371 382 continue 372 383 } 373 set _fonts($axis-ticks) [font create $axis-ticks \ 374 -family helvetica -size 10 \ 375 -weight normal -slant roman] 376 set _fonts($axis-title) [font create $axis-title \ 377 -family helvetica -size 10 \ 378 -weight normal -slant roman] 379 update 384 set _settings($this-$axis-ticks-fontfamily) helvetica 385 set _settings($this-$axis-ticks-fontsize) 10 386 set _settings($this-$axis-ticks-fontweight) normal 387 set _settings($this-$axis-ticks-fontslant) roman 388 set _settings($this-$axis-title-fontfamily) helvetica 389 set _settings($this-$axis-title-fontsize) 10 390 set _settings($this-$axis-title-fontweight) normal 391 set _settings($this-$axis-title-fontslant) roman 392 set tickfont "helvetica 10 normal roman" 393 set titlefont "helvetica 10 normal roman" 380 394 $_clone axis configure $axis -ticklength 5 \ 381 395 -majorticks {} -minorticks {} 382 396 $_clone axis configure $axis \ 383 -tickfont $ _fonts($axis-ticks)\384 -titlefont $ _fonts($axis-title)397 -tickfont $tickfont \ 398 -titlefont $titlefont 385 399 } 386 400 foreach elem [$_clone element names] { … … 395 409 396 410 itcl::body Rappture::XyPrint::SetOption { opt } { 397 set new $_settings($this -graph$opt)411 set new $_settings($this$opt) 398 412 set old [$_clone cget $opt] 399 413 set code [catch [list $_clone configure $opt $new] err] … … 402 416 global errorInfo 403 417 puts stderr "$err: $errorInfo" 404 set _settings($this -graph$opt) $old418 set _settings($this$opt) $old 405 419 $_clone configure $opt $old 406 420 } … … 438 452 set w [Inches2Pixels $_settings($this-layout-width) 3.4] 439 453 set h [Inches2Pixels $_settings($this-layout-height) 3.4] 454 $_clone snap $img -width $w -height $h 455 440 456 set pixelsPerInch [winfo pixels . 1i] 441 set sx [expr 2.5*$pixelsPerInch/$w] 442 set sy [expr 2.0*$pixelsPerInch/$h] 457 set cw [winfo width $itk_component(preview)] 458 set ch [winfo height $itk_component(preview)] 459 set rw [expr 2.5*$pixelsPerInch] 460 set rh [expr 2.5*$pixelsPerInch] 461 set maxwidth $rw 462 set maxheight $rh 463 if { $maxwidth > $cw } { 464 set maxwidth $cw 465 } 466 if { $maxheight > $ch } { 467 set maxheight $ch 468 } 469 set sx [expr double($maxwidth)/$w] 470 set sy [expr double($maxheight)/$h] 443 471 set s [expr min($sx,$sy)] 444 $_clone snap $img -width $w -height $h 445 446 if 0 { 447 if { ![winfo exists .labeltest] } { 448 toplevel .labeltest -bg red 449 label .labeltest.label -image $img 450 pack .labeltest.label -fill both 451 } 452 } 472 453 473 set pw [expr int(round($s * $w))] 454 474 set ph [expr int(round($s * $h))] 455 $_preview configure -width $pw -height $ph 456 if 0 { 457 .labeltest.label configure -image $img 458 } 475 $_preview configure -width $pw -height $ph 459 476 blt::winop resample $img $_preview box 460 477 image delete $img … … 501 518 foreach option { -min -max -loose -title -stepsize -subdivisions } { 502 519 set _settings($this-axis$option) [$_clone axis cget $axis $option] 520 } 521 foreach attr { fontfamily fontsize fontweight fontslant } { 522 set specific $this-$axis-ticks 523 set general $this-axis-ticks 524 set _settings(${general}-${attr}) $_settings(${specific}-${attr}) 525 set specific $this-$axis-title 526 set general $this-axis-title 527 set _settings(${general}-${attr}) $_settings(${specific}-${attr}) 503 528 } 504 529 set type [GetAxisType $axis] … … 676 701 set _settings($this-legend-anchor) [$page.anchor current] 677 702 if { $_clone != "" } { 678 font configure $_fonts(legend) \ 679 -family $_settings($this-legend-font-family) \ 680 -size $_settings($this-legend-font-size) \ 681 -weight $_settings($this-legend-font-weight) \ 682 -slant $_settings($this-legend-font-slant) 703 lappend font $_settings($this-legend-fontfamily) 704 lappend font $_settings($this-legend-fontsize) 705 lappend font $_settings($this-legend-fontweight) 706 lappend font $_settings($this-legend-fontslant) 683 707 foreach option { -hide -position -anchor -borderwidth } { 684 708 SetComponentOption legend $option 685 709 } 686 $_clone legend configure -font fixed -font $ _fonts(legend)710 $_clone legend configure -font fixed -font $font 687 711 } 688 712 ApplyElementSettings … … 836 860 837 861 Rappture::PushButton $page.fontweight \ 838 -width 18 -height 18 \839 862 -onimage [Rappture::icon font-bold] \ 840 863 -offimage [Rappture::icon font-bold] \ 841 864 -onvalue "bold" -offvalue "normal" \ 842 865 -command [itcl::code $this ApplyLegendSettings] \ 843 -variable [itcl::scope _settings($this-legend-font -weight)]866 -variable [itcl::scope _settings($this-legend-fontweight)] 844 867 Rappture::Tooltip::for $page.fontweight \ 845 868 "Use the bold version of the font." 846 869 847 870 Rappture::PushButton $page.fontslant \ 848 -width 18 -height 18 \849 871 -onimage [Rappture::icon font-italic] \ 850 872 -offimage [Rappture::icon font-italic] \ 851 873 -onvalue "italic" -offvalue "roman" \ 852 874 -command [itcl::code $this ApplyLegendSettings] \ 853 -variable [itcl::scope _settings($this-legend-font -slant)]875 -variable [itcl::scope _settings($this-legend-fontslant)] 854 876 Rappture::Tooltip::for $page.fontslant \ 855 877 "Use the italic version of the font." … … 878 900 879 901 blt::table configure $page r* -resize none -pady { 0 2 } 902 blt::table configure $page c3 c4 -resize none 880 903 blt::table configure $page r8 -resize both 881 904 … … 989 1012 990 1013 Rappture::PushButton $page.tickfontweight \ 991 -width 18 -height 18 \992 1014 -onimage [Rappture::icon font-bold] \ 993 1015 -offimage [Rappture::icon font-bold] \ 994 1016 -onvalue "bold" -offvalue "normal" \ 995 1017 -command [itcl::code $this ApplyAxisSettings] \ 996 -variable [itcl::scope _settings($this-axis-tick font-weight)]1018 -variable [itcl::scope _settings($this-axis-ticks-fontweight)] 997 1019 Rappture::Tooltip::for $page.tickfontweight \ 998 1020 "Use the bold version of the tick font." 999 1021 1000 1022 Rappture::PushButton $page.tickfontslant \ 1001 -width 18 -height 18 \1002 1023 -onimage [Rappture::icon font-italic] \ 1003 1024 -offimage [Rappture::icon font-italic] \ 1004 1025 -onvalue "italic" -offvalue "roman" \ 1005 1026 -command [itcl::code $this ApplyAxisSettings] \ 1006 -variable [itcl::scope _settings($this-axis-tick font-slant)]1027 -variable [itcl::scope _settings($this-axis-ticks-fontslant)] 1007 1028 Rappture::Tooltip::for $page.tickfontslant \ 1008 1029 "Use the italic version of the tick font." … … 1036 1057 1037 1058 Rappture::PushButton $page.titlefontweight \ 1038 -width 18 -height 18 \1039 1059 -onimage [Rappture::icon font-bold] \ 1040 1060 -offimage [Rappture::icon font-bold] \ 1041 1061 -onvalue "bold" -offvalue "normal" \ 1042 1062 -command [itcl::code $this ApplyAxisSettings] \ 1043 -variable [itcl::scope _settings($this-axis-title font-weight)]1063 -variable [itcl::scope _settings($this-axis-title-fontweight)] 1044 1064 Rappture::Tooltip::for $page.titlefontweight \ 1045 1065 "Use the bold version of the title font." 1046 1066 1047 1067 Rappture::PushButton $page.titlefontslant \ 1048 -width 18 -height 18 \1049 1068 -onimage [Rappture::icon font-italic] \ 1050 1069 -offimage [Rappture::icon font-italic] \ 1051 1070 -onvalue "italic" -offvalue "roman" \ 1052 1071 -command [itcl::code $this ApplyAxisSettings] \ 1053 -variable [itcl::scope _settings($this-axis-title font-slant)]1072 -variable [itcl::scope _settings($this-axis-title-fontslant)] 1054 1073 Rappture::Tooltip::for $page.titlefontslant \ 1055 1074 "Use the italic version of the title font." … … 1084 1103 8,4 $page.plotpad -fill both -cspan 3 1085 1104 1086 blt::table configure $page c0 c 7 c8 -resize none1105 blt::table configure $page c0 c4 c5 c6 c7 c8 -resize none 1087 1106 } 1088 1107 … … 1095 1114 set _settings($this-legend-position) [$page.position current] 1096 1115 set _settings($this-legend-anchor) [$page.anchor current] 1097 1116 1098 1117 foreach option { -hide -position -anchor -borderwidth } { 1099 1118 SetComponentOption legend $option 1100 1119 } 1101 font configure $_fonts(legend) \ 1102 -family [$page.fontfamily current] \ 1103 -size [$page.fontsize current] \ 1104 -weight $_settings($this-legend-font-weight) \ 1105 -slant $_settings($this-legend-font-slant) 1106 $_clone legend configure -font fixed -font $_fonts(legend) 1120 lappend font $_settings($this-legend-fontfamily) 1121 lappend font $_settings($this-legend-fontsize) 1122 lappend font $_settings($this-legend-fontweight) 1123 lappend font $_settings($this-legend-fontslant) 1124 $_clone legend configure -font fixed -font $font 1107 1125 ApplyElementSettings 1108 1126 } … … 1121 1139 SetNamedComponentOption axis $axis $option 1122 1140 } 1141 set tickfont {} 1142 set titlefont {} 1143 foreach attr { fontfamily fontsize fontweight fontslant } { 1144 set specific $this-$axis-ticks 1145 set general $this-axis-ticks 1146 set _settings(${specific}-${attr}) $_settings(${general}-${attr}) 1147 lappend tickfont $_settings(${general}-${attr}) 1148 set specific $this-$axis-title 1149 set general $this-axis-title 1150 set _settings(${specific}-${attr}) $_settings(${general}-${attr}) 1151 lappend titlefont $_settings(${general}-${attr}) 1152 } 1153 $_clone axis configure $axis -tickfont $tickfont -titlefont $titlefont 1123 1154 $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) 1124 font configure $axis-title \1125 -family [$page.titlefontfamily current] \1126 -size [$page.titlefontsize current] \1127 -weight $_settings($this-axis-titlefont-weight) \1128 -slant $_settings($this-axis-titlefont-slant)1129 font configure $axis-ticks \1130 -family [$page.tickfontfamily current] \1131 -size [$page.tickfontsize current] \1132 -weight $_settings($this-axis-tickfont-weight) \1133 -slant $_settings($this-axis-tickfont-slant)1134 $_clone axis configure $axis -tickfont $axis-ticks -titlefont $axis-title1135 1155 GetAxis 1136 1156 RegeneratePreview … … 1215 1235 set _settings($this-legend-borderwidth) 0 1216 1236 1217 array unset info 1218 array set info [font configure legend] 1219 $page.fontfamily value $info(-family) 1220 $page.fontsize value $info(-size) 1221 set _settings($this-legend-font-weight) $info(-weight) 1222 set _settings($this-legend-font-slant) $info(-slant) 1223 if { $info(-weight) == "bold" } { 1237 $page.fontfamily value $_settings($this-legend-fontfamily) 1238 $page.fontsize value $_settings($this-legend-fontsize) 1239 if { $_settings($this-legend-fontweight) == "bold" } { 1224 1240 set _settings($this-legend-font-bold) 1 1225 1241 } … … 1244 1260 set axis [lindex $names 0] 1245 1261 1246 array set info [font configure $axis-title] 1247 $page.titlefontfamily value $info(-family) 1248 $page.titlefontsize value $info(-size) 1249 set _settings($this-axis-titlefont-weight) $info(-weight) 1250 set _settings($this-axis-titlefont-slant) $info(-slant) 1251 1252 array set info [font configure $axis-ticks] 1253 $page.tickfontfamily value $info(-family) 1254 $page.tickfontsize value $info(-size) 1255 set _settings($this-axis-tickfont-weight) $info(-weight) 1256 set _settings($this-axis-tickfont-slant) $info(-slant) 1262 $page.titlefontfamily value $_settings($this-$axis-title-fontfamily) 1263 $page.titlefontsize value $_settings($this-axis-title-fontsize) 1264 $page.tickfontfamily value $_settings($this-$axis-ticks-fontfamily) 1265 $page.tickfontsize value $_settings($this-axis-ticks-fontsize) 1257 1266 1258 1267 # Always hide the zero line. … … 1284 1293 set parser [interp create -safe] 1285 1294 $parser alias xyprint [itcl::code $this restore] 1286 $parser alias font font1287 1295 set f [open $_settingsFile "r"] 1288 1296 set code [read $f] … … 1297 1305 $parser eval $_savedSettings($key) 1298 1306 } 1299 foreach {name value} [$parser eval "array get general"] { 1300 set _settings($this-graph-$name) $value 1307 # Restore settings to this instance 1308 foreach {name value} [$parser eval "array get settings"] { 1309 set _settings($this-$name) $value 1301 1310 } 1302 1311 interp delete $parser … … 1338 1347 # Create stanza associated with tool and plot title. 1339 1348 # General settings 1340 append out " set general(format) $_settings($this-general-format)\n" 1341 append out " set general(style) $_settings($this-general-style)\n" 1342 1343 foreach font [array names _fonts] { 1344 append out " font configure $font" 1345 array unset info 1346 array set info [font configure $font] 1347 foreach opt { -family -size -weight -slant } { 1348 set value [list $info($opt)] 1349 append out " $opt $value" 1350 } 1351 append out "\n" 1352 } 1349 set length [string length "${this}-"] 1350 append out " array set settings {\n" 1351 foreach item [array names _settings ${this}-*] { 1352 set field [string range $item $length end] 1353 if { [regexp {^element-[0-9]+$} $field] } { 1354 continue 1355 } 1356 set value $_settings($item) 1357 append out " [list $field] [list $value]\n" 1358 } 1359 append out " }\n" 1360 # Legend font 1361 lappend legendfont $_settings($this-legend-fontfamily) 1362 lappend legendfont $_settings($this-legend-fontsize) 1363 lappend legendfont $_settings($this-legend-fontweight) 1364 lappend legendfont $_settings($this-legend-fontslant) 1365 # Axis tick font 1366 lappend axistickfont $_settings($this-axis-ticks-fontfamily) 1367 lappend axistickfont $_settings($this-axis-ticks-fontsize) 1368 lappend axistickfont $_settings($this-axis-ticks-fontweight) 1369 lappend axistickfont $_settings($this-axis-ticks-fontslant) 1370 # Axis title font 1371 lappend axistitlefont $_settings($this-axis-title-fontfamily) 1372 lappend axistitlefont $_settings($this-axis-title-fontsize) 1373 lappend axistitlefont $_settings($this-axis-title-fontweight) 1374 lappend axistitlefont $_settings($this-axis-title-fontslant) 1353 1375 append out "\n" 1354 1376 … … 1368 1390 append out " $opt $value" 1369 1391 } 1370 append out " -font legend\n"1392 append out " -font \"$legendfont\"\n" 1371 1393 1372 1394 # Element settings … … 1401 1423 append out " $opt $value" 1402 1424 } 1403 append out " -tickfont \"$axis -ticks\""1404 append out " -titlefont \"$axis -title\"\n"1425 append out " -tickfont \"$axistickfont\"" 1426 append out " -titlefont \"$axistitlefont\"\n" 1405 1427 set hide [$_clone marker cget ${axis}-zero -hide] 1406 1428 append out " preview marker configure \"${axis}-zero\" -hide $hide\n"
Note: See TracChangeset
for help on using the changeset viewer.