source: trunk/gui/scripts/xyprint.tcl @ 1602

Last change on this file since 1602 was 1602, checked in by gah, 15 years ago
File size: 40.9 KB
Line 
1
2# ----------------------------------------------------------------------
3#  COMPONENT: xyprint - Print X-Y plot.
4#
5# ======================================================================
6#  AUTHOR:  Michael McLennan, Purdue University
7#  Copyright (c) 2004-2005  Purdue Research Foundation
8#
9#  See the file "license.terms" for information on usage and
10#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11# ======================================================================
12package require Itk
13package require BLT
14
15#option add *XyPrint.width 3i widgetDefault
16#option add *XyPrint.height 3i widgetDefault
17option add *XyPrint.gridColor #d9d9d9 widgetDefault
18option add *XyPrint.activeColor blue widgetDefault
19option add *XyPrint.dimColor gray widgetDefault
20option add *XyPrint.controlBackground gray widgetDefault
21option add *XyPrint*font "Arial 9"
22option add *XyPrint*Entry*width "6" widgetDefault
23option add *XyPrint*Entry*background "white" widgetDefault
24
25array set Rappture::axistypes {
26    x x
27    y y
28    x2 x
29    y2 y
30}
31
32itcl::class Rappture::XyPrint {
33    inherit itk::Widget
34
35    constructor {args} {}
36    destructor {}
37
38    private variable _graph "";         # Original graph.
39    private variable _clone "";         # Cloned graph.
40    private variable _preview "";       # Preview image.
41    private variable _savedSettings;    # Array of settings.
42       
43    public method print { graph toolName plotName }
44
45    private method CopyOptions { cmd orig clone }
46    private method CopyBindings { oper orig clone args }
47    private method CloneGraph { orig }
48
49    private method BuildGeneralTab {}
50    private method BuildLayoutTab {}
51    private method BuildLegendTab {}
52    private method BuildAxisTab {}
53    private method SetOption { opt }
54    private method SetComponentOption { comp opt }
55    private method SetNamedComponentOption { comp name opt }
56    private method GetAxis {}
57    private method GetElement { args }
58    private method RegeneratePreview {}
59    private method InitClone {}
60    private method Pixels2Inches { pixels }
61    private method Inches2Pixels { inches }
62
63    private method ApplyGeneralSettings {}
64    private method ApplyLegendSettings {}
65    private method ApplyAxisSettings {}
66    private method ApplyElementSettings {}
67    private method ApplyLayoutSettings {}
68    private method InitializeSettings {}
69    private method CreateSettings { toolName plotName }
70    private method RestoreSettings { toolName plotName }
71    private method SaveSettings { toolName plotName }
72    private method ResetSettings { }
73    private method GetOutput {}
74    private method Done { state }
75    private method DestroySettings {}
76    private method restore { toolName plotName data }
77    private common _settings
78    private common _fonts
79    private common _wait
80}
81
82# ----------------------------------------------------------------------
83# CONSTRUCTOR
84# ----------------------------------------------------------------------
85itcl::body Rappture::XyPrint::constructor { args } {
86    Rappture::dispatcher _dispatcher
87    $_dispatcher register !rebuild
88    $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"
89   
90#     option add hull.width hull.height
91#     pack propagate $itk_component(hull) no
92
93    set w [winfo pixels . 2.5i]
94    set h [winfo pixels . 2i]
95    set _preview [image create photo -width $w -height $h]
96    itk_component add tabs {
97        blt::tabset $itk_interior.tabs \
98            -highlightthickness 0 -tearoff 0 -side top \
99            -bd 0 -gap 0 -tabborderwidth 1 \
100            -outerpad 1 -background grey
101    } {
102        keep -cursor
103        ignore -highlightthickness -borderwidth -background
104    }
105    itk_component add preview {
106        label $itk_interior.preview \
107            -highlightthickness 0 -bd 0 -image $_preview -width 2.5i \
108                -height 2.25i -background grey -padx 10 -pady 10
109    } {
110        ignore -background
111    }
112    itk_component add ok {
113        button $itk_interior.ok -text "Save" \
114            -highlightthickness 0 \
115            -command [itcl::code $this Done 1] \
116            -compound left \
117            -image [Rappture::icon download]
118    }
119    itk_component add cancel {
120        button $itk_interior.cancel -text "Cancel" \
121            -highlightthickness 0 \
122            -command [itcl::code $this Done 0] \
123            -compound left \
124            -image [Rappture::icon cancel]
125    }
126    blt::table $itk_interior \
127        0,0 $itk_component(preview) -cspan 2 -fill both \
128        1,0 $itk_component(tabs) -fill both -cspan 2 \
129        2,1 $itk_component(cancel) -padx 2 -pady 2 -width .9i -fill y \
130        2,0 $itk_component(ok) -padx 2 -pady 2 -width .9i -fill y
131    blt::table configure $itk_interior r1 -resize none
132    blt::table configure $itk_interior r1 -resize both
133
134    BuildGeneralTab
135    BuildAxisTab
136    BuildLegendTab
137    BuildLayoutTab
138    eval itk_initialize $args
139}
140
141# ----------------------------------------------------------------------
142# DESTRUCTOR
143# ----------------------------------------------------------------------
144itcl::body Rappture::XyPrint::destructor {} {
145    destroy $_clone
146    image delete $_preview
147    array unset _settings $this-*
148}
149
150itcl::body Rappture::XyPrint::DestroySettings {} {
151    destroy $_clone
152    array unset _settings $this-*
153    set _clone ""
154    set _graph ""
155}
156
157itcl::body Rappture::XyPrint::Done { state } {
158    set _wait($this) $state
159}
160
161itcl::body Rappture::XyPrint::print { graph toolName plotName } {
162    set _graph $graph
163    set _clone [CloneGraph $graph]
164    InitClone
165    InitializeSettings
166    # RestoreSettings $toolName $plotName
167    set _wait($this) 0
168    tkwait variable [itcl::scope _wait($this)]
169    set output ""
170    if { $_wait($this) } {
171        set output [GetOutput]
172    }
173    # SaveSettings $toolName $plotName
174    DestroySettings
175    return $output
176}
177
178itcl::body Rappture::XyPrint::GetOutput {} {
179    # Get the selected format of the download.
180    set page $itk_component(graph_page)
181    set format [$page.format current]
182
183    if { $format == "jpg" } {
184        set img [image create photo]
185        $_clone snap $img
186        set bytes [$img data -format "jpeg -quality 100"]
187        set bytes [Rappture::encoding::decode -as b64 $bytes]
188        image delete $img
189        return [list .jpg $bytes]
190    } elseif { $format == "png" } {
191        set img [image create photo]
192        $_clone snap $img
193        set bytes [$img data -format "png"]
194        set bytes [Rappture::encoding::decode -as b64 $bytes]
195        image delete $img
196        return [list .png $bytes]
197    }
198
199    # Handle encapsulated postscript or portable document format.
200
201    # Append an "i" for the graph postscript component.
202    set w $_settings($this-layout-width)i
203    set h $_settings($this-layout-height)i
204
205    $_clone postscript configure \
206        -maxpect false \
207        -decoration yes \
208        -center yes \
209        -width $w -height $h
210   
211    set psdata [$_clone postscript output]
212
213    if 1 {
214        set f [open "junk.raw" "w"]
215        puts -nonewline $f $psdata
216        close $f
217    }
218
219    set cmd ""
220    # | eps2eps << $psdata
221    lappend cmd "|" "/usr/bin/gs" \
222        "-q" "-sDEVICE=epswrite" "-sstdout=%stderr" \
223        "-sOutputFile=-" "-dNOPAUSE" "-dBATCH" "-dSAFER" \
224        "-dDEVICEWIDTH=250000" "-dDEVICEHEIGHT=250000" "-" "<<" "$psdata"
225    if { $format == "pdf" } {
226        # | eps2eps << $psdata | ps2pdf
227        lappend cmd "|" "/usr/bin/gs" \
228            "-q" "-sDEVICE=pdfwrite" "-sstdout=%stderr" \
229            "-sOutputFile=-" "-dNOPAUSE" "-dBATCH" "-dSAFER" \
230            "-dCompatibilityLevel=1.4" "-c" ".setpdfwrite" "-f" "-"
231    }
232    if { [catch {
233        set f [open $cmd "r"]
234        fconfigure $f -translation binary -encoding binary
235        set output [read $f]
236        close $f
237    } err ] != 0 } {
238        global errorInfo
239        puts stderr "failed to generate file: $err\n$errorInfo"
240        return ""
241    }
242    if 0 {
243        set f [open "junk.$format" "w"]
244        fconfigure $f -translation binary -encoding binary
245        puts -nonewline $f $output
246        close $f
247    }
248    return [list .$format $output]
249}
250
251itcl::body Rappture::XyPrint::CopyOptions { cmd orig clone } {
252    set all [eval $orig $cmd]
253    set configLine $clone
254    foreach arg $cmd {
255        lappend configLine $arg
256    }
257    foreach option $all {
258        if { [llength $option] != 5 } {
259            continue
260        }
261        set switch [lindex $option 0]
262        set initial [lindex $option 3]
263        set current [lindex $option 4]
264        if { [string compare $initial $current] == 0 } {
265            continue
266        }
267        lappend configLine $switch $current
268    }
269    eval $configLine
270}
271
272itcl::body Rappture::XyPrint::CloneGraph { orig } {
273    set top $itk_interior
274    set clone [blt::graph $top.graph]
275    CopyOptions "configure" $orig $clone
276    # Axis component
277    foreach axis [$orig axis names] {
278        if { [$orig axis cget $axis -hide] } {
279            continue
280        }
281        if { [$clone axis name $axis] == "" } {
282            $clone axis create $axis
283        }
284        CopyOptions [list axis configure $axis] $orig $clone
285    }
286    foreach axis { x y x2 y2 } {
287        $clone ${axis}axis use [$orig ${axis}axis use]
288    }
289    # Pen component
290    foreach pen [$orig pen names] {
291        if { [$clone pen name $pen] == "" } {
292            $clone pen create $pen
293        }
294        CopyOptions [list pen configure $pen] $orig $clone
295    }
296    # Marker component
297    foreach marker [$orig marker names] {
298        $clone marker create [$orig marker type $marker] -name $marker
299        CopyBindings marker $orig $clone $marker
300        CopyOptions [list marker configure $marker] $orig $clone
301    }
302    # Element component
303    foreach elem [$orig element names] {
304        $clone element create $elem
305        CopyOptions [list element configure $elem] $orig $clone
306    }
307    # Fix element display list
308    $clone element show [$orig element show]
309    # Legend component
310    CopyOptions {legend configure} $orig $clone
311    # Postscript component
312    CopyOptions {postscript configure} $orig $clone
313    # Grid component
314    CopyOptions {grid configure} $orig $clone
315    # Grid component
316    CopyOptions {crosshairs configure} $orig $clone
317    return $clone
318}
319
320itcl::body Rappture::XyPrint::InitClone {} {
321   
322    $_clone configure -width 3.4i -height 3.4i -background white \
323        -borderwidth 0 \
324        -leftmargin 0 \
325        -rightmargin 0 \
326        -topmargin 0 \
327        -bottommargin 0
328   
329    # Kill the title and create a border around the plot
330    $_clone configure \
331        -title "" \
332        -plotborderwidth 1 -plotrelief solid  \
333        -plotbackground white -plotpadx 0 -plotpady 0
334    #
335    set _fonts(legend) [font create -family helvetica -size 10 -weight normal]
336    update
337    $_clone legend configure \
338        -position right \
339        -font $_fonts(legend) \
340        -hide yes -borderwidth 0 -background white -relief solid \
341        -anchor nw -activeborderwidth 0
342    #
343    foreach axis [$_clone axis names] {
344        if { [$_clone axis cget $axis -hide] } {
345            continue
346        }
347        set _fonts($axis-ticks) [font create -family helvetica -size 10 \
348                                     -weight normal -slant roman]
349        set _fonts($axis-title) [font create -family helvetica -size 10 \
350                                     -weight normal -slant roman]
351        puts stderr "tick fonts $_fonts($axis-ticks):  [font configure $_fonts($axis-ticks)]"
352        puts stderr "title fonts $_fonts($axis-title): [font configure $_fonts($axis-title)]"
353        update
354        $_clone axis configure $axis -ticklength 5  \
355            -majorticks {} -minorticks {}
356        $_clone axis configure $axis \
357            -tickfont $_fonts($axis-ticks) \
358            -titlefont $_fonts($axis-title)
359    }
360    #$_clone grid off
361    #$_clone yaxis configure -rotate 90
362    #$_clone y2axis configure -rotate 270
363    foreach elem [$_clone element names] {
364        $_clone element configure $elem -linewidth 1 \
365            -pixels 3
366    }
367    # Create markers representing lines at zero for the x and y axis.
368    $_clone marker create line -name x-zero \
369        -coords "0 -Inf 0 Inf" -dashes 1 -hide yes
370    $_clone marker create line -name y-zero \
371        -coords "-Inf 0 Inf 0" -dashes 1 -hide yes
372}
373
374itcl::body Rappture::XyPrint::SetOption { opt } {
375    set new $_settings($this-graph-$opt)
376    set old [$_clone cget -$opt]
377    set code [catch [list $_clone configure -$opt $new] err]
378    if { $code != 0 } {
379        bell
380        global errorInfo
381        puts stderr "$err: $errorInfo"
382        set _settings($this-graph-$opt) $old
383    }
384}
385
386itcl::body Rappture::XyPrint::SetComponentOption { comp opt } {
387    set new $_settings($this-$comp-$opt)
388    set old [$_clone $comp cget -$opt]
389    set code [catch [list $_clone $comp configure -$opt $new] err]
390    if { $code != 0 } {
391        bell
392        global errorInfo
393        puts stderr "$err: $errorInfo"
394        set _settings($this-$comp-$opt) $old
395    }
396}
397
398itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } {
399    set new $_settings($this-$comp-$opt)
400    set old [$_clone $comp cget $name -$opt]
401    set code [catch [list $_clone $comp configure $name -$opt $new] err]
402    if { $code != 0 } {
403        bell
404        global errorInfo
405        puts stderr "$err: $errorInfo"
406        set _settings($this-$comp-$opt) $old
407    }
408}
409
410itcl::body Rappture::XyPrint::RegeneratePreview {} {
411    update
412    set img [image create photo]
413
414    set w [Inches2Pixels $_settings($this-layout-width)]
415    set h [Inches2Pixels $_settings($this-layout-height)]
416    set pixelsPerInch [winfo pixels . 1i]
417    set sx [expr 2.5*$pixelsPerInch/$w]
418    set sy [expr 2.0*$pixelsPerInch/$h]
419    set s [expr min($sx,$sy)]
420    $_clone snap $img -width $w -height $h
421
422    if 0 {
423    if { ![winfo exists .labeltest] } {
424        toplevel .labeltest -bg red
425        label .labeltest.label -image $img
426        pack .labeltest.label -fill both
427    }
428    }
429    set pw [expr int(round($s * $w))]
430    set ph [expr int(round($s * $h))]
431    $_preview configure -width $pw -height $ph
432    #.labeltest.label configure -image $img
433    blt::winop resample $img $_preview box
434    image delete $img
435}
436
437itcl::body Rappture::XyPrint::Pixels2Inches { pixels } {
438    if { [llength $pixels] == 2 } {
439        set pixels [lindex $pixels 0]
440    }
441    set pixelsPerInch [winfo pixels . 1i]
442    set inches [expr { double($pixels) / $pixelsPerInch }]
443    return [format %.3g ${inches}]
444}
445
446itcl::body Rappture::XyPrint::Inches2Pixels { inches } {
447    return  [winfo pixels . ${inches}i]
448}
449
450
451itcl::body Rappture::XyPrint::GetAxis {} {
452    set axis [$itk_component(axis_combo) current]
453    foreach option { min max loose title stepsize subdivisions } {
454        set _settings($this-axis-$option) [$_clone axis cget $axis -$option]
455    }
456    set type $Rappture::axistypes($axis)
457    if { [$_clone grid cget -map${type}] == $axis } {
458        set _settings($this-axis-grid) 1
459    }  else {
460        set _settings($this-axis-grid) 0
461    }
462    set _settings($this-axis-plotpad${type}) \
463        [Pixels2Inches [$_clone cget -plotpad${type}]]
464    set _settings($this-axis-zero) [$_clone marker cget ${type}-zero -hide]
465}
466
467itcl::body Rappture::XyPrint::GetElement { args } {
468    set index 1
469    foreach elem [$_clone element show] {
470        set _settings($this-element-$index) $elem
471        incr index
472    }
473    set index [$itk_component(element_slider) get]
474    set elem $_settings($this-element-$index)
475    set _settings($this-element-symbol) [$_clone element cget $elem -symbol]
476    set _settings($this-element-color) [$_clone element cget $elem -color]
477    set _settings($this-element-dashes) [$_clone element cget $elem -dashes]
478    set _settings($this-element-hide) [$_clone element cget $elem -hide]
479    set _settings($this-element-label) [$_clone element cget $elem -label]
480    set page $itk_component(legend_page)
481    $page.color value [$page.color label $_settings($this-element-color)]
482    $page.symbol value [$page.symbol label $_settings($this-element-symbol)]
483    $page.dashes value [$page.dashes label $_settings($this-element-dashes)]
484    #FixElement
485}
486
487itcl::body Rappture::XyPrint::BuildLayoutTab {} {
488    itk_component add layout_page {
489        frame $itk_component(tabs).layout_page
490    }
491    set page $itk_component(layout_page)
492    $itk_component(tabs) insert end "layout" \
493        -text "Layout" -padx 2 -pady 2 -window $page -fill both
494
495    label $page.width_l -text "width" 
496    entry $page.width -width 6 \
497        -textvariable [itcl::scope _settings($this-layout-width)]
498    bind  $page.width <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
499
500    label $page.height_l -text "height"
501    entry $page.height -width 6 \
502        -textvariable [itcl::scope _settings($this-layout-height)]
503    bind  $page.height <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
504
505    label $page.margin_l -text "Margins" 
506
507    label $page.left_l -text "left"
508    entry $page.left -width 6 \
509        -textvariable [itcl::scope _settings($this-layout-leftmargin)]
510    bind  $page.left <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
511
512    label $page.right_l -text "right"
513    entry $page.right -width 6 \
514        -textvariable [itcl::scope _settings($this-layout-rightmargin)]
515    bind  $page.right <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
516
517    label $page.top_l -text "top"
518    entry $page.top -width 6 \
519        -textvariable [itcl::scope _settings($this-layout-topmargin)]
520    bind  $page.top <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
521
522    label $page.bottom_l -text "bottom"
523    entry $page.bottom -width 6 \
524        -textvariable [itcl::scope _settings($this-layout-bottommargin)]
525    bind  $page.bottom <KeyPress-Return> [itcl::code $this ApplyLayoutSettings]
526
527    blt::table $page \
528        1,0 $page.width_l -anchor e \
529        1,1 $page.width -fill x -cspan 2 \
530        1,3 $page.height_l -anchor e \
531        1,4 $page.height -fill x -cspan 2 \
532        3,2 $page.top_l -anchor e \
533        3,3 $page.top -fill x \
534        4,0 $page.left_l -anchor e \
535        4,1 $page.left -fill x  \
536        4,4 $page.right_l -anchor e \
537        4,5 $page.right -fill x \
538        5,2 $page.bottom_l -anchor e \
539        5,3 $page.bottom -fill x 
540
541    blt::table configure $page r* -resize none -pady { 0 2 }
542    blt::table configure $page r2 -resize both
543    blt::table configure $page c2 c4 -width .5i
544    blt::table configure $page r6 -height .125i
545}
546
547
548itcl::body Rappture::XyPrint::BuildGeneralTab {} {
549    itk_component add graph_page {
550        frame $itk_component(tabs).graph_page
551    }
552    set page $itk_component(graph_page)
553    $itk_component(tabs) insert end "graph" \
554        -text "General" -padx 2 -pady 2 -window $page -fill both
555
556    label $page.format_l -text "format"
557    Rappture::Combobox $page.format -width 30 -editable no
558    $page.format choices insert end \
559        "eps" "EPS Encapsulated PostScript"  \
560        "pdf" "PDF Portable Document Format" \
561        "jpg"  "JPEG Joint Photographic Experts Group Format" \
562        "png"  "PNG Portable Network Graphics Format"         
563
564    bind $page.format <<Value>> [itcl::code $this ApplyGeneralSettings]
565
566    label $page.style_l -text "style"
567    Rappture::Combobox $page.style -width 20 -editable no
568    $page.style choices insert end \
569        "ieee" "IEEE Journal"  \
570        "gekco" "G Klimeck" 
571    bind $page.style <<Value>> [itcl::code $this ApplyGeneralSettings]
572
573    checkbutton $page.remember -text "remember settings" \
574        -variable [itcl::scope _settings($this-general-remember)] 
575
576    blt::table $page \
577        2,0 $page.format_l -anchor e \
578        2,1 $page.format -fill x \
579        3,0 $page.style_l -anchor e \
580        3,1 $page.style -fill x \
581        5,0 $page.remember -cspan 2 -anchor w
582    blt::table configure $page r* -resize none  -pady { 0 2 }
583    blt::table configure $page r4 -resize both
584
585}
586   
587itcl::body Rappture::XyPrint::ApplyLegendSettings {} {
588    set page $itk_component(legend_page)
589    set _settings($this-legend-position)  [$page.position current]
590    set _settings($this-legend-anchor)    [$page.anchor current]
591    foreach option { hide position anchor borderwidth } {
592        SetComponentOption legend $option
593    }
594    ApplyElementSettings
595}
596
597itcl::body Rappture::XyPrint::BuildLegendTab {} {
598    itk_component add legend_page {
599        frame $itk_component(tabs).legend_page
600    }
601    set page $itk_component(legend_page)
602    $itk_component(tabs) insert end "legend" \
603        -text "Legend" -padx 2 -pady 2 -window $page -fill both
604
605    checkbutton $page.show -text "show legend" \
606        -offvalue 1 -onvalue 0 \
607        -variable [itcl::scope _settings($this-legend-hide)]  \
608        -command [itcl::code $this ApplyLegendSettings]
609
610    label $page.position_l -text "position"
611    Rappture::Combobox $page.position -width 15 -editable no
612    $page.position choices insert end \
613        "leftmargin" "left margin"  \
614        "rightmargin" "right margin"  \
615        "bottommargin" "bottom margin"  \
616        "topmargin" "top margin"  \
617        "plotarea" "inside plot"
618    bind $page.position <<Value>> [itcl::code $this ApplyLegendSettings]
619
620    Rappture::Combobox $page.anchor -width 10 -editable no
621    $page.anchor choices insert end \
622        "nw" "northwest"  \
623        "n" "north"  \
624        "ne" "northeast"  \
625        "sw" "southwest"  \
626        "s" "south"  \
627        "se" "southeast"  \
628        "c" "center"  \
629        "e" "east"  \
630        "w" "west" 
631    bind $page.anchor <<Value>> [itcl::code $this ApplyLegendSettings]
632
633    checkbutton $page.border -text "border" \
634        -font "Arial 10"  \
635        -variable [itcl::scope _settings($this-legend-borderwidth)] \
636        -onvalue 1 -offvalue 0 \
637        -command [itcl::code $this ApplyLegendSettings]
638
639    label $page.slider_l -text "legend\nentry"  -font "Arial 10" -justify right
640    itk_component add element_slider {
641        ::scale $page.slider -from 1 -to 1 \
642            -orient horizontal -width 12 \
643            -command [itcl::code $this GetElement]
644    }
645    checkbutton $page.hide -text "hide" \
646        -font "Arial 10"  \
647        -variable [itcl::scope _settings($this-element-hide)] \
648        -command [itcl::code $this ApplyElementSettings]
649
650    label $page.label_l -text "label" -font "Arial 10"
651    entry $page.label \
652        -background white \
653        -font "Arial 10" \
654        -textvariable [itcl::scope _settings($this-element-label)]
655    bind  $page.label <KeyPress-Return> [itcl::code $this ApplyElementSettings]
656
657    label $page.color_l -text "color "  -font "Arial 10"
658    Rappture::Combobox $page.color -width 15 -editable no
659    $page.color choices insert end \
660        "#000000" "black" \
661        "#ffffff" "white" \
662        "#0000cd" "blue" \
663        "#cd0000" "red" \
664        "#00cd00" "green" \
665        "#3a5fcd" "royal blue" \
666        "#cdcd00" "yellow" \
667        "#cd1076" "deep pink" \
668        "#009acd" "deep sky blue" \
669        "#00c5cd" "torquise" \
670        "#a2b5cd" "light steel blue" \
671        "#7ac5cd" "cadet blue" \
672        "#66cdaa" "aquamarine" \
673        "#a2cd5a" "dark olive green" \
674        "#cd9b9b" "rosy brown"
675    bind $page.color <<Value>> [itcl::code $this ApplyElementSettings]
676
677    label $page.dashes_l -text "line style"  -font "Arial 10"
678    Rappture::Combobox $page.dashes -width 15 -editable no
679    $page.dashes choices insert end \
680        "" "solid"  \
681        "1" "dot" \
682        "5 2" "dash" \
683        "2 4 2" "dashdot" \
684        "2 4 2 2" "dashdotdot"
685    bind $page.dashes <<Value>> [itcl::code $this ApplyElementSettings]
686
687    label $page.symbol_l -text "symbol"  -font "Arial 10"
688    Rappture::Combobox $page.symbol -editable no
689    $page.symbol choices insert end \
690        "none" "none"  \
691        "square" "square" \
692        "circle" "circle" \
693        "diamond" "diamond" \
694        "plus" "plus" \
695        "cross" "cross" \
696        "splus" "skinny plus"  \
697        "scross" "skinny cross" \
698        "triangle" "triangle"
699    bind $page.symbol <<Value>> [itcl::code $this ApplyElementSettings]
700
701    label $page.font_l -text "font"
702    Rappture::Combobox $page.fontfamily -width 10 -editable no
703    $page.fontfamily choices insert end \
704        "courier" "Courier" \
705        "helvetica" "Helvetica"  \
706        "new*century*schoolbook"  "New Century Schoolbook" \
707        "symbol"  "Symbol" \
708        "times"  "Times"         
709    bind $page.fontfamily <<Value>> [itcl::code $this ApplyLegendSettings]
710
711    Rappture::Combobox $page.fontsize -width 4 -editable no
712    $page.fontsize choices insert end \
713        "8" "8" \
714        "9" "9" \
715        "10" "10" \
716        "11" "11" \
717        "12" "12" \
718        "14" "14" \
719        "17" "17" \
720        "18" "18" \
721        "20" "20"
722    bind  $page.fontsize <<Value>> [itcl::code $this ApplyLegendSettings]
723
724    Rappture::PushButton $page.fontbold \
725        -width 18 -height 18 \
726        -onimage [Rappture::icon font-bold] \
727        -offimage [Rappture::icon font-bold] \
728        -command [itcl::code $this ApplyLegendSettings] \
729        -variable [itcl::scope _settings($this-legend-font-bold)]
730
731    Rappture::PushButton $page.fontitalic \
732        -width 18 -height 18 \
733        -onimage [Rappture::icon font-italic] \
734        -offimage [Rappture::icon font-italic] \
735        -command [itcl::code $this ApplyLegendSettings] \
736        -variable [itcl::scope _settings($this-legend-font-italic)]
737
738    blt::table $page \
739        1,0 $page.show -cspan 2 -anchor w \
740        1,2 $page.border -cspan 2 -anchor w \
741        2,0 $page.position_l -anchor e \
742        2,1 $page.position -fill x \
743        2,2 $page.anchor -fill x  -cspan 3 \
744        3,0 $page.font_l -anchor e \
745        3,1 $page.fontfamily -fill x \
746        3,2 $page.fontsize -fill x \
747        3,3 $page.fontbold -anchor e \
748        3,4 $page.fontitalic -anchor e \
749        4,0 $page.slider_l -anchor e \
750        4,1 $page.slider -fill x -cspan 5 \
751        5,0 $page.label_l -anchor e \
752        5,1 $page.label -fill x -cspan 5 \
753        6,0 $page.color_l -anchor e \
754        6,1 $page.color -fill x \
755        6,2 $page.symbol_l -anchor e \
756        6,3 $page.symbol -fill both -cspan 3 \
757        7,0 $page.dashes_l -anchor e \
758        7,1 $page.dashes -fill x \
759
760    blt::table configure $page r* -resize none -pady { 0 2 }
761    blt::table configure $page r8 -resize both
762
763}
764
765itcl::body Rappture::XyPrint::BuildAxisTab {} {
766    itk_component add axis_page {
767        frame $itk_component(tabs).axis_page
768    }
769    set page $itk_component(axis_page)
770    $itk_component(tabs) insert end "axis" \
771        -text "Axis" -padx 2 -pady 2 -window $page -fill both
772   
773    label $page.axis_l -text "axis"  -font "Arial 10"
774    itk_component add axis_combo {
775        Rappture::Combobox $page.axis -width 20 -editable no
776    }
777    bind $itk_component(axis_combo) <<Value>> [itcl::code $this GetAxis]
778
779    label $page.title_l -text "title"  -font "Arial 10"
780    entry $page.title \
781        -textvariable [itcl::scope _settings($this-axis-title)]
782    bind  $page.title <KeyPress-Return> [itcl::code $this ApplyAxisSettings]
783
784    label $page.min_l -text "min"  -font "Arial 10"
785    entry $page.min -width 10 \
786        -textvariable [itcl::scope _settings($this-axis-min)]
787    bind  $page.min <KeyPress-Return> [itcl::code $this ApplyAxisSettings]
788
789    label $page.max_l -text "max"  -font "Arial 10"
790    entry $page.max -width 10 \
791        -textvariable [itcl::scope _settings($this-axis-max)]
792    bind  $page.max <KeyPress-Return> [itcl::code $this ApplyAxisSettings]
793
794    label $page.subdivisions_l -text "subdivisions"  -font "Arial 10"
795    entry $page.subdivisions \
796        -textvariable [itcl::scope _settings($this-axis-subdivisions)]
797    bind  $page.subdivisions <KeyPress-Return> \
798        [itcl::code $this ApplyAxisSettings]
799
800    label $page.stepsize_l -text "step size"  -font "Arial 10"
801    entry $page.stepsize \
802        -textvariable [itcl::scope _settings($this-axis-stepsize)]
803    bind  $page.stepsize <KeyPress-Return> [itcl::code $this ApplyAxisSettings]
804
805    checkbutton $page.loose -text "loose limits" \
806        -onvalue "always" -offvalue "0" \
807        -variable [itcl::scope _settings($this-axis-loose)] \
808        -command [itcl::code $this ApplyAxisSettings]
809
810    label $page.plotpad_l -text "pad" 
811    entry $page.plotpad -width 6 \
812        -textvariable [itcl::scope _settings($this-axis-plotpad)]
813    bind  $page.plotpad <KeyPress-Return> [itcl::code $this ApplyAxisSettings]
814
815    checkbutton $page.grid -text "show grid lines" \
816        -variable [itcl::scope _settings($this-axis-grid)] \
817        -command [itcl::code $this ApplyAxisSettings]
818
819    checkbutton $page.zero -text "mark zero" \
820        -offvalue 1 -onvalue 0 \
821        -variable [itcl::scope _settings($this-axis-zero)] \
822        -command [itcl::code $this ApplyAxisSettings]
823
824    label $page.tickfont_l -text "tick font"
825    Rappture::Combobox $page.tickfontfamily -width 10 -editable no
826    $page.tickfontfamily choices insert end \
827        "courier" "Courier" \
828        "helvetica" "Helvetica"  \
829        "new*century*schoolbook"  "New Century Schoolbook" \
830        "symbol"  "Symbol" \
831        "times"  "Times"         
832    bind $page.tickfontfamily <<Value>> [itcl::code $this ApplyAxisSettings]
833
834    Rappture::Combobox $page.tickfontsize -width 4 -editable no
835    $page.tickfontsize choices insert end \
836        "8" "8" \
837        "9" "9" \
838        "10" "10" \
839        "11" "11" \
840        "12" "12" \
841        "14" "14" \
842        "17" "17" \
843        "18" "18" \
844        "20" "20"
845    bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings]
846
847    Rappture::PushButton $page.tickfontbold \
848        -width 18 -height 18 \
849        -onimage [Rappture::icon font-bold] \
850        -offimage [Rappture::icon font-bold] \
851        -command [itcl::code $this ApplyAxisSettings] \
852        -variable [itcl::scope _settings($this-axis-tickfont-bold)]
853
854    Rappture::PushButton $page.tickfontitalic \
855        -width 18 -height 18 \
856        -onimage [Rappture::icon font-italic] \
857        -offimage [Rappture::icon font-italic] \
858        -command [itcl::code $this ApplyAxisSettings] \
859        -variable [itcl::scope _settings($this-axis-tickfont-italic)]
860
861    label $page.titlefont_l -text "title font"
862    Rappture::Combobox $page.titlefontfamily -width 10 -editable no
863    $page.titlefontfamily choices insert end \
864        "courier" "Courier" \
865        "helvetica" "Helvetica"  \
866        "new*century*schoolbook"  "New Century Schoolbook" \
867        "symbol"  "Symbol" \
868        "times"  "Times"         
869    bind $page.titlefontfamily <<Value>> [itcl::code $this ApplyAxisSettings]
870
871    Rappture::Combobox $page.titlefontsize -width 4 -editable no
872    $page.titlefontsize choices insert end \
873        "8" "8" \
874        "9" "9" \
875        "10" "10" \
876        "11" "11" \
877        "12" "12" \
878        "14" "14" \
879        "17" "17" \
880        "18" "18" \
881        "20" "20"
882    bind $page.tickfontsize <<Value>> [itcl::code $this ApplyAxisSettings]
883
884    Rappture::PushButton $page.titlefontbold \
885        -width 18 -height 18 \
886        -onimage [Rappture::icon font-bold] \
887        -offimage [Rappture::icon font-bold] \
888        -command [itcl::code $this ApplyAxisSettings] \
889        -variable [itcl::scope _settings($this-axis-titlefont-bold)]
890
891    Rappture::PushButton $page.titlefontitalic \
892        -width 18 -height 18 \
893        -onimage [Rappture::icon font-italic] \
894        -offimage [Rappture::icon font-italic] \
895        -command [itcl::code $this ApplyAxisSettings] \
896        -variable [itcl::scope _settings($this-axis-titlefont-italic)]
897
898    blt::table $page \
899        1,1 $page.axis_l -anchor e  -pady 6 \
900        1,2 $page.axis -fill x -cspan 6 \
901        2,1 $page.title_l -anchor e \
902        2,2 $page.title -fill x -cspan 5 \
903        3,1 $page.min_l -anchor e \
904        3,2 $page.min -fill x \
905        3,3 $page.stepsize_l -anchor e \
906        3,4 $page.stepsize -fill both -cspan 3 \
907        4,1 $page.max_l -anchor e \
908        4,2 $page.max -fill both \
909        4,3 $page.subdivisions_l -anchor e \
910        4,4 $page.subdivisions -fill both -cspan 3  \
911        5,1 $page.titlefont_l -anchor e \
912        5,2 $page.titlefontfamily -fill x -cspan 2 \
913        5,4 $page.titlefontsize -fill x \
914        5,5 $page.titlefontbold -anchor e \
915        5,6 $page.titlefontitalic -anchor e \
916        6,1 $page.tickfont_l -anchor e \
917        6,2 $page.tickfontfamily -fill x -cspan 2 \
918        6,4 $page.tickfontsize -fill x \
919        6,5 $page.tickfontbold -anchor e \
920        6,6 $page.tickfontitalic -anchor e \
921        7,1 $page.loose -cspan 2 -anchor w \
922        7,3 $page.grid -anchor w -cspan 2 \
923        8,1 $page.zero -cspan 2 -anchor w \
924        8,3 $page.plotpad_l -anchor e \
925        8,4 $page.plotpad -fill both -cspan 3
926}
927
928itcl::body Rappture::XyPrint::ApplyGeneralSettings {} {
929    RegeneratePreview
930}
931
932itcl::body Rappture::XyPrint::ApplyLegendSettings {} {
933    set page $itk_component(legend_page)
934    set _settings($this-legend-position)  [$page.position current]
935    set _settings($this-legend-anchor)    [$page.anchor current]
936
937    foreach option { hide position anchor borderwidth } {
938        SetComponentOption legend $option
939    }
940    set slant "roman"
941    if { $_settings($this-legend-font-italic) } {
942        set slant "italic"
943    }
944    set weight "normal"
945    if { $_settings($this-legend-font-bold) } {
946        set weight "bold"
947    }
948    font configure $_fonts(legend) \
949        -family [$page.fontfamily current] \
950        -size [$page.fontsize current] \
951        -weight $weight -slant $slant
952    $_clone legend configure -font $_fonts(legend)
953    ApplyElementSettings
954}
955
956itcl::body Rappture::XyPrint::ApplyAxisSettings {} {
957    set axis [$itk_component(axis_combo) current]
958    set type $Rappture::axistypes($axis)
959    set page $itk_component(axis_page)
960    if { $_settings($this-axis-grid) } {
961        $_clone grid configure -hide no -map${type} ${axis}
962    } else {
963        $_clone grid configure -hide no -map${type} ""
964    }
965    $_clone configure -plotpad${type} $_settings($this-axis-plotpad)
966    foreach option { min max loose title stepsize subdivisions } {
967        SetNamedComponentOption axis $axis $option
968    }
969    $_clone marker configure ${type}-zero -hide $_settings($this-axis-zero)
970    set slant "roman"
971    if { $_settings($this-axis-titlefont-italic) } {
972        set slant "italic"
973    }
974    set weight "normal"
975    if { $_settings($this-axis-titlefont-bold) } {
976        set weight "bold"
977    }
978    font configure $_fonts($axis-title) \
979        -family [$page.titlefontfamily current] \
980        -size [$page.titlefontsize current] \
981        -weight $weight -slant $slant
982    set slant "roman"
983    if { $_settings($this-axis-tickfont-italic) } {
984        set slant "italic"
985    }
986    set weight "normal"
987    if { $_settings($this-axis-tickfont-bold) } {
988        set weight "bold"
989    }
990    font configure $_fonts($axis-ticks) \
991        -family [$page.tickfontfamily current] \
992        -size [$page.tickfontsize current] \
993        -weight $weight -slant $slant
994    $_clone axis configure $axis -tickfont $_fonts($axis-ticks) \
995        -titlefont $_fonts($axis-title)
996    GetAxis
997    RegeneratePreview
998}
999
1000itcl::body Rappture::XyPrint::ApplyElementSettings {} {
1001    set index [$itk_component(element_slider) get]
1002    set elem $_settings($this-element-$index)
1003    set page $itk_component(legend_page)
1004    set _settings($this-element-color)  [$page.color current]
1005    set _settings($this-element-symbol) [$page.symbol current]
1006    set _settings($this-element-dashes) [$page.dashes current]
1007    foreach option { symbol color dashes hide label } {
1008        SetNamedComponentOption element $elem $option
1009    }
1010    RegeneratePreview
1011}
1012
1013itcl::body Rappture::XyPrint::ApplyLayoutSettings {} {
1014    foreach opt { leftmargin rightmargin topmargin bottommargin } {
1015        set new [Inches2Pixels $_settings($this-layout-$opt)]
1016        set old [$_clone cget -$opt]
1017        set code [catch [list $_clone configure -$opt $new] err]
1018        if { $code != 0 } {
1019            bell
1020            global errorInfo
1021            puts stderr "$err: $errorInfo"
1022            set _settings($this-layout-$opt) [Pixel2Inches $old]
1023        }
1024    }
1025    RegeneratePreview
1026}
1027
1028
1029itcl::body Rappture::XyPrint::InitializeSettings {} {
1030    # General settings
1031
1032    # Always set to "eps" "ieee"
1033    set _settings($this-general-format) eps
1034    set _settings($this-general-style) ieee
1035    set _settings($this-general-remember) 1
1036    set page $itk_component(graph_page)
1037    $page.format value [$page.format label $_settings($this-general-format)]
1038    $page.style value [$page.style label $_settings($this-general-style)]
1039
1040    # Layout settings
1041    set _settings($this-layout-width) [Pixels2Inches [$_clone cget -width]]
1042    set _settings($this-layout-height) [Pixels2Inches [$_clone cget -height]]
1043    set _settings($this-layout-leftmargin) \
1044        [Pixels2Inches [$_clone cget -leftmargin]]
1045    set _settings($this-layout-rightmargin) \
1046        [Pixels2Inches [$_clone cget -rightmargin]]
1047    set _settings($this-layout-topmargin) \
1048        [Pixels2Inches [$_clone cget -topmargin]]
1049    set _settings($this-layout-bottommargin) \
1050        [Pixels2Inches [$_clone cget -bottommargin]]
1051
1052    # Legend settings
1053    set page $itk_component(legend_page)
1054
1055    set names [$_clone element show]
1056    $itk_component(element_slider) configure -from 1 -to [llength $names]
1057    set state [expr  { ([llength $names] < 2) ? "disabled" : "normal" } ]
1058    $page.slider configure -state $state
1059    $page.slider_l configure -state $state
1060    # Always initialize the slider to the first entry in the element list.
1061    $itk_component(element_slider) set 1
1062    # Always set the borderwidth to be not displayed
1063    set _settings($this-legend-borderwidth) 0
1064    $page.fontfamily value "Helvetica"
1065    $page.fontsize value "10"
1066    set _settings($this-legend-font-bold) 0
1067    set _settings($this-legend-font-italic) 0
1068
1069    set _settings($this-legend-hide) [$_clone legend cget -hide]
1070    set _settings($this-legend-position) [$_clone legend cget -position]
1071    set _settings($this-legend-anchor) [$_clone legend cget -anchor]
1072    $page.position value \
1073        [$page.position label $_settings($this-legend-position)]
1074    $page.anchor value [$page.anchor label $_settings($this-legend-anchor)]
1075    GetElement
1076
1077    # Axis settings
1078    set page $itk_component(axis_page)
1079    set names [lsort [$_clone axis names]]
1080    $itk_component(axis_combo) choices delete 0 end
1081    foreach axis $names {
1082        if { ![$_clone axis cget $axis -hide] } {
1083            $itk_component(axis_combo) choices insert end $axis $axis
1084        }
1085        lappend axisnames $axis
1086    }
1087    $page.titlefontfamily value "Helvetica"
1088    $page.tickfontfamily value "Helvetica"
1089    $page.titlefontsize value "10"
1090    $page.tickfontsize value "10"
1091    set _settings($this-axis-tickfont-bold) 0
1092    set _settings($this-axis-tickfont-italic) 0
1093    set _settings($this-axis-titlefont-bold) 0
1094    set _settings($this-axis-titlefont-italic) 0
1095    # Always hide the zero line.
1096    set _settings($this-axis-zero) 1
1097    set _settings($this-axis-plotpad) [Pixels2Inches [$_clone cget -plotpadx]]
1098    # Pick the first axis to initially display
1099    set axis [lindex $axisnames 0]
1100    $itk_component(axis_combo) value $axis
1101    GetAxis
1102}
1103
1104
1105itcl::body Rappture::XyPrint::restore { toolName plotName data } {
1106    set key [list $toolName $plotName]
1107    set _savedSettings($key) $data
1108}
1109
1110itcl::body Rappture::XyPrint::RestoreSettings { toolName plotName } {
1111    if { ![file readable "~/.rappture"] } {
1112        return;                         # No file or not readable
1113    }
1114    # Read the file by sourcing it into a safe interpreter The only commands
1115    # executed will be "xyprint" which will simply add the data into an array
1116    # _savedSettings.
1117    set parser [interp create -safe]
1118    $parser alias xyprint [itcl::code $this restore]
1119    set f [open $file "r"]
1120    set code [read $f]
1121    close $f
1122    $parser eval $code
1123   
1124    # Now see if there's an entry for this tool/plot combination.  The data
1125    # associated with the variable is itself code to update the graph (clone).
1126    set key [list $toolName $plotName]
1127    if { [info exists _savedSettings($key)] }  {
1128        $parser alias "xygraph" $_clone
1129        $parser eval $_savedSettings($key)
1130    }
1131    foreach {name value} [$parser eval "array get general"] {
1132        set _settings($this-graph-$name) $value
1133    }
1134    interp delete $parser
1135}
1136
1137itcl::body Rappture::XyPrint::ResetSettings {} {
1138    # Revert the widget back to the original graph's settings
1139    destroy $_clone
1140    set _clone [CloneGraph $graph]
1141    InitClone
1142    InitializeSettings
1143}
1144
1145itcl::body Rappture::XyPrint::SaveSettings { toolName plotName } {
1146    if { ![file writable "~/.rappture"] } {
1147        return
1148    }
1149    set out [CreateSettings $toolName $plotName]
1150    # Write the settings out
1151    set f [open ".rappture" "w" 0600]
1152    foreach key [lsort [array names _savedSettings]] {
1153        set tool [lindex $key 0]
1154        set plot [lindex $key 1]
1155        if { $plotName == "plot" && $toolName == "$tool" } {
1156            continue
1157        }
1158        puts $f "xyprint \"$tool\" \"$plot\" \{"
1159        puts $f "$_savedSettings($key)"
1160        puts $f "\}\n"
1161    }
1162    # Now write the new setting
1163    puts $f "xyprint \"$toolName\" \"$plotName\" \{"
1164    puts $f "$out"
1165    puts $f "\}\n"
1166    close $f
1167}
1168
1169itcl::body Rappture::XyPrint::CreateSettings { toolName plotName } {
1170    # Create stanza associated with tool and plot title.
1171    # General settings
1172    append out "\n"
1173    append out "xyprint \"\$toolName\" \"\$plotName\" \{\n"
1174    append out "  set general(format) $_settings($this-general-format)\n"
1175    append out "  set general(style) $_settings($this-general-style)\n"
1176    append out "  set general(remember) 1\n"
1177
1178    # Layout settings
1179    append out "  xygraph configure \\\n"
1180    append out "    -width \"[Pixels2Inches [$_clone cget -width]]\" \\\n"
1181    append out "    -height \"[Pixels2Inches [$_clone cget -height]]\" \\\n"
1182    append out "    -leftmargin \"[Pixels2Inches [$_clone cget -leftmargin]]\" \\\n"
1183    append out "    -rightmargin \"[Pixels2Inches [$_clone cget -rightmargin]]\" \\\n"
1184    append out "    -topmargin \"[Pixels2Inches [$_clone cget -topmargin]]\" \\\n"
1185    append out "    -bottommargin \"[Pixels2Inches [$_clone cget -bottommargin]]\"\\\n"
1186    append out "    -plotpadx \"[Pixels2Inches [$_clone cget -plotpadx]]\" \\\n"
1187    append out "    -plotpady \"[Pixels2Inches [$_clone cget -plotpady]]\" \n"
1188
1189    # Legend settings
1190    append out "  xygraph legend configure \\\n"
1191    append out "    -position \"[$_clone legend cget -position]\" \\\n"
1192    append out "    -anchor \"[$_clone legend cget -anchor]\" \\\n"
1193    append out "    -borderwidth \"[$_clone legend cget -borderwidth]\" \\\n"
1194    append out "    -hide \"[$_clone legend cget -hide]\" \n"
1195   
1196    # Element settings
1197    foreach elem [$_clone element show] {
1198        append out "  if \{ \[xygraph element exists \"$elem\"\] \} \{\n"
1199        append out "    xygraph element configure \"$elem\" \\\n"
1200        append out "      -symbol \"[$_clone element cget $elem -symbol]\" \\\n"
1201        append out "      -color \"[$_clone element cget $elem -color]\" \\\n"
1202        append out "      -dashes \"[$_clone element cget $elem -dashes]\" \\\n"
1203        append out "      -hide \"[$_clone element cget $elem -hide]\" \\\n"
1204        append out "      -label \"[$_clone element cget $elem -label]\" \n"
1205        append out "  \}\n"
1206    }
1207   
1208    # Axis settings
1209    foreach axis [$_clone axis names] {
1210        if { [$_clone axis cget $axis -hide] } {
1211            continue
1212        }
1213        append out "  if \{ \[xygraph axis names \"$axis\"\] == \"$axis\" \} \{\n"
1214        append out "    xygraph axis configure \"$axis\" \\\n"
1215        append out "      -hide \"[$_clone axis cget $axis -hide]\" \\\n"
1216        append out "      -min \"[$_clone axis cget $axis -min]\" \\\n"
1217        append out "      -max \"[$_clone axis cget $axis -max]\" \\\n"
1218        append out "      -loose \"[$_clone axis cget $axis -loose]\" \\\n"
1219        append out "      -title \"[$_clone axis cget $axis -title]\" \\\n"
1220        append out "      -stepsize \"[$_clone axis cget $axis -stepsize]\" \\\n"
1221        append out "      -subdivisions \"[$_clone axis cget $axis -subdivisions]\"\n"
1222        set hide [$_clone marker cget ${axis}-zero -hide]
1223        append out "    xygraph marker configure \"${axis}-zero\" -hide $hide\n"
1224        append out "  \}\n"
1225    }   
1226    append out "  xygraph grid configure \\\n"
1227    append out "    -hide \"[$_clone grid cget -hide]\" \\\n"
1228    append out "    -mapx \"[$_clone grid cget -mapx]\" \\\n"
1229    append out "    -mapy \"[$_clone grid cget -mapy]\"\n"
1230    append out "\}\n"
1231    return $out
1232}
1233
Note: See TracBrowser for help on using the repository browser.