- Timestamp:
- Oct 29, 2009 2:04:52 PM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/pushbutton.tcl
r1531 r1604 24 24 itk_option define -width width Width "normal" 25 25 itk_option define -height height Height "normal" 26 itk_option define -onvalue onValue OnValue "normal" 27 itk_option define -offvalue offValue OffValue "normal" 26 28 27 29 constructor {args} { # defined below } … … 102 104 $itk_component(button) configure -relief raise \ 103 105 -image $offimage -bg grey85 106 } else { 107 puts stderr "unknown value \"$var\": should be \"$offvalue\" or \"onvalue\"" 104 108 } 105 109 } … … 151 155 $itk_component(button) configure -height $itk_option(-height) 152 156 } 157 -
trunk/gui/scripts/xyprint.tcl
r1603 r1604 168 168 set _clone [CloneGraph $graph] 169 169 InitClone 170 RestoreSettings $toolName $plotName 170 171 InitializeSettings 171 # RestoreSettings $toolName $plotName172 172 set _wait($this) 0 173 173 tkwait variable [itcl::scope _wait($this)] … … 176 176 set output [GetOutput] 177 177 } 178 #SaveSettings $toolName $plotName178 SaveSettings $toolName $plotName 179 179 DestroySettings 180 180 return $output … … 341 341 -plotbackground white -plotpadx 0 -plotpady 0 342 342 # 343 set _fonts(legend) [font create -family helvetica -size 10 -weight normal] 343 set _settings($this-layout-width) [Pixels2Inches [$_clone cget -width]] 344 set _settings($this-layout-height) [Pixels2Inches [$_clone cget -height]] 345 346 set _fonts(legend) [font create legend \ 347 -family helvetica -size 10 -weight normal] 344 348 update 345 349 $_clone legend configure \ … … 353 357 continue 354 358 } 355 set _fonts($axis-ticks) [font create -family helvetica -size 10 \ 359 set _fonts($axis-ticks) [font create $axis-ticks \ 360 -family helvetica -size 10 \ 356 361 -weight normal -slant roman] 357 set _fonts($axis-title) [font create -family helvetica -size 10 \ 362 set _fonts($axis-title) [font create $axis-title \ 363 -family helvetica -size 10 \ 358 364 -weight normal -slant roman] 359 puts stderr "tick fonts $_fonts($axis-ticks): [font configure $_fonts($axis-ticks)]"360 puts stderr "title fonts $_fonts($axis-title): [font configure $_fonts($axis-title)]"361 365 update 362 366 $_clone axis configure $axis -ticklength 5 \ … … 378 382 $_clone marker create line -name y-zero \ 379 383 -coords "-Inf 0 Inf 0" -dashes 1 -hide yes 384 385 puts stderr "font names [font names]" 380 386 } 381 387 … … 419 425 update 420 426 set img [image create photo] 421 422 427 set w [Inches2Pixels $_settings($this-layout-width)] 423 428 set h [Inches2Pixels $_settings($this-layout-height)] … … 600 605 SetComponentOption legend $option 601 606 } 607 $_clone legend configure -font legend 602 608 ApplyElementSettings 603 609 } … … 710 716 Rappture::Combobox $page.fontfamily -width 10 -editable no 711 717 $page.fontfamily choices insert end \ 712 "courier" " Courier" \713 "helvetica" " Helvetica" \714 "new*century*schoolbook" " New Century Schoolbook" \715 "symbol" " Symbol" \716 "times" " Times"718 "courier" "courier" \ 719 "helvetica" "helvetica" \ 720 "new*century*schoolbook" "new century schoolbook" \ 721 "symbol" "symbol" \ 722 "times" "times" 717 723 bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings] 718 724 … … 730 736 bind $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings] 731 737 732 Rappture::PushButton $page.font bold\738 Rappture::PushButton $page.fontweight \ 733 739 -width 18 -height 18 \ 734 740 -onimage [Rappture::icon font-bold] \ 735 741 -offimage [Rappture::icon font-bold] \ 742 -onvalue "bold" -offvalue "normal" \ 736 743 -command [itcl::code $this ApplyLegendSettings] \ 737 -variable [itcl::scope _settings($this-legend-font- bold)]738 739 Rappture::PushButton $page.font italic\744 -variable [itcl::scope _settings($this-legend-font-weight)] 745 746 Rappture::PushButton $page.fontslant \ 740 747 -width 18 -height 18 \ 741 748 -onimage [Rappture::icon font-italic] \ 742 749 -offimage [Rappture::icon font-italic] \ 750 -onvalue "italic" -offvalue "roman" \ 743 751 -command [itcl::code $this ApplyLegendSettings] \ 744 -variable [itcl::scope _settings($this-legend-font- italic)]752 -variable [itcl::scope _settings($this-legend-font-slant)] 745 753 746 754 blt::table $page \ … … 753 761 3,1 $page.fontfamily -fill x \ 754 762 3,2 $page.fontsize -fill x \ 755 3,3 $page.font bold-anchor e \756 3,4 $page.font italic-anchor e \763 3,3 $page.fontweight -anchor e \ 764 3,4 $page.fontslant -anchor e \ 757 765 4,0 $page.slider_l -anchor e \ 758 766 4,1 $page.slider -fill x -cspan 5 \ … … 833 841 Rappture::Combobox $page.tickfontfamily -width 10 -editable no 834 842 $page.tickfontfamily choices insert end \ 835 "courier" " Courier" \836 "helvetica" " Helvetica" \837 "new*century*schoolbook" " New Century Schoolbook" \838 "symbol" " Symbol" \839 "times" " Times"843 "courier" "courier" \ 844 "helvetica" "helvetica" \ 845 "new*century*schoolbook" "new century schoolbook" \ 846 "symbol" "symbol" \ 847 "times" "times" 840 848 bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 841 849 … … 853 861 bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] 854 862 855 Rappture::PushButton $page.tickfont bold\863 Rappture::PushButton $page.tickfontweight \ 856 864 -width 18 -height 18 \ 857 865 -onimage [Rappture::icon font-bold] \ 858 866 -offimage [Rappture::icon font-bold] \ 867 -onvalue "bold" -offvalue "normal" \ 859 868 -command [itcl::code $this ApplyAxisSettings] \ 860 -variable [itcl::scope _settings($this-axis-tickfont- bold)]861 862 Rappture::PushButton $page.tickfont italic\869 -variable [itcl::scope _settings($this-axis-tickfont-weight)] 870 871 Rappture::PushButton $page.tickfontslant \ 863 872 -width 18 -height 18 \ 864 873 -onimage [Rappture::icon font-italic] \ 865 874 -offimage [Rappture::icon font-italic] \ 875 -onvalue "italic" -offvalue "roman" \ 866 876 -command [itcl::code $this ApplyAxisSettings] \ 867 -variable [itcl::scope _settings($this-axis-tickfont- italic)]877 -variable [itcl::scope _settings($this-axis-tickfont-slant)] 868 878 869 879 label $page.titlefont_l -text "title font" 870 880 Rappture::Combobox $page.titlefontfamily -width 10 -editable no 871 881 $page.titlefontfamily choices insert end \ 872 "courier" " Courier" \873 "helvetica" " Helvetica" \874 "new*century*schoolbook" " New Century Schoolbook" \875 "symbol" " Symbol" \876 "times" " Times"882 "courier" "courier" \ 883 "helvetica" "helvetica" \ 884 "new*century*schoolbook" "new century schoolbook" \ 885 "symbol" "symbol" \ 886 "times" "times" 877 887 bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings] 878 888 … … 890 900 bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings] 891 901 892 Rappture::PushButton $page.titlefont bold\902 Rappture::PushButton $page.titlefontweight \ 893 903 -width 18 -height 18 \ 894 904 -onimage [Rappture::icon font-bold] \ 895 905 -offimage [Rappture::icon font-bold] \ 906 -onvalue "bold" -offvalue "normal" \ 896 907 -command [itcl::code $this ApplyAxisSettings] \ 897 -variable [itcl::scope _settings($this-axis-titlefont- bold)]898 899 Rappture::PushButton $page.titlefont italic\908 -variable [itcl::scope _settings($this-axis-titlefont-weight)] 909 910 Rappture::PushButton $page.titlefontslant \ 900 911 -width 18 -height 18 \ 901 912 -onimage [Rappture::icon font-italic] \ 902 913 -offimage [Rappture::icon font-italic] \ 914 -onvalue "italic" -offvalue "roman" \ 903 915 -command [itcl::code $this ApplyAxisSettings] \ 904 -variable [itcl::scope _settings($this-axis-titlefont- italic)]916 -variable [itcl::scope _settings($this-axis-titlefont-slant)] 905 917 906 918 blt::table $page \ … … 920 932 5,2 $page.titlefontfamily -fill x -cspan 2 \ 921 933 5,4 $page.titlefontsize -fill x \ 922 5,5 $page.titlefont bold-anchor e \923 5,6 $page.titlefont italic-anchor e \934 5,5 $page.titlefontweight -anchor e \ 935 5,6 $page.titlefontslant -anchor e \ 924 936 6,1 $page.tickfont_l -anchor e \ 925 937 6,2 $page.tickfontfamily -fill x -cspan 2 \ 926 938 6,4 $page.tickfontsize -fill x \ 927 6,5 $page.tickfont bold-anchor e \928 6,6 $page.tickfont italic-anchor e \939 6,5 $page.tickfontweight -anchor e \ 940 6,6 $page.tickfontslant -anchor e \ 929 941 7,1 $page.loose -cspan 2 -anchor w \ 930 942 7,3 $page.grid -anchor w -cspan 2 \ … … 946 958 SetComponentOption legend $option 947 959 } 948 set slant "roman"949 if { $_settings($this-legend-font-italic) } {950 set slant "italic"951 }952 set weight "normal"953 if { $_settings($this-legend-font-bold) } {954 set weight "bold"955 }956 960 font configure $_fonts(legend) \ 957 961 -family [$page.fontfamily current] \ 958 962 -size [$page.fontsize current] \ 959 -weight $weight -slant $slant 963 -weight $_settings($this-legend-font-weight) \ 964 -slant $_settings($this-legend-font-slant) 960 965 $_clone legend configure -font $_fonts(legend) 961 966 ApplyElementSettings … … 976 981 } 977 982 $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero) 978 set slant "roman" 979 if { $_settings($this-axis-titlefont-italic) } { 980 set slant "italic" 981 } 982 set weight "normal" 983 if { $_settings($this-axis-titlefont-bold) } { 984 set weight "bold" 985 } 986 font configure $_fonts($axis-title) \ 983 font configure $axis-title \ 987 984 -family [$page.titlefontfamily current] \ 988 985 -size [$page.titlefontsize current] \ 989 -weight $weight -slant $slant 990 set slant "roman" 991 if { $_settings($this-axis-tickfont-italic) } { 992 set slant "italic" 993 } 994 set weight "normal" 995 if { $_settings($this-axis-tickfont-bold) } { 996 set weight "bold" 997 } 998 font configure $_fonts($axis-ticks) \ 986 -weight $_settings($this-axis-titlefont-weight) \ 987 -slant $_settings($this-axis-titlefont-slant) 988 font configure $axis-ticks \ 999 989 -family [$page.tickfontfamily current] \ 1000 990 -size [$page.tickfontsize current] \ 1001 -weight $ weight -slant $slant1002 $_clone axis configure $axis -tickfont $_fonts($axis-ticks) \ 1003 -titlefont $_fonts($axis-title) 991 -weight $_settings($this-axis-tickfont-weight) \ 992 -slant $_settings($this-axis-tickfont-slant) 993 $_clone axis configure $axis -tickfont $axis-ticks -titlefont $axis-title 1004 994 GetAxis 1005 995 RegeneratePreview … … 1028 1018 global errorInfo 1029 1019 puts stderr "$err: $errorInfo" 1030 set _settings($this-layout-$opt) [Pixel 2Inches $old]1020 set _settings($this-layout-$opt) [Pixels2Inches $old] 1031 1021 } 1032 1022 } … … 1070 1060 # Always set the borderwidth to be not displayed 1071 1061 set _settings($this-legend-borderwidth) 0 1072 $page.fontfamily value "Helvetica" 1073 $page.fontsize value "10" 1074 set _settings($this-legend-font-bold) 0 1075 set _settings($this-legend-font-italic) 0 1076 1062 1063 array unset info 1064 array set info [font configure legend] 1065 $page.fontfamily value $info(-family) 1066 $page.fontsize value $info(-size) 1067 set _settings($this-legend-font-weight) $info(-weight) 1068 set _settings($this-legend-font-slant) $info(-slant) 1069 if { $info(-weight) == "bold" } { 1070 set _settings($this-legend-font-bold) 1 1071 } 1077 1072 set _settings($this-legend-hide) [$_clone legend cget -hide] 1078 1073 set _settings($this-legend-position) [$_clone legend cget -position] … … 1093 1088 lappend axisnames $axis 1094 1089 } 1095 $page.titlefontfamily value "Helvetica" 1096 $page.tickfontfamily value "Helvetica" 1097 $page.titlefontsize value "10" 1098 $page.tickfontsize value "10" 1099 set _settings($this-axis-tickfont-bold) 0 1100 set _settings($this-axis-tickfont-italic) 0 1101 set _settings($this-axis-titlefont-bold) 0 1102 set _settings($this-axis-titlefont-italic) 0 1090 set axis [lindex $names 0] 1091 1092 array set info [font configure $axis-title] 1093 $page.titlefontfamily value $info(-family) 1094 $page.titlefontsize value $info(-size) 1095 set _settings($this-axis-titlefont-weight) $info(-weight) 1096 set _settings($this-axis-titlefont-slant) $info(-slant) 1097 1098 array set info [font configure $axis-ticks] 1099 $page.tickfontfamily value $info(-family) 1100 $page.tickfontsize value $info(-size) 1101 set _settings($this-axis-tickfont-weight) $info(-weight) 1102 set _settings($this-axis-tickfont-slant) $info(-slant) 1103 1103 1104 # Always hide the zero line. 1104 1105 set _settings($this-axis-zero) 1 … … 1125 1126 set parser [interp create -safe] 1126 1127 $parser alias xyprint [itcl::code $this restore] 1127 set f [open $file "r"] 1128 $parser alias font font 1129 set f [open "~/.rappture" "r"] 1128 1130 set code [read $f] 1129 1131 close $f … … 1152 1154 1153 1155 itcl::body Rappture::XyPrint::SaveSettings { toolName plotName } { 1154 if { ! [file writable "~/.rappture"]} {1156 if { !$_settings($this-general-remember) } { 1155 1157 return 1156 1158 } 1157 set out [CreateSettings $toolName $plotName] 1159 if { [catch { open "~/.rappture" "w" 0600 } f ] != 0 } { 1160 puts stderr "~/.rappture isn't writable: $f" 1161 bell 1162 return 1163 } 1164 set key [list $toolName $plotName] 1165 set _savedSettings($key) [CreateSettings $toolName $plotName] 1158 1166 # Write the settings out 1159 set f [open ".rappture" "w" 0600]1160 1167 foreach key [lsort [array names _savedSettings]] { 1161 1168 set tool [lindex $key 0] 1162 1169 set plot [lindex $key 1] 1163 if { $plotName == "plot" && $toolName == "$tool" } {1164 continue1165 }1166 1170 puts $f "xyprint \"$tool\" \"$plot\" \{" 1167 1171 puts $f "$_savedSettings($key)" 1168 1172 puts $f "\}\n" 1169 1173 } 1170 # Now write the new setting1171 puts $f "xyprint \"$toolName\" \"$plotName\" \{"1172 puts $f "$out"1173 puts $f "\}\n"1174 1174 close $f 1175 1175 } … … 1178 1178 # Create stanza associated with tool and plot title. 1179 1179 # General settings 1180 append out "\n"1181 append out "xyprint \"\$toolName\" \"\$plotName\" \{\n"1182 1180 append out " set general(format) $_settings($this-general-format)\n" 1183 1181 append out " set general(style) $_settings($this-general-style)\n" 1184 1182 append out " set general(remember) 1\n" 1185 1183 1184 foreach font [array names _fonts] { 1185 append out " font configure $font \\\n" 1186 array unset info 1187 array set info [font configure $font] 1188 append out " -family \"$info(-family)\" \\\n" 1189 append out " -size \"$info(-size)\" \\\n" 1190 append out " -weight \"$info(-weight)\" \\\n" 1191 append out " -slant \"$info(-slant)\" \n" 1192 } 1193 1186 1194 # Layout settings 1187 1195 append out " xygraph configure \\\n" 1188 append out " -width \"[ Pixels2Inches [$_clone cget -width]]\" \\\n"1189 append out " -height \"[ Pixels2Inches [$_clone cget -height]]\" \\\n"1190 append out " -leftmargin \"[ Pixels2Inches [$_clone cget -leftmargin]]\" \\\n"1191 append out " -rightmargin \"[ Pixels2Inches [$_clone cget -rightmargin]]\" \\\n"1192 append out " -topmargin \"[ Pixels2Inches [$_clone cget -topmargin]]\" \\\n"1193 append out " -bottommargin \"[ Pixels2Inches [$_clone cget -bottommargin]]\"\\\n"1194 append out " -plotpadx \"[ Pixels2Inches [$_clone cget -plotpadx]]\" \\\n"1195 append out " -plotpady \"[ Pixels2Inches [$_clone cget -plotpady]]\" \n"1196 append out " -width \"[$_clone cget -width]\" \\\n" 1197 append out " -height \"[$_clone cget -height]\" \\\n" 1198 append out " -leftmargin \"[$_clone cget -leftmargin]\" \\\n" 1199 append out " -rightmargin \"[$_clone cget -rightmargin]\" \\\n" 1200 append out " -topmargin \"[$_clone cget -topmargin]\" \\\n" 1201 append out " -bottommargin \"[$_clone cget -bottommargin]\"\\\n" 1202 append out " -plotpadx \"[$_clone cget -plotpadx]\" \\\n" 1203 append out " -plotpady \"[$_clone cget -plotpady]\" \n" 1196 1204 1197 1205 # Legend settings … … 1200 1208 append out " -anchor \"[$_clone legend cget -anchor]\" \\\n" 1201 1209 append out " -borderwidth \"[$_clone legend cget -borderwidth]\" \\\n" 1210 append out " -font legend \\\n" 1202 1211 append out " -hide \"[$_clone legend cget -hide]\" \n" 1203 1212 … … 1225 1234 append out " -max \"[$_clone axis cget $axis -max]\" \\\n" 1226 1235 append out " -loose \"[$_clone axis cget $axis -loose]\" \\\n" 1236 append out " -tickfont \"$axis-ticks\" \\\n" 1227 1237 append out " -title \"[$_clone axis cget $axis -title]\" \\\n" 1238 append out " -titlefont \"$axis-title\" \\\n" 1228 1239 append out " -stepsize \"[$_clone axis cget $axis -stepsize]\" \\\n" 1229 1240 append out " -subdivisions \"[$_clone axis cget $axis -subdivisions]\"\n" … … 1232 1243 append out " \}\n" 1233 1244 } 1245 1234 1246 append out " xygraph grid configure \\\n" 1235 1247 append out " -hide \"[$_clone grid cget -hide]\" \\\n" 1236 1248 append out " -mapx \"[$_clone grid cget -mapx]\" \\\n" 1237 1249 append out " -mapy \"[$_clone grid cget -mapy]\"\n" 1238 append out "\}\n"1239 1250 return $out 1240 1251 }
Note: See TracChangeset
for help on using the changeset viewer.