chiark / gitweb /
Merge remote-tracking branch 'mason/master'
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 Jun 2014 16:54:58 +0000 (17:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 Jun 2014 16:54:58 +0000 (17:54 +0100)
yarrg/CommodsScrape.pm
yarrg/where-vessels
ypp-chart-memshow

index 4b027f185f76b9ed1dcb9ca44a92c68c90c8fb9c..ccc2d98bd0ea4624fb7d977e5411b8459a414686 100644 (file)
@@ -55,7 +55,7 @@ sub yppedia_chart_parse ($$ $$$$ $) {
        s/^\s*//; chomp; s/\s+$//; s/\s+/ /g;
        s/\<\/?(?:b|em)\>//g;
        s/\{\{(?:chart\ style|Chart league difficulty)\|[^{}]*\}\}//gi;
-       s/^\{\{testing\}\}//;
+       s/^\{\{(?:testing|current)\}\}//;
        next unless m/\{\{/; # only interested in chart template stuff
 
        if (($x,$y,$arch) =
index eacde3aa7eda581375a39ea13281259f0abdf120..045f5ad76bb06f591777eeb753c69dc4244c88d2 100755 (executable)
@@ -1155,6 +1155,18 @@ proc draw {} {
 }
 
 
+#---------- info toplevel ----------
+
+proc info-toplevel-create {info title} {
+    toplevel $info
+    wm withdraw $info
+    wm title $info "where-vessels - $title"
+    wm protocol $info WM_DELETE_WINDOW [list wm withdraw $info]
+
+    button $info.close -text Close -command [list wm withdraw $info]
+    pack $info.close -side bottom
+}
+
 #---------- parser error reporting ----------
 
 proc parser-control-create {w base invokebuttontext etl_title} {
@@ -1171,17 +1183,11 @@ proc parser-control-create {w base invokebuttontext etl_title} {
     pack $w.resframe -side top -expand y -fill both
 
     set eb .err_$base
-    toplevel $eb
-    wm withdraw $eb
-    wm title $eb "where-vessels - $etl_title"
-    wm protocol $eb WM_DELETE_WINDOW [list wm withdraw $eb]
+    info-toplevel-create $eb $etl_title
 
     label $eb.title -text $etl_title
     pack $eb.title -side top
 
-    button $eb.close -text Close -command [list wm withdraw $eb]
-    pack $eb.close -side bottom
-
     frame $eb.emsg -bd 2 -relief groove
     label $eb.emsg.lab -anchor nw -text "Error:"
     text $eb.emsg.text -height 1
@@ -1322,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 {} {
@@ -1405,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
index 44b6fac800f18af36ed57cc1d8c765e16d101d3a..ccf26e53c74fb5651f90882cb20c3f763efa9112 100755 (executable)
@@ -118,7 +118,7 @@ sub watch_dir ($) {
            next unless $size;
            last if $size==$lastsize;
            $lastsize= $size;
-           select undef,undef,undef, 0.100;
+           select undef,undef,undef, 0.300;
        }
 
        $child= fork;  defined $child or die $!;