This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix some tracing stuff and elim tix


Hi,

I've committed the following patch, which allows some of the tracing code
to run properly. If you start in tracing mode, the toolbar was broken, and
trace and action dialogs were so old, they were using the old "manage
create" procedures.

I've updated these, and they seem to work now. I have NOT done anything
else to check functionality.

Oh, yeah, some other news: the Tix death march has begun.
Keith

ChangeLog:
2001-07-12  Keith Seitz  <keiths@redhat.com>

	* library/srcbar.itcl (create_trace_buttons): Fix
	syntax errors.

	* library/tracedlg.tcl: Update to work with Itcl3.0
	and ManagedWin.

	* library/actiondlg.tcl: Update to work with Itcl3.0
	and ManagedWin.
	(build_win): Use iwidgets scrolled listbox instead
	of the tix one.

Patch:
Index: tracedlg.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/tracedlg.tcl,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 tracedlg.tcl
--- tracedlg.tcl	2000/02/07 00:19:42	1.1.1.1
+++ tracedlg.tcl	2001/07/12 23:07:20
@@ -1,5 +1,5 @@
-# Trace configuration dialog for GDBtk.
-# Copyright 1997, 1998, 1999 Cygnus Solutions
+# Trace configuration dialog for Insight
+# Copyright 1997, 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
@@ -26,28 +26,17 @@
 # either one if a tracepoint was set/edited successfully or zero if
 # the user bails out (cancel or destroy buttons).

