Changeset 6682
- Timestamp:
- May 5, 2017 2:55:42 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4_trunk/gui/scripts/xyprint.tcl
r5659 r6682 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: xyprint - Print X-Y plot. … … 23 23 option add *XyPrint*Entry*background "white" widgetDefault 24 24 25 itk::usual BltComboMenu { 26 #empty 27 } 28 itk::usual BltComboEntry { 29 #empty 30 } 31 25 32 itcl::class Rappture::XyPrint { 26 33 inherit itk::Widget … … 29 36 destructor {} 30 37 31 private variable _graph ""; # Original graph. 38 private variable _graph ""; # Original graph. 32 39 private variable _clone ""; # Cloned graph. 33 40 private variable _preview ""; # Preview image. 34 41 private variable _savedSettings; # Array of settings. 42 private variable _outputFormatType ""; 43 private variable _formatIcon ""; 44 private variable _colorIcon ""; 45 private variable _colorText ""; 35 46 36 47 private common _oldSettingsFile "~/.rpsettings" … … 40 51 public method reset {} 41 52 42 private method CopyOptions { cmd orig clone {exclude {}}} 53 private method CopyOptions { cmd orig clone {exclude {}}} 43 54 private method CloneGraph { orig } 44 55 … … 52 63 private method GetAxis {} 53 64 private method GetElement { args } 54 private method RegeneratePreview {} 55 private method InitClone {} 56 private method Pixels2Inches { pixels } 57 private method Inches2Pixels { inches {defValue ""}} 58 private method Color2RGB { color } 59 60 private method ApplyGeneralSettings {} 61 private method ApplyLegendSettings {} 62 private method ApplyAxisSettings {} 63 private method ApplyElementSettings {} 64 private method ApplyLayoutSettings {} 65 private method InitializeSettings {} 66 private method CreateSettings { toolName plotName } 67 private method RestoreSettings { toolName plotName } 68 private method SaveSettings { toolName plotName } 65 private method RegeneratePreview {} 66 private method InitClone {} 67 private method Pixels2Inches { pixels } 68 private method Inches2Pixels { inches {defValue ""}} 69 private method Color2RGB { color } 70 71 private method ApplyGeneralSettings {} 72 private method ApplyLegendSettings {} 73 private method ApplyAxisSettings {} 74 private method ApplyElementSettings {} 75 private method ApplyLayoutSettings {} 76 private method InitializeSettings {} 77 private method CreateSettings { toolName plotName } 78 private method RestoreSettings { toolName plotName } 79 private method SaveSettings { toolName plotName } 69 80 private method DestroySettings {} 70 private method ResetSettings { } 81 private method ResetSettings { } 71 82 private method GetOutput {} 72 83 private method SetWaitVariable { state } 73 private method SetLayoutOption { option } 74 private method GetAxisType { axis } 75 private method restore { toolName plotName data } 84 private method SetLayoutOption { option } 85 private method GetAxisType { axis } 86 private method restore { toolName plotName data } 87 private method AddColorToMenu { menu name color } 76 88 77 89 # Same dialog may be used for different graphs … … 87 99 $_dispatcher register !rebuild 88 100 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 89 101 90 102 set w [winfo pixels . 2.5i] 91 103 set h [winfo pixels . 2i] 92 set _preview [image create p hoto-width $w -height $h]104 set _preview [image create picture -width $w -height $h] 93 105 itk_component add tabs { 94 106 blt::tabset $itk_interior.tabs \ 95 107 -highlightthickness 0 -tearoff 0 -side top \ 96 - bd 0 -gap 0 -tabborderwidth 1 \97 -outerpad 1 - backgroundgrey108 -outerborderwidth 0 -gap 0 -borderwidth 1 \ 109 -outerpad 1 -troughcolor grey 98 110 } { 99 111 keep -cursor … … 126 138 0,1 $itk_component(tabs) -fill both -cspan 2 \ 127 139 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 140 1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 129 141 blt::table $inner \ 130 0,0 $itk_component(preview) -fill both -padx 10 -pady 10 142 0,0 $itk_component(preview) -fill both -padx 10 -pady 10 131 143 132 144 #blt::table configure $itk_interior c1 c2 -resize none … … 166 178 CloneGraph $graph 167 179 InitClone 168 RestoreSettings $toolName $plotName 180 RestoreSettings $toolName $plotName 169 181 InitializeSettings 170 182 SetWaitVariable 0 171 183 tkwait variable [itcl::scope _wait($this)] 172 SaveSettings $toolName $plotName 184 SaveSettings $toolName $plotName 173 185 set output "" 174 186 if { $_wait($this) } { 175 187 set output [GetOutput] 176 188 } 177 DestroySettings 189 DestroySettings 178 190 return $output 179 191 } … … 182 194 # Get the selected format of the download. 183 195 set page $itk_component(graph_page) 184 set format [$page.format current]185 196 set m $page.format.menu 197 set format [$m item cget $_settings($this-general-format) -value] 186 198 if { $format == "jpg" } { 187 set img [image create p hoto]199 set img [image create picture] 188 200 $_clone snap $img 189 set bytes [$img data -format "jpeg -quality 100"] 190 set bytes [Rappture::encoding::decode -as b64 $bytes] 201 $img export jpg -quality 100 -data bytes 191 202 image delete $img 192 203 return [list .jpg $bytes] 193 204 } elseif { $format == "png" } { 194 set img [image create p hoto]205 set img [image create picture] 195 206 $_clone snap $img 196 set bytes [$img data -format "png"] 197 set bytes [Rappture::encoding::decode -as b64 $bytes] 207 $img export png -data bytes 198 208 image delete $img 199 209 return [list .png $bytes] 210 } elseif { $format == "gif" } { 211 set img [image create picture] 212 $_clone snap $img 213 $img export gif -data bytes 214 image delete $img 215 return [list .gif $bytes] 200 216 } 201 217 … … 207 223 208 224 $_clone postscript configure \ 209 -maxpect false \210 225 -decoration yes \ 211 226 -center yes \ 212 227 -width $w -height $h 213 228 214 229 set psdata [$_clone postscript output] 215 230 216 231 if 0 { 217 set f [open "junk.raw" "w"] 232 set f [open "junk.raw" "w"] 218 233 puts -nonewline $f $psdata 219 234 close $f 220 235 } 221 if { $format == "eps" } { 236 if { $format == "eps" } { 222 237 return [list .$format $psdata] 223 238 } 224 239 225 240 set cmd "" 226 # | eps2eps << $psdata 241 # | eps2eps << $psdata 227 242 lappend cmd "|" "/usr/bin/gs" \ 228 243 "-q" "-sDEVICE=epswrite" "-sstdout=%stderr" \ … … 230 245 "-dDEVICEWIDTH=250000" "-dDEVICEHEIGHT=250000" "-" "<<" "$psdata" 231 246 if { $format == "pdf" } { 232 # | eps2eps << $psdata | ps2pdf 247 # | eps2eps << $psdata | ps2pdf 233 248 lappend cmd "|" "/usr/bin/gs" \ 234 249 "-q" "-sDEVICE=pdfwrite" "-sstdout=%stderr" \ … … 242 257 close $f 243 258 } err ] != 0 } { 244 global errorInfo 259 global errorInfo 245 260 puts stderr "failed to generate file: $err\n$errorInfo" 246 261 return "" 247 262 } 248 263 if 0 { 249 set f [open "junk.$format" "w"] 264 set f [open "junk.$format" "w"] 250 265 fconfigure $f -translation binary -encoding binary 251 266 puts -nonewline $f $output … … 319 334 # Element component 320 335 foreach elem [$orig element names] { 321 set oper [$orig element type $elem] 336 set oper [$orig element type $elem] 322 337 $_clone $oper create $elem 323 CopyOptions [list $oper configure $elem] $orig $_clone -data 338 CopyOptions [list $oper configure $elem] $orig $_clone -data 324 339 if { [$_clone $oper cget $elem -hide] } { 325 $_clone $oper configure $elem -label "" 340 $_clone $oper configure $elem -label "" 326 341 } 327 342 } … … 334 349 # Crosshairs component 335 350 CopyOptions {crosshairs configure} $orig $_clone 336 # Grid component337 CopyOptions {grid configure} $orig $_clone338 351 339 352 # Create markers representing lines at zero for the x and y axis. … … 345 358 346 359 itcl::body Rappture::XyPrint::InitClone {} { 347 360 348 361 $_clone configure -width 3.4i -height 3.4i -background white \ 349 362 -borderwidth 0 \ … … 352 365 -topmargin 0 \ 353 366 -bottommargin 0 354 367 355 368 # Kill the title and create a border around the plot 356 369 $_clone configure \ … … 372 385 -hide yes -borderwidth 0 -background white -relief solid \ 373 386 -anchor nw -activeborderwidth 0 374 # 387 # 375 388 set _settings($this-axis-ticks-fontfamily) helvetica 376 389 set _settings($this-axis-ticks-fontsize) 10 … … 411 424 incr count 412 425 if { [$_clone element cget $elem -linewidth] > 1 } { 413 $_clone element configure $elem -linewidth 1 -pixels 3 426 $_clone element configure $elem -linewidth 1 -pixels 3 414 427 } 415 428 } 416 429 if { $count == 0 } { 417 # There are no "line" elements in the graph. 430 # There are no "line" elements in the graph. 418 431 # Remove the symbol and dashes controls. 419 432 set page $itk_component(legend_page) 420 433 # May have already been forgotten. 421 catch { 434 catch { 422 435 blt::table forget $page.symbol_l 423 436 blt::table forget $page.symbol 424 437 blt::table forget $page.dashes_l 425 blt::table forget $page.dashes 438 blt::table forget $page.dashes 426 439 } 427 440 } … … 429 442 430 443 itcl::body Rappture::XyPrint::SetOption { opt } { 431 set new $_settings($this$opt) 444 set new $_settings($this$opt) 432 445 set old [$_clone cget $opt] 433 446 set code [catch [list $_clone configure $opt $new] err] … … 442 455 443 456 itcl::body Rappture::XyPrint::SetComponentOption { comp opt } { 444 set new $_settings($this-$comp$opt) 457 set new $_settings($this-$comp$opt) 445 458 set old [$_clone $comp cget $opt] 446 459 set code [catch [list $_clone $comp configure $opt $new] err] … … 455 468 456 469 itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } { 457 set new $_settings($this-$comp$opt) 470 set new $_settings($this-$comp$opt) 458 471 set old [$_clone $comp cget $name $opt] 459 472 set code [catch [list $_clone $comp configure $name $opt $new] err] … … 468 481 469 482 itcl::body Rappture::XyPrint::RegeneratePreview {} { 470 update 471 set img [image create p hoto]483 update 484 set img [image create picture] 472 485 set w [Inches2Pixels $_settings($this-layout-width) 3.4] 473 486 set h [Inches2Pixels $_settings($this-layout-height) 3.4] … … 482 495 set maxheight $rh 483 496 if { $maxwidth > $cw } { 484 set maxwidth $cw 497 set maxwidth $cw 485 498 } 486 499 if { $maxheight > $ch } { 487 set maxheight $ch 500 set maxheight $ch 488 501 } 489 502 set sx [expr double($maxwidth)/$w] … … 494 507 set ph [expr int(round($s * $h))] 495 508 $_preview configure -width $pw -height $ph 496 blt::winop resample $img $_preview box 509 #.labeltest.label configure -image $img 510 $_preview resample $img -filter box 497 511 image delete $img 498 512 } … … 548 562 } 549 563 set type [GetAxisType $axis] 550 if { [$_clone grid cget -map${type}] == $axis } {551 set _settings($this-axis-grid) 1552 } else {553 set _settings($this-axis-grid) 0554 }555 564 set _settings($this-axis-plotpad${type}) \ 556 565 [Pixels2Inches [$_clone cget -plotpad${type}]] … … 560 569 itcl::body Rappture::XyPrint::GetElement { args } { 561 570 set index 1 571 set page $itk_component(legend_page) 562 572 array unset _settings $this-element-* 563 573 foreach elem [$_clone element show] { … … 568 578 set elem $_settings($this-element-$index) 569 579 set _settings($this-element-label) [$_clone element cget $elem -label] 570 set _settings($this-element-color) [$_clone element cget $elem -color] 580 581 set color [$_clone element cget $elem -color] 582 set found 0 583 set m $page.color.menu 584 foreach item [$m names] { 585 set c [$m item cget $item -value] 586 if { $c == $color } { 587 set color $item 588 set found 1 589 break 590 } 591 } 592 if { !$found } { 593 AddColorToMenu $m $color $color 594 } 595 $m select $color 596 571 597 if { [$_clone element type $elem] != "bar" } { 572 598 set _settings($this-element-symbol) [$_clone element cget $elem -symbol] 573 599 set _settings($this-element-dashes) [$_clone element cget $elem -dashes] 574 600 } 575 set page $itk_component(legend_page)576 set color [$page.color label $_settings($this-element-color)]577 if { $color == "" } {578 set color [Color2RGB $_settings($this-element-color)]579 $page.color choices insert end $color $color580 $page.color value $color581 } else {582 $page.color value [$page.color label $_settings($this-element-color)]583 }584 601 if { [$_clone element type $elem] != "bar" } { 585 602 $page.symbol value [$page.symbol label $_settings($this-element-symbol)] … … 591 608 itcl::body Rappture::XyPrint::BuildLayoutTab {} { 592 609 itk_component add layout_page { 593 frame $itk_component(tabs).layout_page 610 frame $itk_component(tabs).layout_page 594 611 } 595 612 set page $itk_component(layout_page) … … 597 614 -text "Layout" -padx 2 -pady 2 -window $page -fill both 598 615 599 label $page.width_l -text "width" 616 label $page.width_l -text "width" 600 617 entry $page.width -width 6 \ 601 618 -textvariable [itcl::scope _settings($this-layout-width)] … … 604 621 "Set the width (inches) of the output image. Must be a positive number." 605 622 606 label $page.height_l -text "height" 623 label $page.height_l -text "height" 607 624 entry $page.height -width 6 \ 608 625 -textvariable [itcl::scope _settings($this-layout-height)] … … 611 628 "Set the height (inches) of the output image. Must be a positive number" 612 629 613 label $page.margin_l -text "Margins" 630 label $page.margin_l -text "Margins" 614 631 615 632 label $page.left_l -text "left" … … 620 637 "Set the size (inches) of the left margin. If zero, the size is automatically determined." 621 638 622 label $page.right_l -text "right" 639 label $page.right_l -text "right" 623 640 entry $page.right -width 6 \ 624 641 -textvariable [itcl::scope _settings($this-layout-rightmargin)] … … 659 676 0,2 $page.map -fill both -rspan 7 -padx 2 660 677 661 blt::table configure $page c0 r* -resize none 678 blt::table configure $page c0 r* -resize none 662 679 blt::table configure $page c1 r2 -resize both 663 680 } … … 666 683 itcl::body Rappture::XyPrint::BuildGeneralTab {} { 667 684 itk_component add graph_page { 668 frame $itk_component(tabs).graph_page 685 frame $itk_component(tabs).graph_page 669 686 } 670 687 set page $itk_component(graph_page) … … 673 690 674 691 label $page.format_l -text "format" 675 Rappture::Combobox $page.format -width 30 -editable no 676 $page.format choices insert end \ 677 "pdf" "PDF Portable Document Format" \ 678 "ps" "PS PostScript Format" \ 679 "eps" "EPS Encapsulated PostScript" \ 680 "jpg" "JPEG Joint Photographic Experts Group Format" \ 681 "png" "PNG Portable Network Graphics Format" 682 683 bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings] 684 Rappture::Tooltip::for $page.format \ 685 "Set the format of the image." 686 687 label $page.style_l -text "style" 688 Rappture::Combobox $page.style -width 20 -editable no 689 $page.style choices insert end \ 690 "ieee" "IEEE Journal" \ 691 "gekco" "G Klimeck" 692 bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings] 693 Rappture::Tooltip::for $page.format \ 694 "Set the style template." 695 696 checkbutton $page.remember -text "remember settings" \ 697 -variable [itcl::scope _settings($this-general-remember)] 692 set m $page.format.menu 693 blt::comboentry $page.format \ 694 -width 1i \ 695 -textvariable [itcl::scope _settings($this-general-format)] \ 696 -editable no -menu $m \ 697 -iconvariable [itcl::scope _formatIcon] \ 698 -command [itcl::code $this ApplyGeneralSettings] 699 blt::combomenu $m \ 700 -xscrollbar $m.xs \ 701 -yscrollbar $m.ys \ 702 -textvariable [itcl::scope _settings($this-general-format)] \ 703 -iconvariable [itcl::scope _formatIcon] \ 704 -height { 0 2i } 705 blt::tk::scrollbar $m.xs 706 blt::tk::scrollbar $m.ys 707 $m add -value "pdf" -text "PDF Portable Document Format" \ 708 -icon [Rappture::icon pdf] 709 $m add -value "ps" -text "PS PostScript Format" \ 710 -icon [Rappture::icon ps] 711 $m add -value "eps" -text "EPS Encapsulated PostScript" \ 712 -icon [Rappture::icon eps] 713 $m add -value "jpg" -text "JPEG Joint Photographic Experts Group Format" \ 714 -icon [Rappture::icon jpg] 715 $m add -value "png" -text "PNG Portable Network Graphics Format" \ 716 -icon [Rappture::icon png] 717 $m add -value "gif" -text "GIF Graphics Interchange Format" \ 718 -icon [Rappture::icon gif] 719 Rappture::Tooltip::for $page.format_l "Set the format of the image." 720 721 label $page.style_l -text "style" 722 set m $page.style.menu 723 blt::comboentry $page.style \ 724 -width 1i \ 725 -textvariable [itcl::scope _settings($this-general-style)] \ 726 -editable no -menu $m \ 727 -command [itcl::code $this ApplyGeneralSettings] 728 blt::combomenu $m \ 729 -xscrollbar $m.xs \ 730 -yscrollbar $m.ys \ 731 -textvariable [itcl::scope _settings($this-general-style)] \ 732 -height { 0 2i } 733 blt::tk::scrollbar $m.xs 734 blt::tk::scrollbar $m.ys 735 $m add -value "ieee" -text "IEEE Journal" 736 $m add -value "gekco" -text "G Klimeck" 737 $m item configure all \ 738 -variable [itcl::scope _settings($this-general-style)] 739 Rappture::Tooltip::for $page.style_l "Set the style template." 740 741 blt::tk::checkbutton $page.remember -text "remember settings" \ 742 -variable [itcl::scope _settings($this-general-remember)] 698 743 Rappture::Tooltip::for $page.remember \ 699 744 "Remember the settings. They will be override the default settings." … … 711 756 3,1 $page.style -fill x -cspan 2 \ 712 757 5,0 $page.remember -cspan 2 -anchor w \ 713 5,2 $page.revert -anchor e 758 5,2 $page.revert -anchor e 714 759 blt::table configure $page r* -resize none -pady { 0 2 } 715 760 blt::table configure $page r4 -resize both 716 761 717 762 } 718 719 itcl::body Rappture::XyPrint::ApplyLegendSettings {} { 720 set page $itk_component(legend_page) 721 set _settings($this-legend-anchor) [$page.anchor current] 722 if { $_clone != "" } { 723 lappend font $_settings($this-legend-fontfamily) 724 lappend font $_settings($this-legend-fontsize) 725 lappend font $_settings($this-legend-fontweight) 726 lappend font $_settings($this-legend-fontslant) 727 foreach option { -hide -position -anchor -borderwidth } { 728 SetComponentOption legend $option 729 } 730 $_clone legend configure -font fixed -font $font 731 } 732 ApplyElementSettings 733 } 734 763 735 764 itcl::body Rappture::XyPrint::BuildLegendTab {} { 736 765 itk_component add legend_page { 737 frame $itk_component(tabs).legend_page 766 frame $itk_component(tabs).legend_page 738 767 } 739 768 set page $itk_component(legend_page) … … 741 770 -text "Legend" -padx 2 -pady 2 -window $page -fill both 742 771 743 checkbutton $page.show -text "show legend" \772 blt::tk::checkbutton $page.show -text "show legend" \ 744 773 -offvalue 1 -onvalue 0 \ 745 774 -variable [itcl::scope _settings($this-legend-hide)] \ 746 -command [itcl::code $this ApplyLegendSettings] 775 -command [itcl::code $this ApplyLegendSettings] 747 776 Rappture::Tooltip::for $page.show \ 748 777 "Display the legend." 749 778 750 label $page.position_l -text "position"779 blt::tk::label $page.position_l -text "position" 751 780 Rappture::Combobox $page.position -width 15 -editable no 752 781 $page.position choices insert end \ … … 755 784 "bottommargin" "bottom margin" \ 756 785 "topmargin" "top margin" \ 757 "plotarea" "inside plot" 786 "plotarea" "inside plot" 758 787 bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings] 759 788 Rappture::Tooltip::for $page.position \ … … 770 799 "c" "center" \ 771 800 "e" "east" \ 772 "w" "west" 801 "w" "west" 773 802 bind $page.anchor <<Value>> [itcl::code $this ApplyLegendSettings] 774 803 Rappture::Tooltip::for $page.anchor \ 775 804 "Set the anchor of the legend. This option and the anchor determine the legend's location." 776 805 777 checkbutton $page.border -text "border" \806 blt::tk::checkbutton $page.border -text "border" \ 778 807 -variable [itcl::scope _settings($this-legend-borderwidth)] \ 779 808 -onvalue 1 -offvalue 0 \ … … 787 816 -orient horizontal -width 12 \ 788 817 -command [itcl::code $this GetElement] 789 } 818 } 790 819 Rappture::Tooltip::for $page.slider \ 791 820 "Select the current entry." 792 821 793 label $page.label_l -text "label"822 blt::tk::label $page.label_l -text "label" 794 823 entry $page.label \ 795 824 -background white \ … … 799 828 "Set the label of the current entry in the legend." 800 829 801 label $page.color_l -text "color " 830 blt::tk::label $page.color_l -text "color" 831 set m $page.color.menu 832 blt::comboentry $page.color \ 833 -width 1i \ 834 -textvariable [itcl::scope _colorText] \ 835 -iconvariable [itcl::scope _colorIcon] \ 836 -editable no -menu $m \ 837 -command [itcl::code $this ApplyElementSettings] 838 blt::combomenu $m \ 839 -xscrollbar $m.xs \ 840 -yscrollbar $m.ys \ 841 -textvariable [itcl::scope _colorText] \ 842 -iconvariable [itcl::scope _colorIcon] \ 843 -height { 0 2i } 844 blt::tk::scrollbar $m.xs 845 blt::tk::scrollbar $m.ys 846 foreach {rgb name} { 847 "#000000" "black" 848 "#ffffff" "white" 849 "#0000cd" "blue" 850 "#cd0000" "red" 851 "#00cd00" "green" 852 "#3a5fcd" "royal blue" 853 "#cdcd00" "yellow" 854 "#cd1076" "deep pink" 855 "#009acd" "deep sky blue" 856 "#00c5cd" "turquoise" 857 "#a2b5cd" "light steel blue" 858 "#7ac5cd" "cadet blue" 859 "#66cdaa" "aquamarine" 860 "#a2cd5a" "dark olive green" 861 "#cd9b9b" "rosy brown" 862 "#0000ff" "blue1" 863 "#ff0000" "red1" 864 "#00ff00" "green1" 865 } { 866 AddColorToMenu $m $name $rgb 867 } 868 Rappture::Tooltip::for $page.color \ 869 "Set the color of the current entry." 870 871 if 0 { 872 label $page.color_l -text "color " 802 873 Rappture::Combobox $page.color -width 15 -editable no 803 874 $page.color choices insert end \ … … 819 890 "#0000ff" "blue1" \ 820 891 "#ff0000" "red1" \ 821 "#00ff00" "green1" 892 "#00ff00" "green1" 822 893 bind $page.color <<Value>> [itcl::code $this ApplyElementSettings] 823 894 Rappture::Tooltip::for $page.color \ 824 895 "Set the color of the current entry." 825 826 label $page.dashes_l -text "line style"896 } 897 blt::tk::label $page.dashes_l -text "line style" 827 898 Rappture::Combobox $page.dashes -width 15 -editable no 828 899 $page.dashes choices insert end \ … … 836 907 "Set the line style of the current entry." 837 908 838 label $page.symbol_l -text "symbol"909 blt::tk::label $page.symbol_l -text "symbol" 839 910 Rappture::Combobox $page.symbol -editable no 840 911 $page.symbol choices insert end \ … … 852 923 "Set the symbol of the current entry. \"none\" display no symbols." 853 924 854 label $page.font_l -text "font" 855 Rappture::Combobox $page.fontfamily -width 10 -editable no 856 $page.fontfamily choices insert end \ 857 "courier" "courier" \ 858 "helvetica" "helvetica" \ 859 "new*century*schoolbook" "new century schoolbook" \ 860 "symbol" "symbol" \ 861 "times" "times" 862 bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings] 925 blt::tk::label $page.font_l -text "font" 926 set m $page.fontfamily.menu 927 blt::comboentry $page.fontfamily \ 928 -width 1i \ 929 -textvariable [itcl::scope _settings($this-legend-fontfamily)] \ 930 -editable no -menu $m \ 931 -command [itcl::code $this ApplyLegendSettings] 932 blt::combomenu $m \ 933 -xscrollbar $m.xs \ 934 -yscrollbar $m.ys \ 935 -textvariable [itcl::scope _settings($this-legend-fontfamily)] \ 936 -height { 0 2i } 937 blt::tk::scrollbar $m.xs 938 blt::tk::scrollbar $m.ys 939 $m style create "courier" -font "{courier new} 9" 940 $m style create "helvetica" -font "{arial} 9" 941 $m style create "newcentury" -font "{new century schoolbook} 9" 942 $m style create "times" -font "{times new roman} 9" 943 $m add -text "courier" -value "courier" -style "courier" 944 $m add -text "helvetica" -value "helvetica" -style "helvetica" 945 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 946 -style "newcentury" 947 $m add -text "symbol" -value "symbol" 948 $m add -text "times" -value "times" -style "times" 949 $m item configure all -icon [Rappture::icon font] 863 950 Rappture::Tooltip::for $page.fontfamily \ 864 951 "Set the font of entries in the legend." 865 952 866 Rappture::Combobox $page.fontsize -width 4 -editable no 867 $page.fontsize choices insert end \ 868 "8" "8" \ 869 "9" "9" \ 870 "10" "10" \ 871 "11" "11" \ 872 "12" "12" \ 873 "14" "14" \ 874 "17" "17" \ 875 "18" "18" \ 876 "20" "20" 877 bind $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings] 953 set m $page.fontsize.menu 954 blt::comboentry $page.fontsize \ 955 -width 0.5i \ 956 -textvariable [itcl::scope _settings($this-legend-fontsize)] \ 957 -editable no -menu $m \ 958 -command [itcl::code $this ApplyLegendSettings] 959 blt::combomenu $m \ 960 -xscrollbar $m.xs \ 961 -yscrollbar $m.ys \ 962 -textvariable [itcl::scope _settings($this-legend-fontsize)] \ 963 -height { 0 2i } 964 blt::tk::scrollbar $m.xs 965 blt::tk::scrollbar $m.ys 966 foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } { 967 $m add -text $size -value $size 968 } 878 969 Rappture::Tooltip::for $page.fontsize \ 879 "Set the size (points) of the font." 880 881 Rappture::PushButton $page.fontweight \ 970 "Set the size (in points) of the legend font." 971 972 blt::tk::pushbutton $page.fontweight \ 973 -width 18 -height 18 \ 882 974 -onimage [Rappture::icon font-bold] \ 883 975 -offimage [Rappture::icon font-bold] \ … … 888 980 "Use the bold version of the font." 889 981 890 Rappture::PushButton $page.fontslant \ 982 blt::tk::pushbutton $page.fontslant \ 983 -width 18 -height 18 \ 891 984 -onimage [Rappture::icon font-italic] \ 892 985 -offimage [Rappture::icon font-italic] \ … … 927 1020 itcl::body Rappture::XyPrint::BuildAxisTab {} { 928 1021 itk_component add axis_page { 929 frame $itk_component(tabs).axis_page 1022 frame $itk_component(tabs).axis_page 930 1023 } 931 1024 set page $itk_component(axis_page) 932 1025 $itk_component(tabs) insert end "axis" \ 933 1026 -text "Axis" -padx 2 -pady 2 -window $page -fill both 934 935 label $page.axis_l -text "axis"1027 1028 blt::tk::label $page.axis_l -text "axis" 936 1029 itk_component add axis_combo { 937 1030 Rappture::Combobox $page.axis -width 20 -editable no 938 } 1031 } 939 1032 bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis] 940 1033 Rappture::Tooltip::for $page.axis \ 941 1034 "Select the current axis." 942 1035 943 label $page.title_l -text "title"1036 blt::tk::label $page.title_l -text "title" 944 1037 entry $page.title \ 945 1038 -textvariable [itcl::scope _settings($this-axis-title)] … … 948 1041 "Set the title of the current axis." 949 1042 950 label $page.min_l -text "min"1043 blt::tk::label $page.min_l -text "min" 951 1044 entry $page.min -width 10 \ 952 1045 -textvariable [itcl::scope _settings($this-axis-min)] … … 955 1048 "Set the minimum limit for the current axis. If empty, the minimum is automatically determined." 956 1049 957 label $page.max_l -text "max"1050 blt::tk::label $page.max_l -text "max" 958 1051 entry $page.max -width 10 \ 959 1052 -textvariable [itcl::scope _settings($this-axis-max)] … … 962 1055 "Set the maximum limit for the current axis. If empty, the maximum is automatically determined." 963 1056 964 label $page.subdivisions_l -text "subdivisions"1057 blt::tk::label $page.subdivisions_l -text "subdivisions" 965 1058 entry $page.subdivisions \ 966 1059 -textvariable [itcl::scope _settings($this-axis-subdivisions)] … … 970 1063 "Set the number of subdivisions (minor ticks) for the current axis." 971 1064 972 label $page.stepsize_l -text "step size"1065 blt::tk::label $page.stepsize_l -text "step size" 973 1066 entry $page.stepsize \ 974 1067 -textvariable [itcl::scope _settings($this-axis-stepsize)] … … 977 1070 "Set the interval between major ticks for the current axis. If zero, the interval is automatically determined." 978 1071 979 checkbutton $page.loose -text "loose limits" \1072 blt::tk::checkbutton $page.loose -text "loose limits" \ 980 1073 -onvalue "always" -offvalue "0" \ 981 1074 -variable [itcl::scope _settings($this-axis-loose)] \ … … 984 1077 "Set major ticks outside of the limits for the current axis." 985 1078 986 label $page.plotpad_l -text "pad"1079 blt::tk::label $page.plotpad_l -text "pad" 987 1080 entry $page.plotpad -width 6 \ 988 1081 -textvariable [itcl::scope _settings($this-axis-plotpad)] … … 991 1084 "Set padding (points) between the current axis and the plot." 992 1085 993 checkbutton $page.grid -text "show grid lines" \1086 blt::tk::checkbutton $page.grid -text "show grid lines" \ 994 1087 -variable [itcl::scope _settings($this-axis-grid)] \ 995 1088 -command [itcl::code $this ApplyAxisSettings] … … 997 1090 "Display grid lines for the current axis." 998 1091 999 checkbutton $page.zero -text "mark zero" \1092 blt::tk::checkbutton $page.zero -text "mark zero" \ 1000 1093 -offvalue 1 -onvalue 0 \ 1001 1094 -variable [itcl::scope _settings($this-axis-zero)] \ … … 1004 1097 "Display a line at zero for the current axis." 1005 1098 1006 label $page.tickfont_l -text "tick font" 1007 Rappture::Combobox $page.tickfontfamily -width 10 -editable no 1008 $page.tickfontfamily choices insert end \ 1009 "courier" "courier" \ 1010 "helvetica" "helvetica" \ 1011 "new*century*schoolbook" "new century schoolbook" \ 1012 "symbol" "symbol" \ 1013 "times" "times" 1014 bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1099 blt::tk::label $page.tickfont_l -text "tick font" 1100 set m $page.tickfontfamily.menu 1101 blt::comboentry $page.tickfontfamily \ 1102 -width 1i \ 1103 -textvariable [itcl::scope _settings($this-axis-ticks-fontfamily)] \ 1104 -editable no -menu $m \ 1105 -command [itcl::code $this ApplyAxisSettings] 1106 blt::combomenu $m \ 1107 -xscrollbar $m.xs \ 1108 -yscrollbar $m.ys \ 1109 -textvariable [itcl::scope _settings($this-axis-ticks-fontfamily)] \ 1110 -height { 0 2i } 1111 blt::tk::scrollbar $m.xs 1112 blt::tk::scrollbar $m.ys 1113 $m style create "courier" -font "{courier new} 9" 1114 $m style create "helvetica" -font "{arial} 9" 1115 $m style create "newcentury" -font "{new century schoolbook} 9" 1116 $m style create "times" -font "{times new roman} 9" 1117 $m add -text "courier" -value "courier" -style "courier" 1118 $m add -text "helvetica" -value "helvetica" -style "helvetica" 1119 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 1120 -style "newcentury" 1121 $m add -text "symbol" -value "symbol" 1122 $m add -text "times" -value "times" -style "times" 1123 $m item configure all -icon [Rappture::icon font] 1015 1124 Rappture::Tooltip::for $page.tickfontfamily \ 1016 1125 "Set the font of the ticks for the current axis." 1017 1126 1018 Rappture::Combobox $page.tickfontsize -width 4 -editable no 1019 $page.tickfontsize choices insert end \ 1020 "8" "8" \ 1021 "9" "9" \ 1022 "10" "10" \ 1023 "11" "11" \ 1024 "12" "12" \ 1025 "14" "14" \ 1026 "17" "17" \ 1027 "18" "18" \ 1028 "20" "20" 1029 bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1127 set m $page.tickfontsize.menu 1128 blt::comboentry $page.tickfontsize \ 1129 -width 0.5i \ 1130 -textvariable [itcl::scope _settings($this-axis-ticks-fontsize)] \ 1131 -editable no -menu $m \ 1132 -command [itcl::code $this ApplyLegendSettings] 1133 blt::combomenu $m \ 1134 -xscrollbar $m.xs \ 1135 -yscrollbar $m.ys \ 1136 -textvariable [itcl::scope _settings($this-axis-ticks-fontsize)] \ 1137 -height { 0 2i } 1138 blt::tk::scrollbar $m.xs 1139 blt::tk::scrollbar $m.ys 1140 foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } { 1141 $m add -text $size -value $size 1142 } 1030 1143 Rappture::Tooltip::for $page.tickfontsize \ 1031 "Set the size (points) of the tick font." 1032 1033 Rappture::PushButton $page.tickfontweight \ 1144 "Set the size (in points) of the tick font." 1145 1146 blt::tk::pushbutton $page.tickfontweight \ 1147 -width 18 -height 18 \ 1034 1148 -onimage [Rappture::icon font-bold] \ 1035 1149 -offimage [Rappture::icon font-bold] \ … … 1040 1154 "Use the bold version of the tick font." 1041 1155 1042 Rappture::PushButton $page.tickfontslant \ 1156 blt::tk::pushbutton $page.tickfontslant \ 1157 -width 18 -height 18 \ 1043 1158 -onimage [Rappture::icon font-italic] \ 1044 1159 -offimage [Rappture::icon font-italic] \ … … 1049 1164 "Use the italic version of the tick font." 1050 1165 1051 label $page.titlefont_l -text "title font" 1052 Rappture::Combobox $page.titlefontfamily -width 10 -editable no 1053 $page.titlefontfamily choices insert end \ 1054 "courier" "courier" \ 1055 "helvetica" "helvetica" \ 1056 "new*century*schoolbook" "new century schoolbook" \ 1057 "symbol" "symbol" \ 1058 "times" "times" 1059 bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1166 blt::tk::label $page.titlefont_l -text "title font" 1167 set m $page.titlefontfamily.menu 1168 blt::comboentry $page.titlefontfamily \ 1169 -width 1i \ 1170 -textvariable [itcl::scope _settings($this-axis-title-fontfamily)] \ 1171 -editable no -menu $m \ 1172 -command [itcl::code $this ApplyAxisSettings] 1173 blt::combomenu $m \ 1174 -xscrollbar $m.xs \ 1175 -yscrollbar $m.ys \ 1176 -textvariable [itcl::scope _settings($this-axis-title-fontfamily)] \ 1177 -height { 0 2i } 1178 blt::tk::scrollbar $m.xs 1179 blt::tk::scrollbar $m.ys 1180 $m style create "courier" -font "{courier new} 9" 1181 $m style create "helvetica" -font "{arial} 9" 1182 $m style create "newcentury" -font "{new century schoolbook} 9" 1183 $m style create "times" -font "{times new roman} 9" 1184 $m add -text "courier" -value "courier" -style "courier" 1185 $m add -text "helvetica" -value "helvetica" -style "helvetica" 1186 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 1187 -style "newcentury" 1188 $m add -text "symbol" -value "symbol" 1189 $m add -text "times" -value "times" -style "times" 1190 $m item configure all -icon [Rappture::icon font] 1060 1191 Rappture::Tooltip::for $page.titlefontfamily \ 1061 1192 "Set the font of the title for the current axis." 1062 1193 1063 Rappture::Combobox $page.titlefontsize -width 4 -editable no 1064 $page.titlefontsize choices insert end \ 1065 "8" "8" \ 1066 "9" "9" \ 1067 "10" "10" \ 1068 "11" "11" \ 1069 "12" "12" \ 1070 "14" "14" \ 1071 "17" "17" \ 1072 "18" "18" \ 1073 "20" "20" 1074 bind $page.titlefontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1194 set m $page.titlefontsize.menu 1195 blt::comboentry $page.titlefontsize \ 1196 -width 0.5i \ 1197 -textvariable [itcl::scope _settings($this-axis-title-fontsize)] \ 1198 -editable no -menu $m \ 1199 -command [itcl::code $this ApplyLegendSettings] 1200 blt::combomenu $m \ 1201 -xscrollbar $m.xs \ 1202 -yscrollbar $m.ys \ 1203 -textvariable [itcl::scope _settings($this-axis-title-fontsize)] \ 1204 -height { 0 2i } 1205 blt::tk::scrollbar $m.xs 1206 blt::tk::scrollbar $m.ys 1207 foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } { 1208 $m add -text $size -value $size 1209 } 1075 1210 Rappture::Tooltip::for $page.titlefontsize \ 1076 "Set the size (point) of the title font." 1077 1078 Rappture::PushButton $page.titlefontweight \ 1211 "Set the size (in points) of the title font." 1212 1213 blt::tk::pushbutton $page.titlefontweight \ 1214 -width 18 -height 18 \ 1079 1215 -onimage [Rappture::icon font-bold] \ 1080 1216 -offimage [Rappture::icon font-bold] \ … … 1085 1221 "Use the bold version of the title font." 1086 1222 1087 Rappture::PushButton $page.titlefontslant \ 1223 blt::tk::pushbutton $page.titlefontslant \ 1224 -width 18 -height 18 \ 1088 1225 -onimage [Rappture::icon font-italic] \ 1089 1226 -offimage [Rappture::icon font-italic] \ … … 1102 1239 3,2 $page.min -fill x \ 1103 1240 3,3 $page.stepsize_l -anchor e \ 1104 3,4 $page.stepsize -fill both-cspan 3 \1241 3,4 $page.stepsize -fill x -cspan 3 \ 1105 1242 4,1 $page.max_l -anchor e \ 1106 4,2 $page.max -fill both\1243 4,2 $page.max -fill x \ 1107 1244 4,3 $page.subdivisions_l -anchor e \ 1108 4,4 $page.subdivisions -fill both-cspan 3 \1245 4,4 $page.subdivisions -fill x -cspan 3 \ 1109 1246 5,1 $page.titlefont_l -anchor e \ 1110 1247 5,2 $page.titlefontfamily -fill x -cspan 2 \ … … 1121 1258 8,1 $page.zero -cspan 2 -anchor w \ 1122 1259 8,3 $page.plotpad_l -anchor e \ 1123 8,4 $page.plotpad -fill both -cspan 3 1124 1125 blt::table configure $page c0 c4 c5 c6 c7 c8 -resize none 1260 8,4 $page.plotpad -fill both -cspan 3 1261 1262 blt::table configure $page r* c0 c4 c5 c6 c7 c8 -resize none 1263 blt::table configure $page r* -pady 1 1264 blt::table configure $page r9 -resize both 1126 1265 } 1127 1266 … … 1132 1271 itcl::body Rappture::XyPrint::ApplyLegendSettings {} { 1133 1272 set page $itk_component(legend_page) 1273 1134 1274 set _settings($this-legend-position) [$page.position current] 1135 1275 set _settings($this-legend-anchor) [$page.anchor current] 1136 1137 1276 foreach option { -hide -position -anchor -borderwidth } { 1138 1277 SetComponentOption legend $option 1139 1278 } 1140 set _settings($this-legend-fontfamily) [$page.fontfamily value]1141 set _settings($this-legend-fontsize) [$page.fontsize value]1142 1279 lappend font $_settings($this-legend-fontfamily) 1143 1280 lappend font $_settings($this-legend-fontsize) … … 1145 1282 lappend font $_settings($this-legend-fontslant) 1146 1283 $_clone legend configure -font fixed -font $font 1284 1285 # Set the font of the comboentry to the selected legend font. 1286 set m $page.fontfamily.menu 1287 set style [$m item cget $_settings($this-legend-fontfamily) -style] 1288 set font [$m style cget $style -font] 1289 $page.fontfamily configure -font $font 1147 1290 ApplyElementSettings 1148 1291 } … … 1152 1295 set type [GetAxisType $axis] 1153 1296 set page $itk_component(axis_page) 1154 if { $_settings($this-axis-grid) } {1155 $_clone grid configure -hide no -map${type} ${axis}1156 } else {1157 $_clone grid configure -hide no -map${type} ""1158 }1159 1297 $_clone configure -plotpad${type} $_settings($this-axis-plotpad) 1160 foreach option { - min -max -loose -title -stepsize -subdivisions } {1298 foreach option { -grid -min -max -loose -title -stepsize -subdivisions } { 1161 1299 SetNamedComponentOption axis $axis $option 1162 1300 } 1163 set _settings($this-axis-ticks-fontfamily) [$page.tickfontfamily value]1164 set _settings($this-axis-ticks-fontsize) [$page.tickfontsize value]1165 set _settings($this-axis-title-fontfamily) [$page.titlefontfamily value]1166 set _settings($this-axis-title-fontsize) [$page.titlefontsize value]1167 1168 1301 set tickfont {} 1169 1302 set titlefont {} … … 1179 1312 lappend titlefont $_settings(${general}-${attr}) 1180 1313 } 1314 # Set the font of the comboentry to the selected tick font. 1315 set m $page.tickfontfamily.menu 1316 set style [$m item cget $_settings($this-axis-ticks-fontfamily) -style] 1317 set font [$m style cget $style -font] 1318 $page.tickfontfamily configure -font $font 1319 1320 # Set the font of the comboentry to the selected title font. 1321 set m $page.titlefontfamily.menu 1322 set style [$m item cget $_settings($this-axis-title-fontfamily) -style] 1323 set font [$m style cget $style -font] 1324 $page.titlefontfamily configure -font $font 1325 1181 1326 $_clone axis configure $axis -tickfont $tickfont -titlefont $titlefont 1182 1327 $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) 1183 GetAxis 1328 1184 1329 RegeneratePreview 1185 1330 } … … 1188 1333 set index [$itk_component(element_slider) get] 1189 1334 set page $itk_component(legend_page) 1190 set _settings($this-element-color) [$page.color current]1191 1335 if { $_clone != "" } { 1192 1336 set elem $_settings($this-element-$index) … … 1211 1355 1212 1356 itcl::body Rappture::XyPrint::ApplyLayoutSettings {} { 1213 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1357 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1214 1358 -bottommargin } { 1215 1359 set old [$_clone cget $opt] … … 1229 1373 itcl::body Rappture::XyPrint::InitializeSettings {} { 1230 1374 # General settings 1231 1232 # Always set to "ps" "ieee" 1233 set _settings($this-general-format) ps 1234 set _settings($this-general-style) ieee 1375 set page $itk_component(graph_page) 1376 1377 # Always set to "jpg" "ieee" 1378 set _settings($this-general-format) \ 1379 "JPEG Joint Photographic Experts Group Format" 1380 $page.format.menu select "JPEG Joint Photographic Experts Group Format" 1381 set _settings($this-general-style) ieee 1235 1382 set _settings($this-general-remember) 0 1236 set page $itk_component(graph_page)1237 $page.format value [$page.format label $_settings($this-general-format)]1238 $page.style value [$page.style label $_settings($this-general-style)]1239 1383 1240 1384 # Layout settings … … 1254 1398 1255 1399 set names [$_clone element show] 1256 $itk_component(element_slider) configure -from 1 -to [llength $names] 1400 $itk_component(element_slider) configure -from 1 -to [llength $names] 1257 1401 set state [expr { ([llength $names] < 2) ? "disabled" : "normal" } ] 1258 1402 $page.slider configure -state $state … … 1263 1407 set _settings($this-legend-borderwidth) 0 1264 1408 1265 $page.fontfamily value $_settings($this-legend-fontfamily)1266 $page.fontsize value $_settings($this-legend-fontsize)1267 1409 if { $_settings($this-legend-fontweight) == "bold" } { 1268 1410 set _settings($this-legend-font-bold) 1 … … 1278 1420 # Axis settings 1279 1421 set page $itk_component(axis_page) 1280 set names [lsort [$_clone axis names]] 1422 set names [lsort [$_clone axis names]] 1281 1423 $itk_component(axis_combo) choices delete 0 end 1282 1424 foreach axis $names { … … 1290 1432 } 1291 1433 set axis [lindex $names 0] 1292 1293 $page.titlefontfamily value $_settings($this-$axis-title-fontfamily)1294 $page.titlefontsize value $_settings($this-$axis-title-fontsize)1295 $page.tickfontfamily value $_settings($this-$axis-ticks-fontfamily)1296 $page.tickfontsize value $_settings($this-$axis-ticks-fontsize)1297 1434 1298 1435 # Always hide the zero line. … … 1302 1439 set axis [lindex $axisnames 0] 1303 1440 $itk_component(axis_combo) value $axis 1304 GetAxis 1441 GetAxis 1305 1442 RegeneratePreview 1306 1443 } … … 1315 1452 if { ![file readable $_settingsFile] } { 1316 1453 return; # No file or not readable 1317 } 1454 } 1318 1455 if { [file exists $_oldSettingsFile] } { 1319 1456 file delete $_oldSettingsFile … … 1327 1464 set code [read $f] 1328 1465 close $f 1329 if { [catch { $parser eval $code }] != 0 } { 1330 file delete $_settingsFile 1331 } 1466 $parser eval $code 1467 1332 1468 # Now see if there's an entry for this tool/plot combination. The data 1333 1469 # associated with the variable is itself code to update the graph (clone). … … 1346 1482 itcl::body Rappture::XyPrint::ResetSettings {} { 1347 1483 set graph $_graph 1348 DestroySettings 1484 DestroySettings 1349 1485 set _graph $graph 1350 1486 CloneGraph $graph … … 1380 1516 # General settings 1381 1517 set length [string length "${this}-"] 1382 append out " array set settings {\n" 1518 append out " array set settings {\n" 1383 1519 foreach item [array names _settings ${this}-*] { 1384 1520 set field [string range $item $length end] … … 1389 1525 append out " [list $field] [list $value]\n" 1390 1526 } 1391 append out " }\n" 1527 append out " }\n" 1392 1528 # Legend font 1393 1529 lappend legendfont $_settings($this-legend-fontfamily) … … 1408 1544 1409 1545 # Layout settings 1410 append out " preview configure" 1411 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1546 append out " preview configure" 1547 foreach opt { -width -height -leftmargin -rightmargin -topmargin 1412 1548 -bottommargin -plotpadx -plotpady } { 1413 set value [ $_clone cget $opt]1414 append out " $opt [list $value]"1549 set value [list [$_clone cget $opt]] 1550 append out " $opt $value" 1415 1551 } 1416 1552 append out "\n" 1417 1553 1418 1554 # Legend settings 1419 append out " preview legend configure" 1420 foreach opt { -position -anchor -borderwidth -hide } { 1421 set value [ $_clone legend cget $opt]1422 append out " $opt [list $value]"1423 } 1424 append out " -font [list $legendfont]\n"1555 append out " preview legend configure" 1556 foreach opt { -position -anchor -borderwidth -hide } { 1557 set value [list [$_clone legend cget $opt]] 1558 append out " $opt $value" 1559 } 1560 append out " -font \"$legendfont\"\n" 1425 1561 1426 1562 # Element settings … … 1430 1566 continue 1431 1567 } 1432 set label [list $label] 1433 append out " if \{ \[preview element exists $label] \} \{\n" 1434 append out " preview element configure $label" 1568 append out " if \{ \[preview element exists \"$label\"\] \} \{\n" 1569 append out " preview element configure \"$label\"" 1435 1570 if { [$_clone element type $elem] != "bar" } { 1436 set options { -symbol -color -dashes -label } 1571 set options { -symbol -color -dashes -label } 1437 1572 } else { 1438 set options { -color -label } 1439 } 1440 foreach opt $options { 1441 set value [ $_clone element cget $elem $opt]1442 append out " $opt [list $value]"1573 set options { -color -label } 1574 } 1575 foreach opt $options { 1576 set value [list [$_clone element cget $elem $opt]] 1577 append out " $opt $value" 1443 1578 } 1444 1579 append out " \}\n" 1445 1580 } 1446 1581 1447 1582 # Axis settings 1448 1583 foreach axis [$_clone axis names] { … … 1450 1585 continue 1451 1586 } 1452 set axis [list $axis] 1453 append out " if \{ \[llength \[preview axis names $axis\]\] == 1 \} \{\n" 1454 append out " preview axis configure $axis" 1455 foreach opt { -hide -min -max -loose -title -stepsize -subdivisions } { 1456 set value [$_clone axis cget $axis $opt] 1457 append out " $opt [list $value]" 1458 } 1459 append out " -tickfont [list $axistickfont]" 1460 append out " -titlefont [list $axistitlefont]\n" 1587 append out " if \{ \[preview axis names \"$axis\"\] == \"$axis\" \} \{\n" 1588 append out " preview axis configure \"$axis\"" 1589 foreach opt { -grid -hide -min -max -loose -title -stepsize -subdivisions } { 1590 set value [list [$_clone axis cget $axis $opt]] 1591 append out " $opt $value" 1592 } 1593 append out " -tickfont \"$axistickfont\"" 1594 append out " -titlefont \"$axistitlefont\"\n" 1461 1595 set hide [$_clone marker cget ${axis}-zero -hide] 1462 append out " preview marker configure ${axis}-zero-hide $hide\n"1596 append out " preview marker configure \"${axis}-zero\" -hide $hide\n" 1463 1597 append out " \}\n" 1464 } 1465 1466 append out " preview grid configure" 1467 append out " -hide \"[$_clone grid cget -hide]\"" 1468 append out " -mapx \"[$_clone grid cget -mapx]\"" 1469 append out " -mapy \"[$_clone grid cget -mapy]\"" 1598 } 1470 1599 return $out 1471 1600 } 1601 1602 itcl::body Rappture::XyPrint::AddColorToMenu { m name color } { 1603 set icon [image create picture -width 19 -height 17] 1604 $icon blank 0x0 1605 $icon draw circle 7 7 8 -color black \ 1606 -antialiased 1 -linewidth 0 -shadow { -width 1 -offset 1 } 1607 $icon draw circle 7 7 7 -color $color \ 1608 -antialiased 1 -linewidth 0 1609 $m add -text $name -icon $icon -value $color \ 1610 -variable [itcl::scope _settings($this-element-color)] 1611 }
Note: See TracChangeset
for help on using the changeset viewer.