Subject: Patch for Iwidgets scrolledhtml.itk - DN [1]
Brian Griffin <bgriffin@model.com> - 14 Mar 2000 - comp.lang.tcl
This is a multi-part message in MIME format. --------------31FEEFAA860C7E081980B18C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here is a patch that fixes several rendering problems with the scrolledhtml widget. These fixes make the widget usable (at least for most of our man pages). The table layout is improved slightly so it is at least readable. I've also added a -debug option to the widget which will dump error tracebacks to stderr. These errors are normally caught and therefore hidden from view. The patch is against version 1.3 (itcl-3-1-0). I don't know since I haven't tested it, but it's possible this patch will fix some of the problems reported with the hyperhelp widget. -Brian -- ------------------------------------------------------------- -- Model Technology Inc. -- -- 10450 S.W. Nimbus Avenue/Bldg. R (503) 641-1340 tel -- -- Portland, OR 97223-4347 USA (503) 526-5410 fax -- ------------------------------------------------------------- -- For technical support..........mailto:support@model.com -- -- For sales and marketing info.....mailto:sales@model.com -- -- For PC & wkstn licensing.......mailto:license@model.com -- -- Home Page:.........................http://www.model.com -- -- AIM:.........................................bgriffin42 -- ------------------------------------------------------------- --------------31FEEFAA860C7E081980B18C Content-Type: text/plain; charset=us-ascii; name="fix.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix.txt" Index: scrolledhtml.itk =================================================================== RCS file: /cvsroot/incrTcl/iwidgets3.0.0/generic/scrolledhtml.itk,v retrieving revision 1.3 diff -w -p -r1.3 scrolledhtml.itk *** scrolledhtml.itk 1999/02/21 02:50:38 1.3 --- scrolledhtml.itk 2000/03/14 18:07:27 *************** class iwidgets::Scrolledhtml { *** 141,146 **** --- 141,147 ---- itk_option define -unknownimage unknownimage File {} itk_option define -textbackground textBackground Background {} itk_option define -update update Update 1 + itk_option define -debug deBug Debug 0 public method import {args} public method clear {} *************** body iwidgets::Scrolledhtml::import {arg *** 544,550 **** append _cwd [file dirname $filename] } else { set f [open $filename r] ! g set _cwd [file dirname $filename] } } } --- 545,551 ---- append _cwd [file dirname $filename] } else { set f [open $filename r] ! set _cwd [file dirname $filename] } } } *************** body iwidgets::Scrolledhtml::render {htm *** 611,618 **** [lindex $entity 1]] "" entity set cmd [string tolower [lindex $entity 0]] if {[info command _entity_$cmd]!=""} { ! catch {eval _entity_$cmd [lrange $entity 1 end]} } set html \ [string range $html [expr [lindex $match 1]+1] end] } --- 612,624 ---- [lindex $entity 1]] "" entity set cmd [string tolower [lindex $entity 0]] if {[info command _entity_$cmd]!=""} { ! if {[catch {eval _entity_$cmd [lrange $entity 1 end]} bad]} { ! if {$itk_option(-debug)} { ! global errorInfo ! puts stderr "render: _entity_$cmd [lrange $entity 1 end] Error:$bad\n$errorInfo" ! } } + } set html \ [string range $html [expr [lindex $match 1]+1] end] } *************** body iwidgets::Scrolledhtml::_append_tex *** 728,743 **** if ![string length $text] return } if {!$_pre && !$_intitle} { ! set p [$_hottext get "end - 2c"] set n [string index $text 0] if {$n == " " && $p == " "} { set text [string range $text 1 end] } ! $_hottext insert end $text $_tag return } if {$_pre && !$_intitle} { ! $_hottext insert end $text $_tag return } append _title $text --- 734,757 ---- if ![string length $text] return } if {!$_pre && !$_intitle} { ! if {[catch {$_hottext get "end - 2c"} p]} { ! set p "" ! } set n [string index $text 0] if {$n == " " && $p == " "} { set text [string range $text 1 end] } ! if {[catch {$_hottext insert end $text $_tag}]} { ! set pht [winfo parent $_hottext] ! catch {$pht insert end $text $_tag} ! } return } if {$_pre && !$_intitle} { ! if {[catch {$_hottext insert end $text $_tag}]} { ! set pht [winfo parent $_hottext] ! catch {$pht insert end $text $_tag} ! } return } append _title $text *************** body iwidgets::Scrolledhtml::_set_tag {} *** 807,813 **** if {![info exists _tagl($_tag)]} { set _tagfont($_tag) 1 eval $_hottext tag configure $_tag \ ! -foreground $_color \ -lmargin1 ${_left}m \ -lmargin2 ${_left2}m $args if [catch {eval $_hottext tag configure $_tag \ --- 821,827 ---- if {![info exists _tagl($_tag)]} { set _tagfont($_tag) 1 eval $_hottext tag configure $_tag \ ! -foreground \$_color \ -lmargin1 ${_left}m \ -lmargin2 ${_left2}m $args if [catch {eval $_hottext tag configure $_tag \ *************** body iwidgets::Scrolledhtml::_entity_tab *** 2127,2133 **** # end table # ------------------------------------------------------------------ body iwidgets::Scrolledhtml::_entity_/table {} { ! if $_intable { _pop tableborder set table [[_pop table] childsite] _pop row --- 2141,2147 ---- # end table # ------------------------------------------------------------------ body iwidgets::Scrolledhtml::_entity_/table {} { ! if {$_intable} { _pop tableborder set table [[_pop table] childsite] _pop row *************** body iwidgets::Scrolledhtml::_entity_/ta *** 2150,2155 **** --- 2164,2181 ---- set _link [_pop link] set _alink [_pop alink] foreach x [grid slaves $table] { + set text [$x get 1.0 end] + set tl [split $text \n] + set max 0 + foreach l $tl { + set len [string length $l] + if {$len > $max} { + set max $len + } + } + if {$max > [$x cget -width]} { + $x configure -width $max + } if {[$x cget -height] == 1} { $x configure -height [lindex [split [$x index "end - 1 chars"] "."] 0] } *************** body iwidgets::Scrolledhtml::_entity_td *** 2219,2227 **** set cellspacing [_peek cellspacing] set _hottext $table.cell[incr _counter] text $_hottext -relief flat -width $ar(width) -height $ar(height) \ ! -foreground $_color -background $_bgcolor -highlightthickness 0 \ ! -wrap word -cursor $itk_option(-cursor) \ -padx $cellpadding -pady $cellpadding if [info exists ar(nowrap)] { $_hottext configure -wrap none } --- 2245,2258 ---- set cellspacing [_peek cellspacing] set _hottext $table.cell[incr _counter] text $_hottext -relief flat -width $ar(width) -height $ar(height) \ ! -highlightthickness 0 -wrap word -cursor $itk_option(-cursor) \ -padx $cellpadding -pady $cellpadding + if {$_color != ""} { + $_hottext config -foreground $_color + } + if {$_bgcolor != ""} { + $_hottext config -background $_bgcolor + } if [info exists ar(nowrap)] { $_hottext configure -wrap none } *************** body iwidgets::Scrolledhtml::_entity_td *** 2229,2235 **** --- 2260,2272 ---- $_hottext configure -relief sunken } set row [_peek row] + if {$row < 0} { + set row 0 + } set column [_pop column] + if {$column < 0} { + set column 0 + } while {[grid slaves $table -row $row -column $column] != ""} { incr column } --------------31FEEFAA860C7E081980B18C--
Last modified
2000-07-20
2000-07-20
(195.108.246.52)
Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated
