From: Ian Jackson Date: Sun, 19 Feb 2012 15:02:01 +0000 (+0000) Subject: where-vessels: printing X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=commitdiff_plain;h=0249114accb7871b75a33868f85c279aebb7d365 where-vessels: printing --- diff --git a/yarrg/where-vessels b/yarrg/where-vessels index 6b1b0e2..045f5ad 100755 --- a/yarrg/where-vessels +++ b/yarrg/where-vessels @@ -1328,6 +1328,29 @@ proc islandnames-handler {offset maxchars} { $offset [expr {$offset+$maxchars-1}]] } +#---------- print to postscript ---------- + +proc print-to-postscript {} { + global canvas ocean + set postscript_fontmap(fixed) {Courier 12} + manyset [$canvas bbox all] xmin ymin xmax ymax + set file where-vessels.$ocean.ps + $canvas postscript -file $file -rotate 1 \ + -width [expr {$xmax-$xmin}] \ + -height [expr {$ymax-$ymin}] \ + -fontmap postscript_fontmap + .printed.info configure -text "Printed to $file + +Usually, the next thing would be something like" + set text "epsffit 0 0 595.276 841.89 <$file >t.ps" + .printed.rune configure -state normal + .printed.rune delete 1.0 end + .printed.rune insert end $text + .printed.rune configure -width [string length $text] -state disabled + update idletasks + wm deiconify .printed +} + #---------- main user interface ---------- proc widgets-setup {} { @@ -1411,8 +1434,20 @@ proc widgets-setup {} { if {![have-notes]} { .cp.ctrl.notes.do configure -state disabled - } + } + + button .cp.ctrl.print -text {Print to file} -command print-to-postscript + pack .cp.ctrl.print -side top + #----- message saying we've printed ----- + + info-toplevel-create .printed "printed" + + label .printed.info + text .printed.rune -state disabled -height 1 -borderwidth 0 + pack .printed.info -side top + pack .printed.rune -side top + #----- island name count and copy ----- label .islands.count