This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[PATCH] Eliminate Tix from download dialog
- To: Insight Maling List <insight at sources dot redhat dot com>
- Subject: [PATCH] Eliminate Tix from download dialog
- From: Keith Seitz <keiths at cygnus dot com>
- Date: Fri, 13 Jul 2001 17:02:54 -0700 (PDT)
Hi,
I've committed a patch which removes our reliance of tix in the download
dialog.
Unfortunately, there are some iwidgets bugs which prevent this from
working just right. It is mostly fixed in a newer version of iwidgets, but
for now, here's the patch for iwidgets to make this work properly. (This
is only a cosmetic issue.)
Index: itcl/iwidgets3.0.0/generic/feedback.itk
===================================================================
RCS file: /cvs/src/src/itcl/iwidgets3.0.0/generic/feedback.itk,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 feedback.itk
--- feedback.itk 2000/02/07 00:19:46 1.1.1.1
+++ feedback.itk 2001/07/14 00:00:51
@@ -172,6 +172,7 @@ configbody iwidgets::Feedback::steps {
#
-----------------------------------------------------------------------------
body iwidgets::Feedback::_display {} {
set troughwidth [winfo width $itk_component(trough)]
+ incr troughwidth [expr {-2 * [cget -borderwidth]}]
set _barwidth [expr $troughwidth.0/$itk_option(-steps)]
set fraction [expr int((1.0*$_stepval)/$itk_option(-steps)*100.0)]
@@ -203,5 +204,8 @@ body iwidgets::Feedback::step {{inc 1}}
}
incr _stepval $inc
+ if {$_stepval > $itk_option(-steps)} {
+ set _stepval $itk_option(-steps)
+ }
_display
}
We'll see about getting our itcl fixed and getting our change back into
the itcl repository. (Or we'll write our own feedback widget and put it in
libgui.)
Keith
ChangeLog:
2001-07-13 Keith Seitz <keiths@redhat.com>
* library/download.itb (constructor): Use the iwidgets
feedback widget instead of tixMeter.
Pack all the topmost widgets together -- don't use grid.
(update_download): Support the feedback widget.
(done): Ditto.
* library/download.ith (steps): New private variable.
(num_steps): New common.
Patch:
Index: download.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.itb,v
retrieving revision 1.5
diff -u -p -r1.5 download.itb
--- download.itb 2000/11/30 22:49:46 1.5
+++ download.itb 2001/07/13 23:58:28
@@ -1,5 +1,5 @@
-# Download class implementation for GDBtk.
-# Copyright 1999 Cygnus Solutions
+# Download class implementation for Insight.
+# Copyright 1999, 2001 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
@@ -31,22 +31,25 @@ body Download::constructor {args} {
set i 0
while {$i <$num_sections} {
- tixMeter $f.meter$i -value 0 -text 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
grid $f.sec$i $f.meter$i $f.num$i -padx 4 -pady 4 -sticky news
+ set steps($i) 0
incr i
}
+ grid columnconfigure $f 1 -weight 1
- grid $itk_interior.dload -padx 5 -pady 5
- grid $itk_interior.stat -padx 5 -pady 5
- grid $itk_interior.f -padx 5 -pady 5
-
button $itk_interior.cancel -text Cancel -command "$this cancel" \
-state active -width 10
- grid $itk_interior.cancel -padx 5 -pady 5
-# grid $itk_interior
-
+
+ pack $itk_interior.dload -padx 5 -pady 5 -side top -fill x -expand yes
+ pack $itk_interior.stat -padx 5 -pady 5 -expand yes
+ pack $itk_interior.f -padx 5 -pady 5 -fill x -expand yes
+
+ pack $itk_interior.cancel -padx 5 -pady 5 -side bottom
+ ::update idletasks
}
# ------------------------------------------------------------------
@@ -61,14 +64,19 @@ body Download::update_download { sec num
set i $section($s)
if {$s == $sec} {
- $itk_interior.f.meter$i config -value [expr {$num / $bytes($i)}] -text $num
+ set stepSize [expr {int($bytes($i) / $num_steps)}]
+ set new_step [expr {int($num / $stepSize)}]
+ set diff [expr {$new_step - $steps($i)}]
+ set steps($i) $new_step
+ $itk_interior.f.meter$i step $diff
break
} else {
- if {[expr {double([$itk_interior.f.meter$i cget -value])}] != 1.0} {
- $itk_interior.f.meter$i config -value 1.0 -text [expr {int($bytes($i))}]
+ if {$steps($i) != $num_steps} {
+ $itk_interior.f.meter$i step $num_steps
}
}
}
+
::update
}
@@ -89,7 +97,9 @@ body Download::done { {msg ""} } {
# set all indicators to FULL
foreach sec $section(names) {
set i $section($sec)
- $itk_interior.f.meter$i config -value 1.0 -text "DONE"
+ if {$steps($i) != $num_steps} {
+ $itk_interior.f.meter$i step $num_steps
+ }
}
} else {
# download failed
@@ -131,7 +141,7 @@ body Download::download_hash { section n
after cancel $download_timer(timer)
}
- set download_timer(timer) [after 333 Download::do_download_hooks]
+ set download_timer(timer) [after 100 Download::do_download_hooks]
if {![info exists download_timer(ok)] || $download_timer(ok)} {
run_hooks download_progress_hook $section $num $total_bytes
::update
@@ -148,21 +158,21 @@ body Download::download_it { } {
global gdb_target_name gdb_pretty_name
global gdb_running
global tcl_platform
-
+
debug "exe=$gdb_exe_name downloading=$gdb_downloading"
debug " loaded=$gdb_loaded target=$gdb_target_name running=$gdb_running"
-
+
if {$gdb_downloading || $gdb_exe_name == ""} {
return 0
}
-
+
set gdb_downloading 1
set gdb_loaded 0
# Make sure the source window has had time to be created
::update
-
+
gdbtk_busy
-
+
# Only places that load files should do set_exe
#set_exe
switch [set_target] {
@@ -185,7 +195,7 @@ body Download::download_it { } {
return 1
}
}
-
+
if {[string compare $tcl_platform(platform) "windows"] == 0} {
set f [ide_cygwin_path to_win32 $gdb_exe_name]
} else {
@@ -198,9 +208,9 @@ body Download::download_it { } {
gdbtk_idle
return 0
}
-
+
debug "downloading $gdb_exe_name"
-
+
set target $gdb_target_name
# get load info and total up number of bytes
@@ -225,7 +235,6 @@ body Download::download_it { } {
set ::download_cancel_ok 0
set ::download_start_time [clock seconds]
-
if {[pref getd gdb/load/$target-verbose] == "1"} {
# open a detailed download dialog window
@@ -238,7 +247,7 @@ body Download::download_it { } {
}
set download_dialog ""
}
-
+
set download_error ""
debug "starting load"
::update idletasks
@@ -251,7 +260,7 @@ body Download::download_it { } {
}
set ::download_cancel_ok 1
}
-
+
debug "Done loading"
set gdb_downloading 0
@@ -266,7 +275,7 @@ body Download::download_it { } {
catch {$download_dialog done}
}
}
-
+
foreach src [ManagedWin::find SrcWin] {
if {$download_error == "CANCEL"} {
$src download_progress CANCEL 1 1
Index: download.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.ith,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 download.ith
--- download.ith 2000/02/07 00:19:42 1.1.1.1
+++ download.ith 2001/07/13 23:58:28
@@ -1,5 +1,5 @@
-# Download class definition for GDBtk.
-# Copyright 1999 Cygnus Solutions
+# Download class definition for Insight
+# Copyright 1999, 2001 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
@@ -16,10 +16,14 @@ class Download {
inherit ManagedWin
protected {
+ variable steps
+
common total_bytes
common section
common bytes
common num_sections
+ common num_steps 100
+
proc dont_remember_size {} { return 1}
}
public {