OSDN Git Service

2001-11-05 Martin M. Hunt <hunt@redhat.com>
authorhunt <hunt>
Mon, 5 Nov 2001 19:14:00 +0000 (19:14 +0000)
committerhunt <hunt>
Mon, 5 Nov 2001 19:14:00 +0000 (19:14 +0000)
* library/debugwin.itb (DebugWin::build_win):
Initialize gdbtk_de(ERRORS_ONLY) and gdbtk_de(filter_var)
(DebugWin::puts): Rewrite filter to handle new options.
(DebugWinDOpts::build_win): Update list of classes. Change
filter dialog so we can not display only errors and warnings
or choose between displaying ALL classes except those selected
or only selected classes. Fix "OK" button to apply
changes before closing dialog.
DebugWinOpts::_apply): Now takes an agrument that
indicates if dialog should exit after applying filter.

* library/debugwin.ith (_apply): Now takes an arg.

* library/main.tcl: If GDBTK_DEBUGFILE is not set,
use "insight.log" as the default. If GDBTK_DEBUG is set
and nonzero, start logging debug messages to
GDBTK_DEBUGFILE immediately. Never open the debug window
automatically.

* library/managedwin.itb (ManagedWin::shutdown): Don't
save debug window options dialog on active list

* library/srcwin.itb: Remove troublesome debug line.

gdb/gdbtk/ChangeLog
gdb/gdbtk/library/debugwin.itb
gdb/gdbtk/library/debugwin.ith
gdb/gdbtk/library/main.tcl
gdb/gdbtk/library/managedwin.itb
gdb/gdbtk/library/srcwin.itb

index cbc5369..8fa5709 100644 (file)
@@ -1,4 +1,30 @@
-2001-10-18  Martin M. Hunt  <hunt@redhat.com>
+2001-11-05  Martin M. Hunt  <hunt@redhat.com>  
+
+       * library/debugwin.itb (DebugWin::build_win): 
+       Initialize gdbtk_de(ERRORS_ONLY) and gdbtk_de(filter_var)
+       (DebugWin::puts): Rewrite filter to handle new options.
+       (DebugWinDOpts::build_win): Update list of classes. Change 
+       filter dialog so we can not display only errors and warnings
+       or choose between displaying ALL classes except those selected
+       or only selected classes. Fix "OK" button to apply
+       changes before closing dialog.
+       DebugWinOpts::_apply): Now takes an agrument that
+       indicates if dialog should exit after applying filter.
+       
+       * library/debugwin.ith (_apply): Now takes an arg.
+
+       * library/main.tcl: If GDBTK_DEBUGFILE is not set,
+       use "insight.log" as the default. If GDBTK_DEBUG is set
+       and nonzero, start logging debug messages to
+       GDBTK_DEBUGFILE immediately. Never open the debug window
+       automatically.
+
+       * library/managedwin.itb (ManagedWin::shutdown): Don't 
+       save debug window options dialog on active list
+       
+       * library/srcwin.itb: Remove troublesome debug line.
+
+2001-11-05  Martin M. Hunt  <hunt@redhat.com>
        * library/globalpref.itb (GlobalPref::_init_var):
        New method to initialize _saved and _new arrays.
        (GlobalPref::constructor): Call _init_var.
