-# 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
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 $itk_interior.dload -padx 5 -pady 5
- grid $itk_interior.stat -padx 5 -pady 5
- grid $itk_interior.f -padx 5 -pady 5
+ grid columnconfigure $f 1 -weight 1
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
}
# ------------------------------------------------------------------
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
}
# 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
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
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] {
return 1
}
}
-
+
if {[string compare $tcl_platform(platform) "windows"] == 0} {
set f [ide_cygwin_path to_win32 $gdb_exe_name]
} else {
gdbtk_idle
return 0
}
-
+
debug "downloading $gdb_exe_name"
-
+
set target $gdb_target_name
# get load info and total up number of bytes
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
}
set download_dialog ""
}
-
+
set download_error ""
debug "starting load"
::update idletasks
}
set ::download_cancel_ok 1
}
-
+
debug "Done loading"
set gdb_downloading 0
catch {$download_dialog done}
}
}
-
+
foreach src [ManagedWin::find SrcWin] {
if {$download_error == "CANCEL"} {
$src download_progress CANCEL 1 1