2001-08-28 Keith Seitz <keiths@redhat.com>
+ * library/process.ith (top): Remove unused protected variable.
+ Use GDBWin::_top instead.
+ (lb): Remove unused variable.
+ (change_context): Remove parameter. It's not needed.
+ * library/process.itb (constructor): Don't set the variable
+ "top". It isn't needed. GDBWin has this information.
+ (buildwin): Get rid of tixScrolledListbox. Use
+ iwidgets::scrolledlistbox instead.
+ Loose the balloon help. It annoys more than helps.
+ (update): Use new scrolledlistbox component.
+ Split the list of threads BEFORE doing llength. Someone
+ shoot me if this has to be fixed one more time...
+ (change_context): Update definition and usage.
+ (cursor): Use GDBWin::_top instead of our own private copy.
+
+2001-08-28 Keith Seitz <keiths@redhat.com>
+
* generic/gdbtk-cmds.c (gdb_disassemble_driver): We should be
looking for "thread", not "threads" to determine if we have
a multi-threaded child process.
-# Process window for GDBtk.
-# Copyright 1998, 1999 Cygnus Solutions
+# Process window for Insight.
+# Copyright 1998, 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
# ----------------------------------------------------------------------
body ProcessWin::constructor {args} {
- set top [winfo toplevel $itk_interior]
window_name "Processes"
gdbtk_busy
# ------------------------------------------------------------------
body ProcessWin::build_win {} {
global tixOption tcl_platform
+
if {$tcl_platform(platform) == "windows"} {
- tixScrolledListBox $itk_interior.s -scrollbar both -sizebox 1
+ #tixScrolledListBox $itk_interior.s -scrollbar both -sizebox 1
+ set hsmode static
+ set vsmode static
+ ide_sizebox $itk_interior.sbox
+ place $itk_interior.sbox -relx 1.0 -rely 1.0 -anchor se
} else {
- tixScrolledListBox $itk_interior.s -scrollbar auto
+ #tixScrolledListBox $itk_interior.s -scrollbar auto
+ set hsmode dynamic
+ set vsmode dynamic
}
- set lb [$itk_interior.s subwidget listbox]
- $lb configure -selectmode single -bg $tixOption(input1_bg) \
- -selectbackground green \
- -selectforeground black \
- -font src-font \
- -exportselection false
- update dummy
- balloon register $lb "Click on a line to change context"
- # bind mouse button 1 to change the current context
- bind $lb <ButtonPress-1> [code $this change_context %y]
- bind $lb <ButtonRelease-1> break
+ itk_component add slbox {
+ iwidgets::scrolledlistbox $itk_interior.slbox \
+ -background [pref get gdb/font/normal_bg] \
+ -selectbackground green \
+ -selectforeground black \
+ -textfont src-font \
+ -exportselection false \
+ -selectioncommand [code $this change_context]
+ } {}
+ [$itk_component(slbox) component listbox] configure \
+ -bg [pref get gdb/font/normal_bg]
+ update dummy
- pack $itk_interior.s -side left -expand yes -fill both
+ pack $itk_component(slbox) -side left -expand yes -fill both
}
body ProcessWin::update {event} {
if {!$protect_me} {
- $lb delete 0 end
+ $itk_component(slbox) delete 0 end
if {[catch {gdb_cmd "info thread"} threads]} {
# failed. leave window blank
return
}
- #debug "processWin update: \n$threads"
+ set threads [split $threads \n]
+ debug "processWin update: \n$threads"
if {[llength $threads] == 0} {
# no processes/threads listed.
return
# insert each line one at a time
set active -1
set num_threads 0
- foreach line [split $threads \n] {
+ foreach line $threads {
# Active line starts with "*"
if {[string index $line 0] == "*"} {
# strip off leading "*"
}
# scan for GDB ID number at start of line
if {[scan $line "%d" id($num_threads)] == 1} {
- $lb insert end $line
+ $itk_component(slbox) insert end $line
incr num_threads
}
}
# highlight the active thread
if {$active >= 0} {
set active_thread $id($active)
- $lb selection set $active
- $lb see $active
+ $itk_component(slbox) selection set $active
+ $itk_component(slbox) see $active
}
}
}
# METHOD: change_context - change the current context (active thread)
# This method is currently ONLY called from the mouse binding
# ------------------------------------------------------------------
-body ProcessWin::change_context {y} {
- if {!$Running && [$lb size] != 0} {
+body ProcessWin::change_context {} {
+ if {!$Running && [$itk_component(slbox) size] != 0} {
gdbtk_busy
- set linenum [$lb nearest $y]
- set idnum $id($linenum)
- #debug "change_context to line $linenum id=$idnum"
+ set sel [$itk_component(slbox) curselection]
+ set idnum $id($sel)
+ #debug "change_context to line $sel id=$idnum"
catch {gdb_cmd "thread $idnum"}
# Run idle hooks and cause all widgets to update
set protect_me 1
# pointer to the given glyph.
# ------------------------------------------------------------------
body ProcessWin::cursor {glyph} {
- $top configure -cursor $glyph
+ $_top configure -cursor $glyph
}