index d560b54..ccea1c9 100644 (file)
@@ -59,7 +59,9 @@ body DebugWin::build_win {} {
   # initialize the gdbtk_de array
   if {![info exists ::gdbtk_de]} {
     set ::gdbtk_de(ALL) 1
+    set ::gdbtk_de(ERRORS_ONLY) 0
     set ::gdbtk_de(others) 0
+    set ::gdbtk_de(filter_var) ALL
   }
 
   # create menubar
@@ -144,16 +146,33 @@ body DebugWin::build_win {} {
 #              msg   - message to display
 # -----------------------------------------------------------------------------
 body DebugWin::puts {level cls func msg} {
-
   # filter. check if we should display this message
   # for now we always let high-level messages through
-  if {!$::gdbtk_de(ALL) && $level == "I"} {
-    if {[info exists ::gdbtk_de($cls)]} {
-      if {!$::gdbtk_de($cls)} {
+  if {$level == "I"} {
+
+    # errors and warnings only
+    if {$::gdbtk_de(ERRORS_ONLY)} { return }
+
+    # ALL classes except those set
+    if {$::gdbtk_de(ALL)} {
+      if {[info exists ::gdbtk_de($cls)]} {
+       if {$::gdbtk_de($cls)} {
+         return
+       }
+      } elseif {$::gdbtk_de(others)} {
+       return
+      }
+    }
+
+    # ONLY the classes set
+    if {!$::gdbtk_de(ALL)} {
+      if {[info exists ::gdbtk_de($cls)]} {
+       if {!$::gdbtk_de($cls)} {
+         return
+       }
+      } elseif {!$::gdbtk_de(others)} {
        return
       }
-    } elseif {!$::gdbtk_de(others)} {
-      return
     }
   }
 
@@ -319,25 +338,37 @@ body DebugWinDOpts::build_win {} {
   wm title [winfo toplevel $itk_interior] "Debug Display Options"
   # initialize here so we can resource this file and update the list
   set _classes {DebugWin RegWin SrcBar SrcWin ToolBar WatchWin EmbeddedWin \
-               ManagedWin GDBWin StackWin SrcTextWin VariableWin global BPWin \
-                 TargetSelection ModalDialog ProcessWin}
+               ManagedWin GDBWin StackWin SrcTextWin VariableWin global BpWin \
+                 TargetSelection ModalDialog ProcessWin GDBEventHandler}
+  set _classes [concat [lsort $_classes] others]
+
   set f [frame $itk_interior.f]
   set btns [frame $itk_interior.buttons]
 
-  iwidgets::Labeledframe $f.classes -labelpos nw -labeltext {Classes}
+  iwidgets::Labeledframe $f.display -labelpos nw -labeltext {Classes}
+  set fr [$f.display childsite]
+  radiobutton $fr.0 -text "Messages from ALL classes EXCEPT those selected below" \
+    -variable ::gdbtk_de(filter_var) -value ALL -command [code $this _all]
+  radiobutton $fr.1 -text "Messages from ONLY those classes selected below" \
+    -variable ::gdbtk_de(filter_var) -value ONLY -command [code $this _all]
+  radiobutton $fr.2 -text "Only WARNINGS and ERRORS" \
+    -variable ::gdbtk_de(filter_var) -value ERRORS -command [code $this _all]
+
+  grid $fr.0 -sticky w -padx 5 -pady 5
+  grid $fr.1 -sticky w -padx 5 -pady 5
+  grid $fr.2 -sticky w -padx 5 -pady 5
+
+  iwidgets::Labeledframe $f.classes 
   set fr [$f.classes childsite]
 
-  checkbutton $fr.0 -text ALL -variable ::gdbtk_de(ALL) -command [code $this _all]
-  set i 1
-  foreach cls [lsort $_classes] {
+  set i 0
+  foreach cls $_classes {
     if {![info exists ::gdbtk_de($cls)]} {
       set ::gdbtk_de($cls) 0
     }
     checkbutton $fr.$i -text $cls -variable ::gdbtk_de($cls)
     incr i
   }
-  checkbutton $fr.$i -text others -variable ::gdbtk_de(others)
-  incr i
 
   set k [expr 3*(int($i/3))]
   set more [expr $i - $k]
@@ -351,12 +382,13 @@ body DebugWinDOpts::build_win {} {
     2 { grid $fr.$j $fr.[expr $j+1] x -sticky w -padx 5 -pady 5}
   }
 
+  pack $f.display -side top -expand 1 -fill both
   pack $f.classes -side top -expand 1 -fill both
 
-  button $btns.ok -text [gettext OK] -width 7 -command [code delete object $this] \
+  button $btns.ok -text [gettext OK] -width 7 -command [code $this _apply 1] \
     -default active
   button $btns.apply -text "Apply to All"  -width 7 \
-    -command [code $this _apply]
+    -command [code $this _apply 0]
   if {$::debug::logfile == "" || $::debug::logfile == "stdout"} {
     $btns.apply configure -state disabled
   }
@@ -380,11 +412,37 @@ body DebugWinDOpts::build_win {} {
 #              deselect all the individual class checkbuttons.
 # -----------------------------------------------------------------------------
 body DebugWinDOpts::_all {} {
-  if {$::gdbtk_de(ALL)} {
-    foreach cls $_classes {
-      set ::gdbtk_de($cls) 0
+  switch $::gdbtk_de(filter_var) {
+    ALL {
+      set ::gdbtk_de(ALL) 1
+      set ::gdbtk_de(ERRORS_ONLY) 0
+      #enable class buttons
+      set num 0
+      foreach class $_classes {
+       $itk_interior.f.classes.childsite.$num configure -state normal
+       incr num
+      }
+    }
+    ONLY {
+      set ::gdbtk_de(ALL) 0
+      set ::gdbtk_de(ERRORS_ONLY) 0
+      #enable class buttons
+      set num 0
+      foreach class $_classes {
+       $itk_interior.f.classes.childsite.$num configure -state normal
+       incr num
+      }
+    }
+    ERRORS {
+      set ::gdbtk_de(ALL) 0
+      set ::gdbtk_de(ERRORS_ONLY) 1
+      # disable class buttons
+      set num 0
+      foreach class $_classes {
+       $itk_interior.f.classes.childsite.$num configure -state disabled
+       incr num
+      }
     }
-    set ::gdbtk_de(others) 0
   }
 }
 
@@ -398,9 +456,13 @@ body DebugWinDOpts::_all {} {
 #              log file through the new filter into the debug window. The
 #              button is disabled if there is no log file.
 # -----------------------------------------------------------------------------
-body DebugWinDOpts::_apply {} {
+body DebugWinDOpts::_apply { done } {
   set dw [ManagedWin::find DebugWin]
+  debug $dw
   if {$dw != ""} {
     $dw loadlog
   }
+  if {$done} {
+    delete object $this
+  }
 }
index c9734c2..8ebda34 100644 (file)
@@ -79,7 +79,6 @@ class DebugWinDOpts {
     variable _classes
     method build_win {}
     method _all {}
-    method _apply {}
+    method _apply {done}
   }
-
 }
index aaa28d9..e294796 100644 (file)
@@ -101,8 +101,12 @@ if {[info exists env(GDBTK_TRACE)] && $env(GDBTK_TRACE) != 0} {
   }
 }
 
-if {[info exists env(GDBTK_DEBUGFILE)]} {
-  ::debug::logfile $env(GDBTK_DEBUGFILE)
+if {[info exists env(GDBTK_DEBUG)] && $env(GDBTK_DEBUG) != 0} {
+  if {[info exists env(GDBTK_DEBUGFILE)]} {
+    ::debug::logfile $env(GDBTK_DEBUGFILE)
+  } else {
+    ::debug::logfile "insight.log"
+  }
 }
 
 if {$tcl_platform(platform) == "unix"} {
@@ -147,13 +151,6 @@ ManagedWin::init
 # wm command . [concat $argv0 $argv] 
 wm group . . 
 
-# Open debug window if testsuite is not running and GDBTK_DEBUG is set
-if {![info exists env(GDBTK_TEST_RUNNING)] || !$env(GDBTK_TEST_RUNNING)} {
-  if {[info exists env(GDBTK_DEBUG)] && $env(GDBTK_DEBUG) > 1} {
-    ManagedWin::open DebugWin
-  }
-}
-
 # some initial commands to get gdb in the right mode
 gdb_cmd {set height 0}
 gdb_cmd {set width 0}
index 43493dc..2bc6f67 100644 (file)
@@ -115,7 +115,8 @@ body ManagedWin::restart {} {
 body ManagedWin::shutdown {} {
   set activeWins {}
   foreach win [itcl_info objects -isa ManagedWin] {
-    if {![$win isa ModalDialog] && ![$win isa DebugWin]} {
+    if {![$win isa ModalDialog] && ![$win isa DebugWin] &&
+       ! [$win isa DebugWinDopts]} {
       set g [wm geometry [winfo toplevel [namespace tail $win]]]
       pref setd gdb/geometry/[namespace tail $win] $g
       lappend activeWins [$win pickle]
index 5d90296..f5ba7b1 100644 (file)
@@ -356,7 +356,6 @@ body SrcWin::goto_func {w {val ""}} {
 body SrcWin::fillNameCB {} {
   global _files
   set allfiles [gdb_listfiles]
-  debug "gdb_listfiles returned $allfiles"
   foreach f $allfiles {
     # FIXME: If you reactivate this code add a catch as gdb_find_file can err
     # (P.S.: I don't know why this is commented out)