Changeset 6682 for branches/blt4_trunk


Ignore:
Timestamp:
May 5, 2017 2:55:42 PM (5 years ago)
Author:
dkearney
Message:

updating xyprint widget to the version from mygeohub's geoexplorer_dev version of rappture to resolve compatibility issues with the development version of blt that this branch is built with.

File:
1 edited

Legend:

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

    r5659 r6682  
    1 # -*- mode: tcl; indent-tabs-mode: nil -*-
     1
    22# ----------------------------------------------------------------------
    33#  COMPONENT: xyprint - Print X-Y plot.
     
    2323option add *XyPrint*Entry*background "white" widgetDefault
    2424
     25itk::usual BltComboMenu {
     26    #empty
     27}
     28itk::usual BltComboEntry {
     29    #empty
     30}
     31
    2532itcl::class Rappture::XyPrint {
    2633    inherit itk::Widget
     
    2936    destructor {}
    3037
    31     private variable _graph "";         # Original graph.
     38    private variable _graph "";         # Original graph. 
    3239    private variable _clone "";         # Cloned graph.
    3340    private variable _preview "";       # Preview image.
    3441    private variable _savedSettings;    # Array of settings.
     42    private variable _outputFormatType "";
     43    private variable _formatIcon "";
     44    private variable _colorIcon "";
     45    private variable _colorText "";
    3546
    3647    private common _oldSettingsFile "~/.rpsettings"
     
    4051    public method reset {}
    4152
    42     private method CopyOptions { cmd orig clone {exclude {}}}
     53    private method CopyOptions { cmd orig clone {exclude {}}} 
    4354    private method CloneGraph { orig }
    4455
     
    5263    private method GetAxis {}
    5364    private method GetElement { args }
    54     private method RegeneratePreview {}
    55     private method InitClone {}
    56     private method Pixels2Inches { pixels }
    57     private method Inches2Pixels { inches {defValue ""}}
    58     private method Color2RGB { color }
    59 
    60     private method ApplyGeneralSettings {}
    61     private method ApplyLegendSettings {}
    62     private method ApplyAxisSettings {}
    63     private method ApplyElementSettings {}
    64     private method ApplyLayoutSettings {}
    65     private method InitializeSettings {}
    66     private method CreateSettings { toolName plotName }
    67     private method RestoreSettings { toolName plotName }
    68     private method SaveSettings { toolName plotName }
     65    private method RegeneratePreview {} 
     66    private method InitClone {} 
     67    private method Pixels2Inches { pixels } 
     68    private method Inches2Pixels { inches {defValue ""}} 
     69    private method Color2RGB { color } 
     70
     71    private method ApplyGeneralSettings {} 
     72    private method ApplyLegendSettings {} 
     73    private method ApplyAxisSettings {} 
     74    private method ApplyElementSettings {} 
     75    private method ApplyLayoutSettings {} 
     76    private method InitializeSettings {} 
     77    private method CreateSettings { toolName plotName } 
     78    private method RestoreSettings { toolName plotName } 
     79    private method SaveSettings { toolName plotName } 
    6980    private method DestroySettings {}
    70     private method ResetSettings { }
     81    private method ResetSettings { } 
    7182    private method GetOutput {}
    7283    private method SetWaitVariable { state }
    73     private method SetLayoutOption { option }
    74     private method GetAxisType { axis }
    75     private method restore { toolName plotName data }
     84    private method SetLayoutOption { option }
     85    private method GetAxisType { axis }
     86    private method restore { toolName plotName data }
     87    private method AddColorToMenu { menu name color }
    7688
    7789    # Same dialog may be used for different graphs
     
    8799    $_dispatcher register !rebuild
    88100    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
    89 
     101   
    90102    set w [winfo pixels . 2.5i]
    91103    set h [winfo pixels . 2i]
    92     set _preview [image create photo -width $w -height $h]
     104    set _preview [image create picture -width $w -height $h]
    93105    itk_component add tabs {
    94106        blt::tabset $itk_interior.tabs \
    95107            -highlightthickness 0 -tearoff 0 -side top \
    96             -bd 0 -gap 0 -tabborderwidth 1 \
    97             -outerpad 1 -background grey
     108            -outerborderwidth 0 -gap 0 -borderwidth 1 \
     109            -outerpad 1 -troughcolor grey
    98110    } {
    99111        keep -cursor
     
    126138        0,1 $itk_component(tabs) -fill both -cspan 2 \
    127139        1,2 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \
    128         1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y
     140        1,1 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y 
    129141    blt::table $inner \
    130         0,0 $itk_component(preview) -fill both -padx 10 -pady 10
     142        0,0 $itk_component(preview) -fill both -padx 10 -pady 10 
    131143
    132144    #blt::table configure $itk_interior c1 c2 -resize none
     
    166178    CloneGraph $graph
    167179    InitClone
    168     RestoreSettings $toolName $plotName
     180    RestoreSettings $toolName $plotName 
    169181    InitializeSettings
    170182    SetWaitVariable 0
    171183    tkwait variable [itcl::scope _wait($this)]
    172     SaveSettings $toolName $plotName
     184    SaveSettings $toolName $plotName 
    173185    set output ""
    174186    if { $_wait($this) } {
    175187        set output [GetOutput]
    176188    }
    177     DestroySettings
     189    DestroySettings 
    178190    return $output
    179191}
     
    182194    # Get the selected format of the download.
    183195    set page $itk_component(graph_page)
    184     set format [$page.format current]
    185 
     196    set m $page.format.menu
     197    set format [$m item cget $_settings($this-general-format) -value]
    186198    if { $format == "jpg" } {
    187         set img [image create photo]
     199        set img [image create picture]
    188200        $_clone snap $img
    189         set bytes [$img data -format "jpeg -quality 100"]
    190         set bytes [Rappture::encoding::decode -as b64 $bytes]
     201        $img export jpg -quality 100 -data bytes
    191202        image delete $img
    192203        return [list .jpg $bytes]
    193204    } elseif { $format == "png" } {
    194         set img [image create photo]
     205        set img [image create picture]
    195206        $_clone snap $img
    196         set bytes [$img data -format "png"]
    197         set bytes [Rappture::encoding::decode -as b64 $bytes]
     207        $img export png -data bytes
    198208        image delete $img
    199209        return [list .png $bytes]
     210    } elseif { $format == "gif" } {
     211        set img [image create picture]
     212        $_clone snap $img
     213        $img export gif -data bytes
     214        image delete $img
     215        return [list .gif $bytes]
    200216    }
    201217
     
    207223
    208224    $_clone postscript configure \
    209         -maxpect false \
    210225        -decoration yes \
    211226        -center yes \
    212227        -width $w -height $h
    213 
     228   
    214229    set psdata [$_clone postscript output]
    215230
    216231    if 0 {
    217         set f [open "junk.raw" "w"]
     232        set f [open "junk.raw" "w"] 
    218233        puts -nonewline $f $psdata
    219234        close $f
    220235    }
    221     if { $format == "eps" } {
     236    if { $format == "eps" } { 
    222237        return [list .$format $psdata]
    223238    }
    224239
    225240    set cmd ""
    226     # | eps2eps << $psdata
     241    # | eps2eps << $psdata 
    227242    lappend cmd "|" "/usr/bin/gs" \
    228243        "-q" "-sDEVICE=epswrite" "-sstdout=%stderr" \
     
    230245        "-dDEVICEWIDTH=250000" "-dDEVICEHEIGHT=250000" "-" "<<" "$psdata"
    231246    if { $format == "pdf" } {
    232         # | eps2eps << $psdata | ps2pdf
     247        # | eps2eps << $psdata | ps2pdf 
    233248        lappend cmd "|" "/usr/bin/gs" \
    234249            "-q" "-sDEVICE=pdfwrite" "-sstdout=%stderr" \
     
    242257        close $f
    243258    } err ] != 0 } {
    244         global errorInfo
     259        global errorInfo 
    245260        puts stderr "failed to generate file: $err\n$errorInfo"
    246261        return ""
    247262    }
    248263    if 0 {
    249         set f [open "junk.$format" "w"]
     264        set f [open "junk.$format" "w"] 
    250265        fconfigure $f -translation binary -encoding binary
    251266        puts -nonewline $f $output
     
    319334    # Element component
    320335    foreach elem [$orig element names] {
    321         set oper [$orig element type $elem]
     336        set oper [$orig element type $elem] 
    322337        $_clone $oper create $elem
    323         CopyOptions [list $oper configure $elem] $orig $_clone -data
     338        CopyOptions [list $oper configure $elem] $orig $_clone -data 
    324339        if { [$_clone $oper cget $elem -hide] } {
    325             $_clone $oper configure $elem -label ""
     340            $_clone $oper configure $elem -label "" 
    326341        }
    327342    }
     
    334349    # Crosshairs component
    335350    CopyOptions {crosshairs configure} $orig $_clone
    336     # Grid component
    337     CopyOptions {grid configure} $orig $_clone
    338351
    339352    # Create markers representing lines at zero for the x and y axis.
     
    345358
    346359itcl::body Rappture::XyPrint::InitClone {} {
    347 
     360   
    348361    $_clone configure -width 3.4i -height 3.4i -background white \
    349362        -borderwidth 0 \
     
    352365        -topmargin 0 \
    353366        -bottommargin 0
    354 
     367   
    355368    # Kill the title and create a border around the plot
    356369    $_clone configure \
     
    372385        -hide yes -borderwidth 0 -background white -relief solid \
    373386        -anchor nw -activeborderwidth 0
    374     #
     387    # 
    375388    set _settings($this-axis-ticks-fontfamily) helvetica
    376389    set _settings($this-axis-ticks-fontsize)   10
     
    411424        incr count
    412425        if { [$_clone element cget $elem -linewidth] > 1 } {
    413             $_clone element configure $elem -linewidth 1 -pixels 3
     426            $_clone element configure $elem -linewidth 1 -pixels 3 
    414427        }
    415428    }
    416429    if { $count == 0 } {
    417         # There are no "line" elements in the graph.
     430        # There are no "line" elements in the graph. 
    418431        # Remove the symbol and dashes controls.
    419432        set page $itk_component(legend_page)
    420433        # May have already been forgotten.
    421         catch {
     434        catch { 
    422435            blt::table forget $page.symbol_l
    423436            blt::table forget $page.symbol
    424437            blt::table forget $page.dashes_l
    425             blt::table forget $page.dashes
     438            blt::table forget $page.dashes 
    426439        }
    427440    }
     
    429442
    430443itcl::body Rappture::XyPrint::SetOption { opt } {
    431     set new $_settings($this$opt)
     444    set new $_settings($this$opt) 
    432445    set old [$_clone cget $opt]
    433446    set code [catch [list $_clone configure $opt $new] err]
     
    442455
    443456itcl::body Rappture::XyPrint::SetComponentOption { comp opt } {
    444     set new $_settings($this-$comp$opt)
     457    set new $_settings($this-$comp$opt) 
    445458    set old [$_clone $comp cget $opt]
    446459    set code [catch [list $_clone $comp configure $opt $new] err]
     
    455468
    456469itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } {
    457     set new $_settings($this-$comp$opt)
     470    set new $_settings($this-$comp$opt) 
    458471    set old [$_clone $comp cget $name $opt]
    459472    set code [catch [list $_clone $comp configure $name $opt $new] err]
     
    468481
    469482itcl::body Rappture::XyPrint::RegeneratePreview {} {
    470     update
    471     set img [image create photo]
     483    update 
     484    set img [image create picture]
    472485    set w [Inches2Pixels $_settings($this-layout-width) 3.4]
    473486    set h [Inches2Pixels $_settings($this-layout-height) 3.4]
     
    482495    set maxheight $rh
    483496    if { $maxwidth > $cw } {
    484         set maxwidth $cw
     497        set maxwidth $cw 
    485498    }
    486499    if { $maxheight > $ch } {
    487         set maxheight $ch
     500        set maxheight $ch 
    488501    }
    489502    set sx [expr double($maxwidth)/$w]
     
    494507    set ph [expr int(round($s * $h))]
    495508    $_preview configure -width $pw -height $ph
    496     blt::winop resample $img $_preview box
     509    #.labeltest.label configure -image $img
     510    $_preview resample $img -filter box
    497511    image delete $img
    498512}
     
    548562    }
    549563    set type [GetAxisType $axis]
    550     if { [$_clone grid cget -map${type}] == $axis } {
    551         set _settings($this-axis-grid) 1
    552     }  else {
    553         set _settings($this-axis-grid) 0
    554     }
    555564    set _settings($this-axis-plotpad${type}) \
    556565        [Pixels2Inches [$_clone cget -plotpad${type}]]
     
    560569itcl::body Rappture::XyPrint::GetElement { args } {
    561570    set index 1
     571    set page $itk_component(legend_page)
    562572    array unset _settings $this-element-*
    563573    foreach elem [$_clone element show] {
     
    568578    set elem $_settings($this-element-$index)
    569579    set _settings($this-element-label) [$_clone element cget $elem -label]
    570     set _settings($this-element-color) [$_clone element cget $elem -color]
     580
     581    set color [$_clone element cget $elem -color]
     582    set found 0
     583    set m $page.color.menu
     584    foreach item [$m names] {
     585        set c [$m item cget $item -value]
     586        if { $c == $color } {
     587            set color $item
     588            set found 1
     589            break
     590        }
     591    }
     592    if { !$found } {
     593        AddColorToMenu $m $color $color
     594    }
     595    $m select $color
     596
    571597    if { [$_clone element type $elem] != "bar" } {
    572598        set _settings($this-element-symbol) [$_clone element cget $elem -symbol]
    573599        set _settings($this-element-dashes) [$_clone element cget $elem -dashes]
    574600    }
    575     set page $itk_component(legend_page)
    576     set color [$page.color label $_settings($this-element-color)]
    577     if { $color == "" } {
    578         set color [Color2RGB $_settings($this-element-color)]
    579         $page.color choices insert end $color $color
    580         $page.color value $color
    581     } else {
    582         $page.color value [$page.color label $_settings($this-element-color)]
    583     }
    584601    if { [$_clone element type $elem] != "bar" } {
    585602        $page.symbol value [$page.symbol label $_settings($this-element-symbol)]
     
    591608itcl::body Rappture::XyPrint::BuildLayoutTab {} {
    592609    itk_component add layout_page {
    593         frame $itk_component(tabs).layout_page
     610        frame $itk_component(tabs).layout_page 
    594611    }
    595612    set page $itk_component(layout_page)
     
    597614        -text "Layout" -padx 2 -pady 2 -window $page -fill both
    598615
    599     label $page.width_l -text "width"
     616    label $page.width_l -text "width" 
    600617    entry $page.width -width 6 \
    601618        -textvariable [itcl::scope _settings($this-layout-width)]
     
    604621        "Set the width (inches) of the output image. Must be a positive number."
    605622
    606     label $page.height_l -text "height"
     623    label $page.height_l -text "height" 
    607624    entry $page.height -width 6 \
    608625        -textvariable [itcl::scope _settings($this-layout-height)]
     
    611628        "Set the height (inches) of the output image. Must be a positive number"
    612629
    613     label $page.margin_l -text "Margins"
     630    label $page.margin_l -text "Margins" 
    614631
    615632    label $page.left_l -text "left"
     
    620637        "Set the size (inches) of the left margin. If zero, the size is automatically determined."
    621638
    622     label $page.right_l -text "right"
     639    label $page.right_l -text "right" 
    623640    entry $page.right -width 6 \
    624641        -textvariable [itcl::scope _settings($this-layout-rightmargin)]
     
    659676        0,2 $page.map -fill both -rspan 7 -padx 2
    660677
    661     blt::table configure $page c0 r* -resize none
     678    blt::table configure $page c0 r* -resize none 
    662679    blt::table configure $page c1 r2 -resize both
    663680}
     
    666683itcl::body Rappture::XyPrint::BuildGeneralTab {} {
    667684    itk_component add graph_page {
    668         frame $itk_component(tabs).graph_page
     685        frame $itk_component(tabs).graph_page 
    669686    }
    670687    set page $itk_component(graph_page)
     
    673690
    674691    label $page.format_l -text "format"
    675     Rappture::Combobox $page.format -width 30 -editable no
    676     $page.format choices insert end \
    677         "pdf" "PDF Portable Document Format" \
    678         "ps"  "PS PostScript Format"  \
    679         "eps" "EPS Encapsulated PostScript"  \
    680         "jpg" "JPEG Joint Photographic Experts Group Format" \
    681         "png" "PNG Portable Network Graphics Format"
    682 
    683     bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings]
    684     Rappture::Tooltip::for $page.format \
    685         "Set the format of the image."
    686 
    687     label $page.style_l -text "style"
    688     Rappture::Combobox $page.style -width 20 -editable no
    689     $page.style choices insert end \
    690         "ieee" "IEEE Journal"  \
    691         "gekco" "G Klimeck"
    692     bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings]
    693     Rappture::Tooltip::for $page.format \
    694         "Set the style template."
    695 
    696     checkbutton $page.remember -text "remember settings" \
    697         -variable [itcl::scope _settings($this-general-remember)]
     692    set m $page.format.menu
     693    blt::comboentry $page.format \
     694        -width 1i \
     695        -textvariable [itcl::scope _settings($this-general-format)] \
     696        -editable no -menu $m \
     697        -iconvariable [itcl::scope _formatIcon] \
     698        -command [itcl::code $this ApplyGeneralSettings]
     699    blt::combomenu $m \
     700        -xscrollbar $m.xs \
     701        -yscrollbar $m.ys  \
     702        -textvariable [itcl::scope _settings($this-general-format)] \
     703        -iconvariable [itcl::scope _formatIcon] \
     704        -height { 0 2i }
     705    blt::tk::scrollbar $m.xs
     706    blt::tk::scrollbar $m.ys
     707    $m add -value "pdf" -text "PDF Portable Document Format"  \
     708        -icon [Rappture::icon pdf]
     709    $m add -value "ps"  -text "PS PostScript Format"  \
     710        -icon [Rappture::icon ps]
     711    $m add -value "eps" -text "EPS Encapsulated PostScript"  \
     712        -icon [Rappture::icon eps]
     713    $m add -value "jpg" -text "JPEG Joint Photographic Experts Group Format"  \
     714        -icon [Rappture::icon jpg]
     715    $m add -value "png" -text "PNG Portable Network Graphics Format"  \
     716        -icon [Rappture::icon png]
     717    $m add -value "gif" -text "GIF Graphics Interchange Format" \
     718        -icon [Rappture::icon gif]
     719    Rappture::Tooltip::for $page.format_l "Set the format of the image."
     720
     721    label $page.style_l -text "style"
     722    set m $page.style.menu
     723    blt::comboentry $page.style \
     724        -width 1i \
     725        -textvariable [itcl::scope _settings($this-general-style)] \
     726        -editable no -menu $m \
     727        -command [itcl::code $this ApplyGeneralSettings]
     728    blt::combomenu $m \
     729        -xscrollbar $m.xs \
     730        -yscrollbar $m.ys  \
     731        -textvariable [itcl::scope _settings($this-general-style)] \
     732        -height { 0 2i }
     733    blt::tk::scrollbar $m.xs
     734    blt::tk::scrollbar $m.ys
     735    $m add -value "ieee"  -text "IEEE Journal" 
     736    $m add -value "gekco" -text  "G Klimeck" 
     737    $m item configure all \
     738        -variable [itcl::scope _settings($this-general-style)]
     739    Rappture::Tooltip::for $page.style_l "Set the style template."
     740
     741    blt::tk::checkbutton $page.remember -text "remember settings" \
     742        -variable [itcl::scope _settings($this-general-remember)] 
    698743    Rappture::Tooltip::for $page.remember \
    699744        "Remember the settings. They will be override the default settings."
     
    711756        3,1 $page.style -fill x -cspan 2 \
    712757        5,0 $page.remember -cspan 2 -anchor w \
    713         5,2 $page.revert -anchor e
     758        5,2 $page.revert -anchor e 
    714759    blt::table configure $page r* -resize none  -pady { 0 2 }
    715760    blt::table configure $page r4 -resize both
    716761
    717762}
    718 
    719 itcl::body Rappture::XyPrint::ApplyLegendSettings {} {
    720     set page $itk_component(legend_page)
    721     set _settings($this-legend-anchor)    [$page.anchor current]
    722     if { $_clone != "" } {
    723         lappend font $_settings($this-legend-fontfamily)
    724         lappend font $_settings($this-legend-fontsize)
    725         lappend font $_settings($this-legend-fontweight)
    726         lappend font $_settings($this-legend-fontslant)
    727         foreach option { -hide -position -anchor -borderwidth } {
    728             SetComponentOption legend $option
    729         }
    730         $_clone legend configure -font fixed -font $font
    731     }
    732     ApplyElementSettings
    733 }
    734 
     763   
    735764itcl::body Rappture::XyPrint::BuildLegendTab {} {
    736765    itk_component add legend_page {
    737         frame $itk_component(tabs).legend_page
     766        frame $itk_component(tabs).legend_page 
    738767    }
    739768    set page $itk_component(legend_page)
     
    741770        -text "Legend" -padx 2 -pady 2 -window $page -fill both
    742771
    743     checkbutton $page.show -text "show legend" \
     772    blt::tk::checkbutton $page.show -text "show legend" \
    744773        -offvalue 1 -onvalue 0 \
    745774        -variable [itcl::scope _settings($this-legend-hide)]  \
    746         -command [itcl::code $this ApplyLegendSettings]
     775        -command [itcl::code $this ApplyLegendSettings] 
    747776    Rappture::Tooltip::for $page.show \
    748777        "Display the legend."
    749778
    750     label $page.position_l -text "position"
     779    blt::tk::label $page.position_l -text "position"
    751780    Rappture::Combobox $page.position -width 15 -editable no
    752781    $page.position choices insert end \
     
    755784        "bottommargin" "bottom margin"  \
    756785        "topmargin" "top margin"  \
    757         "plotarea" "inside plot"
     786        "plotarea" "inside plot" 
    758787    bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings]
    759788    Rappture::Tooltip::for $page.position \
     
    770799        "c" "center"  \
    771800        "e" "east"  \
    772         "w" "west"
     801        "w" "west" 
    773802    bind $page.anchor <<Value>> [itcl::code $this ApplyLegendSettings]
    774803    Rappture::Tooltip::for $page.anchor \
    775804        "Set the anchor of the legend.  This option and the anchor determine the legend's location."
    776805
    777     checkbutton $page.border -text "border" \
     806    blt::tk::checkbutton $page.border -text "border" \
    778807        -variable [itcl::scope _settings($this-legend-borderwidth)] \
    779808        -onvalue 1 -offvalue 0 \
     
    787816            -orient horizontal -width 12 \
    788817            -command [itcl::code $this GetElement]
    789     }
     818    } 
    790819    Rappture::Tooltip::for $page.slider \
    791820        "Select the current entry."
    792821
    793     label $page.label_l -text "label"
     822    blt::tk::label $page.label_l -text "label"
    794823    entry $page.label \
    795824        -background white \
     
    799828        "Set the label of the current entry in the legend."
    800829
    801     label $page.color_l -text "color "
     830    blt::tk::label $page.color_l -text "color"
     831    set m $page.color.menu
     832    blt::comboentry $page.color \
     833        -width 1i \
     834        -textvariable [itcl::scope _colorText] \
     835        -iconvariable [itcl::scope _colorIcon] \
     836        -editable no -menu $m \
     837        -command [itcl::code $this ApplyElementSettings]
     838    blt::combomenu $m \
     839        -xscrollbar $m.xs \
     840        -yscrollbar $m.ys  \
     841        -textvariable [itcl::scope _colorText] \
     842        -iconvariable [itcl::scope _colorIcon] \
     843        -height { 0 2i }
     844    blt::tk::scrollbar $m.xs
     845    blt::tk::scrollbar $m.ys
     846    foreach {rgb name} {
     847        "#000000" "black"
     848        "#ffffff" "white"
     849        "#0000cd" "blue"
     850        "#cd0000" "red"
     851        "#00cd00" "green"
     852        "#3a5fcd" "royal blue"
     853        "#cdcd00" "yellow"
     854        "#cd1076" "deep pink"
     855        "#009acd" "deep sky blue"
     856        "#00c5cd" "turquoise"
     857        "#a2b5cd" "light steel blue"
     858        "#7ac5cd" "cadet blue"
     859        "#66cdaa" "aquamarine"
     860        "#a2cd5a" "dark olive green"
     861        "#cd9b9b" "rosy brown"
     862        "#0000ff" "blue1"
     863        "#ff0000" "red1"
     864        "#00ff00" "green1"
     865    } {
     866        AddColorToMenu $m $name $rgb
     867    }
     868    Rappture::Tooltip::for $page.color \
     869        "Set the color of the current entry."
     870
     871    if 0 {
     872    label $page.color_l -text "color "
    802873    Rappture::Combobox $page.color -width 15 -editable no
    803874    $page.color choices insert end \
     
    819890        "#0000ff" "blue1" \
    820891        "#ff0000" "red1" \
    821         "#00ff00" "green1"
     892        "#00ff00" "green1" 
    822893    bind $page.color <<Value>> [itcl::code $this ApplyElementSettings]
    823894    Rappture::Tooltip::for $page.color \
    824895        "Set the color of the current entry."
    825 
    826     label $page.dashes_l -text "line style"
     896    }
     897    blt::tk::label $page.dashes_l -text "line style"
    827898    Rappture::Combobox $page.dashes -width 15 -editable no
    828899    $page.dashes choices insert end \
     
    836907        "Set the line style of the current entry."
    837908
    838     label $page.symbol_l -text "symbol"
     909    blt::tk::label $page.symbol_l -text "symbol"
    839910    Rappture::Combobox $page.symbol -editable no
    840911    $page.symbol choices insert end \
     
    852923        "Set the symbol of the current entry. \"none\" display no symbols."
    853924
    854     label $page.font_l -text "font"
    855     Rappture::Combobox $page.fontfamily -width 10 -editable no
    856     $page.fontfamily choices insert end \
    857         "courier" "courier" \
    858         "helvetica" "helvetica"  \
    859         "new*century*schoolbook"  "new century schoolbook" \
    860         "symbol"  "symbol" \
    861         "times"  "times"
    862     bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings]
     925    blt::tk::label $page.font_l -text "font"
     926    set m $page.fontfamily.menu
     927    blt::comboentry $page.fontfamily \
     928        -width 1i \
     929        -textvariable [itcl::scope _settings($this-legend-fontfamily)] \
     930        -editable no -menu $m \
     931        -command [itcl::code $this ApplyLegendSettings]
     932    blt::combomenu $m \
     933        -xscrollbar $m.xs \
     934        -yscrollbar $m.ys  \
     935        -textvariable [itcl::scope _settings($this-legend-fontfamily)] \
     936        -height { 0 2i }
     937    blt::tk::scrollbar $m.xs
     938    blt::tk::scrollbar $m.ys
     939    $m style create "courier" -font "{courier new} 9"
     940    $m style create "helvetica" -font "{arial} 9"
     941    $m style create "newcentury" -font "{new century schoolbook} 9"
     942    $m style create "times" -font "{times new roman} 9"
     943    $m add -text "courier" -value "courier" -style "courier"
     944    $m add -text "helvetica" -value "helvetica"  -style "helvetica"
     945    $m add -text "new century schoolbook" -value "new*century*schoolbook" \
     946        -style "newcentury"
     947    $m add -text "symbol" -value "symbol"
     948    $m add -text "times" -value "times" -style "times"
     949    $m item configure all -icon [Rappture::icon font]
    863950    Rappture::Tooltip::for $page.fontfamily \
    864951        "Set the font of entries in the legend."
    865952
    866     Rappture::Combobox $page.fontsize -width 4 -editable no
    867     $page.fontsize choices insert end \
    868         "8" "8" \
    869         "9" "9" \
    870         "10" "10" \
    871         "11" "11" \
    872         "12" "12" \
    873         "14" "14" \
    874         "17" "17" \
    875         "18" "18" \
    876         "20" "20"
    877     bind  $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings]
     953    set m $page.fontsize.menu
     954    blt::comboentry $page.fontsize \
     955        -width 0.5i \
     956        -textvariable [itcl::scope _settings($this-legend-fontsize)] \
     957        -editable no -menu $m \
     958        -command [itcl::code $this ApplyLegendSettings]
     959    blt::combomenu $m \
     960        -xscrollbar $m.xs \
     961        -yscrollbar $m.ys  \
     962        -textvariable [itcl::scope _settings($this-legend-fontsize)] \
     963        -height { 0 2i }
     964    blt::tk::scrollbar $m.xs
     965    blt::tk::scrollbar $m.ys
     966    foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } {
     967        $m add -text $size -value $size
     968    }
    878969    Rappture::Tooltip::for $page.fontsize \
    879         "Set the size (points) of the font."
    880 
    881     Rappture::PushButton $page.fontweight \
     970        "Set the size (in points) of the legend font."
     971
     972    blt::tk::pushbutton $page.fontweight \
     973        -width 18 -height 18 \
    882974        -onimage [Rappture::icon font-bold] \
    883975        -offimage [Rappture::icon font-bold] \
     
    888980        "Use the bold version of the font."
    889981
    890     Rappture::PushButton $page.fontslant \
     982    blt::tk::pushbutton $page.fontslant \
     983        -width 18 -height 18 \
    891984        -onimage [Rappture::icon font-italic] \
    892985        -offimage [Rappture::icon font-italic] \
     
    9271020itcl::body Rappture::XyPrint::BuildAxisTab {} {
    9281021    itk_component add axis_page {
    929         frame $itk_component(tabs).axis_page
     1022        frame $itk_component(tabs).axis_page 
    9301023    }
    9311024    set page $itk_component(axis_page)
    9321025    $itk_component(tabs) insert end "axis" \
    9331026        -text "Axis" -padx 2 -pady 2 -window $page -fill both
    934 
    935     label $page.axis_l -text "axis"
     1027   
     1028    blt::tk::label $page.axis_l -text "axis"
    9361029    itk_component add axis_combo {
    9371030        Rappture::Combobox $page.axis -width 20 -editable no
    938     }
     1031    } 
    9391032    bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis]
    9401033    Rappture::Tooltip::for $page.axis \
    9411034        "Select the current axis."
    9421035
    943     label $page.title_l -text "title"
     1036    blt::tk::label $page.title_l -text "title"
    9441037    entry $page.title \
    9451038        -textvariable [itcl::scope _settings($this-axis-title)]
     
    9481041        "Set the title of the current axis."
    9491042
    950     label $page.min_l -text "min"
     1043    blt::tk::label $page.min_l -text "min"
    9511044    entry $page.min -width 10 \
    9521045        -textvariable [itcl::scope _settings($this-axis-min)]
     
    9551048        "Set the minimum limit for the current axis. If empty, the minimum is automatically determined."
    9561049
    957     label $page.max_l -text "max"
     1050    blt::tk::label $page.max_l -text "max"
    9581051    entry $page.max -width 10 \
    9591052        -textvariable [itcl::scope _settings($this-axis-max)]
     
    9621055        "Set the maximum limit for the current axis. If empty, the maximum is automatically determined."
    9631056
    964     label $page.subdivisions_l -text "subdivisions"
     1057    blt::tk::label $page.subdivisions_l -text "subdivisions"
    9651058    entry $page.subdivisions \
    9661059        -textvariable [itcl::scope _settings($this-axis-subdivisions)]
     
    9701063        "Set the number of subdivisions (minor ticks) for the current axis."
    9711064
    972     label $page.stepsize_l -text "step size"
     1065    blt::tk::label $page.stepsize_l -text "step size"
    9731066    entry $page.stepsize \
    9741067        -textvariable [itcl::scope _settings($this-axis-stepsize)]
     
    9771070        "Set the interval between major ticks for the current axis. If zero, the interval is automatically determined."
    9781071
    979     checkbutton $page.loose -text "loose limits" \
     1072    blt::tk::checkbutton $page.loose -text "loose limits" \
    9801073        -onvalue "always" -offvalue "0" \
    9811074        -variable [itcl::scope _settings($this-axis-loose)] \
     
    9841077        "Set major ticks outside of the limits for the current axis."
    9851078
    986     label $page.plotpad_l -text "pad"
     1079    blt::tk::label $page.plotpad_l -text "pad" 
    9871080    entry $page.plotpad -width 6 \
    9881081        -textvariable [itcl::scope _settings($this-axis-plotpad)]
     
    9911084        "Set padding (points) between the current axis and the plot."
    9921085
    993     checkbutton $page.grid -text "show grid lines" \
     1086    blt::tk::checkbutton $page.grid -text "show grid lines" \
    9941087        -variable [itcl::scope _settings($this-axis-grid)] \
    9951088        -command [itcl::code $this ApplyAxisSettings]
     
    9971090        "Display grid lines for the current axis."
    9981091
    999     checkbutton $page.zero -text "mark zero" \
     1092    blt::tk::checkbutton $page.zero -text "mark zero" \
    10001093        -offvalue 1 -onvalue 0 \
    10011094        -variable [itcl::scope _settings($this-axis-zero)] \
     
    10041097        "Display a line at zero for the current axis."
    10051098
    1006     label $page.tickfont_l -text "tick font"
    1007     Rappture::Combobox $page.tickfontfamily -width 10 -editable no
    1008     $page.tickfontfamily choices insert end \
    1009         "courier" "courier" \
    1010         "helvetica" "helvetica"  \
    1011         "new*century*schoolbook"  "new century schoolbook" \
    1012         "symbol"  "symbol" \
    1013         "times"  "times"
    1014     bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings]
     1099    blt::tk::label $page.tickfont_l -text "tick font"
     1100    set m $page.tickfontfamily.menu
     1101    blt::comboentry $page.tickfontfamily \
     1102        -width 1i \
     1103        -textvariable [itcl::scope _settings($this-axis-ticks-fontfamily)] \
     1104        -editable no -menu $m \
     1105        -command [itcl::code $this ApplyAxisSettings]
     1106    blt::combomenu $m \
     1107        -xscrollbar $m.xs \
     1108        -yscrollbar $m.ys  \
     1109        -textvariable [itcl::scope _settings($this-axis-ticks-fontfamily)] \
     1110        -height { 0 2i }
     1111    blt::tk::scrollbar $m.xs
     1112    blt::tk::scrollbar $m.ys
     1113    $m style create "courier" -font "{courier new} 9"
     1114    $m style create "helvetica" -font "{arial} 9"
     1115    $m style create "newcentury" -font "{new century schoolbook} 9"
     1116    $m style create "times" -font "{times new roman} 9"
     1117    $m add -text "courier" -value "courier" -style "courier"
     1118    $m add -text "helvetica" -value "helvetica"  -style "helvetica"
     1119    $m add -text "new century schoolbook" -value "new*century*schoolbook" \
     1120        -style "newcentury"
     1121    $m add -text "symbol" -value "symbol"
     1122    $m add -text "times" -value "times" -style "times"
     1123    $m item configure all -icon [Rappture::icon font]
    10151124    Rappture::Tooltip::for $page.tickfontfamily \
    10161125        "Set the font of the ticks for the current axis."
    10171126
    1018     Rappture::Combobox $page.tickfontsize -width 4 -editable no
    1019     $page.tickfontsize choices insert end \
    1020         "8" "8" \
    1021         "9" "9" \
    1022         "10" "10" \
    1023         "11" "11" \
    1024         "12" "12" \
    1025         "14" "14" \
    1026         "17" "17" \
    1027         "18" "18" \
    1028         "20" "20"
    1029     bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings]
     1127    set m $page.tickfontsize.menu
     1128    blt::comboentry $page.tickfontsize \
     1129        -width 0.5i \
     1130        -textvariable [itcl::scope _settings($this-axis-ticks-fontsize)] \
     1131        -editable no -menu $m \
     1132        -command [itcl::code $this ApplyLegendSettings]
     1133    blt::combomenu $m \
     1134        -xscrollbar $m.xs \
     1135        -yscrollbar $m.ys  \
     1136        -textvariable [itcl::scope _settings($this-axis-ticks-fontsize)] \
     1137        -height { 0 2i }
     1138    blt::tk::scrollbar $m.xs
     1139    blt::tk::scrollbar $m.ys
     1140    foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } {
     1141        $m add -text $size -value $size
     1142    }
    10301143    Rappture::Tooltip::for $page.tickfontsize \
    1031         "Set the size (points) of the tick font."
    1032 
    1033     Rappture::PushButton $page.tickfontweight \
     1144        "Set the size (in points) of the tick font."
     1145
     1146    blt::tk::pushbutton $page.tickfontweight \
     1147        -width 18 -height 18 \
    10341148        -onimage [Rappture::icon font-bold] \
    10351149        -offimage [Rappture::icon font-bold] \
     
    10401154        "Use the bold version of the tick font."
    10411155
    1042     Rappture::PushButton $page.tickfontslant \
     1156    blt::tk::pushbutton $page.tickfontslant \
     1157        -width 18 -height 18 \
    10431158        -onimage [Rappture::icon font-italic] \
    10441159        -offimage [Rappture::icon font-italic] \
     
    10491164        "Use the italic version of the tick font."
    10501165
    1051     label $page.titlefont_l -text "title font"
    1052     Rappture::Combobox $page.titlefontfamily -width 10 -editable no
    1053     $page.titlefontfamily choices insert end \
    1054         "courier" "courier" \
    1055         "helvetica" "helvetica"  \
    1056         "new*century*schoolbook"  "new century schoolbook" \
    1057         "symbol"  "symbol" \
    1058         "times"  "times"
    1059     bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings]
     1166    blt::tk::label $page.titlefont_l -text "title font"
     1167    set m $page.titlefontfamily.menu
     1168    blt::comboentry $page.titlefontfamily \
     1169        -width 1i \
     1170        -textvariable [itcl::scope _settings($this-axis-title-fontfamily)] \
     1171        -editable no -menu $m \
     1172        -command [itcl::code $this ApplyAxisSettings]
     1173    blt::combomenu $m \
     1174        -xscrollbar $m.xs \
     1175        -yscrollbar $m.ys  \
     1176        -textvariable [itcl::scope _settings($this-axis-title-fontfamily)] \
     1177        -height { 0 2i }
     1178    blt::tk::scrollbar $m.xs
     1179    blt::tk::scrollbar $m.ys
     1180    $m style create "courier" -font "{courier new} 9"
     1181    $m style create "helvetica" -font "{arial} 9"
     1182    $m style create "newcentury" -font "{new century schoolbook} 9"
     1183    $m style create "times" -font "{times new roman} 9"
     1184    $m add -text "courier" -value "courier" -style "courier"
     1185    $m add -text "helvetica" -value "helvetica"  -style "helvetica"
     1186    $m add -text "new century schoolbook" -value "new*century*schoolbook" \
     1187        -style "newcentury"
     1188    $m add -text "symbol" -value "symbol"
     1189    $m add -text "times" -value "times" -style "times"
     1190    $m item configure all -icon [Rappture::icon font]
    10601191    Rappture::Tooltip::for $page.titlefontfamily \
    10611192        "Set the font of the title for the current axis."
    10621193
    1063     Rappture::Combobox $page.titlefontsize -width 4 -editable no
    1064     $page.titlefontsize choices insert end \
    1065         "8" "8" \
    1066         "9" "9" \
    1067         "10" "10" \
    1068         "11" "11" \
    1069         "12" "12" \
    1070         "14" "14" \
    1071         "17" "17" \
    1072         "18" "18" \
    1073         "20" "20"
    1074     bind $page.titlefontsize <<Value>> [itcl::code $this ApplyAxisSettings]
     1194    set m $page.titlefontsize.menu
     1195    blt::comboentry $page.titlefontsize \
     1196        -width 0.5i \
     1197        -textvariable [itcl::scope _settings($this-axis-title-fontsize)] \
     1198        -editable no -menu $m \
     1199        -command [itcl::code $this ApplyLegendSettings]
     1200    blt::combomenu $m \
     1201        -xscrollbar $m.xs \
     1202        -yscrollbar $m.ys  \
     1203        -textvariable [itcl::scope _settings($this-axis-title-fontsize)] \
     1204        -height { 0 2i }
     1205    blt::tk::scrollbar $m.xs
     1206    blt::tk::scrollbar $m.ys
     1207    foreach size { "8" "9" "10" "11" "12" "14" "17" "18" "20" } {
     1208        $m add -text $size -value $size
     1209    }
    10751210    Rappture::Tooltip::for $page.titlefontsize \
    1076         "Set the size (point) of the title font."
    1077 
    1078     Rappture::PushButton $page.titlefontweight \
     1211        "Set the size (in points) of the title font."
     1212
     1213    blt::tk::pushbutton $page.titlefontweight \
     1214        -width 18 -height 18 \
    10791215        -onimage [Rappture::icon font-bold] \
    10801216        -offimage [Rappture::icon font-bold] \
     
    10851221        "Use the bold version of the title font."
    10861222
    1087     Rappture::PushButton $page.titlefontslant \
     1223    blt::tk::pushbutton $page.titlefontslant \
     1224        -width 18 -height 18 \
    10881225        -onimage [Rappture::icon font-italic] \
    10891226        -offimage [Rappture::icon font-italic] \
     
    11021239        3,2 $page.min -fill x \
    11031240        3,3 $page.stepsize_l -anchor e \
    1104         3,4 $page.stepsize -fill both -cspan 3 \
     1241        3,4 $page.stepsize -fill x -cspan 3 \
    11051242        4,1 $page.max_l -anchor e \
    1106         4,2 $page.max -fill both \
     1243        4,2 $page.max -fill x \
    11071244        4,3 $page.subdivisions_l -anchor e \
    1108         4,4 $page.subdivisions -fill both -cspan 3  \
     1245        4,4 $page.subdivisions -fill x -cspan 3  \
    11091246        5,1 $page.titlefont_l -anchor e \
    11101247        5,2 $page.titlefontfamily -fill x -cspan 2 \
     
    11211258        8,1 $page.zero -cspan 2 -anchor w \
    11221259        8,3 $page.plotpad_l -anchor e \
    1123         8,4 $page.plotpad -fill both -cspan 3
    1124 
    1125     blt::table configure $page  c0 c4 c5 c6 c7 c8 -resize none
     1260        8,4 $page.plotpad -fill both -cspan 3
     1261
     1262    blt::table configure $page  r* c0 c4 c5 c6 c7 c8 -resize none
     1263    blt::table configure $page  r* -pady 1
     1264    blt::table configure $page r9 -resize both
    11261265}
    11271266
     
    11321271itcl::body Rappture::XyPrint::ApplyLegendSettings {} {
    11331272    set page $itk_component(legend_page)
     1273
    11341274    set _settings($this-legend-position)  [$page.position current]
    11351275    set _settings($this-legend-anchor)    [$page.anchor current]
    1136 
    11371276    foreach option { -hide -position -anchor -borderwidth } {
    11381277        SetComponentOption legend $option
    11391278    }
    1140     set _settings($this-legend-fontfamily)  [$page.fontfamily value]
    1141     set _settings($this-legend-fontsize)    [$page.fontsize value]
    11421279    lappend font $_settings($this-legend-fontfamily)
    11431280    lappend font $_settings($this-legend-fontsize)
     
    11451282    lappend font $_settings($this-legend-fontslant)
    11461283    $_clone legend configure -font fixed -font $font
     1284
     1285    # Set the font of the comboentry to the selected legend font.
     1286    set m $page.fontfamily.menu
     1287    set style [$m item cget $_settings($this-legend-fontfamily) -style]
     1288    set font [$m style cget $style -font]
     1289    $page.fontfamily configure -font $font
    11471290    ApplyElementSettings
    11481291}
     
    11521295    set type [GetAxisType $axis]
    11531296    set page $itk_component(axis_page)
    1154     if { $_settings($this-axis-grid) } {
    1155         $_clone grid configure -hide no -map${type} ${axis}
    1156     } else {
    1157         $_clone grid configure -hide no -map${type} ""
    1158     }
    11591297    $_clone configure -plotpad${type} $_settings($this-axis-plotpad)
    1160     foreach option { -min -max -loose -title -stepsize -subdivisions } {
     1298    foreach option { -grid -min -max -loose -title -stepsize -subdivisions } {
    11611299        SetNamedComponentOption axis $axis $option
    11621300    }
    1163     set _settings($this-axis-ticks-fontfamily)  [$page.tickfontfamily value]
    1164     set _settings($this-axis-ticks-fontsize)    [$page.tickfontsize value]
    1165     set _settings($this-axis-title-fontfamily)  [$page.titlefontfamily value]
    1166     set _settings($this-axis-title-fontsize)    [$page.titlefontsize value]
    1167 
    11681301    set tickfont {}
    11691302    set titlefont {}
     
    11791312        lappend titlefont $_settings(${general}-${attr})
    11801313    }
     1314    # Set the font of the comboentry to the selected tick font.
     1315    set m $page.tickfontfamily.menu
     1316    set style [$m item cget $_settings($this-axis-ticks-fontfamily) -style]
     1317    set font [$m style cget $style -font]
     1318    $page.tickfontfamily configure -font $font
     1319
     1320    # Set the font of the comboentry to the selected title font.
     1321    set m $page.titlefontfamily.menu
     1322    set style [$m item cget $_settings($this-axis-title-fontfamily) -style]
     1323    set font [$m style cget $style -font]
     1324    $page.titlefontfamily configure -font $font
     1325
    11811326    $_clone axis configure $axis -tickfont $tickfont -titlefont $titlefont
    11821327    $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero)
    1183     GetAxis
     1328
    11841329    RegeneratePreview
    11851330}
     
    11881333    set index [$itk_component(element_slider) get]
    11891334    set page $itk_component(legend_page)
    1190     set _settings($this-element-color)  [$page.color current]
    11911335    if { $_clone != "" } {
    11921336        set elem $_settings($this-element-$index)
     
    12111355
    12121356itcl::body Rappture::XyPrint::ApplyLayoutSettings {} {
    1213     foreach opt { -width -height -leftmargin -rightmargin -topmargin
     1357    foreach opt { -width -height -leftmargin -rightmargin -topmargin 
    12141358        -bottommargin } {
    12151359        set old [$_clone cget $opt]
     
    12291373itcl::body Rappture::XyPrint::InitializeSettings {} {
    12301374    # General settings
    1231 
    1232     # Always set to "ps" "ieee"
    1233     set _settings($this-general-format) ps
    1234     set _settings($this-general-style) ieee
     1375    set page $itk_component(graph_page)
     1376
     1377    # Always set to "jpg" "ieee"
     1378    set _settings($this-general-format)   \
     1379        "JPEG Joint Photographic Experts Group Format"
     1380    $page.format.menu select "JPEG Joint Photographic Experts Group Format"
     1381    set _settings($this-general-style)    ieee
    12351382    set _settings($this-general-remember) 0
    1236     set page $itk_component(graph_page)
    1237     $page.format value [$page.format label $_settings($this-general-format)]
    1238     $page.style value [$page.style label $_settings($this-general-style)]
    12391383
    12401384    # Layout settings
     
    12541398
    12551399    set names [$_clone element show]
    1256     $itk_component(element_slider) configure -from 1 -to [llength $names]
     1400    $itk_component(element_slider) configure -from 1 -to [llength $names] 
    12571401    set state [expr  { ([llength $names] < 2) ? "disabled" : "normal" } ]
    12581402    $page.slider configure -state $state
     
    12631407    set _settings($this-legend-borderwidth) 0
    12641408
    1265     $page.fontfamily value $_settings($this-legend-fontfamily)
    1266     $page.fontsize value $_settings($this-legend-fontsize)
    12671409    if { $_settings($this-legend-fontweight) == "bold" } {
    12681410        set _settings($this-legend-font-bold) 1
     
    12781420    # Axis settings
    12791421    set page $itk_component(axis_page)
    1280     set names [lsort [$_clone axis names]]
     1422    set names [lsort [$_clone axis names]] 
    12811423    $itk_component(axis_combo) choices delete 0 end
    12821424    foreach axis $names {
     
    12901432    }
    12911433    set axis [lindex $names 0]
    1292 
    1293     $page.titlefontfamily value $_settings($this-$axis-title-fontfamily)
    1294     $page.titlefontsize value   $_settings($this-$axis-title-fontsize)
    1295     $page.tickfontfamily value  $_settings($this-$axis-ticks-fontfamily)
    1296     $page.tickfontsize value    $_settings($this-$axis-ticks-fontsize)
    12971434
    12981435    # Always hide the zero line.
     
    13021439    set axis [lindex $axisnames 0]
    13031440    $itk_component(axis_combo) value $axis
    1304     GetAxis
     1441    GetAxis 
    13051442    RegeneratePreview
    13061443}
     
    13151452    if { ![file readable $_settingsFile] } {
    13161453        return;                         # No file or not readable
    1317     }
     1454    } 
    13181455    if { [file exists $_oldSettingsFile] } {
    13191456        file delete $_oldSettingsFile
     
    13271464    set code [read $f]
    13281465    close $f
    1329     if { [catch { $parser eval $code }] != 0 } {
    1330         file delete $_settingsFile
    1331     }
     1466    $parser eval $code
     1467   
    13321468    # Now see if there's an entry for this tool/plot combination.  The data
    13331469    # associated with the variable is itself code to update the graph (clone).
     
    13461482itcl::body Rappture::XyPrint::ResetSettings {} {
    13471483    set graph $_graph
    1348     DestroySettings
     1484    DestroySettings 
    13491485    set _graph $graph
    13501486    CloneGraph $graph
     
    13801516    # General settings
    13811517    set length [string length "${this}-"]
    1382     append out "    array set settings {\n"
     1518    append out "    array set settings {\n" 
    13831519    foreach item [array names _settings ${this}-*] {
    13841520        set field [string range $item $length end]
     
    13891525        append out "        [list $field] [list $value]\n"
    13901526    }
    1391     append out "    }\n"
     1527    append out "    }\n" 
    13921528    # Legend font
    13931529    lappend legendfont $_settings($this-legend-fontfamily)
     
    14081544
    14091545    # Layout settings
    1410     append out "    preview configure"
    1411     foreach opt { -width -height -leftmargin -rightmargin -topmargin
     1546    append out "    preview configure" 
     1547    foreach opt { -width -height -leftmargin -rightmargin -topmargin 
    14121548        -bottommargin -plotpadx -plotpady } {
    1413         set value [$_clone cget $opt]
    1414         append out " $opt [list $value]"
     1549        set value [list [$_clone cget $opt]]
     1550        append out " $opt $value"
    14151551    }
    14161552    append out "\n"
    14171553
    14181554    # Legend settings
    1419     append out "    preview legend configure"
    1420     foreach opt { -position -anchor -borderwidth -hide } {
    1421         set value [$_clone legend cget $opt]
    1422         append out " $opt [list $value]"
    1423     }
    1424     append out " -font [list $legendfont]\n"
     1555    append out "    preview legend configure" 
     1556    foreach opt { -position -anchor -borderwidth -hide } { 
     1557        set value [list [$_clone legend cget $opt]]
     1558        append out " $opt $value"
     1559    }
     1560    append out " -font \"$legendfont\"\n"
    14251561
    14261562    # Element settings
     
    14301566            continue
    14311567        }
    1432         set label [list $label]
    1433         append out "    if \{ \[preview element exists $label] \} \{\n"
    1434         append out "        preview element configure $label"
     1568        append out "    if \{ \[preview element exists \"$label\"\] \} \{\n"
     1569        append out "        preview element configure \"$label\""
    14351570        if { [$_clone element type $elem] != "bar" } {
    1436             set options { -symbol -color -dashes -label }
     1571            set options { -symbol -color -dashes -label } 
    14371572        } else {
    1438             set options { -color -label }
    1439         }
    1440         foreach opt $options {
    1441             set value [$_clone element cget $elem $opt]
    1442             append out " $opt [list $value]"
     1573            set options { -color -label } 
     1574        }
     1575        foreach opt $options { 
     1576            set value [list [$_clone element cget $elem $opt]]
     1577            append out " $opt $value"
    14431578        }
    14441579        append out "    \}\n"
    14451580    }
    1446 
     1581   
    14471582    # Axis settings
    14481583    foreach axis [$_clone axis names] {
     
    14501585            continue
    14511586        }
    1452         set axis [list $axis]
    1453         append out "    if \{ \[llength \[preview axis names $axis\]\] == 1 \} \{\n"
    1454         append out "        preview axis configure $axis"
    1455         foreach opt { -hide -min -max -loose -title -stepsize -subdivisions } {
    1456             set value [$_clone axis cget $axis $opt]
    1457             append out " $opt [list $value]"
    1458         }
    1459         append out " -tickfont [list $axistickfont]"
    1460         append out " -titlefont [list $axistitlefont]\n"
     1587        append out "    if \{ \[preview axis names \"$axis\"\] == \"$axis\" \} \{\n"
     1588        append out "        preview axis configure \"$axis\""
     1589        foreach opt { -grid -hide -min -max -loose -title -stepsize -subdivisions } {
     1590            set value [list [$_clone axis cget $axis $opt]]
     1591            append out " $opt $value"
     1592        }
     1593        append out " -tickfont \"$axistickfont\""
     1594        append out " -titlefont \"$axistitlefont\"\n"
    14611595        set hide [$_clone marker cget ${axis}-zero -hide]
    1462         append out "        preview marker configure ${axis}-zero -hide $hide\n"
     1596        append out "        preview marker configure \"${axis}-zero\" -hide $hide\n"
    14631597        append out "    \}\n"
    1464     }
    1465 
    1466     append out "    preview grid configure"
    1467     append out " -hide \"[$_clone grid cget -hide]\""
    1468     append out " -mapx \"[$_clone grid cget -mapx]\""
    1469     append out " -mapy \"[$_clone grid cget -mapy]\""
     1598    }   
    14701599    return $out
    14711600}
     1601
     1602itcl::body Rappture::XyPrint::AddColorToMenu { m name color } {
     1603    set icon [image create picture -width 19 -height 17]
     1604    $icon blank 0x0
     1605    $icon draw circle 7 7 8 -color black \
     1606        -antialiased 1 -linewidth 0 -shadow { -width 1 -offset 1 }
     1607    $icon draw circle 7 7 7 -color $color \
     1608        -antialiased 1 -linewidth 0
     1609    $m add -text $name -icon $icon -value $color \
     1610        -variable [itcl::scope _settings($this-element-color)]
     1611}
Note: See TracChangeset for help on using the changeset viewer.