This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
RE: Target Settings box does not come up
On Tue, 2004-11-23 at 07:02, Keith Seitz wrote:
> Zowie. I'll work on a patch.
Ok, it's official ('cause I say so ;-): iwidgets::feedback is a very,
very lame widget.
I feel better now. I've attached a patch. Apply in src/gdb/gdbtk
directory (it should patch library/download.it*). I've only tested this
on the simulator, but it seems to work.
Please try it out and let me know if that fixes the problem.
Keith
Index: library/download.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.itb,v
retrieving revision 1.9
diff -u -p -r1.9 download.itb
--- library/download.itb 15 Oct 2002 21:19:51 -0000 1.9
+++ library/download.itb 23 Nov 2004 16:18:12 -0000
@@ -31,7 +31,7 @@ itcl::body Download::constructor {args}
set i 0
while {$i <$num_sections} {
- iwidgets::feedback $f.meter$i -steps $num_steps -fraction 0.0
+ iwidgets::feedback $f.meter$i -steps $num_steps
grid forget [$f.meter$i component percentage]
label $f.sec$i -text [lindex $section(names) $i] -anchor w
label $f.num$i -text $bytes($i) -anchor e
@@ -63,11 +63,26 @@ itcl::body Download::update_download { s
set i $section($s)
if {$s == $sec} {
- set f [expr {$num / $bytes($i)}]
- $itk_interior.f.meter$i configure -fraction $f
+ # Advance feedback meter. The iwidgets meter leaves a lot to
+ # be desired. No way to query the current setting. No way to
+ # set the state of the meter by percentage. It only understands
+ # steps, and we must be careful not to step the widget past the
+ # the configured number of steps, or else the meter will be
+ # set wrong. How lame.
+ set steps [expr {$num / $bytes($i) * $num_steps}]
+ if {[expr {$completed_steps($s) + $steps}] > $num_steps} {
+ set steps [expr {$num_steps - $completed_steps($s)}]
+ }
+ incr completed_steps($s) $steps
+ $itk_interior.f.meter$i step $steps
break
} else {
- $itk_interior.f.meter$i configure -fraction 1.0
+ # Section already loaded. Make sure meter is at 100%.
+ if {$completed_steps($s) < $num_steps} {
+ set steps [expr {$num_steps - $completed_steps($s)}]
+ set completed_steps($s) $num_steps
+ $itk_interior.f.meter$i step $steps
+ }
}
}
@@ -91,7 +106,11 @@ itcl::body Download::done { {msg ""} } {
# set all indicators to FULL
foreach sec $section(names) {
set i $section($sec)
- $itk_interior.f.meter$i configure -fraction 1.0
+ if {$completed_steps($sec) < $num_steps} {
+ set steps [expr {$num_steps - $completed_steps($sec)}]
+ set completed_steps($sec) $num_steps
+ $itk_interior.f.meter$i step $steps
+ }
}
} else {
# download failed
@@ -221,6 +240,7 @@ itcl::body Download::download_it { } {
set b [lindex $x 1]
set bytes($i) [expr {double($b)}]
incr total_bytes $b
+ set completed_steps($s) 0
incr i
}
set num_sections $i
Index: library/download.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.ith,v
retrieving revision 1.5
diff -u -p -r1.5 download.ith
--- library/download.ith 15 Oct 2002 21:19:51 -0000 1.5
+++ library/download.ith 23 Nov 2004 16:18:12 -0000
@@ -22,6 +22,9 @@ itcl::class Download {
common num_sections
common num_steps 100
+ # completed steps in feedback meter (iwidget::feedback is lame)
+ common completed_steps
+
method _ignore_on_save {} { return 1 }
proc dont_remember_size {} { return 1}
}