Changeset 1593 for trunk/gui/scripts/xyprint.tcl
- Timestamp:
- Oct 26, 2009 11:20:33 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/xyprint.tcl
r1592 r1593 13 13 package require BLT 14 14 15 #option add *Xy Result.width 3i widgetDefault16 #option add *Xy Result.height 3i widgetDefault17 option add *Xy Result.gridColor #d9d9d9 widgetDefault15 #option add *XyPrint.width 3i widgetDefault 16 #option add *XyPrint.height 3i widgetDefault 17 option add *XyPrint.gridColor #d9d9d9 widgetDefault 18 18 option add *XyPrint.activeColor blue widgetDefault 19 19 option add *XyPrint.dimColor gray widgetDefault … … 46 46 private method CloneGraph { orig } 47 47 48 private method BuildG raphTab {}48 private method BuildGeneralTab {} 49 49 private method BuildLayoutTab {} 50 50 private method BuildLegendTab {} … … 60 60 private method Inches2Pixels { inches } 61 61 62 private method BuildLayoutTab {}63 private method BuildGeneralTab {}64 private method ApplyLegendSettings {}65 private method BuildLegendTab {}66 private method BuildAxisTab {}67 68 62 private method ApplyGeneralSettings {} 69 63 private method ApplyLegendSettings {} … … 73 67 private method InitializeSettings {} 74 68 private method RestoreSettings { file } 69 private method ResetSettings { } 75 70 private method SaveSettings { file } 71 private method GetOutput {} 76 72 private method Done { state } 77 73 private method DestroySettings {} … … 132 128 blt::table configure $itk_interior r1 -resize both 133 129 134 BuildG raphTab130 BuildGeneralTab 135 131 BuildAxisTab 136 132 BuildLegendTab … … 142 138 # DESTRUCTOR 143 139 # ---------------------------------------------------------------------- 144 itcl::body Rappture::Xy Result::destructor {} {140 itcl::body Rappture::XyPrint::destructor {} { 145 141 destroy $_clone 146 142 image delete $_preview … … 148 144 } 149 145 150 itcl::body Rappture::Xy Result::DestroySettings {} {146 itcl::body Rappture::XyPrint::DestroySettings {} { 151 147 destroy $_clone 152 148 array unset _settings $this-* … … 167 163 set _wait($this) 0 168 164 tkwait variable [itcl::scope _wait($this)] 169 if { _wait($this) } { 170 return [GetOutput] 171 } 172 SaveSettings 173 # DestroySettings 174 return "" 165 set output "" 166 if { $_wait($this) } { 167 set output [GetOutput] 168 } 169 SaveSettings dummy 170 DestroySettings 171 return $output 175 172 } 176 173 … … 228 225 return "" 229 226 } 230 set f [open "junk.$format" "w"] 231 fconfigure $f -translation binary -encoding binary 232 puts -nonewline $f $output 233 close $f 227 if 0 { 228 set f [open "junk.$format" "w"] 229 fconfigure $f -translation binary -encoding binary 230 puts -nonewline $f $output 231 close $f 232 } 234 233 return [list .$format $output] 235 234 } … … 344 343 # Create markers representing lines at zero for the x and y axis. 345 344 $_clone marker create line -name x-zero \ 346 -coords "0 -Inf 0 Inf" -dashes dot-hide yes345 -coords "0 -Inf 0 Inf" -dashes 1 -hide yes 347 346 $_clone marker create line -name y-zero \ 348 -coords "-Inf 0 Inf 0" -dashes dot-hide yes347 -coords "-Inf 0 Inf 0" -dashes 1 -hide yes 349 348 } 350 349 … … 391 390 set w [Inches2Pixels $_settings($this-layout-width)] 392 391 set h [Inches2Pixels $_settings($this-layout-height)] 393 puts stderr "w=$w h=$h"394 392 set pixelsPerInch [winfo pixels . 1i] 395 393 set sx [expr 2.5*$pixelsPerInch/$w] 396 394 set sy [expr 2.0*$pixelsPerInch/$h] 397 puts stderr "sx=$sx sy=$sy"398 395 set s [expr min($sx,$sy)] 399 396 $_clone snap $img -width $w -height $h … … 615 612 616 613 label $page.slider_l -text "legend\nentry" -font "Arial 10" -justify right 617 set names [$_clone element show]618 614 itk_component add element_slider { 619 ::scale $page.slider -from 1 -to [llength $names]\615 ::scale $page.slider -from 1 -to 1 \ 620 616 -orient horizontal -width 12 \ 621 617 -command [itcl::code $this GetElement] 622 618 } 623 if { [llength $names] < 2 } {624 $page.slider configure -state disabled625 $page.slider_l configure -state disabled626 }627 619 checkbutton $page.hide -text "hide" \ 628 620 -font "Arial 10" \ … … 715 707 Rappture::Combobox $page.axis -width 20 -editable no 716 708 } 717 set names [lsort [$_clone axis names]]718 foreach axis $names {719 if { ![$_clone axis cget $axis -hide] } {720 $itk_component(axis_combo) choices insert end $axis $axis721 }722 }723 709 bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis] 724 710 … … 756 742 label $page.plotpadx_l -text "pad x-axis" 757 743 entry $page.plotpadx -width 6 \ 758 -textvariable [itcl::scope _settings($this- axis-plotpadx)]744 -textvariable [itcl::scope _settings($this-graph-plotpadx)] 759 745 bind $page.plotpadx <KeyPress-Return> [itcl::code $this ApplyAxisSettings] 760 746 761 747 label $page.plotpady_l -text "pad y-axis" 762 748 entry $page.plotpady -width 6 \ 763 -textvariable [itcl::scope _settings($this- axis-plotpady)]749 -textvariable [itcl::scope _settings($this-graph-plotpady)] 764 750 bind $page.plotpady <KeyPress-Return> [itcl::code $this ApplyAxisSettings] 765 751 … … 812 798 813 799 itcl::body Rappture::XyPrint::ApplyAxisSettings {} { 814 set plotpadx [Inches2Pixels $_settings($this- axis-plotpadx)]815 set plotpady [Inches2Pixels $_settings($this- axis-plotpady)]800 set plotpadx [Inches2Pixels $_settings($this-graph-plotpadx)] 801 set plotpady [Inches2Pixels $_settings($this-graph-plotpady)] 816 802 SetOption plotpadx 817 803 SetOption plotpady … … 827 813 } 828 814 $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) 829 puts stderr "$axis: [$_clone axis configure $axis]"830 815 GetAxis 831 816 RegeneratePreview … … 889 874 set names [$_clone element show] 890 875 $itk_component(element_slider) configure -from 1 -to [llength $names] 891 if { [llength $names] < 2 } { 892 $page.slider configure -state disabled 893 $page.slider_l configure -state disabled 894 } 876 set state [expr { ([llength $names] < 2) ? "disabled" : "normal" } ] 877 $page.slider configure -state $state 878 $page.slider_l configure -state $state 895 879 # Always initialize the slider to the first entry in the element list. 896 880 $itk_component(element_slider) set 1 … … 923 907 blt::table configure $page r* -resize none 924 908 blt::table configure $page r9 -resize both 925 set _settings($this- axis-plotpadx) [Pixels2Inches [$_clone cget -plotpadx]]926 set _settings($this- axis-plotpady) [Pixels2Inches [$_clone cget -plotpady]]909 set _settings($this-graph-plotpadx) [Pixels2Inches [$_clone cget -plotpadx]] 910 set _settings($this-graph-plotpady) [Pixels2Inches [$_clone cget -plotpady]] 927 911 GetAxis 928 912 } … … 933 917 n} 934 918 935 itcl::body Rappture::XyPrint::ResetSettings { file} {919 itcl::body Rappture::XyPrint::ResetSettings {} { 936 920 # Revert the widget back to the original graph's settings 937 921 destroy $_clone … … 984 968 985 969 foreach axis [$_clone axis names] { 970 if { [$_clone axis cget $axis -hide] } { 971 continue 972 } 986 973 append out "if \{ \[\$graph axis names \"$axis\"\] == \"$axis\" \} \{\n" 987 974 set cmd {} 988 975 lappend cmd {$graph} "axis" "configure" $axis 989 foreach opt {-hide -min -max - dashes -title -stepsize -subdivisions} {976 foreach opt {-hide -min -max -title -stepsize -loose -subdivisions} { 990 977 lappend cmd $opt [$_clone axis cget $axis $opt] 991 978 } 992 979 append out "$cmd\n" 993 append out "\}\n"994 980 set hide [$_clone marker cget ${axis}-zero -hide] 995 981 append out "\$graph marker configure ${axis}-zero -hide $hide\n" 982 append out "\}\n" 996 983 } 997 984 set cmd {} … … 1003 990 append out "\}\n" 1004 991 # Write the settings out 1005 puts stderr $out1006 } 992 puts stderr "savesettings=$out" 993 }
Note: See TracChangeset
for help on using the changeset viewer.