X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fdictionary-manager;h=0ecad0ddad8a38bb444e9cb912e0f79e96c9dd2d;hb=2c3d2e7de4d4aea3536ea79ced23677e24589833;hp=3c338cac6c3e0fc3fa8e24e9be427002926efb84;hpb=5bcf61f52358ce7a1ceea3106c4c8a2d0a6dbfcd;p=ypp-sc-tools.db-test.git diff --git a/pctb/dictionary-manager b/pctb/dictionary-manager index 3c338ca..0ecad0d 100755 --- a/pctb/dictionary-manager +++ b/pctb/dictionary-manager @@ -25,9 +25,10 @@ # sponsored by Three Rings. -# ./dictionary-manager --approve-updates ijackson@login.chiark.greenend.org.uk /home/ijackson/things/ypp-sc-tools.pctb-dict-test/pctb /home/ftp/users/ijackson/pctb/test # ./dictionary-manager --approve-updates ijackson@login.chiark.greenend.org.uk /home/ijackson/things/ypp-sc-tools.pctb-dict/pctb /home/ftp/users/ijackson/pctb +# ./dictionary-manager --approve-updates ijackson@login.chiark.greenend.org.uk /home/ijackson/things/ypp-sc-tools.pctb-dict-test/pctb /home/ftp/users/ijackson/pctb/test + # ./dictionary-manager --approve-updates '' . . @@ -41,6 +42,9 @@ # if it wrote a byte to fd 4, it can take another question +set aadepth 2 + + #---------- library routines ---------- proc manyset {list args} { @@ -225,7 +229,7 @@ proc write_database {} { global reqkind database_fn database upvar #0 database_magic/$reqkind magic - set f [open $database_fn.new w] + set f [open $database_fn.tmp w] puts $f $magic write_database_header/$reqkind $f @@ -239,7 +243,7 @@ proc write_database {} { } puts $f "." close $f - file rename -force $database_fn.new $database_fn + file rename -force $database_fn.tmp $database_fn } proc select_database {dbname_spec} { @@ -284,7 +288,7 @@ proc required/char {} { label .selctx.title -text \ {Select match context for altering dictionary:} pack .selctx.title -side left - set new_context [lindex $unk_contexts 0] + set new_context {} set ci 0; foreach ctx [lsort [array names all_contexts]] { set all_contexts($ctx) $ci @@ -897,7 +901,7 @@ proc recursor {} { # $database($context 0x 0x...) = $hex -set database_magic/char {# ypp-sc-tools pctb font v2} +set database_magic/char "# ypp-sc-tools pctb font v3 depth=$aadepth" proc read_database_header/char {f} { global rows @@ -1133,10 +1137,10 @@ proc chop_counted {var} { } proc approve_decompose_data {specdata} { - global data + global data aadepth set data $specdata - regsub-data {^ypp-sc-tools dictionary update v2\n} {} + regsub-data "^ypp-sc-tools dictionary update v3 depth=$aadepth\\n" {} uplevel 1 chop_counted pirate uplevel 1 chop_counted caller uplevel 1 chop_counted dict @@ -1186,9 +1190,14 @@ proc approve_showentry {ix file specdata} { label $wb-def.def -text $def pack $wb-def.scope $wb-def.def -side bottom - set ppm [exec pnmscale 2 << $image] - image create photo approve/$ix -data $ppm - label $wb-image -image approve/$ix -bd 2 -relief sunken + if {[regexp {^P2} $image]} { + set image [exec pgmtoppm {#008-white} << $image | pnmnoraw] + append image "\n" + } + set image [exec pnmscale 2 << $image] + + image create photo approve/$ix -data $image + label $wb-image -image approve/$ix -bd 2 -relief flat -bg black manyset [dict2_reqkind_rows $dict] reqkind approve_showentry_xinfo/$reqkind $wb-xinfo $def