Index: branches/blt4/gui/scripts/xyprint.tcl
===================================================================
--- branches/blt4/gui/scripts/xyprint.tcl	(revision 1772)
+++ branches/blt4/gui/scripts/xyprint.tcl	(revision 1774)
@@ -70,5 +70,5 @@
     private method ResetSettings { } 
     private method GetOutput {}
-    private method Done { state }
+    private method SetWaitVariable { state }
     private method SetLayoutOption { option } 
     private method GetAxisType { axis } 
@@ -112,5 +112,5 @@
         button $itk_interior.ok -text "Save" \
             -highlightthickness 0 \
-	    -command [itcl::code $this Done 1] \
+	    -command [itcl::code $this SetWaitVariable 1] \
 	    -compound left \
 	    -image [Rappture::icon download]
@@ -119,5 +119,5 @@
         button $itk_interior.cancel -text "Cancel" \
             -highlightthickness 0 \
-	    -command [itcl::code $this Done 0] \
+	    -command [itcl::code $this SetWaitVariable 0] \
 	    -compound left \
 	    -image [Rappture::icon cancel]
@@ -158,8 +158,8 @@
 
 itcl::body Rappture::XyPrint::reset {} {
-    Done 0
-}
-
-itcl::body Rappture::XyPrint::Done { state } {
+    SetWaitVariable 0
+}
+
+itcl::body Rappture::XyPrint::SetWaitVariable { state } {
     set _wait($this) $state
 }
@@ -171,11 +171,11 @@
     RestoreSettings $toolName $plotName 
     InitializeSettings
-    set _wait($this) 0
+    SetWaitVariable 0
     tkwait variable [itcl::scope _wait($this)]
+    SaveSettings $toolName $plotName 
     set output ""
     if { $_wait($this) } {
 	set output [GetOutput]
     }
-    SaveSettings $toolName $plotName 
     DestroySettings 
     return $output
@@ -395,39 +395,39 @@
 
 itcl::body Rappture::XyPrint::SetOption { opt } {
-    set new $_settings($this-graph-$opt) 
-    set old [$_clone cget -$opt]
-    set code [catch [list $_clone configure -$opt $new] err]
+    set new $_settings($this-graph$opt) 
+    set old [$_clone cget $opt]
+    set code [catch [list $_clone configure $opt $new] err]
     if { $code != 0 } {
 	bell
 	global errorInfo
 	puts stderr "$err: $errorInfo"
-	set _settings($this-graph-$opt) $old
-	$_clone configure -$opt $old
+	set _settings($this-graph$opt) $old
+	$_clone configure $opt $old
     }
 }
 
 itcl::body Rappture::XyPrint::SetComponentOption { comp opt } {
-    set new $_settings($this-$comp-$opt) 
-    set old [$_clone $comp cget -$opt]
-    set code [catch [list $_clone $comp configure -$opt $new] err]
+    set new $_settings($this-$comp$opt) 
+    set old [$_clone $comp cget $opt]
+    set code [catch [list $_clone $comp configure $opt $new] err]
     if { $code != 0 } {
 	bell
 	global errorInfo
 	puts stderr "$err: $errorInfo"
-	set _settings($this-$comp-$opt) $old
-	$_clone $comp configure -$opt $old
+	set _settings($this-$comp$opt) $old
+	$_clone $comp configure $opt $old
     }
 }
 
 itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } {
-    set new $_settings($this-$comp-$opt) 
-    set old [$_clone $comp cget $name -$opt]
-    set code [catch [list $_clone $comp configure $name -$opt $new] err]
+    set new $_settings($this-$comp$opt) 
+    set old [$_clone $comp cget $name $opt]
+    set code [catch [list $_clone $comp configure $name $opt $new] err]
     if { $code != 0 } {
 	bell
 	global errorInfo
 	puts stderr "$err: $errorInfo"
-	set _settings($this-$comp-$opt) $old
-	$_clone $comp configure $name -$opt $old
+	set _settings($this-$comp$opt) $old
+	$_clone $comp configure $name $opt $old
     }
 }
@@ -514,5 +514,5 @@
     set _settings($this-element-color) [$_clone element cget $elem -color]
     set _settings($this-element-dashes) [$_clone element cget $elem -dashes]
-    set _settings($this-element-hide) [$_clone element cget $elem -hide]
+    #set _settings($this-element-hide) [$_clone element cget $elem -hide]
     set _settings($this-element-label) [$_clone element cget $elem -label]
     set page $itk_component(legend_page)
@@ -663,5 +663,5 @@
     set _settings($this-legend-position)  [$page.position current]
     set _settings($this-legend-anchor)    [$page.anchor current]
-    foreach option { hide position anchor borderwidth } {
+    foreach option { -hide -position -anchor -borderwidth } {
 	SetComponentOption legend $option
     }
@@ -1075,5 +1075,5 @@
     set _settings($this-legend-anchor)    [$page.anchor current]
 
-    foreach option { hide position anchor borderwidth } {
+    foreach option { -hide -position -anchor -borderwidth } {
 	SetComponentOption legend $option
     }
@@ -1092,5 +1092,5 @@
     set page $itk_component(axis_page)
     $_clone configure -plotpad${type} $_settings($this-axis-plotpad)
-    foreach option { grid min max loose title stepsize subdivisions } {
+    foreach option { -grid -min -max -loose -title -stepsize -subdivisions } {
 	SetNamedComponentOption axis $axis $option
     }
@@ -1119,5 +1119,5 @@
     set _settings($this-element-symbol) [$page.symbol current]
     set _settings($this-element-dashes) [$page.dashes current]
-    foreach option { symbol color dashes hide label } {
+    foreach option { -symbol -color -dashes -label } {
 	SetNamedComponentOption element $elem $option
     }
@@ -1338,7 +1338,11 @@
     # Element settings
     foreach elem [$_clone element show] {
- 	append out "    if \{ \[preview element exists \"$elem\"\] \} \{\n"
-	append out "        preview element configure \"$elem\""
-	foreach opt { -symbol -color -dashes -hide -label } { 
+	set label [$_clone element cget $elem -label]
+	if { $label == "" } {
+	    continue
+	}
+ 	append out "    if \{ \[preview element exists \"$label\"\] \} \{\n"
+	append out "        preview element configure \"$label\""
+	foreach opt { -symbol -color -dashes -label } { 
 	    set value [list [$_clone element cget $elem $opt]]
 	    append out " $opt $value"
