chiark / gitweb /
factor out execpnm_createphoto and use it everywhere
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 20:50:43 +0000 (21:50 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 20:50:43 +0000 (21:50 +0100)
pctb/dictionary-manager

index 5e108a7ea72583e29a958ac60027dac37f73f845..19e067c93ba188a21222cb8411845ce19ef13b14 100755 (executable)
@@ -94,6 +94,13 @@ proc bgerror {m} {
     exit 16
 }
 
     exit 16
 }
 
+proc execpnm_createphoto {photoname args} {
+    set tmpfile ./#dictimage#.tmp
+    eval exec $args > $tmpfile
+    image create photo $photoname -file $tmpfile
+    file delete $tmpfile
+}
+
 #---------- display core ----------
 
 set mul 6
 #---------- display core ----------
 
 set mul 6
@@ -422,10 +429,7 @@ proc required/pixmap {} {
        if {![string length $ppml]} break
        append ppm $ppml "\n"
     }
        if {![string length $ppml]} break
        append ppm $ppml "\n"
     }
-    set tmpfile ./#dictimage#.tmp
-    exec pnmscale 2 << $ppm >$tmpfile
-    image create photo image/main -file $tmpfile
-    file delete $tmpfile
+    execpnm_createphoto image/main  pnmscale 2 << $ppm
 
     set alloptions [exec ./database-info-fetch $unk_what]
 
 
     set alloptions [exec ./database-info-fetch $unk_what]
 
@@ -702,11 +706,9 @@ proc char_read_pgm {f} {
        append o $ointerl
     }
 
        append o $ointerl
     }
 
-    debug "DATA1 $o"
-    set tmpfile ./#dictimage#.tmp
-    exec pnmscale 1 << $o >$tmpfile
-    image create photo image/main -file $tmpfile
-    file delete $tmpfile
+#    debug "DATA1 $o"
+
+    execpnm_createphoto image/main  pnmscale 1 << $o
 }
 
 #---------- character set editor display ----------
 }
 
 #---------- character set editor display ----------
@@ -1205,9 +1207,7 @@ proc approve_showentry {ix file specdata} {
        set image [exec pgmtoppm {#008-white} << $image | pnmnoraw]
        append image "\n"
     }
        set image [exec pgmtoppm {#008-white} << $image | pnmnoraw]
        append image "\n"
     }
-    set image [exec pnmscale 2 << $image]
-
-    image create photo approve/$ix -data $image
+    execpnm_createphoto approve/$ix  pnmscale 2 << $image
     label $wb-image -image approve/$ix -bd 2 -relief flat -bg black
 
     manyset [dict2_reqkind_rows $dict] reqkind
     label $wb-image -image approve/$ix -bd 2 -relief flat -bg black
 
     manyset [dict2_reqkind_rows $dict] reqkind