From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Insight Maling List Subject: [PATCH] Remove tix from ProcessWin Date: Tue, 28 Aug 2001 15:36:00 -0000 Message-id: X-SW-Source: 2001-q3/msg00208.html HI, This patch removes all traces of tix from ProcessWin (the thread window). I'm so close to eradicating tix, I'm drooling! Keith ChangeLog 2001-08-28 Keith Seitz * 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. Patch Index: library/process.ith =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/process.ith,v retrieving revision 1.4 diff -u -p -r1.4 process.ith --- process.ith 2001/06/04 15:49:53 1.4 +++ process.ith 2001/08/28 22:34:02 @@ -1,5 +1,5 @@ -# Process window class definition for GDBtk. -# Copyright 1998, 1999 Cygnus Solutions +# Process window class definition 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 @@ -16,17 +16,14 @@ class ProcessWin { inherit EmbeddedWin GDBWin private { - variable top - variable lb variable id variable Running 0 variable protect_me 0 method build_win {} - method change_context {y} + method change_context {} method cursor {glyph} - method change_frame {y} } public { Index: library/process.itb =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/process.itb,v retrieving revision 1.4 diff -u -p -r1.4 process.itb --- process.itb 2001/06/04 15:49:53 1.4 +++ process.itb 2001/08/28 22:34:02 @@ -1,5 +1,5 @@ -# 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 @@ -19,7 +19,6 @@ # ---------------------------------------------------------------------- body ProcessWin::constructor {args} { - set top [winfo toplevel $itk_interior] window_name "Processes" gdbtk_busy @@ -36,25 +35,33 @@ body ProcessWin::constructor {args} { # ------------------------------------------------------------------ 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 [code $this change_context %y] - bind $lb 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 } @@ -64,13 +71,14 @@ body ProcessWin::build_win {} { 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 @@ -79,7 +87,7 @@ body ProcessWin::update {event} { # 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 "*" @@ -88,7 +96,7 @@ body ProcessWin::update {event} { } # 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 } } @@ -96,8 +104,8 @@ body ProcessWin::update {event} { # 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 } } } @@ -106,12 +114,12 @@ body ProcessWin::update {event} { # 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 @@ -162,5 +170,5 @@ body ProcessWin::idle {event} { # pointer to the given glyph. # ------------------------------------------------------------------ body ProcessWin::cursor {glyph} { - $top configure -cursor $glyph + $_top configure -cursor $glyph }