[1572] | 1 | |
---|
| 2 | # ---------------------------------------------------------------------- |
---|
| 3 | # COMPONENT: xyprint - Print X-Y plot. |
---|
| 4 | # |
---|
| 5 | # ====================================================================== |
---|
| 6 | # AUTHOR: Michael McLennan, Purdue University |
---|
| 7 | # Copyright (c) 2004-2005 Purdue Research Foundation |
---|
| 8 | # |
---|
| 9 | # See the file "license.terms" for information on usage and |
---|
| 10 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 11 | # ====================================================================== |
---|
[1588] | 12 | package require Itk |
---|
[1572] | 13 | package require BLT |
---|
| 14 | |
---|
[1593] | 15 | #option add *XyPrint.width 3i widgetDefault |
---|
| 16 | #option add *XyPrint.height 3i widgetDefault |
---|
| 17 | option add *XyPrint.gridColor #d9d9d9 widgetDefault |
---|
[1588] | 18 | option add *XyPrint.activeColor blue widgetDefault |
---|
| 19 | option add *XyPrint.dimColor gray widgetDefault |
---|
| 20 | option add *XyPrint.controlBackground gray widgetDefault |
---|
[1601] | 21 | option add *XyPrint*font "Arial 9" |
---|
[1588] | 22 | option add *XyPrint*Entry*width "6" widgetDefault |
---|
| 23 | option add *XyPrint*Entry*background "white" widgetDefault |
---|
| 24 | |
---|
| 25 | array set Rappture::axistypes { |
---|
| 26 | x x |
---|
| 27 | y y |
---|
| 28 | x2 x |
---|
| 29 | y2 y |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | itcl::class Rappture::XyPrint { |
---|
| 33 | inherit itk::Widget |
---|
| 34 | |
---|
[1589] | 35 | constructor {args} {} |
---|
[1572] | 36 | destructor {} |
---|
[1589] | 37 | |
---|
| 38 | private variable _graph ""; # Original graph. |
---|
[1588] | 39 | private variable _clone ""; # Cloned graph. |
---|
| 40 | private variable _preview ""; # Preview image. |
---|
[1598] | 41 | private variable _savedSettings; # Array of settings. |
---|
| 42 | |
---|
| 43 | public method print { graph toolName plotName } |
---|
[1572] | 44 | |
---|
| 45 | private method CopyOptions { cmd orig clone } |
---|
| 46 | private method CopyBindings { oper orig clone args } |
---|
| 47 | private method CloneGraph { orig } |
---|
[1588] | 48 | |
---|
[1593] | 49 | private method BuildGeneralTab {} |
---|
[1588] | 50 | private method BuildLayoutTab {} |
---|
| 51 | private method BuildLegendTab {} |
---|
| 52 | private method BuildAxisTab {} |
---|
| 53 | private method SetOption { opt } |
---|
| 54 | private method SetComponentOption { comp opt } |
---|
| 55 | private method SetNamedComponentOption { comp name opt } |
---|
| 56 | private method GetAxis {} |
---|
| 57 | private method GetElement { args } |
---|
| 58 | private method RegeneratePreview {} |
---|
| 59 | private method InitClone {} |
---|
| 60 | private method Pixels2Inches { pixels } |
---|
| 61 | private method Inches2Pixels { inches } |
---|
[1589] | 62 | |
---|
| 63 | private method ApplyGeneralSettings {} |
---|
| 64 | private method ApplyLegendSettings {} |
---|
| 65 | private method ApplyAxisSettings {} |
---|
| 66 | private method ApplyElementSettings {} |
---|
| 67 | private method ApplyLayoutSettings {} |
---|
| 68 | private method InitializeSettings {} |
---|
[1598] | 69 | private method CreateSettings { toolName plotName } |
---|
| 70 | private method RestoreSettings { toolName plotName } |
---|
| 71 | private method SaveSettings { toolName plotName } |
---|
[1593] | 72 | private method ResetSettings { } |
---|
| 73 | private method GetOutput {} |
---|
[1589] | 74 | private method Done { state } |
---|
[1591] | 75 | private method DestroySettings {} |
---|
[1598] | 76 | private method restore { toolName plotName data } |
---|
[1588] | 77 | private common _settings |
---|
[1601] | 78 | private common _fonts |
---|
[1589] | 79 | private common _wait |
---|
[1572] | 80 | } |
---|
| 81 | |
---|
| 82 | # ---------------------------------------------------------------------- |
---|
| 83 | # CONSTRUCTOR |
---|
| 84 | # ---------------------------------------------------------------------- |
---|
[1589] | 85 | itcl::body Rappture::XyPrint::constructor { args } { |
---|
[1588] | 86 | Rappture::dispatcher _dispatcher |
---|
| 87 | $_dispatcher register !rebuild |
---|
| 88 | $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" |
---|
| 89 | |
---|
| 90 | # option add hull.width hull.height |
---|
| 91 | # pack propagate $itk_component(hull) no |
---|
| 92 | |
---|
| 93 | set w [winfo pixels . 2.5i] |
---|
| 94 | set h [winfo pixels . 2i] |
---|
| 95 | set _preview [image create photo -width $w -height $h] |
---|
| 96 | itk_component add tabs { |
---|
| 97 | blt::tabset $itk_interior.tabs \ |
---|
| 98 | -highlightthickness 0 -tearoff 0 -side top \ |
---|
| 99 | -bd 0 -gap 0 -tabborderwidth 1 \ |
---|
| 100 | -outerpad 1 -background grey |
---|
| 101 | } { |
---|
| 102 | keep -cursor |
---|
| 103 | ignore -highlightthickness -borderwidth -background |
---|
| 104 | } |
---|
| 105 | itk_component add preview { |
---|
| 106 | label $itk_interior.preview \ |
---|
| 107 | -highlightthickness 0 -bd 0 -image $_preview -width 2.5i \ |
---|
| 108 | -height 2.25i -background grey -padx 10 -pady 10 |
---|
| 109 | } { |
---|
| 110 | ignore -background |
---|
| 111 | } |
---|
| 112 | itk_component add ok { |
---|
[1601] | 113 | button $itk_interior.ok -text "Save" \ |
---|
[1588] | 114 | -highlightthickness 0 \ |
---|
[1589] | 115 | -command [itcl::code $this Done 1] \ |
---|
[1588] | 116 | -compound left \ |
---|
| 117 | -image [Rappture::icon download] |
---|
| 118 | } |
---|
| 119 | itk_component add cancel { |
---|
| 120 | button $itk_interior.cancel -text "Cancel" \ |
---|
| 121 | -highlightthickness 0 \ |
---|
[1589] | 122 | -command [itcl::code $this Done 0] \ |
---|
[1588] | 123 | -compound left \ |
---|
[1595] | 124 | -image [Rappture::icon cancel] |
---|
[1588] | 125 | } |
---|
| 126 | blt::table $itk_interior \ |
---|
| 127 | 0,0 $itk_component(preview) -cspan 2 -fill both \ |
---|
| 128 | 1,0 $itk_component(tabs) -fill both -cspan 2 \ |
---|
[1595] | 129 | 2,1 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \ |
---|
| 130 | 2,0 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y |
---|
[1588] | 131 | blt::table configure $itk_interior r1 -resize none |
---|
| 132 | blt::table configure $itk_interior r1 -resize both |
---|
| 133 | |
---|
[1593] | 134 | BuildGeneralTab |
---|
[1588] | 135 | BuildAxisTab |
---|
| 136 | BuildLegendTab |
---|
| 137 | BuildLayoutTab |
---|
| 138 | eval itk_initialize $args |
---|
[1572] | 139 | } |
---|
| 140 | |
---|
[1588] | 141 | # ---------------------------------------------------------------------- |
---|
| 142 | # DESTRUCTOR |
---|
| 143 | # ---------------------------------------------------------------------- |
---|
[1593] | 144 | itcl::body Rappture::XyPrint::destructor {} { |
---|
[1588] | 145 | destroy $_clone |
---|
| 146 | image delete $_preview |
---|
| 147 | array unset _settings $this-* |
---|
| 148 | } |
---|
| 149 | |
---|
[1593] | 150 | itcl::body Rappture::XyPrint::DestroySettings {} { |
---|
[1590] | 151 | destroy $_clone |
---|
| 152 | array unset _settings $this-* |
---|
| 153 | set _clone "" |
---|
| 154 | set _graph "" |
---|
| 155 | } |
---|
| 156 | |
---|
[1589] | 157 | itcl::body Rappture::XyPrint::Done { state } { |
---|
| 158 | set _wait($this) $state |
---|
| 159 | } |
---|
[1588] | 160 | |
---|
[1598] | 161 | itcl::body Rappture::XyPrint::print { graph toolName plotName } { |
---|
[1590] | 162 | set _graph $graph |
---|
[1589] | 163 | set _clone [CloneGraph $graph] |
---|
| 164 | InitClone |
---|
| 165 | InitializeSettings |
---|
[1598] | 166 | # RestoreSettings $toolName $plotName |
---|
[1589] | 167 | set _wait($this) 0 |
---|
| 168 | tkwait variable [itcl::scope _wait($this)] |
---|
[1593] | 169 | set output "" |
---|
| 170 | if { $_wait($this) } { |
---|
| 171 | set output [GetOutput] |
---|
[1589] | 172 | } |
---|
[1598] | 173 | # SaveSettings $toolName $plotName |
---|
| 174 | DestroySettings |
---|
[1593] | 175 | return $output |
---|
[1589] | 176 | } |
---|
| 177 | |
---|
| 178 | itcl::body Rappture::XyPrint::GetOutput {} { |
---|
[1588] | 179 | # Get the selected format of the download. |
---|
| 180 | set page $itk_component(graph_page) |
---|
| 181 | set format [$page.format current] |
---|
| 182 | |
---|
| 183 | if { $format == "jpg" } { |
---|
| 184 | set img [image create photo] |
---|
| 185 | $_clone snap $img |
---|
| 186 | set bytes [$img data -format "jpeg -quality 100"] |
---|
| 187 | set bytes [Rappture::encoding::decode -as b64 $bytes] |
---|
| 188 | image delete $img |
---|
| 189 | return [list .jpg $bytes] |
---|
| 190 | } elseif { $format == "png" } { |
---|
| 191 | set img [image create photo] |
---|
| 192 | $_clone snap $img |
---|
| 193 | set bytes [$img data -format "png"] |
---|
| 194 | set bytes [Rappture::encoding::decode -as b64 $bytes] |
---|
| 195 | image delete $img |
---|
| 196 | return [list .png $bytes] |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | # Handle encapsulated postscript or portable document format. |
---|
| 200 | |
---|
| 201 | # Append an "i" for the graph postscript component. |
---|
| 202 | set w $_settings($this-layout-width)i |
---|
| 203 | set h $_settings($this-layout-height)i |
---|
| 204 | |
---|
| 205 | $_clone postscript configure \ |
---|
| 206 | -maxpect false \ |
---|
| 207 | -decoration yes \ |
---|
| 208 | -center yes \ |
---|
| 209 | -width $w -height $h |
---|
[1572] | 210 | |
---|
[1588] | 211 | set psdata [$_clone postscript output] |
---|
[1572] | 212 | |
---|
[1598] | 213 | if 1 { |
---|
| 214 | set f [open "junk.raw" "w"] |
---|
| 215 | puts -nonewline $f $psdata |
---|
| 216 | close $f |
---|
[1572] | 217 | } |
---|
[1598] | 218 | |
---|
| 219 | set cmd "" |
---|
| 220 | # | eps2eps << $psdata |
---|
| 221 | lappend cmd "|" "/usr/bin/gs" \ |
---|
| 222 | "-q" "-sDEVICE=epswrite" "-sstdout=%stderr" \ |
---|
| 223 | "-sOutputFile=-" "-dNOPAUSE" "-dBATCH" "-dSAFER" \ |
---|
| 224 | "-dDEVICEWIDTH=250000" "-dDEVICEHEIGHT=250000" "-" "<<" "$psdata" |
---|
| 225 | if { $format == "pdf" } { |
---|
| 226 | # | eps2eps << $psdata | ps2pdf |
---|
| 227 | lappend cmd "|" "/usr/bin/gs" \ |
---|
| 228 | "-q" "-sDEVICE=pdfwrite" "-sstdout=%stderr" \ |
---|
| 229 | "-sOutputFile=-" "-dNOPAUSE" "-dBATCH" "-dSAFER" \ |
---|
| 230 | "-dCompatibilityLevel=1.4" "-c" ".setpdfwrite" "-f" "-" |
---|
| 231 | } |
---|
[1588] | 232 | if { [catch { |
---|
| 233 | set f [open $cmd "r"] |
---|
| 234 | fconfigure $f -translation binary -encoding binary |
---|
| 235 | set output [read $f] |
---|
| 236 | close $f |
---|
| 237 | } err ] != 0 } { |
---|
| 238 | global errorInfo |
---|
| 239 | puts stderr "failed to generate file: $err\n$errorInfo" |
---|
| 240 | return "" |
---|
[1572] | 241 | } |
---|
[1593] | 242 | if 0 { |
---|
| 243 | set f [open "junk.$format" "w"] |
---|
| 244 | fconfigure $f -translation binary -encoding binary |
---|
| 245 | puts -nonewline $f $output |
---|
| 246 | close $f |
---|
| 247 | } |
---|
[1588] | 248 | return [list .$format $output] |
---|
[1572] | 249 | } |
---|
| 250 | |
---|
| 251 | itcl::body Rappture::XyPrint::CopyOptions { cmd orig clone } { |
---|
| 252 | set all [eval $orig $cmd] |
---|
| 253 | set configLine $clone |
---|
| 254 | foreach arg $cmd { |
---|
| 255 | lappend configLine $arg |
---|
| 256 | } |
---|
| 257 | foreach option $all { |
---|
| 258 | if { [llength $option] != 5 } { |
---|
| 259 | continue |
---|
| 260 | } |
---|
| 261 | set switch [lindex $option 0] |
---|
| 262 | set initial [lindex $option 3] |
---|
| 263 | set current [lindex $option 4] |
---|
| 264 | if { [string compare $initial $current] == 0 } { |
---|
| 265 | continue |
---|
| 266 | } |
---|
| 267 | lappend configLine $switch $current |
---|
| 268 | } |
---|
| 269 | eval $configLine |
---|
| 270 | } |
---|
| 271 | |
---|
| 272 | itcl::body Rappture::XyPrint::CloneGraph { orig } { |
---|
[1588] | 273 | set top $itk_interior |
---|
[1572] | 274 | set clone [blt::graph $top.graph] |
---|
| 275 | CopyOptions "configure" $orig $clone |
---|
| 276 | # Axis component |
---|
| 277 | foreach axis [$orig axis names] { |
---|
[1588] | 278 | if { [$orig axis cget $axis -hide] } { |
---|
| 279 | continue |
---|
| 280 | } |
---|
[1572] | 281 | if { [$clone axis name $axis] == "" } { |
---|
| 282 | $clone axis create $axis |
---|
| 283 | } |
---|
| 284 | CopyOptions [list axis configure $axis] $orig $clone |
---|
| 285 | } |
---|
| 286 | foreach axis { x y x2 y2 } { |
---|
| 287 | $clone ${axis}axis use [$orig ${axis}axis use] |
---|
| 288 | } |
---|
| 289 | # Pen component |
---|
| 290 | foreach pen [$orig pen names] { |
---|
| 291 | if { [$clone pen name $pen] == "" } { |
---|
| 292 | $clone pen create $pen |
---|
| 293 | } |
---|
| 294 | CopyOptions [list pen configure $pen] $orig $clone |
---|
| 295 | } |
---|
| 296 | # Marker component |
---|
| 297 | foreach marker [$orig marker names] { |
---|
| 298 | $clone marker create [$orig marker type $marker] -name $marker |
---|
| 299 | CopyBindings marker $orig $clone $marker |
---|
| 300 | CopyOptions [list marker configure $marker] $orig $clone |
---|
| 301 | } |
---|
| 302 | # Element component |
---|
| 303 | foreach elem [$orig element names] { |
---|
| 304 | $clone element create $elem |
---|
| 305 | CopyOptions [list element configure $elem] $orig $clone |
---|
| 306 | } |
---|
| 307 | # Fix element display list |
---|
| 308 | $clone element show [$orig element show] |
---|
| 309 | # Legend component |
---|
| 310 | CopyOptions {legend configure} $orig $clone |
---|
| 311 | # Postscript component |
---|
| 312 | CopyOptions {postscript configure} $orig $clone |
---|
| 313 | # Grid component |
---|
| 314 | CopyOptions {grid configure} $orig $clone |
---|
| 315 | # Grid component |
---|
| 316 | CopyOptions {crosshairs configure} $orig $clone |
---|
| 317 | return $clone |
---|
| 318 | } |
---|
[1588] | 319 | |
---|
| 320 | itcl::body Rappture::XyPrint::InitClone {} { |
---|
[1572] | 321 | |
---|
[1588] | 322 | $_clone configure -width 3.4i -height 3.4i -background white \ |
---|
| 323 | -borderwidth 0 \ |
---|
| 324 | -leftmargin 0 \ |
---|
| 325 | -rightmargin 0 \ |
---|
| 326 | -topmargin 0 \ |
---|
| 327 | -bottommargin 0 |
---|
| 328 | |
---|
| 329 | # Kill the title and create a border around the plot |
---|
| 330 | $_clone configure \ |
---|
| 331 | -title "" \ |
---|
| 332 | -plotborderwidth 1 -plotrelief solid \ |
---|
| 333 | -plotbackground white -plotpadx 0 -plotpady 0 |
---|
| 334 | # |
---|
[1599] | 335 | set _fonts(legend) [font create -family helvetica -size 10 -weight normal] |
---|
[1598] | 336 | update |
---|
[1588] | 337 | $_clone legend configure \ |
---|
| 338 | -position right \ |
---|
[1598] | 339 | -font $_fonts(legend) \ |
---|
[1588] | 340 | -hide yes -borderwidth 0 -background white -relief solid \ |
---|
| 341 | -anchor nw -activeborderwidth 0 |
---|
| 342 | # |
---|
| 343 | foreach axis [$_clone axis names] { |
---|
| 344 | if { [$_clone axis cget $axis -hide] } { |
---|
| 345 | continue |
---|
| 346 | } |
---|
[1599] | 347 | set _fonts($axis-ticks) [font create -family helvetica -size 10 \ |
---|
[1598] | 348 | -weight normal -slant roman] |
---|
[1599] | 349 | set _fonts($axis-title) [font create -family helvetica -size 10 \ |
---|
[1598] | 350 | -weight normal -slant roman] |
---|
| 351 | puts stderr "tick fonts $_fonts($axis-ticks): [font configure $_fonts($axis-ticks)]" |
---|
| 352 | puts stderr "title fonts $_fonts($axis-title): [font configure $_fonts($axis-title)]" |
---|
| 353 | update |
---|
[1588] | 354 | $_clone axis configure $axis -ticklength 5 \ |
---|
| 355 | -majorticks {} -minorticks {} |
---|
| 356 | $_clone axis configure $axis \ |
---|
[1598] | 357 | -tickfont $_fonts($axis-ticks) \ |
---|
| 358 | -titlefont $_fonts($axis-title) |
---|
[1588] | 359 | } |
---|
| 360 | #$_clone grid off |
---|
| 361 | #$_clone yaxis configure -rotate 90 |
---|
| 362 | #$_clone y2axis configure -rotate 270 |
---|
| 363 | foreach elem [$_clone element names] { |
---|
| 364 | $_clone element configure $elem -linewidth 1 \ |
---|
| 365 | -pixels 3 |
---|
| 366 | } |
---|
[1589] | 367 | # Create markers representing lines at zero for the x and y axis. |
---|
[1588] | 368 | $_clone marker create line -name x-zero \ |
---|
[1593] | 369 | -coords "0 -Inf 0 Inf" -dashes 1 -hide yes |
---|
[1588] | 370 | $_clone marker create line -name y-zero \ |
---|
[1593] | 371 | -coords "-Inf 0 Inf 0" -dashes 1 -hide yes |
---|
[1588] | 372 | } |
---|
| 373 | |
---|
| 374 | itcl::body Rappture::XyPrint::SetOption { opt } { |
---|
| 375 | set new $_settings($this-graph-$opt) |
---|
| 376 | set old [$_clone cget -$opt] |
---|
| 377 | set code [catch [list $_clone configure -$opt $new] err] |
---|
| 378 | if { $code != 0 } { |
---|
| 379 | bell |
---|
| 380 | global errorInfo |
---|
| 381 | puts stderr "$err: $errorInfo" |
---|
| 382 | set _settings($this-graph-$opt) $old |
---|
| 383 | } |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | itcl::body Rappture::XyPrint::SetComponentOption { comp opt } { |
---|
| 387 | set new $_settings($this-$comp-$opt) |
---|
| 388 | set old [$_clone $comp cget -$opt] |
---|
| 389 | set code [catch [list $_clone $comp configure -$opt $new] err] |
---|
| 390 | if { $code != 0 } { |
---|
| 391 | bell |
---|
| 392 | global errorInfo |
---|
| 393 | puts stderr "$err: $errorInfo" |
---|
| 394 | set _settings($this-$comp-$opt) $old |
---|
| 395 | } |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } { |
---|
| 399 | set new $_settings($this-$comp-$opt) |
---|
| 400 | set old [$_clone $comp cget $name -$opt] |
---|
| 401 | set code [catch [list $_clone $comp configure $name -$opt $new] err] |
---|
| 402 | if { $code != 0 } { |
---|
| 403 | bell |
---|
| 404 | global errorInfo |
---|
| 405 | puts stderr "$err: $errorInfo" |
---|
| 406 | set _settings($this-$comp-$opt) $old |
---|
| 407 | } |
---|
| 408 | } |
---|
| 409 | |
---|
[1589] | 410 | itcl::body Rappture::XyPrint::RegeneratePreview {} { |
---|
| 411 | update |
---|
| 412 | set img [image create photo] |
---|
| 413 | |
---|
| 414 | set w [Inches2Pixels $_settings($this-layout-width)] |
---|
| 415 | set h [Inches2Pixels $_settings($this-layout-height)] |
---|
| 416 | set pixelsPerInch [winfo pixels . 1i] |
---|
| 417 | set sx [expr 2.5*$pixelsPerInch/$w] |
---|
| 418 | set sy [expr 2.0*$pixelsPerInch/$h] |
---|
| 419 | set s [expr min($sx,$sy)] |
---|
| 420 | $_clone snap $img -width $w -height $h |
---|
| 421 | |
---|
| 422 | if 0 { |
---|
| 423 | if { ![winfo exists .labeltest] } { |
---|
| 424 | toplevel .labeltest -bg red |
---|
| 425 | label .labeltest.label -image $img |
---|
| 426 | pack .labeltest.label -fill both |
---|
| 427 | } |
---|
| 428 | } |
---|
| 429 | set pw [expr int(round($s * $w))] |
---|
| 430 | set ph [expr int(round($s * $h))] |
---|
| 431 | $_preview configure -width $pw -height $ph |
---|
| 432 | #.labeltest.label configure -image $img |
---|
| 433 | blt::winop resample $img $_preview box |
---|
| 434 | image delete $img |
---|
[1588] | 435 | } |
---|
| 436 | |
---|
[1589] | 437 | itcl::body Rappture::XyPrint::Pixels2Inches { pixels } { |
---|
| 438 | if { [llength $pixels] == 2 } { |
---|
| 439 | set pixels [lindex $pixels 0] |
---|
| 440 | } |
---|
| 441 | set pixelsPerInch [winfo pixels . 1i] |
---|
| 442 | set inches [expr { double($pixels) / $pixelsPerInch }] |
---|
| 443 | return [format %.3g ${inches}] |
---|
| 444 | } |
---|
| 445 | |
---|
| 446 | itcl::body Rappture::XyPrint::Inches2Pixels { inches } { |
---|
| 447 | return [winfo pixels . ${inches}i] |
---|
| 448 | } |
---|
| 449 | |
---|
| 450 | |
---|
| 451 | itcl::body Rappture::XyPrint::GetAxis {} { |
---|
| 452 | set axis [$itk_component(axis_combo) current] |
---|
| 453 | foreach option { min max loose title stepsize subdivisions } { |
---|
| 454 | set _settings($this-axis-$option) [$_clone axis cget $axis -$option] |
---|
| 455 | } |
---|
| 456 | set type $Rappture::axistypes($axis) |
---|
| 457 | if { [$_clone grid cget -map${type}] == $axis } { |
---|
| 458 | set _settings($this-axis-grid) 1 |
---|
| 459 | } else { |
---|
| 460 | set _settings($this-axis-grid) 0 |
---|
| 461 | } |
---|
[1599] | 462 | set _settings($this-axis-plotpad${type}) \ |
---|
| 463 | [Pixels2Inches [$_clone cget -plotpad${type}]] |
---|
[1589] | 464 | set _settings($this-axis-zero) [$_clone marker cget ${type}-zero -hide] |
---|
| 465 | } |
---|
| 466 | |
---|
| 467 | itcl::body Rappture::XyPrint::GetElement { args } { |
---|
| 468 | set index 1 |
---|
| 469 | foreach elem [$_clone element show] { |
---|
| 470 | set _settings($this-element-$index) $elem |
---|
| 471 | incr index |
---|
| 472 | } |
---|
| 473 | set index [$itk_component(element_slider) get] |
---|
| 474 | set elem $_settings($this-element-$index) |
---|
| 475 | set _settings($this-element-symbol) [$_clone element cget $elem -symbol] |
---|
| 476 | set _settings($this-element-color) [$_clone element cget $elem -color] |
---|
| 477 | set _settings($this-element-dashes) [$_clone element cget $elem -dashes] |
---|
| 478 | set _settings($this-element-hide) [$_clone element cget $elem -hide] |
---|
| 479 | set _settings($this-element-label) [$_clone element cget $elem -label] |
---|
| 480 | set page $itk_component(legend_page) |
---|
| 481 | $page.color value [$page.color label $_settings($this-element-color)] |
---|
| 482 | $page.symbol value [$page.symbol label $_settings($this-element-symbol)] |
---|
| 483 | $page.dashes value [$page.dashes label $_settings($this-element-dashes)] |
---|
| 484 | #FixElement |
---|
| 485 | } |
---|
| 486 | |
---|
| 487 | itcl::body Rappture::XyPrint::BuildLayoutTab {} { |
---|
| 488 | itk_component add layout_page { |
---|
| 489 | frame $itk_component(tabs).layout_page |
---|
| 490 | } |
---|
| 491 | set page $itk_component(layout_page) |
---|
| 492 | $itk_component(tabs) insert end "layout" \ |
---|
| 493 | -text "Layout" -padx 2 -pady 2 -window $page -fill both |
---|
| 494 | |
---|
| 495 | label $page.width_l -text "width" |
---|
| 496 | entry $page.width -width 6 \ |
---|
| 497 | -textvariable [itcl::scope _settings($this-layout-width)] |
---|
| 498 | bind $page.width <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 499 | |
---|
| 500 | label $page.height_l -text "height" |
---|
| 501 | entry $page.height -width 6 \ |
---|
| 502 | -textvariable [itcl::scope _settings($this-layout-height)] |
---|
| 503 | bind $page.height <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 504 | |
---|
| 505 | label $page.margin_l -text "Margins" |
---|
| 506 | |
---|
| 507 | label $page.left_l -text "left" |
---|
| 508 | entry $page.left -width 6 \ |
---|
| 509 | -textvariable [itcl::scope _settings($this-layout-leftmargin)] |
---|
| 510 | bind $page.left <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 511 | |
---|
| 512 | label $page.right_l -text "right" |
---|
| 513 | entry $page.right -width 6 \ |
---|
| 514 | -textvariable [itcl::scope _settings($this-layout-rightmargin)] |
---|
| 515 | bind $page.right <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 516 | |
---|
| 517 | label $page.top_l -text "top" |
---|
| 518 | entry $page.top -width 6 \ |
---|
| 519 | -textvariable [itcl::scope _settings($this-layout-topmargin)] |
---|
| 520 | bind $page.top <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 521 | |
---|
| 522 | label $page.bottom_l -text "bottom" |
---|
| 523 | entry $page.bottom -width 6 \ |
---|
| 524 | -textvariable [itcl::scope _settings($this-layout-bottommargin)] |
---|
| 525 | bind $page.bottom <KeyPress-Return> [itcl::code $this ApplyLayoutSettings] |
---|
| 526 | |
---|
| 527 | blt::table $page \ |
---|
| 528 | 1,0 $page.width_l -anchor e \ |
---|
| 529 | 1,1 $page.width -fill x -cspan 2 \ |
---|
| 530 | 1,3 $page.height_l -anchor e \ |
---|
| 531 | 1,4 $page.height -fill x -cspan 2 \ |
---|
| 532 | 3,2 $page.top_l -anchor e \ |
---|
| 533 | 3,3 $page.top -fill x \ |
---|
| 534 | 4,0 $page.left_l -anchor e \ |
---|
| 535 | 4,1 $page.left -fill x \ |
---|
| 536 | 4,4 $page.right_l -anchor e \ |
---|
| 537 | 4,5 $page.right -fill x \ |
---|
| 538 | 5,2 $page.bottom_l -anchor e \ |
---|
| 539 | 5,3 $page.bottom -fill x |
---|
| 540 | |
---|
[1601] | 541 | blt::table configure $page r* -resize none -pady { 0 2 } |
---|
[1589] | 542 | blt::table configure $page r2 -resize both |
---|
| 543 | blt::table configure $page c2 c4 -width .5i |
---|
| 544 | blt::table configure $page r6 -height .125i |
---|
| 545 | } |
---|
| 546 | |
---|
| 547 | |
---|
| 548 | itcl::body Rappture::XyPrint::BuildGeneralTab {} { |
---|
[1588] | 549 | itk_component add graph_page { |
---|
| 550 | frame $itk_component(tabs).graph_page |
---|
| 551 | } |
---|
| 552 | set page $itk_component(graph_page) |
---|
| 553 | $itk_component(tabs) insert end "graph" \ |
---|
| 554 | -text "General" -padx 2 -pady 2 -window $page -fill both |
---|
| 555 | |
---|
| 556 | label $page.format_l -text "format" |
---|
| 557 | Rappture::Combobox $page.format -width 30 -editable no |
---|
| 558 | $page.format choices insert end \ |
---|
| 559 | "eps" "EPS Encapsulated PostScript" \ |
---|
| 560 | "pdf" "PDF Portable Document Format" \ |
---|
| 561 | "jpg" "JPEG Joint Photographic Experts Group Format" \ |
---|
| 562 | "png" "PNG Portable Network Graphics Format" |
---|
| 563 | |
---|
[1589] | 564 | bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings] |
---|
[1588] | 565 | |
---|
| 566 | label $page.style_l -text "style" |
---|
| 567 | Rappture::Combobox $page.style -width 20 -editable no |
---|
| 568 | $page.style choices insert end \ |
---|
| 569 | "ieee" "IEEE Journal" \ |
---|
| 570 | "gekco" "G Klimeck" |
---|
[1589] | 571 | bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings] |
---|
[1588] | 572 | |
---|
| 573 | checkbutton $page.remember -text "remember settings" \ |
---|
[1589] | 574 | -variable [itcl::scope _settings($this-general-remember)] |
---|
[1588] | 575 | |
---|
| 576 | blt::table $page \ |
---|
| 577 | 2,0 $page.format_l -anchor e \ |
---|
| 578 | 2,1 $page.format -fill x \ |
---|
| 579 | 3,0 $page.style_l -anchor e \ |
---|
| 580 | 3,1 $page.style -fill x \ |
---|
| 581 | 5,0 $page.remember -cspan 2 -anchor w |
---|
[1601] | 582 | blt::table configure $page r* -resize none -pady { 0 2 } |
---|
[1588] | 583 | blt::table configure $page r4 -resize both |
---|
| 584 | |
---|
| 585 | } |
---|
| 586 | |
---|
[1589] | 587 | itcl::body Rappture::XyPrint::ApplyLegendSettings {} { |
---|
[1588] | 588 | set page $itk_component(legend_page) |
---|
| 589 | set _settings($this-legend-position) [$page.position current] |
---|
| 590 | set _settings($this-legend-anchor) [$page.anchor current] |
---|
| 591 | foreach option { hide position anchor borderwidth } { |
---|
| 592 | SetComponentOption legend $option |
---|
| 593 | } |
---|
[1589] | 594 | ApplyElementSettings |
---|
[1588] | 595 | } |
---|
| 596 | |
---|
| 597 | itcl::body Rappture::XyPrint::BuildLegendTab {} { |
---|
| 598 | itk_component add legend_page { |
---|
| 599 | frame $itk_component(tabs).legend_page |
---|
| 600 | } |
---|
| 601 | set page $itk_component(legend_page) |
---|
| 602 | $itk_component(tabs) insert end "legend" \ |
---|
| 603 | -text "Legend" -padx 2 -pady 2 -window $page -fill both |
---|
| 604 | |
---|
| 605 | checkbutton $page.show -text "show legend" \ |
---|
| 606 | -offvalue 1 -onvalue 0 \ |
---|
| 607 | -variable [itcl::scope _settings($this-legend-hide)] \ |
---|
[1589] | 608 | -command [itcl::code $this ApplyLegendSettings] |
---|
[1588] | 609 | |
---|
| 610 | label $page.position_l -text "position" |
---|
| 611 | Rappture::Combobox $page.position -width 15 -editable no |
---|
| 612 | $page.position choices insert end \ |
---|
| 613 | "leftmargin" "left margin" \ |
---|
| 614 | "rightmargin" "right margin" \ |
---|
| 615 | "bottommargin" "bottom margin" \ |
---|
| 616 | "topmargin" "top margin" \ |
---|
| 617 | "plotarea" "inside plot" |
---|
[1589] | 618 | bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings] |
---|
[1588] | 619 | |
---|
| 620 | Rappture::Combobox $page.anchor -width 10 -editable no |
---|
| 621 | $page.anchor choices insert end \ |
---|
| 622 | "nw" "northwest" \ |
---|
| 623 | "n" "north" \ |
---|
| 624 | "ne" "northeast" \ |
---|
| 625 | "sw" "southwest" \ |
---|
| 626 | "s" "south" \ |
---|
| 627 | "se" "southeast" \ |
---|
| 628 | "c" "center" \ |
---|
| 629 | "e" "east" \ |
---|
| 630 | "w" "west" |
---|
[1589] | 631 | bind $page.anchor <<Value>> [itcl::code $this ApplyLegendSettings] |
---|
[1588] | 632 | |
---|
| 633 | checkbutton $page.border -text "border" \ |
---|
| 634 | -font "Arial 10" \ |
---|
| 635 | -variable [itcl::scope _settings($this-legend-borderwidth)] \ |
---|
| 636 | -onvalue 1 -offvalue 0 \ |
---|
[1589] | 637 | -command [itcl::code $this ApplyLegendSettings] |
---|
[1588] | 638 | |
---|
| 639 | label $page.slider_l -text "legend\nentry" -font "Arial 10" -justify right |
---|
| 640 | itk_component add element_slider { |
---|
[1593] | 641 | ::scale $page.slider -from 1 -to 1 \ |
---|
[1588] | 642 | -orient horizontal -width 12 \ |
---|
| 643 | -command [itcl::code $this GetElement] |
---|
| 644 | } |
---|
| 645 | checkbutton $page.hide -text "hide" \ |
---|
| 646 | -font "Arial 10" \ |
---|
| 647 | -variable [itcl::scope _settings($this-element-hide)] \ |
---|
[1589] | 648 | -command [itcl::code $this ApplyElementSettings] |
---|
[1588] | 649 | |
---|
| 650 | label $page.label_l -text "label" -font "Arial 10" |
---|
| 651 | entry $page.label \ |
---|
| 652 | -background white \ |
---|
| 653 | -font "Arial 10" \ |
---|
| 654 | -textvariable [itcl::scope _settings($this-element-label)] |
---|
[1589] | 655 | bind $page.label <KeyPress-Return> [itcl::code $this ApplyElementSettings] |
---|
[1588] | 656 | |
---|
| 657 | label $page.color_l -text "color " -font "Arial 10" |
---|
| 658 | Rappture::Combobox $page.color -width 15 -editable no |
---|
| 659 | $page.color choices insert end \ |
---|
| 660 | "#000000" "black" \ |
---|
| 661 | "#ffffff" "white" \ |
---|
| 662 | "#0000cd" "blue" \ |
---|
| 663 | "#cd0000" "red" \ |
---|
| 664 | "#00cd00" "green" \ |
---|
| 665 | "#3a5fcd" "royal blue" \ |
---|
| 666 | "#cdcd00" "yellow" \ |
---|
| 667 | "#cd1076" "deep pink" \ |
---|
| 668 | "#009acd" "deep sky blue" \ |
---|
| 669 | "#00c5cd" "torquise" \ |
---|
| 670 | "#a2b5cd" "light steel blue" \ |
---|
| 671 | "#7ac5cd" "cadet blue" \ |
---|
| 672 | "#66cdaa" "aquamarine" \ |
---|
| 673 | "#a2cd5a" "dark olive green" \ |
---|
| 674 | "#cd9b9b" "rosy brown" |
---|
[1589] | 675 | bind $page.color <<Value>> [itcl::code $this ApplyElementSettings] |
---|
[1588] | 676 | |
---|
| 677 | label $page.dashes_l -text "line style" -font "Arial 10" |
---|
| 678 | Rappture::Combobox $page.dashes -width 15 -editable no |
---|
| 679 | $page.dashes choices insert end \ |
---|
| 680 | "" "solid" \ |
---|
| 681 | "1" "dot" \ |
---|
| 682 | "5 2" "dash" \ |
---|
| 683 | "2 4 2" "dashdot" \ |
---|
| 684 | "2 4 2 2" "dashdotdot" |
---|
[1589] | 685 | bind $page.dashes <<Value>> [itcl::code $this ApplyElementSettings] |
---|
[1588] | 686 | |
---|
| 687 | label $page.symbol_l -text "symbol" -font "Arial 10" |
---|
| 688 | Rappture::Combobox $page.symbol -editable no |
---|
| 689 | $page.symbol choices insert end \ |
---|
| 690 | "none" "none" \ |
---|
| 691 | "square" "square" \ |
---|
| 692 | "circle" "circle" \ |
---|
| 693 | "diamond" "diamond" \ |
---|
| 694 | "plus" "plus" \ |
---|
| 695 | "cross" "cross" \ |
---|
| 696 | "splus" "skinny plus" \ |
---|
| 697 | "scross" "skinny cross" \ |
---|
| 698 | "triangle" "triangle" |
---|
[1589] | 699 | bind $page.symbol <<Value>> [itcl::code $this ApplyElementSettings] |
---|
[1588] | 700 | |
---|
[1599] | 701 | label $page.font_l -text "font" |
---|
| 702 | Rappture::Combobox $page.fontfamily -width 10 -editable no |
---|
| 703 | $page.fontfamily choices insert end \ |
---|
| 704 | "courier" "Courier" \ |
---|
| 705 | "helvetica" "Helvetica" \ |
---|
| 706 | "new*century*schoolbook" "New Century Schoolbook" \ |
---|
| 707 | "symbol" "Symbol" \ |
---|
| 708 | "times" "Times" |
---|
[1601] | 709 | bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings] |
---|
[1599] | 710 | |
---|
| 711 | Rappture::Combobox $page.fontsize -width 4 -editable no |
---|
| 712 | $page.fontsize choices insert end \ |
---|
| 713 | "8" "8" \ |
---|
[1601] | 714 | "9" "9" \ |
---|
[1599] | 715 | "10" "10" \ |
---|
| 716 | "11" "11" \ |
---|
| 717 | "12" "12" \ |
---|
| 718 | "14" "14" \ |
---|
| 719 | "17" "17" \ |
---|
| 720 | "18" "18" \ |
---|
| 721 | "20" "20" |
---|
[1601] | 722 | bind $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings] |
---|
[1599] | 723 | |
---|
| 724 | Rappture::PushButton $page.fontbold \ |
---|
[1601] | 725 | -width 18 -height 18 \ |
---|
[1599] | 726 | -onimage [Rappture::icon font-bold] \ |
---|
| 727 | -offimage [Rappture::icon font-bold] \ |
---|
| 728 | -command [itcl::code $this ApplyLegendSettings] \ |
---|
| 729 | -variable [itcl::scope _settings($this-legend-font-bold)] |
---|
| 730 | |
---|
| 731 | Rappture::PushButton $page.fontitalic \ |
---|
[1601] | 732 | -width 18 -height 18 \ |
---|
[1599] | 733 | -onimage [Rappture::icon font-italic] \ |
---|
| 734 | -offimage [Rappture::icon font-italic] \ |
---|
| 735 | -command [itcl::code $this ApplyLegendSettings] \ |
---|
| 736 | -variable [itcl::scope _settings($this-legend-font-italic)] |
---|
| 737 | |
---|
[1588] | 738 | blt::table $page \ |
---|
| 739 | 1,0 $page.show -cspan 2 -anchor w \ |
---|
| 740 | 1,2 $page.border -cspan 2 -anchor w \ |
---|
| 741 | 2,0 $page.position_l -anchor e \ |
---|
| 742 | 2,1 $page.position -fill x \ |
---|
[1599] | 743 | 2,2 $page.anchor -fill x -cspan 3 \ |
---|
| 744 | 3,0 $page.font_l -anchor e \ |
---|
| 745 | 3,1 $page.fontfamily -fill x \ |
---|
| 746 | 3,2 $page.fontsize -fill x \ |
---|
| 747 | 3,3 $page.fontbold -anchor e \ |
---|
| 748 | 3,4 $page.fontitalic -anchor e \ |
---|
| 749 | 4,0 $page.slider_l -anchor e \ |
---|
| 750 | 4,1 $page.slider -fill x -cspan 5 \ |
---|
| 751 | 5,0 $page.label_l -anchor e \ |
---|
| 752 | 5,1 $page.label -fill x -cspan 5 \ |
---|
| 753 | 6,0 $page.color_l -anchor e \ |
---|
| 754 | 6,1 $page.color -fill x \ |
---|
| 755 | 6,2 $page.symbol_l -anchor e \ |
---|
| 756 | 6,3 $page.symbol -fill both -cspan 3 \ |
---|
| 757 | 7,0 $page.dashes_l -anchor e \ |
---|
| 758 | 7,1 $page.dashes -fill x \ |
---|
[1588] | 759 | |
---|
[1601] | 760 | blt::table configure $page r* -resize none -pady { 0 2 } |
---|
[1588] | 761 | blt::table configure $page r8 -resize both |
---|
| 762 | |
---|
| 763 | } |
---|
| 764 | |
---|
| 765 | itcl::body Rappture::XyPrint::BuildAxisTab {} { |
---|
| 766 | itk_component add axis_page { |
---|
| 767 | frame $itk_component(tabs).axis_page |
---|
| 768 | } |
---|
| 769 | set page $itk_component(axis_page) |
---|
| 770 | $itk_component(tabs) insert end "axis" \ |
---|
| 771 | -text "Axis" -padx 2 -pady 2 -window $page -fill both |
---|
| 772 | |
---|
| 773 | label $page.axis_l -text "axis" -font "Arial 10" |
---|
| 774 | itk_component add axis_combo { |
---|
| 775 | Rappture::Combobox $page.axis -width 20 -editable no |
---|
| 776 | } |
---|
| 777 | bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis] |
---|
| 778 | |
---|
| 779 | label $page.title_l -text "title" -font "Arial 10" |
---|
| 780 | entry $page.title \ |
---|
| 781 | -textvariable [itcl::scope _settings($this-axis-title)] |
---|
[1589] | 782 | bind $page.title <KeyPress-Return> [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 783 | |
---|
| 784 | label $page.min_l -text "min" -font "Arial 10" |
---|
| 785 | entry $page.min -width 10 \ |
---|
| 786 | -textvariable [itcl::scope _settings($this-axis-min)] |
---|
[1589] | 787 | bind $page.min <KeyPress-Return> [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 788 | |
---|
| 789 | label $page.max_l -text "max" -font "Arial 10" |
---|
| 790 | entry $page.max -width 10 \ |
---|
| 791 | -textvariable [itcl::scope _settings($this-axis-max)] |
---|
[1589] | 792 | bind $page.max <KeyPress-Return> [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 793 | |
---|
| 794 | label $page.subdivisions_l -text "subdivisions" -font "Arial 10" |
---|
| 795 | entry $page.subdivisions \ |
---|
| 796 | -textvariable [itcl::scope _settings($this-axis-subdivisions)] |
---|
[1589] | 797 | bind $page.subdivisions <KeyPress-Return> \ |
---|
| 798 | [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 799 | |
---|
| 800 | label $page.stepsize_l -text "step size" -font "Arial 10" |
---|
| 801 | entry $page.stepsize \ |
---|
| 802 | -textvariable [itcl::scope _settings($this-axis-stepsize)] |
---|
[1589] | 803 | bind $page.stepsize <KeyPress-Return> [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 804 | |
---|
| 805 | checkbutton $page.loose -text "loose limits" \ |
---|
| 806 | -onvalue "always" -offvalue "0" \ |
---|
| 807 | -variable [itcl::scope _settings($this-axis-loose)] \ |
---|
[1589] | 808 | -command [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 809 | |
---|
[1599] | 810 | label $page.plotpad_l -text "pad" |
---|
| 811 | entry $page.plotpad -width 6 \ |
---|
| 812 | -textvariable [itcl::scope _settings($this-axis-plotpad)] |
---|
| 813 | bind $page.plotpad <KeyPress-Return> [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 814 | |
---|
| 815 | checkbutton $page.grid -text "show grid lines" \ |
---|
| 816 | -variable [itcl::scope _settings($this-axis-grid)] \ |
---|
[1589] | 817 | -command [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 818 | |
---|
| 819 | checkbutton $page.zero -text "mark zero" \ |
---|
| 820 | -offvalue 1 -onvalue 0 \ |
---|
| 821 | -variable [itcl::scope _settings($this-axis-zero)] \ |
---|
[1589] | 822 | -command [itcl::code $this ApplyAxisSettings] |
---|
[1588] | 823 | |
---|
[1598] | 824 | label $page.tickfont_l -text "tick font" |
---|
| 825 | Rappture::Combobox $page.tickfontfamily -width 10 -editable no |
---|
| 826 | $page.tickfontfamily choices insert end \ |
---|
| 827 | "courier" "Courier" \ |
---|
| 828 | "helvetica" "Helvetica" \ |
---|
| 829 | "new*century*schoolbook" "New Century Schoolbook" \ |
---|
| 830 | "symbol" "Symbol" \ |
---|
| 831 | "times" "Times" |
---|
[1601] | 832 | bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings] |
---|
[1598] | 833 | |
---|
| 834 | Rappture::Combobox $page.tickfontsize -width 4 -editable no |
---|
| 835 | $page.tickfontsize choices insert end \ |
---|
| 836 | "8" "8" \ |
---|
[1601] | 837 | "9" "9" \ |
---|
[1598] | 838 | "10" "10" \ |
---|
| 839 | "11" "11" \ |
---|
| 840 | "12" "12" \ |
---|
| 841 | "14" "14" \ |
---|
| 842 | "17" "17" \ |
---|
| 843 | "18" "18" \ |
---|
| 844 | "20" "20" |
---|
[1601] | 845 | bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] |
---|
[1598] | 846 | |
---|
| 847 | Rappture::PushButton $page.tickfontbold \ |
---|
[1601] | 848 | -width 18 -height 18 \ |
---|
[1599] | 849 | -onimage [Rappture::icon font-bold] \ |
---|
| 850 | -offimage [Rappture::icon font-bold] \ |
---|
[1598] | 851 | -command [itcl::code $this ApplyAxisSettings] \ |
---|
| 852 | -variable [itcl::scope _settings($this-axis-tickfont-bold)] |
---|
| 853 | |
---|
| 854 | Rappture::PushButton $page.tickfontitalic \ |
---|
[1601] | 855 | -width 18 -height 18 \ |
---|
[1599] | 856 | -onimage [Rappture::icon font-italic] \ |
---|
| 857 | -offimage [Rappture::icon font-italic] \ |
---|
[1598] | 858 | -command [itcl::code $this ApplyAxisSettings] \ |
---|
| 859 | -variable [itcl::scope _settings($this-axis-tickfont-italic)] |
---|
| 860 | |
---|
[1599] | 861 | label $page.titlefont_l -text "title font" |
---|
| 862 | Rappture::Combobox $page.titlefontfamily -width 10 -editable no |
---|
| 863 | $page.titlefontfamily choices insert end \ |
---|
| 864 | "courier" "Courier" \ |
---|
| 865 | "helvetica" "Helvetica" \ |
---|
| 866 | "new*century*schoolbook" "New Century Schoolbook" \ |
---|
| 867 | "symbol" "Symbol" \ |
---|
| 868 | "times" "Times" |
---|
[1601] | 869 | bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings] |
---|
[1599] | 870 | |
---|
| 871 | Rappture::Combobox $page.titlefontsize -width 4 -editable no |
---|
| 872 | $page.titlefontsize choices insert end \ |
---|
| 873 | "8" "8" \ |
---|
[1601] | 874 | "9" "9" \ |
---|
[1599] | 875 | "10" "10" \ |
---|
| 876 | "11" "11" \ |
---|
| 877 | "12" "12" \ |
---|
| 878 | "14" "14" \ |
---|
| 879 | "17" "17" \ |
---|
| 880 | "18" "18" \ |
---|
| 881 | "20" "20" |
---|
[1601] | 882 | bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] |
---|
[1599] | 883 | |
---|
| 884 | Rappture::PushButton $page.titlefontbold \ |
---|
[1601] | 885 | -width 18 -height 18 \ |
---|
[1599] | 886 | -onimage [Rappture::icon font-bold] \ |
---|
| 887 | -offimage [Rappture::icon font-bold] \ |
---|
| 888 | -command [itcl::code $this ApplyAxisSettings] \ |
---|
| 889 | -variable [itcl::scope _settings($this-axis-titlefont-bold)] |
---|
| 890 | |
---|
| 891 | Rappture::PushButton $page.titlefontitalic \ |
---|
[1601] | 892 | -width 18 -height 18 \ |
---|
[1599] | 893 | -onimage [Rappture::icon font-italic] \ |
---|
| 894 | -offimage [Rappture::icon font-italic] \ |
---|
| 895 | -command [itcl::code $this ApplyAxisSettings] \ |
---|
| 896 | -variable [itcl::scope _settings($this-axis-titlefont-italic)] |
---|
| 897 | |
---|
[1588] | 898 | blt::table $page \ |
---|
[1602] | 899 | 1,1 $page.axis_l -anchor e -pady 6 \ |
---|
| 900 | 1,2 $page.axis -fill x -cspan 6 \ |
---|
[1588] | 901 | 2,1 $page.title_l -anchor e \ |
---|
[1599] | 902 | 2,2 $page.title -fill x -cspan 5 \ |
---|
[1588] | 903 | 3,1 $page.min_l -anchor e \ |
---|
| 904 | 3,2 $page.min -fill x \ |
---|
[1601] | 905 | 3,3 $page.stepsize_l -anchor e \ |
---|
| 906 | 3,4 $page.stepsize -fill both -cspan 3 \ |
---|
| 907 | 4,1 $page.max_l -anchor e \ |
---|
| 908 | 4,2 $page.max -fill both \ |
---|
[1599] | 909 | 4,3 $page.subdivisions_l -anchor e \ |
---|
| 910 | 4,4 $page.subdivisions -fill both -cspan 3 \ |
---|
| 911 | 5,1 $page.titlefont_l -anchor e \ |
---|
| 912 | 5,2 $page.titlefontfamily -fill x -cspan 2 \ |
---|
| 913 | 5,4 $page.titlefontsize -fill x \ |
---|
| 914 | 5,5 $page.titlefontbold -anchor e \ |
---|
| 915 | 5,6 $page.titlefontitalic -anchor e \ |
---|
| 916 | 6,1 $page.tickfont_l -anchor e \ |
---|
| 917 | 6,2 $page.tickfontfamily -fill x -cspan 2 \ |
---|
| 918 | 6,4 $page.tickfontsize -fill x \ |
---|
| 919 | 6,5 $page.tickfontbold -anchor e \ |
---|
| 920 | 6,6 $page.tickfontitalic -anchor e \ |
---|
[1588] | 921 | 7,1 $page.loose -cspan 2 -anchor w \ |
---|
| 922 | 7,3 $page.grid -anchor w -cspan 2 \ |
---|
[1598] | 923 | 8,1 $page.zero -cspan 2 -anchor w \ |
---|
[1599] | 924 | 8,3 $page.plotpad_l -anchor e \ |
---|
| 925 | 8,4 $page.plotpad -fill both -cspan 3 |
---|
[1588] | 926 | } |
---|
| 927 | |
---|
[1589] | 928 | itcl::body Rappture::XyPrint::ApplyGeneralSettings {} { |
---|
| 929 | RegeneratePreview |
---|
| 930 | } |
---|
| 931 | |
---|
| 932 | itcl::body Rappture::XyPrint::ApplyLegendSettings {} { |
---|
| 933 | set page $itk_component(legend_page) |
---|
| 934 | set _settings($this-legend-position) [$page.position current] |
---|
| 935 | set _settings($this-legend-anchor) [$page.anchor current] |
---|
| 936 | |
---|
| 937 | foreach option { hide position anchor borderwidth } { |
---|
| 938 | SetComponentOption legend $option |
---|
[1588] | 939 | } |
---|
[1601] | 940 | set slant "roman" |
---|
| 941 | if { $_settings($this-legend-font-italic) } { |
---|
| 942 | set slant "italic" |
---|
| 943 | } |
---|
| 944 | set weight "normal" |
---|
| 945 | if { $_settings($this-legend-font-bold) } { |
---|
| 946 | set weight "bold" |
---|
| 947 | } |
---|
| 948 | font configure $_fonts(legend) \ |
---|
| 949 | -family [$page.fontfamily current] \ |
---|
| 950 | -size [$page.fontsize current] \ |
---|
| 951 | -weight $weight -slant $slant |
---|
| 952 | $_clone legend configure -font $_fonts(legend) |
---|
[1589] | 953 | ApplyElementSettings |
---|
[1588] | 954 | } |
---|
| 955 | |
---|
[1589] | 956 | itcl::body Rappture::XyPrint::ApplyAxisSettings {} { |
---|
| 957 | set axis [$itk_component(axis_combo) current] |
---|
| 958 | set type $Rappture::axistypes($axis) |
---|
[1601] | 959 | set page $itk_component(axis_page) |
---|
[1589] | 960 | if { $_settings($this-axis-grid) } { |
---|
| 961 | $_clone grid configure -hide no -map${type} ${axis} |
---|
| 962 | } else { |
---|
| 963 | $_clone grid configure -hide no -map${type} "" |
---|
| 964 | } |
---|
[1599] | 965 | $_clone configure -plotpad${type} $_settings($this-axis-plotpad) |
---|
[1589] | 966 | foreach option { min max loose title stepsize subdivisions } { |
---|
| 967 | SetNamedComponentOption axis $axis $option |
---|
| 968 | } |
---|
| 969 | $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) |
---|
[1601] | 970 | set slant "roman" |
---|
| 971 | if { $_settings($this-axis-titlefont-italic) } { |
---|
| 972 | set slant "italic" |
---|
| 973 | } |
---|
| 974 | set weight "normal" |
---|
| 975 | if { $_settings($this-axis-titlefont-bold) } { |
---|
| 976 | set weight "bold" |
---|
| 977 | } |
---|
| 978 | font configure $_fonts($axis-title) \ |
---|
| 979 | -family [$page.titlefontfamily current] \ |
---|
| 980 | -size [$page.titlefontsize current] \ |
---|
| 981 | -weight $weight -slant $slant |
---|
| 982 | set slant "roman" |
---|
| 983 | if { $_settings($this-axis-tickfont-italic) } { |
---|
| 984 | set slant "italic" |
---|
| 985 | } |
---|
| 986 | set weight "normal" |
---|
| 987 | if { $_settings($this-axis-tickfont-bold) } { |
---|
| 988 | set weight "bold" |
---|
| 989 | } |
---|
| 990 | font configure $_fonts($axis-ticks) \ |
---|
| 991 | -family [$page.tickfontfamily current] \ |
---|
| 992 | -size [$page.tickfontsize current] \ |
---|
| 993 | -weight $weight -slant $slant |
---|
| 994 | $_clone axis configure $axis -tickfont $_fonts($axis-ticks) \ |
---|
| 995 | -titlefont $_fonts($axis-title) |
---|
[1589] | 996 | GetAxis |
---|
| 997 | RegeneratePreview |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | itcl::body Rappture::XyPrint::ApplyElementSettings {} { |
---|
[1588] | 1001 | set index [$itk_component(element_slider) get] |
---|
| 1002 | set elem $_settings($this-element-$index) |
---|
| 1003 | set page $itk_component(legend_page) |
---|
| 1004 | set _settings($this-element-color) [$page.color current] |
---|
| 1005 | set _settings($this-element-symbol) [$page.symbol current] |
---|
| 1006 | set _settings($this-element-dashes) [$page.dashes current] |
---|
| 1007 | foreach option { symbol color dashes hide label } { |
---|
| 1008 | SetNamedComponentOption element $elem $option |
---|
| 1009 | } |
---|
| 1010 | RegeneratePreview |
---|
| 1011 | } |
---|
| 1012 | |
---|
[1589] | 1013 | itcl::body Rappture::XyPrint::ApplyLayoutSettings {} { |
---|
[1588] | 1014 | foreach opt { leftmargin rightmargin topmargin bottommargin } { |
---|
| 1015 | set new [Inches2Pixels $_settings($this-layout-$opt)] |
---|
| 1016 | set old [$_clone cget -$opt] |
---|
| 1017 | set code [catch [list $_clone configure -$opt $new] err] |
---|
| 1018 | if { $code != 0 } { |
---|
| 1019 | bell |
---|
| 1020 | global errorInfo |
---|
| 1021 | puts stderr "$err: $errorInfo" |
---|
| 1022 | set _settings($this-layout-$opt) [Pixel2Inches $old] |
---|
| 1023 | } |
---|
| 1024 | } |
---|
| 1025 | RegeneratePreview |
---|
| 1026 | } |
---|
| 1027 | |
---|
| 1028 | |
---|
[1589] | 1029 | itcl::body Rappture::XyPrint::InitializeSettings {} { |
---|
| 1030 | # General settings |
---|
[1588] | 1031 | |
---|
[1589] | 1032 | # Always set to "eps" "ieee" |
---|
| 1033 | set _settings($this-general-format) eps |
---|
| 1034 | set _settings($this-general-style) ieee |
---|
| 1035 | set _settings($this-general-remember) 1 |
---|
| 1036 | set page $itk_component(graph_page) |
---|
| 1037 | $page.format value [$page.format label $_settings($this-general-format)] |
---|
| 1038 | $page.style value [$page.style label $_settings($this-general-style)] |
---|
[1588] | 1039 | |
---|
[1589] | 1040 | # Layout settings |
---|
[1588] | 1041 | set _settings($this-layout-width) [Pixels2Inches [$_clone cget -width]] |
---|
| 1042 | set _settings($this-layout-height) [Pixels2Inches [$_clone cget -height]] |
---|
| 1043 | set _settings($this-layout-leftmargin) \ |
---|
| 1044 | [Pixels2Inches [$_clone cget -leftmargin]] |
---|
| 1045 | set _settings($this-layout-rightmargin) \ |
---|
| 1046 | [Pixels2Inches [$_clone cget -rightmargin]] |
---|
| 1047 | set _settings($this-layout-topmargin) \ |
---|
| 1048 | [Pixels2Inches [$_clone cget -topmargin]] |
---|
| 1049 | set _settings($this-layout-bottommargin) \ |
---|
| 1050 | [Pixels2Inches [$_clone cget -bottommargin]] |
---|
[1589] | 1051 | |
---|
| 1052 | # Legend settings |
---|
| 1053 | set page $itk_component(legend_page) |
---|
| 1054 | |
---|
| 1055 | set names [$_clone element show] |
---|
| 1056 | $itk_component(element_slider) configure -from 1 -to [llength $names] |
---|
[1593] | 1057 | set state [expr { ([llength $names] < 2) ? "disabled" : "normal" } ] |
---|
| 1058 | $page.slider configure -state $state |
---|
| 1059 | $page.slider_l configure -state $state |
---|
[1589] | 1060 | # Always initialize the slider to the first entry in the element list. |
---|
| 1061 | $itk_component(element_slider) set 1 |
---|
| 1062 | # Always set the borderwidth to be not displayed |
---|
| 1063 | set _settings($this-legend-borderwidth) 0 |
---|
[1601] | 1064 | $page.fontfamily value "Helvetica" |
---|
| 1065 | $page.fontsize value "10" |
---|
| 1066 | set _settings($this-legend-font-bold) 0 |
---|
| 1067 | set _settings($this-legend-font-italic) 0 |
---|
[1589] | 1068 | |
---|
| 1069 | set _settings($this-legend-hide) [$_clone legend cget -hide] |
---|
| 1070 | set _settings($this-legend-position) [$_clone legend cget -position] |
---|
| 1071 | set _settings($this-legend-anchor) [$_clone legend cget -anchor] |
---|
| 1072 | $page.position value \ |
---|
| 1073 | [$page.position label $_settings($this-legend-position)] |
---|
| 1074 | $page.anchor value [$page.anchor label $_settings($this-legend-anchor)] |
---|
| 1075 | GetElement |
---|
| 1076 | |
---|
| 1077 | # Axis settings |
---|
[1601] | 1078 | set page $itk_component(axis_page) |
---|
[1589] | 1079 | set names [lsort [$_clone axis names]] |
---|
| 1080 | $itk_component(axis_combo) choices delete 0 end |
---|
| 1081 | foreach axis $names { |
---|
| 1082 | if { ![$_clone axis cget $axis -hide] } { |
---|
| 1083 | $itk_component(axis_combo) choices insert end $axis $axis |
---|
| 1084 | } |
---|
| 1085 | lappend axisnames $axis |
---|
| 1086 | } |
---|
[1601] | 1087 | $page.titlefontfamily value "Helvetica" |
---|
| 1088 | $page.tickfontfamily value "Helvetica" |
---|
| 1089 | $page.titlefontsize value "10" |
---|
| 1090 | $page.tickfontsize value "10" |
---|
| 1091 | set _settings($this-axis-tickfont-bold) 0 |
---|
| 1092 | set _settings($this-axis-tickfont-italic) 0 |
---|
| 1093 | set _settings($this-axis-titlefont-bold) 0 |
---|
| 1094 | set _settings($this-axis-titlefont-italic) 0 |
---|
[1589] | 1095 | # Always hide the zero line. |
---|
| 1096 | set _settings($this-axis-zero) 1 |
---|
[1601] | 1097 | set _settings($this-axis-plotpad) [Pixels2Inches [$_clone cget -plotpadx]] |
---|
[1589] | 1098 | # Pick the first axis to initially display |
---|
| 1099 | set axis [lindex $axisnames 0] |
---|
| 1100 | $itk_component(axis_combo) value $axis |
---|
| 1101 | GetAxis |
---|
[1588] | 1102 | } |
---|
| 1103 | |
---|
[1589] | 1104 | |
---|
[1598] | 1105 | itcl::body Rappture::XyPrint::restore { toolName plotName data } { |
---|
| 1106 | set key [list $toolName $plotName] |
---|
| 1107 | set _savedSettings($key) $data |
---|
| 1108 | } |
---|
[1590] | 1109 | |
---|
[1598] | 1110 | itcl::body Rappture::XyPrint::RestoreSettings { toolName plotName } { |
---|
| 1111 | if { ![file readable "~/.rappture"] } { |
---|
| 1112 | return; # No file or not readable |
---|
| 1113 | } |
---|
| 1114 | # Read the file by sourcing it into a safe interpreter The only commands |
---|
| 1115 | # executed will be "xyprint" which will simply add the data into an array |
---|
| 1116 | # _savedSettings. |
---|
| 1117 | set parser [interp create -safe] |
---|
| 1118 | $parser alias xyprint [itcl::code $this restore] |
---|
| 1119 | set f [open $file "r"] |
---|
| 1120 | set code [read $f] |
---|
| 1121 | close $f |
---|
| 1122 | $parser eval $code |
---|
| 1123 | |
---|
| 1124 | # Now see if there's an entry for this tool/plot combination. The data |
---|
| 1125 | # associated with the variable is itself code to update the graph (clone). |
---|
| 1126 | set key [list $toolName $plotName] |
---|
| 1127 | if { [info exists _savedSettings($key)] } { |
---|
| 1128 | $parser alias "xygraph" $_clone |
---|
| 1129 | $parser eval $_savedSettings($key) |
---|
| 1130 | } |
---|
| 1131 | foreach {name value} [$parser eval "array get general"] { |
---|
| 1132 | set _settings($this-graph-$name) $value |
---|
| 1133 | } |
---|
| 1134 | interp delete $parser |
---|
| 1135 | } |
---|
| 1136 | |
---|
[1593] | 1137 | itcl::body Rappture::XyPrint::ResetSettings {} { |
---|
[1590] | 1138 | # Revert the widget back to the original graph's settings |
---|
| 1139 | destroy $_clone |
---|
| 1140 | set _clone [CloneGraph $graph] |
---|
| 1141 | InitClone |
---|
| 1142 | InitializeSettings |
---|
[1589] | 1143 | } |
---|
| 1144 | |
---|
[1598] | 1145 | itcl::body Rappture::XyPrint::SaveSettings { toolName plotName } { |
---|
| 1146 | if { ![file writable "~/.rappture"] } { |
---|
| 1147 | return |
---|
| 1148 | } |
---|
| 1149 | set out [CreateSettings $toolName $plotName] |
---|
| 1150 | # Write the settings out |
---|
| 1151 | set f [open ".rappture" "w" 0600] |
---|
| 1152 | foreach key [lsort [array names _savedSettings]] { |
---|
| 1153 | set tool [lindex $key 0] |
---|
| 1154 | set plot [lindex $key 1] |
---|
| 1155 | if { $plotName == "plot" && $toolName == "$tool" } { |
---|
| 1156 | continue |
---|
| 1157 | } |
---|
| 1158 | puts $f "xyprint \"$tool\" \"$plot\" \{" |
---|
| 1159 | puts $f "$_savedSettings($key)" |
---|
| 1160 | puts $f "\}\n" |
---|
| 1161 | } |
---|
| 1162 | # Now write the new setting |
---|
| 1163 | puts $f "xyprint \"$toolName\" \"$plotName\" \{" |
---|
| 1164 | puts $f "$out" |
---|
| 1165 | puts $f "\}\n" |
---|
| 1166 | close $f |
---|
| 1167 | } |
---|
| 1168 | |
---|
| 1169 | itcl::body Rappture::XyPrint::CreateSettings { toolName plotName } { |
---|
[1589] | 1170 | # Create stanza associated with tool and plot title. |
---|
| 1171 | # General settings |
---|
[1595] | 1172 | append out "\n" |
---|
[1598] | 1173 | append out "xyprint \"\$toolName\" \"\$plotName\" \{\n" |
---|
[1595] | 1174 | append out " set general(format) $_settings($this-general-format)\n" |
---|
| 1175 | append out " set general(style) $_settings($this-general-style)\n" |
---|
| 1176 | append out " set general(remember) 1\n" |
---|
[1589] | 1177 | |
---|
| 1178 | # Layout settings |
---|
[1598] | 1179 | append out " xygraph configure \\\n" |
---|
[1595] | 1180 | append out " -width \"[Pixels2Inches [$_clone cget -width]]\" \\\n" |
---|
| 1181 | append out " -height \"[Pixels2Inches [$_clone cget -height]]\" \\\n" |
---|
| 1182 | append out " -leftmargin \"[Pixels2Inches [$_clone cget -leftmargin]]\" \\\n" |
---|
| 1183 | append out " -rightmargin \"[Pixels2Inches [$_clone cget -rightmargin]]\" \\\n" |
---|
| 1184 | append out " -topmargin \"[Pixels2Inches [$_clone cget -topmargin]]\" \\\n" |
---|
| 1185 | append out " -bottommargin \"[Pixels2Inches [$_clone cget -bottommargin]]\"\\\n" |
---|
| 1186 | append out " -plotpadx \"[Pixels2Inches [$_clone cget -plotpadx]]\" \\\n" |
---|
| 1187 | append out " -plotpady \"[Pixels2Inches [$_clone cget -plotpady]]\" \n" |
---|
| 1188 | |
---|
[1589] | 1189 | # Legend settings |
---|
[1598] | 1190 | append out " xygraph legend configure \\\n" |
---|
[1595] | 1191 | append out " -position \"[$_clone legend cget -position]\" \\\n" |
---|
| 1192 | append out " -anchor \"[$_clone legend cget -anchor]\" \\\n" |
---|
| 1193 | append out " -borderwidth \"[$_clone legend cget -borderwidth]\" \\\n" |
---|
| 1194 | append out " -hide \"[$_clone legend cget -hide]\" \n" |
---|
[1589] | 1195 | |
---|
| 1196 | # Element settings |
---|
| 1197 | foreach elem [$_clone element show] { |
---|
[1598] | 1198 | append out " if \{ \[xygraph element exists \"$elem\"\] \} \{\n" |
---|
| 1199 | append out " xygraph element configure \"$elem\" \\\n" |
---|
[1595] | 1200 | append out " -symbol \"[$_clone element cget $elem -symbol]\" \\\n" |
---|
| 1201 | append out " -color \"[$_clone element cget $elem -color]\" \\\n" |
---|
| 1202 | append out " -dashes \"[$_clone element cget $elem -dashes]\" \\\n" |
---|
| 1203 | append out " -hide \"[$_clone element cget $elem -hide]\" \\\n" |
---|
| 1204 | append out " -label \"[$_clone element cget $elem -label]\" \n" |
---|
| 1205 | append out " \}\n" |
---|
[1589] | 1206 | } |
---|
| 1207 | |
---|
| 1208 | # Axis settings |
---|
| 1209 | foreach axis [$_clone axis names] { |
---|
[1593] | 1210 | if { [$_clone axis cget $axis -hide] } { |
---|
| 1211 | continue |
---|
| 1212 | } |
---|
[1598] | 1213 | append out " if \{ \[xygraph axis names \"$axis\"\] == \"$axis\" \} \{\n" |
---|
| 1214 | append out " xygraph axis configure \"$axis\" \\\n" |
---|
[1595] | 1215 | append out " -hide \"[$_clone axis cget $axis -hide]\" \\\n" |
---|
| 1216 | append out " -min \"[$_clone axis cget $axis -min]\" \\\n" |
---|
| 1217 | append out " -max \"[$_clone axis cget $axis -max]\" \\\n" |
---|
| 1218 | append out " -loose \"[$_clone axis cget $axis -loose]\" \\\n" |
---|
| 1219 | append out " -title \"[$_clone axis cget $axis -title]\" \\\n" |
---|
| 1220 | append out " -stepsize \"[$_clone axis cget $axis -stepsize]\" \\\n" |
---|
| 1221 | append out " -subdivisions \"[$_clone axis cget $axis -subdivisions]\"\n" |
---|
[1589] | 1222 | set hide [$_clone marker cget ${axis}-zero -hide] |
---|
[1598] | 1223 | append out " xygraph marker configure \"${axis}-zero\" -hide $hide\n" |
---|
[1595] | 1224 | append out " \}\n" |
---|
[1589] | 1225 | } |
---|
[1598] | 1226 | append out " xygraph grid configure \\\n" |
---|
[1595] | 1227 | append out " -hide \"[$_clone grid cget -hide]\" \\\n" |
---|
| 1228 | append out " -mapx \"[$_clone grid cget -mapx]\" \\\n" |
---|
| 1229 | append out " -mapy \"[$_clone grid cget -mapy]\"\n" |
---|
[1589] | 1230 | append out "\}\n" |
---|
[1598] | 1231 | return $out |
---|
[1589] | 1232 | } |
---|
[1598] | 1233 | |
---|