ignored."
return
}
if {[set tdlvl [incr in(TD) -1]] < 0} {
Msg "$id: ### without | ignored."
return
}
$curD insert end \n
if {[incr in(TD) -1] < 0} {set in(TD) 0}
if {$V>4} {puts "$id: We now have levels: TD=$in(TD) TR=$in(TR) TABLE=$in(TABLE)."}
switch $opt(TABLE) {
1 {
if {[set tl $in(TABLE)] > 0} {
if {$V>1} {puts "$id: We are now in table level $tl."}
set tn $Tl2n($tl)
if {$V>1} {puts "$id: We are now in table level $tl number $tn."}
} else {
if {$V>1} {puts "$id: We are no longer inside a table."}
set tn 0
}
if {[incr txtlvl -1] < 0} {set txtlvl 0}
set curD $Txt($txtlvl)
if {$V>1} {puts "$id: Text level is $txtlvl Tn2f($tn)=$Tn2f($tn) curD=Txt($txtlvl)=$curD"}
}
default -
2 -
0 {}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
proc endTR {w att} {
global B V R curD docLines me in txtlvl
set id "$me/endTR"
if {$V>4} {puts "$id: w={$w} att={$att} curD={$curD} txtlvl=$txtlvl."}
while {$in(TD) >= $in(TR)} {
if {$V>1} {puts "$id: Unclosed | at table level $in(TABLE) in line $docLines."}
endTD $w {}
}
if {[incr in(TR) -1] < 0} {set in(TR) 0}
if {$V>4} {puts "$id: We now have levels: TD=$in(TD) TR=$in(TR) TABLE=$in(TABLE)."}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# This creates a "cell" in a table. We are passed the the cell's name, which #
# we use to create a frame, and pack a text widget inside. Both have debug #
# borders, so we have to account for 4 border widths when resizing. If any #
# args are passed, they are used for the initial text in the cell. This is #
# sometimes useful for debugging. #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
proc tblcell {tn cell r c} {
global B bd C V me LC N R SP Src Ftag URLt PicMinw PicMaxw \
curD Tn2b Tf2c Tn2f Tn2t Txt TxtMin TxtMaxw TxtMaxW TxtMinw TxtMinW TxtLen txtlvl
set id "$me/tblcell"
if {[incr txtlvl] < 1} {
Msg "$id: ### Attempt to define $cell at txtlvl $txtlvl ###"
return
}
# chkT0 {$id start}
if {$V>4} {puts "$id: Table $tn cell $cell row $r col $c"}
if ![info exists Tn2f($tn)] {set Tn2f($tn) {}}
if ![info exists Txt($txtlvl)] {set Txt($txtlvl) {}}
if {$V>4} {puts "$id: Tn2f($tn)={$Tn2f($tn)} curD=Txt($txtlvl)={$Txt($txtlvl)}"}
if {$V>4} {puts "$id: Table $tn curD={$curD}"}
if ![info exists Tn2f($tn)] {Msg "$id: Tn2f($tn) not defined."; return}
set tf $Tn2f($tn); if {$V>4} {puts "$id: Table frame Tn2f($tn)={$tf}"}
if ![info exists Tn2b($tn)] {set Tn2b($tn) $bd(T1)}
set tb $Tn2b($tn); if {$V>4} {puts "$id: Table border Tn2b($tn)=$tb"}
if [catch {frame $cell -bd $bd(T2) -relief flat -bg $C(T2)} x] {
Msg $x
return
}
set curD [set Txt($txtlvl) $cell.d]
set URLt($curD) $URLt($Txt(0))
text $curD -height 1 -width 1 -wrap word -bd $bd(T3) -bg $C(T3) -relief sunken \
-highlightthickness 0 -font F$Ftag
if {$V>4} {puts "$id: Table $tn cell curD={$curD} created."}
HSP $curD {}
set Tn2t($tn) $curD
set TxtLen($curD) 0
set TxtMin($curD) 0
set TxtMinw($curD) 0
set TxtMinW($curD) 0
set TxtMaxw($curD) 0
set TxtMaxW($curD) 0
set PicMinw($curD) 0
set PicMaxw($curD) 0
if {$V>2} {puts "$id: Cell $curD now has TxtLen=$TxtLen($curD) TxtMin=$TxtMin($curD) TxtMinW=$TxtMinW($curD) TxtMaxW=$TxtMaxW($curD) PicMinw=$PicMinw($curD) PicMaxw=$PicMaxw($curD)."}
if {$V>4} {puts "$id: Created cell $cell text $Tn2t($tn)"}
if {$V>4} {puts "$id: Grid $cell -in $tf -row $r -column $c -sticky news"}
grid $cell -in $tf -row $r -column $c -sticky news
grid columnconfigure $tf $c -weight 1
grid propagate $tf
Hnl 0
set LC {}
set Tf2c($curD) {}
pack $curD -in $cell -expand 1 -fill both
# chkT0 {$id end}
bind $curD {
if {$V>4} {puts "KP_Up"}
set h [lindex [%W config -height] 4]
incr h -1
if {$V>4} {puts "KP_Up: %W config -height $h"}
%W config -height $h }
bind $curD {
if {$V>4} {puts "KP_Down"}
set h [lindex [%W config -height] 4]
incr h
if {$V>4} {puts "KP_Down: %W config -height $h"}
%W config -height $h
}
bind $curD {
if {$V>4} {puts "KP_Left"}
set w [lindex [%W config -width] 4]
incr w -1
if {$V>4} {puts "KP_Left: %W config -width $w"}
%W config -width $w
}
bind $curD {
if {$V>4} {puts "KP_Right"}
set w [lindex [%W config -width] 4]
incr w
if {$V>4} {puts "KP_Right: %W config -width $w"}
%W config -width $w
}
if {$V>1} {puts "$id: Created cell Txt($txtlvl)={$Txt($txtlvl)} Tn2f($tn)={$Tn2f($tn)}"}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
proc tagTR {w att} {
global B V me in N Trow Tcol Trows opt
set id "$me/tagTR"
set tl $in(TABLE); # Current table level.
set tn $N(TABLE); # Current table number.
if {$V>4} {puts "$me/tagTR: w=$w att=\"$att\" tn=$tn"}
while {$in(TR) >= $tl} {
if {$V>1} {puts "$id: Unclosed at table level $tl."}
endTR $w {}
}
incr in(TR)
if {$V>4} {puts "$id: We now have levels: TD=$in(TD) TR=$in(TR) TABLE=$in(TABLE)."}
switch $opt(TABLE) {
2 { if {$V>4} {puts "$id: tkTable $tn ..."}
Msg "$id: not implemented yet for tkTable."
Hnl 2; lltab $w
}
1 { if {$V>4} {puts "$me/tagTR: w=$w tn=$tn Trow=$Trow($tn) Tcol=$Tcol($tn)"}
set r [incr Trow($tn)]
set c [set Tcol($tn) 0]
if {$V>4} {puts "$me/tagTR: w=$w tn=$tn r=$r c=$c Trows($tn)=$Trows($tn)."}
if {$r > $Trows($tn)} {
set Trows($tn) $r
if {$V>4} {puts "$id: w=$w Trows($tn)=$Trows($tn)."}
}
}
default -
0 { Hnl 2; lltab $w
}
}
}
|