-itcl_class TraceDlg {
+class TraceDlg {
+  inherit ManagedWin
+
   # ------------------------------------------------------------------
   # CONSTRUCTOR: create new trace dialog
   # ------------------------------------------------------------------
-  constructor {config} {
-    #
-    #  Create a window with the same name as this object
-    #
-    set class [$this info class]
-    set hull [namespace tail $this]
-    set old_name $this
-    ::rename $this $this-tmp-
-    ::frame $hull -class $class
-    ::rename $hull $old_name-win-
-    ::rename $this $old_name
-
-    set top [winfo toplevel [namespace tail $this]]
-    wm withdraw $top
-    build_win $this
-    after idle [list wm deiconify $top]
-    after idle [list $this title]
-#    after idle grab $this
+  constructor {args} {
+
+    eval itk_initialize $args
+    build_win
+    title
   }

   # ------------------------------------------------------------------
@@ -56,21 +45,17 @@ itcl_class TraceDlg {
   destructor {

     # Remove this window and all hooks
-#    grab release $this
     if {$ActionsDlg != ""} {
-      catch {manage delete $ActionsDlg}
+      catch {delete object $ActionsDlg}
     }
-    set top [winfo toplevel [namespace tail $this]]
-    destroy $top
-    destroy $this
   }

   # ------------------------------------------------------------------
   # METHOD: build_win - build the Trace dialog box (cache this?)
   # ------------------------------------------------------------------
-  method build_win {f} {
-    global _TPassCount
+  method build_win {} {

+    set f $itk_interior

     # Need to set the title to either "Add Tracepoint" or "Edit Tracepoint",
     # depending on the location of the given tracepoint.
@@ -265,7 +250,7 @@ itcl_class TraceDlg {
       # Do not allow this until we clean up the action dialog...
       tk_messageBox -type ok -icon error \
 	-message "Cannot set tracepoint ranges across functions!"
-      after idle manage delete $this
+      after idle [code delete object $this]
     }
     #set functions [join $functions ,]
     label $exp.funlbl -text {Function:}
@@ -378,15 +363,15 @@ itcl_class TraceDlg {

     #debug "ADDING ACTION FOR $File:[lindex $Lines 0]"
     if {$Lines != {}} {
-      set ActionsDlg [eval manage create actiondlg -File $File \
+      set ActionsDlg [eval ManagedWin::open ActionDlg -File $File \
 			-Line [lindex $Lines 0] \
 			-WhileStepping $whilestepping -Number [lindex $Number 0]\
-			-Callback \"$this done\" $step_args]
+			-Callback "\\\{$this done\\\}" $step_args]
     } else {
-      set ActionsDlg [eval manage create actiondlg -File $File \
+      set ActionsDlg [eval ManagedWin::open ActionDlg -File $File \
 			-Address [lindex $Addresses 0] \
 			-WhileStepping $whilestepping -Number [lindex $Number 0]\
-			-Callback \"$this done\" $step_args]
+			-Callback "\\\{$this done\\\}" $step_args]
     }
   }

@@ -461,7 +446,7 @@ itcl_class TraceDlg {
   # METHOD: cancel - cancel the dialog and do not set the trace
   # ------------------------------------------------------------------
   method cancel {} {
-    manage delete $this
+    ::delete object $this
   }

   # ------------------------------------------------------------------
@@ -499,7 +484,7 @@ itcl_class TraceDlg {
           set tpnum [gdb_tracepoint_exists "$File:$line"]
           if {$tpnum == -1} {
              tk_messageBox -type ok -icon error -message "Tracepoint was deleted"
-             manage delete $this
+             ::delete object $this
              return
            }
         }
@@ -534,14 +519,15 @@ itcl_class TraceDlg {
 	      continue
 	    }
 	  }
-        if {$New == 0 && $Exists == 1} {
-          set num [gdb_tracepoint_exists "$File:$Line"]
-          if {$num == -1} {
-             tk_messageBox -type ok -icon error -message "Tracepoint was deleted"
-             manage delete $this
-             return
-          }
-       }
+	  if {$New == 0 && $Exists == 1} {
+	    set num [gdb_tracepoint_exists "$File:$Line"]
+	    if {$num == -1} {
+	      tk_messageBox -type ok -icon error -message "Tracepoint was deleted"
+	      ::delete object $this
+	      return
+	    }
+	  }
+
 	  #debug "Editing tracepoint \#$Number: $_TPassCount $actions"
 	  set err [catch {gdb_edit_tracepoint $number $_TPassCount $actions} errTxt]
 	}
@@ -557,7 +543,7 @@ itcl_class TraceDlg {
       }
     }

-    manage delete $this
+    ::delete object $this
   }

   method cmd {line} {
@@ -568,7 +554,7 @@ itcl_class TraceDlg {
     debug "deleting tracepoint $Number"
     set err [catch {gdb_cmd "delete tracepoints $Number"} errTxt]
     debug "done deleting tracepoint $Number"
-    manage delete $this
+    ::delete object $this
   }

   method get_data {action} {
@@ -670,11 +656,11 @@ itcl_class TraceDlg {

     # !! lindex $Lines 0 -- better way?
     if {$Lines != {}} {
-      manage create actiondlg -File $File -Line [lindex $Lines 0] \
+      ManagedWin::open ActionDlg -File $File -Line [lindex $Lines 0] \
 	-WhileStepping $whilestepping -Number [lindex $Number 0] \
 	-Callback "$this done" -Data $real_data -Steps $steps
     } else {
-      manage create actiondlg -File $File -Address [lindex $Addresses 0] \
+      ManagedWin::open ActionDlg -File $File -Address [lindex $Addresses 0] \
 	-WhileStepping $whilestepping -Number [lindex $Number 0] \
 	-Callback "$this done" -Data $real_data -Steps $steps
     }
@@ -704,23 +690,23 @@ itcl_class TraceDlg {
   }

   # PUBLIC DATA
-  public File {}
-  public Lines {}
-  public Addresses {}
-  public Number {}
+  public variable File {}
+  public variable Lines {}
+  public variable Addresses {}
+  public variable Number {}

   # PROTECTED DATA
-  protected Delete
-  protected _TPassCount
-  protected ActionType {}
-  protected ActionLB
-  protected Actions
-  protected WhileStepping 0
-  protected Selection {}
-  protected New 0;			# set whenever there is a new tp to add
-  protected Exists 0;			# set whenever a tracepoint in the range exists
-  protected Dismissed 0;		# has this dialog been dismissed already?
-  protected ActionsDlg {}
+  protected variable Delete
+  protected variable _TPassCount
+  protected variable ActionType {}
+  protected variable ActionLB
+  protected variable Actions
+  protected variable WhileStepping 0
+  protected variable Selection {}
+  protected variable New 0;		# set whenever there is a new tp to add
+  protected variable Exists 0;		# set whenever a tracepoint in the range exists
+  protected variable Dismissed 0;	# has this dialog been dismissed already?
+  protected variable ActionsDlg {}
 }

 proc gdb_add_tracepoint {where passes actions {addr {}}} {
Index: actiondlg.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/actiondlg.tcl,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 actiondlg.tcl
--- actiondlg.tcl	2000/02/07 00:19:42	1.1.1.1
+++ actiondlg.tcl	2001/07/12 23:07:21
@@ -12,23 +12,16 @@
 # GNU General Public License for more details.


-itcl_class ActionDlg {
+class ActionDlg {
+  inherit ManagedWin
+
   # ------------------------------------------------------------------
   # CONSTRUCTOR
   # ------------------------------------------------------------------
-  constructor {config} {
+  constructor {args} {
     global _TStepCount _TOtherVariable

-    set class [$this info class]
-    set hull [namespace tail $this]
-    set old_name $this
-    ::rename $this $this-tmp-
-    ::frame $hull -class $class
-    ::rename $hull $old_name-win-
-    ::rename $this $old_name
-
-    set top [winfo toplevel [namespace tail $this]]
-    wm withdraw $top
+    eval itk_initialize $args

     set Registers [gdb_regnames]
     if {$Line != ""} {
@@ -52,7 +45,7 @@ itcl_class ActionDlg {
     lappend Variables "All Registers"
     lappend Variables "Collect Stack"

-    build_win $this
+    build_win

     # Set a default return status, in case we are destroyed
     set _TOtherVariable {}
@@ -61,9 +54,6 @@ itcl_class ActionDlg {
     if {"$Data" != {}} {
       change 1 $Data
     }
-
-    after idle [list wm deiconify $top]
-    # after idle grab $this
   }

   # ------------------------------------------------------------------
@@ -77,18 +67,16 @@ itcl_class ActionDlg {
     # Note that this is okay: the callback (TraceDlg::done, usually) will
     # ignore stray "cancel" callbacks
     eval $Callback cancel
-
-    set top [winfo toplevel [namespace tail $this]]
-    destroy $this
-    destroy $top
   }

   # ------------------------------------------------------------------
   # METHOD: build_win - build the Trace dialog box (cache this?)
   # ------------------------------------------------------------------
-  method build_win {f} {
+  method build_win {} {
     global _TStepCount _TOtherVariable

+    set f $itk_interior
+
     # The two frames of this dialog
     set bbox [frame $f.bbox];            # for holding OK,CANCEL buttons
     set data [frame $f.data];            # for everything else
@@ -121,20 +109,24 @@ itcl_class ActionDlg {

     # The Collect listbox
     label $cFrame.lbl -text {Collect:}
-    tixScrolledListBox $cFrame.lb -scrollbar auto \
-      -browsecmd "$this toggle_button_state 0"    \
-      -command "$this change 0"
-    set CollectLB [$cFrame.lb subwidget listbox]
-    $CollectLB configure -selectmode extended
+    set CollectLB [iwidgets::scrolledlistbox $cFrame.lb -hscrollmode dynamic \
+		     -vscrollmode dynamic                                    \
+		     -selectioncommand [code $this toggle_button_state 0]    \
+		     -dblclickcommand [code $this change 0]                  \
+		     -selectmode extended                                    \
+		     -exportselection false]
+    [$CollectLB component listbox] configure -background gray92
     pack $cFrame.lbl $cFrame.lb -side top -expand yes -pady 2

     # The Variables listbox
     label $vFrame.lbl -text {Variables:}
-    tixScrolledListBox $vFrame.lb -scrollbar auto \
-      -browsecmd "$this toggle_button_state 1"    \
-      -command "$this change 1"
-    set VariablesLB [$vFrame.lb subwidget listbox]
-    $VariablesLB configure -selectmode extended
+    set VariablesLB [iwidgets::scrolledlistbox $vFrame.lb -hscrollmode dynamic \
+		       -vscrollmode dynamic                                    \
+		       -selectioncommand [code $this toggle_button_state 1]    \
+		       -dblclickcommand [code $this change 1]                  \
+		       -selectmode extended                                    \
+		       -exportselection false]
+    [$VariablesLB component listbox] configure -background gray92
     pack $vFrame.lbl $vFrame.lb -side top -expand yes -pady 2

     # The button frame
@@ -175,16 +167,16 @@ itcl_class ActionDlg {

   method toggle_button_state {add} {

-    # BUG in Tix.. This is invoked whenever a <1> event is generated in
+    # This is invoked whenever a <1> event is generated in
     # the listbox...
     if {$add} {
-      set a [$VariablesLB curselection]
+      set a [$VariablesLB getcurselection]
       if {"$a" != ""} {
 	$AddButton configure -state normal
 	$RemoveButton configure -state disabled
       }
     } else {
-      set a [$CollectLB curselection]
+      set a [$CollectLB getcurselection]
       if {"$a" != ""} {
 	$AddButton configure -state disabled
 	$RemoveButton configure -state normal
@@ -674,7 +666,7 @@ itcl_class ActionDlg {
   # METHOD: cancel - cancel the dialog and do not set the trace
   # ------------------------------------------------------------------
   method cancel {} {
-    delete
+    ::delete object $this
   }

   method remove_special {list items} {
@@ -779,7 +771,7 @@ itcl_class ActionDlg {

     debug "DATA = $data"
     eval $Callback $command $steps [list $data]
-    delete
+    ::delete object $this
   }


@@ -792,27 +784,27 @@ itcl_class ActionDlg {
   }

   # PUBLIC DATA
-  public File
-  public Line {}
-  public WhileStepping 0
-  public Number
-  public Callback
-  public Data {}
-  public Steps {}
-  public Address {}
+  public variable File
+  public variable Line {}
+  public variable WhileStepping 0
+  public variable Number
+  public variable Callback
+  public variable Data {}
+  public variable Steps {}
+  public variable Address {}

   # PROTECTED DATA
-  protected WhileSteppingEntry
-  protected CollectLB
-  protected VariablesLB
-  protected Variables {}
-  protected Collect {}
-  protected Locals
-  protected Args
-  protected Registers
-  protected Others {}
-  protected AddButton
-  protected RemoveButton
-  protected OtherEntry
-  protected StackCollect {*(char*)$sp@64}
+  protected variable WhileSteppingEntry
+  protected variable CollectLB
+  protected variable VariablesLB
+  protected variable Variables {}
+  protected variable Collect {}
+  protected variable Locals
+  protected variable Args
+  protected variable Registers
+  protected variable Others {}
+  protected variable AddButton
+  protected variable RemoveButton
+  protected variable OtherEntry
+  protected variable StackCollect {*(char*)$sp@64}
 }
Index: srcbar.itcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srcbar.itcl,v
retrieving revision 1.10
diff -u -p -r1.10 srcbar.itcl
--- srcbar.itcl	2001/06/04 17:19:13	1.10
+++ srcbar.itcl	2001/07/12 23:09:15
@@ -559,23 +559,23 @@ class SrcBar {
   private method create_trace_buttons {{show 0}} {

     if {$show} {
-      set command $Tool add button
+      set command "add button"
     } else {
-      set command $Tool create
+      set command "create"
     }

-    $command tfindstart Trace {tfind_cmd "tfind start"} "First Hit <F>" \
+    $Tool $command tfindstart Trace {tfind_cmd "tfind start"} "First Hit <F>" \
       -image rewind_img

-    $command tfind Trace {tfind_cmd tfind} "Next Hit <N>" -image next_hit_img
+    $Tool $command tfind Trace {tfind_cmd tfind} "Next Hit <N>" -image next_hit_img

-    $command tfindprev Trace {tfind_cmd "tfind -"} "Previous Hit <P>" \
+    $Tool $command tfindprev Trace {tfind_cmd "tfind -"} "Previous Hit <P>" \
       -image prev_hit_img

-    $command tfindline Trace {tfind_cmd "tfind line"} "Next Line Hit <L>" \
+    $Tool $command tfindline Trace {tfind_cmd "tfind line"} "Next Line Hit <L>" \
       -image next_line_img

-    $command tfindtp Trace { tfind_cmd "tfind tracepoint"} \
+    $Tool $command tfindtp Trace { tfind_cmd "tfind tracepoint"} \
       "Next Hit Here <H>" -image next_check_img

     set Trace_control_buttons {tfindstart tfind tfindprev tfindline tfindtp}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]