From a08a94640f4f0c02c536f337630dd234e917121f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 4 Jul 2009 21:50:43 +0100 Subject: [PATCH] factor out execpnm_createphoto and use it everywhere --- pctb/dictionary-manager | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pctb/dictionary-manager b/pctb/dictionary-manager index 5e108a7..19e067c 100755 --- a/pctb/dictionary-manager +++ b/pctb/dictionary-manager @@ -94,6 +94,13 @@ proc bgerror {m} { 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 @@ -422,10 +429,7 @@ proc required/pixmap {} { 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] @@ -702,11 +706,9 @@ proc char_read_pgm {f} { 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 ---------- @@ -1205,9 +1207,7 @@ proc approve_showentry {ix file specdata} { 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 -- 2.30.2