-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.
# 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
# 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
}
}
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]
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
}
# 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
}
}
# 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
+ }
}