From: Ron F. <ro...@us...> - 2006-08-15 13:01:23
|
Update of /cvsroot/nsclspectcl/SpecTcl/Gui In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2115/Gui Modified Files: newGui.tcl Log Message: Enh 205 - limit gui representation of attach target to less than 50 chars so that the window does not auto-enlarge to somethig stupid Index: newGui.tcl =================================================================== RCS file: /cvsroot/nsclspectcl/SpecTcl/Gui/newGui.tcl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** newGui.tcl 19 Jul 2006 14:16:27 -0000 1.7 --- newGui.tcl 15 Aug 2006 13:01:21 -0000 1.8 *************** *** 36,39 **** --- 36,40 ---- package require filtercontrol + set LargestSource 50 *************** *** 681,684 **** --- 682,686 ---- global BuffersAnalyzed global LastSequence + global LargestSource # It's always possible the user destroyed the window so conditionalize *************** *** 703,706 **** --- 705,726 ---- set state Inactive } + # + # For some data sources, the status line can get terribly long. + # for example attach -pipe cat {list of 100 file} + # If the status line is more than LargestSource chars long, we replace the middle + # characters with ... + # + + set sourceLen [string length $source] + if {$sourceLen > $LargestSource} { + set remove [expr $sourceLen - $LargestSource] + set midpoint [expr $sourceLen/2] + set start [expr $midpoint - $remove/2] + set stop [expr $midpoint + $remove/2] + set source [string replace $source $start $stop ...] + } + + # format statusline 2. + .gui.statusline2 configure -text \ [format "Data Source: %s (%s) %d Buffers Analyzed %.2f%% efficient" $source $state $BuffersAnalyzed $efficiency] |