Changeset 1776 for branches/blt4/gui


Ignore:
Timestamp:
Jun 23, 2010, 8:21:41 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/xyprint.tcl

    r1775 r1776  
    3333    private variable _preview "";       # Preview image.
    3434    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 ""
    3645
    3746    private common _oldSettingsFile "~/.rpsettings"
    3847    private common _settingsFile "~/.rp_settings"
    39 
    4048    public method print { graph toolName plotName }
    4149    public method reset {}
     
    8896    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    8997   
    90 #     option add hull.width hull.height
    91 #     pack propagate $itk_component(hull) no
    92 
    9398    set w [winfo pixels . 2.5i]
    9499    set h [winfo pixels . 2i]
     
    186191    # Get the selected format of the download.
    187192    set page $itk_component(graph_page)
    188     set format [$page.format current]
     193    set format $_settings($this-general-format)
    189194   
    190195    # Handle JPEG or PNG image formats.
     
    490495
    491496itcl::body Rappture::XyPrint::GetAxis {} {
    492     set axis [$itk_component(axis_combo) current]
     497    set axis $_settings($this-axis-selected)
    493498    foreach option { grid min max loose title stepsize subdivisions } {
    494499        set _settings($this-axis-$option) [$_clone axis cget $axis -$option]
     
    614619
    615620    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."
    628643
    629644    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."
    637663
    638664    blt::tk::checkbutton $page.remember -text "remember settings" \
     
    661687itcl::body Rappture::XyPrint::ApplyLegendSettings {} {
    662688    set page $itk_component(legend_page)
    663     set _settings($this-legend-position)  [$page.position current]
    664689    set _settings($this-legend-anchor)    [$page.anchor current]
    665690    if { $_clone != "" } {
    666691        font configure $_fonts(legend) \
    667692            -family $_settings($this-legend-font-family) \
    668             -size [$page.fontsize current] \
     693            -size $_settings($this-legend-font-size) \
    669694            -weight $_settings($this-legend-font-weight) \
    670695            -slant $_settings($this-legend-font-slant)
     
    693718
    694719    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)]
    703740    Rappture::Tooltip::for $page.position \
    704741        "Set the position of the legend.  This option and the anchor determine the legend's location."
     
    800837    blt::comboentry $page.fontfamily \
    801838        -width 10 \
    802         -textvariable [itcl::scope _legendFontName] \
     839        -textvariable [itcl::scope _legendFontFamily] \
    803840        -editable no -menu $m \
    804841        -command [itcl::code $this ApplyLegendSettings]
     
    806843        -xscrollbar $m.xs \
    807844        -yscrollbar $m.ys  \
    808         -textvariable [itcl::scope _legendFontName] \
     845        -textvariable [itcl::scope _legendFontFamily] \
    809846        -height { 0 2i }
    810847    blt::tk::scrollbar $m.xs
     
    823860        -variable [itcl::scope _settings($this-legend-font-family)]
    824861    $m select "helvetica"
    825     if 0 {
    826     Rappture::Combobox $page.fontfamily -width 10 -editable no
    827     $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]
    835862    Rappture::Tooltip::for $page.fontfamily \
    836863        "Set the font of entries in the legend."
    837864
    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)]
    850889    Rappture::Tooltip::for $page.fontsize \
    851890        "Set the size (points) of the font."
     
    907946   
    908947    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."
    915964
    916965    label $page.title_l -text "title"
     
    9781027
    9791028    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)]
    9881054    Rappture::Tooltip::for $page.tickfontfamily \
    9891055        "Set the font of the ticks for the current axis."
    9901056
    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)]
    10031081    Rappture::Tooltip::for $page.tickfontsize \
    10041082        "Set the size (points) of the tick font."
     
    10251103
    10261104    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)]
    10351130    Rappture::Tooltip::for $page.titlefontfamily \
    10361131        "Set the font of the title for the current axis."
    10371132
    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)]
    10501157    Rappture::Tooltip::for $page.titlefontsize \
    10511158        "Set the size (point) of the title font."
     
    10991206        8,3 $page.plotpad_l -anchor e \
    11001207        8,4 $page.plotpad -fill both -cspan 3
     1208
     1209    blt::table configure $page  c0 c7 c8 -resize none
     1210   
    11011211}
    11021212
     
    11071217
    11081218itcl::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)
    11101223    set type [GetAxisType $axis]
    11111224    set page $itk_component(axis_page)
     
    11161229    $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero)
    11171230    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) \
    11201233        -weight $_settings($this-axis-titlefont-weight) \
    11211234        -slant  $_settings($this-axis-titlefont-slant)
    11221235    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) \
    11251238        -weight $_settings($this-axis-tickfont-weight) \
    11261239        -slant  $_settings($this-axis-tickfont-slant)
     
    11721285    # Always set to "ps" "ieee"
    11731286    set _settings($this-general-format) ps
    1174     set _settings($this-general-style) ieee
     1287    set _settings($this-general-style)  ieee
    11751288    set _settings($this-general-remember) 0
    11761289    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)]
    11791290
    11801291    # Layout settings
     
    12061317    array set info [font configure legend]
    12071318    set _settings($this-legend-font-family) $info(-family)
    1208     $page.fontsize value $info(-size)
     1319    set _settings($this-legend-font-size)  $info(-size)
    12091320    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)
    12111322    if { $info(-weight) == "bold" } {
    12121323        set _settings($this-legend-font-bold) 1
     
    12151326    set _settings($this-legend-position) [$_clone legend cget -position]
    12161327    set _settings($this-legend-anchor) [$_clone legend cget -anchor]
    1217     $page.position value \
    1218         [$page.position label $_settings($this-legend-position)]
    12191328    $page.anchor value [$page.anchor label $_settings($this-legend-anchor)]
    12201329    GetElement
     
    12231332    set page $itk_component(axis_page)
    12241333    set names [lsort [$_clone axis names]]
    1225     $itk_component(axis_combo) choices delete 0 end
     1334    $itk_component(axis_menu) delete all
    12261335    foreach axis $names {
    12271336        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)]
    12291339        }
    12301340        lappend axisnames $axis
    12311341    }
    1232     set axis [lindex $names 0]
     1342    set axis [lindex $axisnames 0]
     1343    set _settings($this-axis-selected) $axis
    12331344
    12341345    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)
    12371348    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)
    12391350
    12401351    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)
    12431354    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)
    12451356
    12461357    # Always hide the zero line.
     
    12491360    # Pick the first axis to initially display
    12501361    set axis [lindex $axisnames 0]
    1251     $itk_component(axis_combo) value $axis
     1362    set $_settings($this-axis-selected) $axis
    12521363    GetAxis
    12531364}
Note: See TracChangeset for help on using the changeset viewer.