+ pack forget .d.pe
+ pack .d.csr -side top -before .d.mi
+ pack .d.got .d.ctx -side top -after .d.mi
+
+ read_database ./charset-$rows.txt
+ draw_glyphsdone
+ startup_cursor
+}
+
+#========== PIXMAPS ==========
+
+#---------- pixmap database read and write ----------
+
+set database_magic/pixmap {# ypp-sc-tools pctb pixmaps v1}
+
+proc read_database_header/pixmap {f} { }
+proc read_database_entry/pixmap {f def} {
+ global database
+
+ set im ""
+
+ set p3 [db_getsl $f]; append im $p3 "\n"
+ if {[string compare $p3 P3]} { error "$p3 ?" }
+
+ set wh [db_getsl $f]; append im $wh "\n"; manyset $wh w h
+ set depth [db_getsl $f]; append im $depth "\n"
+
+ for {set y 0} {$y < $h} {incr y} {
+ set line [db_getsl $f]; append im $line "\n"
+ }
+ set database($im) $def
+}
+proc write_database_header/pixmap {f} { puts $f "" }
+proc format_database_entry/pixmap {im def} {
+ return "$def\n$im"
+}
+
+#---------- pixmap display and input handling ----------
+
+proc foreach_pixmap_col {var body} {
+ global alloptions
+ upvar 1 $var col
+ for {set col 0} {$col < [llength $alloptions]/3} {incr col} {
+ uplevel 1 $body
+ }
+}
+
+proc pixmap_select {ncol} {
+ global alloptions
+ debug "PIX SELECT $ncol [llength $alloptions]"
+ foreach_pixmap_col col {
+ if {$col==$ncol} continue
+ .d.pe.grid.l$col selection clear 0 end
+ }
+ pixmap_maybe_ok
+}
+proc pixmap_maybe_ok {} {
+ global alloptions pixmap_selcol pixmap_selrow
+ set nsel 0
+ foreach_pixmap_col col {
+ set cs [.d.pe.grid.l$col curselection]
+ incr nsel [llength $cs]
+ set pixmap_selcol $col
+ set pixmap_selrow [lindex $cs 0]
+ }
+ if {$nsel==1} {
+ .d.pe.ok configure -state normal -command pixmap_ok
+ } else {
+ .d.pe.ok configure -state disabled -command {}
+ }
+}
+proc pixmap_ok {} {
+ global database ppm pixmap_selcol pixmap_selrow mainkind alloptions
+ foreach_pixmap_col col {
+ .d.pe.grid.l$col configure -state disabled
+ }
+ .d.pe.ok configure -state disabled
+ helptext {{{ Processing }}}
+ manyset [lrange $alloptions [expr {$pixmap_selcol*3}] end] \
+ colname coldesc rows
+ manyset [lrange $rows [expr {$pixmap_selrow*2}] end] \
+ rowname rowdesc
+ set result "$colname - $rowname"
+ debug "UPDATE PIXMAP AS >$result<"
+ set database($ppm) $result
+ write_database
+ done/$mainkind