Index: trunk/gui/scripts/molvisviewer.tcl
===================================================================
--- trunk/gui/scripts/molvisviewer.tcl	(revision 1338)
+++ trunk/gui/scripts/molvisviewer.tcl	(revision 1339)
@@ -68,4 +68,5 @@
     public method representation {option {model "all"} }
     public method atomscale {option {model "all"} }
+    public method bondthickness {option {model "all"} }
     public method ResetView {} 
     public method settings {option args}
@@ -115,4 +116,6 @@
     common _downloadPopup           ;# download options from popup
     private variable _pdbdata       ;# pdb data from run file sent to pymol
+    private common hardcopy_
+    private variable nextToken_ 0
 }
 
@@ -435,7 +438,6 @@
         -value lines -font "Arial 9" -pady 0
 
-    label $inner.sizelabel -text "Atom Scale" -font "Arial 9 bold"
-    scale $inner.atomscale \
-        -from 0.1 -to 2.0 -resolution 0.05 \
+    scale $inner.atomscale -width 10 -font "Arial 9 bold" \
+        -from 0.1 -to 2.0 -resolution 0.05 -label "Atom Scale" \
         -showvalue true -orient horizontal \
         -command [itcl::code $this atomscale] \
@@ -443,7 +445,6 @@
     $inner.atomscale set $_settings($this-atomscale)
 
-    label $inner.bondthicknesslabel -text "Bond Thickness" -font "Arial 9 bold"
-    scale $inner.bondthickness \
-        -from 0.1 -to 1.0 -resolution 0.25 \
+    scale $inner.bondthickness -width 10 -font "Arial 9 bold" \
+        -from 0.1 -to 1.0 -resolution 0.025 -label "Bond Thickness" \
         -showvalue true -orient horizontal \
         -command [itcl::code $this bondthickness] \
@@ -469,11 +470,9 @@
         2,2 $inner.lines -anchor w -columnspan 2 \
         3,2 $inner.bstick -anchor w -columnspan 2 \
-        4,0 $inner.sizelabel -columnspan 4 -anchor w \
-        5,1 $inner.atomscale -anchor w -columnspan 3 \
-        6,0 $inner.bondthicknesslabel -columnspan 4 -anchor w \
-        7,1 $inner.bondthickness -anchor w -columnspan 3 \
-        8,0 $inner.labels -anchor w -columnspan 4 \
-        9,0 $inner.rock -anchor w -columnspan 4 \
-        10,0 $inner.ortho -anchor w -columnspan 4
+        4,0 $inner.labels -anchor w -columnspan 4 \
+        5,0 $inner.rock -anchor w -columnspan 4 \
+        6,0 $inner.ortho -anchor w -columnspan 4 \
+        8,1 $inner.atomscale -anchor w -columnspan 2 \
+        10,1 $inner.bondthickness -anchor w -columnspan 2 
 
     blt::table configure $inner c0 -resize expand -width 2
@@ -517,4 +516,8 @@
                     -variable Rappture::MolvisViewer::_downloadPopup(format) \
                     -value jpg
+                pack $inner.jpg -anchor w
+                radiobutton $inner.jpg -text "PNG Image" \
+                    -variable Rappture::MolvisViewer::_downloadPopup(format) \
+                    -value png 
                 pack $inner.jpg -anchor w
                 radiobutton $inner.pdb -text "PDB File" \
@@ -541,13 +544,24 @@
             }
             switch -- $_downloadPopup(format) {
-              jpg {
-                return [ \
-                  list .jpg [ \
-                    Rappture::encoding::decode -as b64 [ \
-                      $_image(plot) data -format jpeg]]]
-              }
-              pdb {
-                return [list .pdb $_pdbdata]
-              }
+		jpg {
+		    set data [$_image(plot) data -format jpeg]
+		    set encoded [Rappture::encoding::decode -as b64 $data]
+		    return [list .jpg $encoded]
+		}
+		png {
+		    set token "print[incr nextToken_]"
+		    _send "print $token 2400 2400"
+		    # Setup popup with cancel button and timeout.
+		    blt::busy hold $popup
+		    tkwait Rappture::MolvisViewer::hardcopy_($this-$token)
+		    # Pass the image as-is. Don't convert it.
+		    set data $hardcopy_($this-$token) 
+		    set encoded [Rappture::encoding::decode -as b64 $data]
+		    blt::busy release $popup
+		    return [list .png $encoded]
+		}
+		pdb {
+		    return [list .pdb $_pdbdata]
+		}
             }
         }
@@ -646,11 +660,16 @@
         set _cacheid $cacheid
     }
-#    debug "reading $size bytes from proxy\n"
-    set _imagecache($tag) [ReceiveBytes $size]
-#    debug "success: reading $size bytes from proxy\n"
-
-    #debug "CACHED: $tag,$cacheid"
-    $_image(plot) configure -data $_imagecache($tag)
-    set _image(id) $tag
+    #debug "reading $size bytes from proxy\n"
+    set data [ReceiveBytes $size]
+    #debug "success: reading $size bytes from proxy\n"
+    if { $cacheid == "print" } {
+	# $frame is the token that we sent to the proxy.
+	set hardcopy_($this-$frame) $data
+    } else {
+	set _imagecache($tag) $data
+	#debug "CACHED: $tag,$cacheid"
+	$_image(plot) configure -data $data
+	set _image(id) $tag
+    }
 }
 
@@ -1348,5 +1367,5 @@
         set scale $option
         if { ($scale < 0.1) || ($scale > 2.0) } {
-            error "bad atom size \"$scale\""
+            error "bad bind thickness \"$scale\""
         }
     } else {
