Changeset 1776 for branches/blt4/gui
- Timestamp:
- Jun 23, 2010, 8:21:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/xyprint.tcl
r1775 r1776 33 33 private variable _preview ""; # Preview image. 34 34 private variable _savedSettings; # Array of settings. 35 private variable _legendFontName "" 35 private variable _legendFontFamily "" 36 private variable _legendFontSize "" 37 private variable _tickFontFamily "" 38 private variable _titleFontFamily "" 39 private variable _tickFontSize "" 40 private variable _titleFontSize "" 41 private variable _format "" 42 private variable _axis "" 43 private variable _style "" 44 private variable _position "" 36 45 37 46 private common _oldSettingsFile "~/.rpsettings" 38 47 private common _settingsFile "~/.rp_settings" 39 40 48 public method print { graph toolName plotName } 41 49 public method reset {} … … 88 96 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 89 97 90 # option add hull.width hull.height91 # pack propagate $itk_component(hull) no92 93 98 set w [winfo pixels . 2.5i] 94 99 set h [winfo pixels . 2i] … … 186 191 # Get the selected format of the download. 187 192 set page $itk_component(graph_page) 188 set format [$page.format current]193 set format $_settings($this-general-format) 189 194 190 195 # Handle JPEG or PNG image formats. … … 490 495 491 496 itcl::body Rappture::XyPrint::GetAxis {} { 492 set axis [$itk_component(axis_combo) current]497 set axis $_settings($this-axis-selected) 493 498 foreach option { grid min max loose title stepsize subdivisions } { 494 499 set _settings($this-axis-$option) [$_clone axis cget $axis -$option] … … 614 619 615 620 label $page.format_l -text "format" 616 Rappture::Combobox $page.format -width 30 -editable no 617 $page.format choices insert end \ 618 "pdf" "PDF Portable Document Format" \ 619 "ps" "PS PostScript Format" \ 620 "eps" "EPS Encapsulated PostScript" \ 621 "jpg" "JPEG Joint Photographic Experts Group Format" \ 622 "png" "PNG Portable Network Graphics Format" \ 623 "gif" "GIF Graphics Interchange Format" 624 625 bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings] 626 Rappture::Tooltip::for $page.format \ 627 "Set the format of the image." 621 set m $page.format.menu 622 blt::comboentry $page.format \ 623 -width 30 \ 624 -textvariable [itcl::scope _format] \ 625 -editable no -menu $m \ 626 -command [itcl::code $this ApplyGeneralSettings] 627 blt::combomenu $m \ 628 -xscrollbar $m.xs \ 629 -yscrollbar $m.ys \ 630 -textvariable [itcl::scope _format] \ 631 -height { 0 2i } 632 blt::tk::scrollbar $m.xs 633 blt::tk::scrollbar $m.ys 634 $m add -value "pdf" -text "PDF Portable Document Format" 635 $m add -value "ps" -text "PS PostScript Format" 636 $m add -value "eps" -text "EPS Encapsulated PostScript" 637 $m add -value "jpg" -text "JPEG Joint Photographic Experts Group Format" 638 $m add -value "png" -text "PNG Portable Network Graphics Format" 639 $m add -value "gif" -text "GIF Graphics Interchange Format" 640 $m item configure all \ 641 -variable [itcl::scope _settings($this-general-format)] 642 Rappture::Tooltip::for $page.format "Set the format of the image." 628 643 629 644 label $page.style_l -text "style" 630 Rappture::Combobox $page.style -width 20 -editable no 631 $page.style choices insert end \ 632 "ieee" "IEEE Journal" \ 633 "gekco" "G Klimeck" 634 bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings] 635 Rappture::Tooltip::for $page.format \ 636 "Set the style template." 645 set m $page.style.menu 646 blt::comboentry $page.style \ 647 -width 30 \ 648 -textvariable [itcl::scope _style] \ 649 -editable no -menu $m \ 650 -command [itcl::code $this ApplyGeneralSettings] 651 blt::combomenu $m \ 652 -xscrollbar $m.xs \ 653 -yscrollbar $m.ys \ 654 -textvariable [itcl::scope _style] \ 655 -height { 0 2i } 656 blt::tk::scrollbar $m.xs 657 blt::tk::scrollbar $m.ys 658 $m add -value "ieee" -text "IEEE Journal" 659 $m add -value "gekco" -text "G Klimeck" 660 $m item configure all \ 661 -variable [itcl::scope _settings($this-general-style)] 662 Rappture::Tooltip::for $page.format "Set the style template." 637 663 638 664 blt::tk::checkbutton $page.remember -text "remember settings" \ … … 661 687 itcl::body Rappture::XyPrint::ApplyLegendSettings {} { 662 688 set page $itk_component(legend_page) 663 set _settings($this-legend-position) [$page.position current]664 689 set _settings($this-legend-anchor) [$page.anchor current] 665 690 if { $_clone != "" } { 666 691 font configure $_fonts(legend) \ 667 692 -family $_settings($this-legend-font-family) \ 668 -size [$page.fontsize current]\693 -size $_settings($this-legend-font-size) \ 669 694 -weight $_settings($this-legend-font-weight) \ 670 695 -slant $_settings($this-legend-font-slant) … … 693 718 694 719 label $page.position_l -text "position" 695 Rappture::Combobox $page.position -width 15 -editable no 696 $page.position choices insert end \ 697 "leftmargin" "left margin" \ 698 "rightmargin" "right margin" \ 699 "bottommargin" "bottom margin" \ 700 "topmargin" "top margin" \ 701 "plotarea" "inside plot" 702 bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings] 720 set m $page.position.menu 721 blt::comboentry $page.position \ 722 -width 15 \ 723 -textvariable [itcl::scope _position] \ 724 -editable no -menu $m \ 725 -command [itcl::code $this ApplyLegendSettings] 726 blt::combomenu $m \ 727 -xscrollbar $m.xs \ 728 -yscrollbar $m.ys \ 729 -textvariable [itcl::scope _position] \ 730 -height { 0 2i } 731 blt::tk::scrollbar $m.xs 732 blt::tk::scrollbar $m.ys 733 $m add -value "leftmargin" -text "left margin" 734 $m add -value "rightmargin" -text "right margin" 735 $m add -value "bottommargin" -text "bottom margin" 736 $m add -value "topmargin" -text "top margin" 737 $m add -value "plotarea" -text "inside plot" 738 $m item configure all \ 739 -variable [itcl::scope _settings($this-legend-position)] 703 740 Rappture::Tooltip::for $page.position \ 704 741 "Set the position of the legend. This option and the anchor determine the legend's location." … … 800 837 blt::comboentry $page.fontfamily \ 801 838 -width 10 \ 802 -textvariable [itcl::scope _legendFont Name] \839 -textvariable [itcl::scope _legendFontFamily] \ 803 840 -editable no -menu $m \ 804 841 -command [itcl::code $this ApplyLegendSettings] … … 806 843 -xscrollbar $m.xs \ 807 844 -yscrollbar $m.ys \ 808 -textvariable [itcl::scope _legendFont Name] \845 -textvariable [itcl::scope _legendFontFamily] \ 809 846 -height { 0 2i } 810 847 blt::tk::scrollbar $m.xs … … 823 860 -variable [itcl::scope _settings($this-legend-font-family)] 824 861 $m select "helvetica" 825 if 0 {826 Rappture::Combobox $page.fontfamily -width 10 -editable no827 $page.fontfamily choices insert end \828 "courier" "courier" \829 "helvetica" "helvetica" \830 "new*century*schoolbook" "new century schoolbook" \831 "symbol" "symbol" \832 "times" "times"833 }834 bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings]835 862 Rappture::Tooltip::for $page.fontfamily \ 836 863 "Set the font of entries in the legend." 837 864 838 Rappture::Combobox $page.fontsize -width 4 -editable no 839 $page.fontsize choices insert end \ 840 "8" "8" \ 841 "9" "9" \ 842 "10" "10" \ 843 "11" "11" \ 844 "12" "12" \ 845 "14" "14" \ 846 "17" "17" \ 847 "18" "18" \ 848 "20" "20" 849 bind $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings] 865 set m $page.fontsize.menu 866 blt::comboentry $page.fontsize \ 867 -width .4i \ 868 -textvariable [itcl::scope _legendFontSize] \ 869 -editable no -menu $m \ 870 -command [itcl::code $this ApplyLegendSettings] 871 blt::combomenu $m \ 872 -xscrollbar $m.xs \ 873 -yscrollbar $m.ys \ 874 -textvariable [itcl::scope _legendFontSize] \ 875 -height { 0 2i } 876 blt::tk::scrollbar $m.xs 877 blt::tk::scrollbar $m.ys 878 $m add -text "8" -value "8" 879 $m add -text "9" -value "9" 880 $m add -text "10" -value "10" 881 $m add -text "11" -value "11" 882 $m add -text "12" -value "12" 883 $m add -text "14" -value "14" 884 $m add -text "17" -value "17" 885 $m add -text "18" -value "18" 886 $m add -text "20" -value "20" 887 $m item configure all \ 888 -variable [itcl::scope _settings($this-legend-font-size)] 850 889 Rappture::Tooltip::for $page.fontsize \ 851 890 "Set the size (points) of the font." … … 907 946 908 947 label $page.axis_l -text "axis" 909 itk_component add axis_combo { 910 Rappture::Combobox $page.axis -width 20 -editable no 911 } 912 bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis] 913 Rappture::Tooltip::for $page.axis \ 914 "Select the current axis." 948 set m $page.axis.menu 949 blt::comboentry $page.axis \ 950 -width 10 \ 951 -textvariable [itcl::scope _axis] \ 952 -editable no -menu $m \ 953 -command [itcl::code $this GetAxis] 954 itk_component add axis_menu { 955 blt::combomenu $m \ 956 -xscrollbar $m.xs \ 957 -yscrollbar $m.ys \ 958 -textvariable [itcl::scope _axis] \ 959 -height { 0 2i } 960 } 961 blt::tk::scrollbar $m.xs 962 blt::tk::scrollbar $m.ys 963 Rappture::Tooltip::for $page.axis "Select the current axis." 915 964 916 965 label $page.title_l -text "title" … … 978 1027 979 1028 label $page.tickfont_l -text "tick font" 980 Rappture::Combobox $page.tickfontfamily -width 10 -editable no 981 $page.tickfontfamily choices insert end \ 982 "courier" "courier" \ 983 "helvetica" "helvetica" \ 984 "new*century*schoolbook" "new century schoolbook" \ 985 "symbol" "symbol" \ 986 "times" "times" 987 bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1029 set m $page.tickfontfamily.menu 1030 blt::comboentry $page.tickfontfamily \ 1031 -width 10 \ 1032 -textvariable [itcl::scope _tickFontFamily] \ 1033 -editable no -menu $m \ 1034 -command [itcl::code $this ApplyAxisSettings] 1035 blt::combomenu $m \ 1036 -xscrollbar $m.xs \ 1037 -yscrollbar $m.ys \ 1038 -textvariable [itcl::scope _tickFontFamily] \ 1039 -height { 0 2i } 1040 blt::tk::scrollbar $m.xs 1041 blt::tk::scrollbar $m.ys 1042 $m style create "courier" -font "{courier new} 9" 1043 $m style create "helvetica" -font "{arial} 9" 1044 $m style create "newcentury" -font "{new century schoolbook} 9" 1045 $m style create "times" -font "{times new roman} 9" 1046 $m add -text "courier" -value "courier" -style "courier" 1047 $m add -text "helvetica" -value "helvetica" -style "helvetica" 1048 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 1049 -style "newcentury" 1050 $m add -text "symbol" -value "symbol" 1051 $m add -text "times" -value "times" -style "times" 1052 $m item configure all \ 1053 -variable [itcl::scope _settings($this-axis-tickfont-family)] 988 1054 Rappture::Tooltip::for $page.tickfontfamily \ 989 1055 "Set the font of the ticks for the current axis." 990 1056 991 Rappture::Combobox $page.tickfontsize -width 4 -editable no 992 $page.tickfontsize choices insert end \ 993 "8" "8" \ 994 "9" "9" \ 995 "10" "10" \ 996 "11" "11" \ 997 "12" "12" \ 998 "14" "14" \ 999 "17" "17" \ 1000 "18" "18" \ 1001 "20" "20" 1002 bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1057 set m $page.tickfontsize.menu 1058 blt::comboentry $page.tickfontsize \ 1059 -width .4i \ 1060 -textvariable [itcl::scope _tickFontSize] \ 1061 -editable no -menu $m \ 1062 -command [itcl::code $this ApplyAxisSettings] 1063 blt::combomenu $m \ 1064 -xscrollbar $m.xs \ 1065 -yscrollbar $m.ys \ 1066 -textvariable [itcl::scope _tickFontSize] \ 1067 -height { 0 2i } 1068 blt::tk::scrollbar $m.xs 1069 blt::tk::scrollbar $m.ys 1070 $m add -text "8" -value "8" 1071 $m add -text "9" -value "9" 1072 $m add -text "10" -value "10" 1073 $m add -text "11" -value "11" 1074 $m add -text "12" -value "12" 1075 $m add -text "14" -value "14" 1076 $m add -text "17" -value "17" 1077 $m add -text "18" -value "18" 1078 $m add -text "20" -value "20" 1079 $m item configure all \ 1080 -variable [itcl::scope _settings($this-axis-tickfont-size)] 1003 1081 Rappture::Tooltip::for $page.tickfontsize \ 1004 1082 "Set the size (points) of the tick font." … … 1025 1103 1026 1104 label $page.titlefont_l -text "title font" 1027 Rappture::Combobox $page.titlefontfamily -width 10 -editable no 1028 $page.titlefontfamily choices insert end \ 1029 "courier" "courier" \ 1030 "helvetica" "helvetica" \ 1031 "new*century*schoolbook" "new century schoolbook" \ 1032 "symbol" "symbol" \ 1033 "times" "times" 1034 bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 1105 set m $page.titlefontfamily.menu 1106 blt::comboentry $page.titlefontfamily \ 1107 -width 10 \ 1108 -textvariable [itcl::scope _titleFontFamily] \ 1109 -editable no -menu $m \ 1110 -command [itcl::code $this ApplyAxisSettings] 1111 blt::combomenu $m \ 1112 -xscrollbar $m.xs \ 1113 -yscrollbar $m.ys \ 1114 -textvariable [itcl::scope _titleFontFamily] \ 1115 -height { 0 2i } 1116 blt::tk::scrollbar $m.xs 1117 blt::tk::scrollbar $m.ys 1118 $m style create "courier" -font "{courier new} 9" 1119 $m style create "helvetica" -font "{arial} 9" 1120 $m style create "newcentury" -font "{new century schoolbook} 9" 1121 $m style create "times" -font "{times new roman} 9" 1122 $m add -text "courier" -value "courier" -style "courier" 1123 $m add -text "helvetica" -value "helvetica" -style "helvetica" 1124 $m add -text "new century schoolbook" -value "new*century*schoolbook" \ 1125 -style "newcentury" 1126 $m add -text "symbol" -value "symbol" 1127 $m add -text "times" -value "times" -style "times" 1128 $m item configure all \ 1129 -variable [itcl::scope _settings($this-axis-titlefont-family)] 1035 1130 Rappture::Tooltip::for $page.titlefontfamily \ 1036 1131 "Set the font of the title for the current axis." 1037 1132 1038 Rappture::Combobox $page.titlefontsize -width 4 -editable no 1039 $page.titlefontsize choices insert end \ 1040 "8" "8" \ 1041 "9" "9" \ 1042 "10" "10" \ 1043 "11" "11" \ 1044 "12" "12" \ 1045 "14" "14" \ 1046 "17" "17" \ 1047 "18" "18" \ 1048 "20" "20" 1049 bind $page.titlefontsize <<Value>> [itcl::code $this ApplyAxisSettings] 1133 set m $page.titlefontsize.menu 1134 blt::comboentry $page.titlefontsize \ 1135 -width .4i \ 1136 -textvariable [itcl::scope _titleFontSize] \ 1137 -editable no -menu $m \ 1138 -command [itcl::code $this ApplyAxisSettings] 1139 blt::combomenu $m \ 1140 -xscrollbar $m.xs \ 1141 -yscrollbar $m.ys \ 1142 -textvariable [itcl::scope _titleFontSize] \ 1143 -height { 0 2i } 1144 blt::tk::scrollbar $m.xs 1145 blt::tk::scrollbar $m.ys 1146 $m add -text "8" -value "8" 1147 $m add -text "9" -value "9" 1148 $m add -text "10" -value "10" 1149 $m add -text "11" -value "11" 1150 $m add -text "12" -value "12" 1151 $m add -text "14" -value "14" 1152 $m add -text "17" -value "17" 1153 $m add -text "18" -value "18" 1154 $m add -text "20" -value "20" 1155 $m item configure all \ 1156 -variable [itcl::scope _settings($this-axis-titlefont-size)] 1050 1157 Rappture::Tooltip::for $page.titlefontsize \ 1051 1158 "Set the size (point) of the title font." … … 1099 1206 8,3 $page.plotpad_l -anchor e \ 1100 1207 8,4 $page.plotpad -fill both -cspan 3 1208 1209 blt::table configure $page c0 c7 c8 -resize none 1210 1101 1211 } 1102 1212 … … 1107 1217 1108 1218 itcl::body Rappture::XyPrint::ApplyAxisSettings {} { 1109 set axis [$itk_component(axis_combo) current] 1219 if { $_clone == "" } { 1220 return 1221 } 1222 set axis $_settings($this-axis-selected) 1110 1223 set type [GetAxisType $axis] 1111 1224 set page $itk_component(axis_page) … … 1116 1229 $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) 1117 1230 font configure $axis-title \ 1118 -family [$page.titlefontfamily current]\1119 -size [$page.titlefontsize current]\1231 -family $_settings($this-axis-titlefont-family) \ 1232 -size $_settings($this-axis-titlefont-size) \ 1120 1233 -weight $_settings($this-axis-titlefont-weight) \ 1121 1234 -slant $_settings($this-axis-titlefont-slant) 1122 1235 font configure $axis-ticks \ 1123 -family [$page.tickfontfamily current]\1124 -size [$page.tickfontsize current]\1236 -family $_settings($this-axis-tickfont-family) \ 1237 -size $_settings($this-axis-tickfont-size) \ 1125 1238 -weight $_settings($this-axis-tickfont-weight) \ 1126 1239 -slant $_settings($this-axis-tickfont-slant) … … 1172 1285 # Always set to "ps" "ieee" 1173 1286 set _settings($this-general-format) ps 1174 set _settings($this-general-style) ieee1287 set _settings($this-general-style) ieee 1175 1288 set _settings($this-general-remember) 0 1176 1289 set page $itk_component(graph_page) 1177 $page.format value [$page.format label $_settings($this-general-format)]1178 $page.style value [$page.style label $_settings($this-general-style)]1179 1290 1180 1291 # Layout settings … … 1206 1317 array set info [font configure legend] 1207 1318 set _settings($this-legend-font-family) $info(-family) 1208 $page.fontsize value$info(-size)1319 set _settings($this-legend-font-size) $info(-size) 1209 1320 set _settings($this-legend-font-weight) $info(-weight) 1210 set _settings($this-legend-font-slant) $info(-slant)1321 set _settings($this-legend-font-slant) $info(-slant) 1211 1322 if { $info(-weight) == "bold" } { 1212 1323 set _settings($this-legend-font-bold) 1 … … 1215 1326 set _settings($this-legend-position) [$_clone legend cget -position] 1216 1327 set _settings($this-legend-anchor) [$_clone legend cget -anchor] 1217 $page.position value \1218 [$page.position label $_settings($this-legend-position)]1219 1328 $page.anchor value [$page.anchor label $_settings($this-legend-anchor)] 1220 1329 GetElement … … 1223 1332 set page $itk_component(axis_page) 1224 1333 set names [lsort [$_clone axis names]] 1225 $itk_component(axis_ combo) choices delete 0 end1334 $itk_component(axis_menu) delete all 1226 1335 foreach axis $names { 1227 1336 if { ![$_clone axis cget $axis -hide] } { 1228 $itk_component(axis_combo) choices insert end $axis $axis 1337 $itk_component(axis_menu) add -text $axis -value $axis \ 1338 -variable [itcl::scope _settings($this-axis-selected)] 1229 1339 } 1230 1340 lappend axisnames $axis 1231 1341 } 1232 set axis [lindex $names 0] 1342 set axis [lindex $axisnames 0] 1343 set _settings($this-axis-selected) $axis 1233 1344 1234 1345 array set info [font configure $axis-title] 1235 $page.titlefontfamily value$info(-family)1236 $page.titlefontsize value$info(-size)1346 set _settings($this-axis-titlefont-family) $info(-family) 1347 set _settings($this-axis-titlefont-size) $info(-size) 1237 1348 set _settings($this-axis-titlefont-weight) $info(-weight) 1238 set _settings($this-axis-titlefont-slant) $info(-slant)1349 set _settings($this-axis-titlefont-slant) $info(-slant) 1239 1350 1240 1351 array set info [font configure $axis-ticks] 1241 $page.tickfontfamily value$info(-family)1242 $page.tickfontsize value$info(-size)1352 set _settings($this-axis-tickfont-family) $info(-family) 1353 set _settings($this-axis-tickfont-size) $info(-size) 1243 1354 set _settings($this-axis-tickfont-weight) $info(-weight) 1244 set _settings($this-axis-tickfont-slant) $info(-slant)1355 set _settings($this-axis-tickfont-slant) $info(-slant) 1245 1356 1246 1357 # Always hide the zero line. … … 1249 1360 # Pick the first axis to initially display 1250 1361 set axis [lindex $axisnames 0] 1251 $itk_component(axis_combo) value$axis1362 set $_settings($this-axis-selected) $axis 1252 1363 GetAxis 1253 1364 }
Note: See TracChangeset
for help on using the changeset viewer.