Changeset 1775 for branches/blt4/gui/scripts
- Timestamp:
- Jun 23, 2010 6:54:49 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/xyprint.tcl
r1774 r1775 33 33 private variable _preview ""; # Preview image. 34 34 private variable _savedSettings; # Array of settings. 35 private variable _legendFontName "" 35 36 36 37 private common _oldSettingsFile "~/.rpsettings" … … 167 168 itcl::body Rappture::XyPrint::print { graph toolName plotName } { 168 169 set _graph $graph 169 set _clone [CloneGraph $graph]170 CloneGraph $graph 170 171 InitClone 171 172 RestoreSettings $toolName $plotName … … 291 292 destroy $top.graph 292 293 } 293 set clone [blt::graph $top.graph]294 CopyOptions "configure" $orig $ clone294 set _clone [blt::graph $top.graph] 295 CopyOptions "configure" $orig $_clone 295 296 # Axis component 296 297 foreach axis [$orig axis names] { … … 298 299 continue 299 300 } 300 if { [$ clone axis name $axis] == "" } {301 $ clone axis create $axis302 } 303 CopyOptions [list axis configure $axis] $orig $ clone301 if { [$_clone axis name $axis] == "" } { 302 $_clone axis create $axis 303 } 304 CopyOptions [list axis configure $axis] $orig $_clone 304 305 } 305 306 foreach axis { x y x2 y2 } { 306 $ clone ${axis}axis use [$orig ${axis}axis use]307 $_clone ${axis}axis use [$orig ${axis}axis use] 307 308 } 308 309 # Pen component 309 310 foreach pen [$orig pen names] { 310 if { [$ clone pen name $pen] == "" } {311 $ clone pen create $pen312 } 313 CopyOptions [list pen configure $pen] $orig $ clone311 if { [$_clone pen name $pen] == "" } { 312 $_clone pen create $pen 313 } 314 CopyOptions [list pen configure $pen] $orig $_clone 314 315 } 315 316 # Marker component 316 317 foreach marker [$orig marker names] { 317 $ clone marker create [$orig marker type $marker] -name $marker318 CopyOptions [list marker configure $marker] $orig $ clone318 $_clone marker create [$orig marker type $marker] -name $marker 319 CopyOptions [list marker configure $marker] $orig $_clone 319 320 } 320 321 # Element component 321 322 foreach elem [$orig element names] { 322 $ clone element create $elem323 CopyOptions [list element configure $elem] $orig $ clone324 if { [$ clone element cget $elem -hide] } {325 $ clone element configure $elem -label ""323 $_clone element create $elem 324 CopyOptions [list element configure $elem] $orig $_clone 325 if { [$_clone element cget $elem -hide] } { 326 $_clone element configure $elem -label "" 326 327 } 327 328 } 328 329 # Fix element display list 329 $ clone element show [$orig element show]330 $_clone element show [$orig element show] 330 331 # Legend component 331 CopyOptions {legend configure} $orig $ clone332 CopyOptions {legend configure} $orig $_clone 332 333 # Postscript component 333 CopyOptions {postscript configure} $orig $ clone334 CopyOptions {postscript configure} $orig $_clone 334 335 # Crosshairs component 335 CopyOptions {crosshairs configure} $orig $clone 336 return $clone 336 CopyOptions {crosshairs configure} $orig $_clone 337 337 } 338 338 … … 663 663 set _settings($this-legend-position) [$page.position current] 664 664 set _settings($this-legend-anchor) [$page.anchor current] 665 foreach option { -hide -position -anchor -borderwidth } { 666 SetComponentOption legend $option 667 } 668 $_clone legend configure -font legend 665 if { $_clone != "" } { 666 font configure $_fonts(legend) \ 667 -family $_settings($this-legend-font-family) \ 668 -size [$page.fontsize current] \ 669 -weight $_settings($this-legend-font-weight) \ 670 -slant $_settings($this-legend-font-slant) 671 foreach option { -hide -position -anchor -borderwidth } { 672 SetComponentOption legend $option 673 } 674 $_clone legend configure -font fixed -font $_fonts(legend) 675 } 669 676 ApplyElementSettings 670 677 } … … 790 797 791 798 label $page.font_l -text "font" 799 set m $page.fontfamily.menu 800 blt::comboentry $page.fontfamily \ 801 -width 10 \ 802 -textvariable [itcl::scope _legendFontName] \ 803 -editable no -menu $m \ 804 -command [itcl::code $this ApplyLegendSettings] 805 blt::combomenu $m \ 806 -xscrollbar $m.xs \ 807 -yscrollbar $m.ys \ 808 -textvariable [itcl::scope _legendFontName] \ 809 -height { 0 2i } 810 blt::tk::scrollbar $m.xs 811 blt::tk::scrollbar $m.ys 812 $m style create "courier" -font "{courier new} 9" 813 $m style create "helvetica" -font "{arial} 9" 814 $m style create "newcentury" -font "{new century schoolbook} 9" 815 $m style create "times" -font "{times new roman} 9" 816 $m add -text "courier" -value "courier" -style "courier" 817 $m add -text "helvetica" -value "helvetica" -style "helvetica" 818 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 819 -style "newcentury" 820 $m add -text "symbol" -value "symbol" 821 $m add -text "times" -value "times" -style "times" 822 $m item configure all \ 823 -variable [itcl::scope _settings($this-legend-font-family)] 824 $m select "helvetica" 825 if 0 { 792 826 Rappture::Combobox $page.fontfamily -width 10 -editable no 793 827 $page.fontfamily choices insert end \ … … 797 831 "symbol" "symbol" \ 798 832 "times" "times" 833 } 799 834 bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings] 800 835 Rappture::Tooltip::for $page.fontfamily \ … … 1070 1105 } 1071 1106 1072 itcl::body Rappture::XyPrint::ApplyLegendSettings {} {1073 set page $itk_component(legend_page)1074 set _settings($this-legend-position) [$page.position current]1075 set _settings($this-legend-anchor) [$page.anchor current]1076 1077 foreach option { -hide -position -anchor -borderwidth } {1078 SetComponentOption legend $option1079 }1080 font configure $_fonts(legend) \1081 -family [$page.fontfamily current] \1082 -size [$page.fontsize current] \1083 -weight $_settings($this-legend-font-weight) \1084 -slant $_settings($this-legend-font-slant)1085 $_clone legend configure -font fixed -font $_fonts(legend)1086 ApplyElementSettings1087 }1088 1107 1089 1108 itcl::body Rappture::XyPrint::ApplyAxisSettings {} { … … 1114 1133 itcl::body Rappture::XyPrint::ApplyElementSettings {} { 1115 1134 set index [$itk_component(element_slider) get] 1116 set elem $_settings($this-element-$index)1117 1135 set page $itk_component(legend_page) 1118 1136 set _settings($this-element-color) [$page.color current] 1119 1137 set _settings($this-element-symbol) [$page.symbol current] 1120 1138 set _settings($this-element-dashes) [$page.dashes current] 1121 foreach option { -symbol -color -dashes -label } { 1122 SetNamedComponentOption element $elem $option 1123 } 1124 RegeneratePreview 1139 if { $_clone != "" } { 1140 set elem $_settings($this-element-$index) 1141 foreach option { -symbol -color -dashes -label } { 1142 SetNamedComponentOption element $elem $option 1143 } 1144 RegeneratePreview 1145 } 1125 1146 } 1126 1147 … … 1184 1205 array unset info 1185 1206 array set info [font configure legend] 1186 $page.fontfamily value$info(-family)1207 set _settings($this-legend-font-family) $info(-family) 1187 1208 $page.fontsize value $info(-size) 1188 1209 set _settings($this-legend-font-weight) $info(-weight)
Note: See TracChangeset
for help on using the changeset viewer.