diff options
author | Martin Hunt <hunt@redhat.com> | 2002-12-17 20:29:12 +0000 |
---|---|---|
committer | Martin Hunt <hunt@redhat.com> | 2002-12-17 20:29:12 +0000 |
commit | 5301be4cd9b0c1571a3b6cb289e0e3b7a2a04fcb (patch) | |
tree | 923a1bd4c5f2410308ef84dc39b42c44216a534c /gdb/gdbtk/library | |
parent | de9fc5150d3b76bc58bf8a6695cd9ce76bbde866 (diff) | |
download | gdb-5301be4cd9b0c1571a3b6cb289e0e3b7a2a04fcb.tar.gz |
2002-12-17 Martin M. Hunt <hunt@redhat.com>
* library/regwin.itb (_load_prefs): Get list of registers from
the group name.
(_build_win): Remove old menu system. Replace with an optionmenu
that contains all the valid group names for this architecture.
(_layout_table): No need to update old menu.
(_but3): Add "Close" to popup menu.
(_delete_from_display): No need to update old menu.
(_display_all): Ditto.
(_post_menu): Deleted.
(_select_group): New method. Callback for group optionmenu.
* library/regwin.ith: New private variable _group.
New private method _select_group. Removed _post_menu.
* generic/gdbtk-register.c: Include reggroups.h.
(gdb_register_info): Add "group" and "grouplist".
(gdb_regformat): Fix Tcl_WrongNumArgs call so it doesn't crash.
(gdb_reggrouplist): New function. Returns the names of the
register groups.
(gdb_reggroup): New function. Returns the register numbers of the
registers in a group.
Diffstat (limited to 'gdb/gdbtk/library')
-rw-r--r-- | gdb/gdbtk/library/regwin.itb | 203 | ||||
-rw-r--r-- | gdb/gdbtk/library/regwin.ith | 5 |
2 files changed, 50 insertions, 158 deletions
diff --git a/gdb/gdbtk/library/regwin.itb b/gdb/gdbtk/library/regwin.itb index 29518db3e49..0cb1962627f 100644 --- a/gdb/gdbtk/library/regwin.itb +++ b/gdb/gdbtk/library/regwin.itb @@ -80,10 +80,10 @@ itcl::body RegWin::_load_prefs {} { set _reg_display_list {} set _register(hidden) {} - foreach r [gdb_reginfo name -numbers] { + set regs [gdb_reginfo group $_group] + foreach r [gdb_reginfo name -numbers $regs] { set nm [lindex $r 0] set rn [lindex $r 1] - set size [string length $nm] if {$size > $_max_label_width} { set _max_label_width $size @@ -202,17 +202,6 @@ itcl::body RegWin::_build_win {} { $itk_component(hscroll) configure -command [code $itk_component(table) xview] $itk_component(vscroll) configure -command [code $itk_component(table) yview] - grid $itk_component(table) -row 0 -column 0 -sticky news - grid $itk_component(vscroll) -row 0 -column 1 -sticky ns - grid $itk_component(hscroll) -row 1 -column 0 -sticky ew - grid columnconfigure $itk_interior 0 -weight 1 - grid rowconfigure $itk_interior 0 -weight 1 - - # Add sizebox for windows - if {[string compare $::tcl_platform(platform) "windows"] == 0} { - ide_sizebox $itk_interior.sbox - place $itk_interior.sbox -relx 1.0 -rely 1.0 -anchor se - } # Create/configure tags for various display styles # normal - the "normal" display style @@ -235,71 +224,33 @@ itcl::body RegWin::_build_win {} { $itk_component(table) tag raise edit $itk_component(table) tag raise sel - # Register to receive notifications on preference changes - # (Note that these are not supported by the preference dialogs, but...) - #foreach opt [list highlight select header] { - # pref add_hook gdb/font/${opt}_fg [code $this _prefs_changed] - # pref add_hook gdb/font/${opt}_bg [code $this _prefs_changed] - #} - - # Create toplevel menubar - itk_component add menubar { - menu $itk_interior.m -tearoff false - } { - ignore -tearoff + itk_component add frame { + frame $itk_interior.m } - $_top configure -menu $itk_component(menubar) - - # Create register menu - itk_component add reg_menu { - menu $itk_component(menubar).reg -tearoff false \ - -postcommand [code $this _post_menu] - } { - ignore -tearoff - } - $itk_component(menubar) add cascade -menu $itk_component(reg_menu) \ - -label "Register" -underline 0 + iwidgets::optionmenu $itk_component(frame).opt -labeltext "Group:" \ + -labelpos w -command [code $this _select_group] + eval $itk_component(frame).opt insert end [gdb_reginfo grouplist] + $itk_component(frame).opt select "all" + + pack $itk_component(frame).opt -anchor nw + grid $itk_component(frame) -row 0 -columnspan 2 -sticky news + grid $itk_component(table) -row 1 -column 0 -sticky news + grid $itk_component(vscroll) -row 1 -column 1 -sticky ns + grid $itk_component(hscroll) -row 2 -column 0 -sticky ew + grid columnconfigure $itk_interior 0 -weight 1 + grid rowconfigure $itk_interior 0 -weight 0 + grid rowconfigure $itk_interior 1 -weight 1 - # Create register->format cascade menu - itk_component add reg_format { - menu $itk_component(reg_menu).format -tearoff false - } { - ignore -tearoff + # Add sizebox for windows + if {[string compare $::tcl_platform(platform) "windows"] == 0} { + ide_sizebox $itk_interior.sbox + place $itk_interior.sbox -relx 1.0 -rely 1.0 -anchor se } - $itk_component(reg_menu) add cascade -menu $itk_component(reg_format) \ - -label "Format" -underline 0 - $itk_component(reg_format) add radio -label "Hex" -value x \ - -underline 0 -state disabled -command [code $this update dummy] - $itk_component(reg_format) add radio -label "Decimal" -value d \ - -underline 0 -state disabled -command [code $this update dummy] - $itk_component(reg_format) add radio -label "Unsigned" -value u \ - -underline 0 -state disabled -command [code $this update dummy] - $itk_component(reg_format) add radio -label "Floating Point" -value f \ - -underline 0 -state disabled -command [code $this update dummy] - $itk_component(reg_menu) add command -label "Open Memory Window" \ - -underline 7 -state disabled - set _menuitems(open_memory) [$itk_component(reg_menu) index last] - $itk_component(reg_menu) add command -label "Add to Watch" \ - -underline 7 -state disabled - set _menuitems(add_to_watch) [$itk_component(reg_menu) index last] - $itk_component(reg_menu) add separator - $itk_component(reg_menu) add command -label "Remove from Display" \ - -underline 0 -state disabled - set _menuitems(remove_from_display) [$itk_component(reg_menu) index last] - $itk_component(reg_menu) add command -label "Display all Registers" \ - -underline 0 -state disabled -command [code $this _display_all] - set _menuitems(display_all_registers) [$itk_component(reg_menu) index last] - $itk_component(reg_menu) add separator - $itk_component(reg_menu) add command -label "Close" \ - -underline 0 -command [code delete object $this] - # Add popup menu - we populate it in the event handler itk_component add popup { menu $itk_interior.pop -tearoff 0 } {} - $itk_component(popup) configure \ - -disabledforeground [$itk_component(menubar) cget -fg] } # ------------------------------------------------------------------ @@ -404,12 +355,6 @@ itcl::body RegWin::_layout_table {} { incr x 2 } } - - # Update register menu - if {[llength $_register(hidden)] != 0} { - $itk_component(reg_menu) entryconfigure $_menuitems(display_all_registers) \ - -state normal - } } # ------------------------------------------------------------------ @@ -637,6 +582,11 @@ itcl::body RegWin::_but3 {x y X Y} { $itk_component(popup) add command \ -label "Help" -command {open_help register.html} + # Close + $itk_component(popup) add separator + $itk_component(popup) add command -label "Close" \ + -underline 0 -command [code delete object $this] + tk_popup $itk_component(popup) $X $Y } } @@ -659,9 +609,6 @@ itcl::body RegWin::_delete_from_display {rn} { # Relayout table _layout_table - - $itk_component(reg_menu) entryconfigure $_menuitems(display_all_registers) \ - -state normal } } @@ -674,16 +621,11 @@ itcl::body RegWin::_delete_from_display {rn} { # ------------------------------------------------------------------ itcl::body RegWin::_display_all {} { - $itk_component(reg_menu) entryconfigure $_menuitems(display_all_registers) \ - -state disabled - # Unhide all hidden registers foreach r $_register(hidden) { pref setd gdb/reg/[gdb_reginfo name $r] {} } - set _register(hidden) {} - # Note which register is active and restore it if {[catch {$itk_component(table) index active} cell]} { set active {} @@ -815,79 +757,6 @@ itcl::body RegWin::_move {direction} { } } -# ------------------------------------------------------------------ -# NAME: private method RegWin::_post_menu -# DESCRIPTION: Configures the Register menu before it is posted -# -# ARGUMENTS: None -# RETURNS: Nothing -# ------------------------------------------------------------------ -itcl::body RegWin::_post_menu {} { - global gdb_running - - # Configure the menu for the active cell - if {![catch {$itk_component(table) index active} cell] - && [info exists _register($cell)] && $gdb_running} { - - set code $_type($_register($cell),code) - - $itk_component(reg_menu) entryconfigure $_menuitems(remove_from_display) \ - -state normal -command [code $this _delete_from_display $_register($cell)] - - set state normal - - for {set i 0} {$i <= [$itk_component(reg_format) index end]} {incr i} { - $itk_component(reg_format) entryconfigure $i \ - -state $state \ - -variable [scope _format($_register($cell))] \ - -command [code $this _change_format $_register($cell)] - } - - if {$code == "float"} { - # disable decimal and unsigned - $itk_component(reg_format) entryconfigure 1 -state disabled - $itk_component(reg_format) entryconfigure 2 -state disabled - } elseif {$code == "int"} { - # disable float - $itk_component(reg_format) entryconfigure 3 -state disabled - } - - # memory window - if {$code == "int"} { - $itk_component(reg_menu) entryconfigure $_menuitems(open_memory) \ - -state normal -command [code $this _open_memory $_register($cell)] - } else { - $itk_component(reg_menu) entryconfigure $_menuitems(open_memory) \ - -state disabled - } - - # add to watch - $itk_component(reg_menu) entryconfigure $_menuitems(add_to_watch) \ - -state normal -command [code $this _add_to_watch $_register($cell)] - - } else { - # Disable everything - $itk_component(reg_menu) entryconfigure $_menuitems(remove_from_display) \ - -state disabled -command {} - - for {set i 0} {$i <= [$itk_component(reg_format) index end]} {incr i} { - $itk_component(reg_format) entryconfigure $i -state disabled \ - -variable {} - } - - $itk_component(reg_menu) entryconfigure $_menuitems(open_memory) \ - -state disabled -command {} - - $itk_component(reg_menu) entryconfigure $_menuitems(add_to_watch) \ - -state disabled -command {} - - if {0} { - $itk_component(reg_menu) entryconfigure $_menuitems(edit) \ - -state disabled -command {} - } - } -} - # ------------------------------------------------------------------ # NAME: private method RegWin::_select_cell @@ -1022,6 +891,26 @@ itcl::body RegWin::_update_register {rn} { set _data($_cell($rn)) [_get_value $rn] } +# ------------------------------------------------------------------ +# NAME: private_method RegWin::_select_group +# DESCRIPTION: Changes the register group. Callback +# +# ARGUMENTS: +# +# RETURNS: Nothing +# ------------------------------------------------------------------ +itcl::body RegWin::_select_group {} { + set gr [$itk_component(frame).opt get] + if {$gr == ""} { + return + } + set _group $gr + # Clear gdb's change list + catch {gdb_reginfo changed} + update "" + _layout_table +} + # # Gdb Events diff --git a/gdb/gdbtk/library/regwin.ith b/gdb/gdbtk/library/regwin.ith index f44ca9e1f23..47be705f2f9 100644 --- a/gdb/gdbtk/library/regwin.ith +++ b/gdb/gdbtk/library/regwin.ith @@ -28,6 +28,9 @@ itcl::class RegWin { # Mapping of table cell index to register number variable _register + # the register group that is displayed + variable _group "all" + # Mapping of register number to table cell index. "hidden" if # the register was "removed" from the display. variable _cell @@ -74,7 +77,7 @@ itcl::class RegWin { method _edit {x y} method _move {direction} method _open_memory {rn} - method _post_menu {} + method _select_group {} method _select_cell {cell} method _unedit {} |