summaryrefslogtreecommitdiff
path: root/gdb/gdbtk
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2001-02-01 22:56:27 +0000
committerFernando Nasser <fnasser@redhat.com>2001-02-01 22:56:27 +0000
commit12b6183b87deb98b3f07f608d5ba3c3d597ffef7 (patch)
tree91ca07a4586840597cbc728a660efa8edbe175eb /gdb/gdbtk
parentddff8c6bfc7d02b08995fd1e7a0ccd39edc0134b (diff)
downloadgdb-12b6183b87deb98b3f07f608d5ba3c3d597ffef7.tar.gz
2001-02-01 Fernando Nasser <fnasser@redhat.com>
* library/gdbtoolbar.itcl (add): New method. Emulate the style of the toolbar iwidget commands. (toolbar_show): Old name. (show): New name. (toolbar_create_button): Old name. (create): New name. (toolbar_configure_button): Old name. (itemconfigure): New name. (toolbar_bind_button): Old name. (itembind): New name. (toolbar_set_button_balloon): Old name. (itemballoon): New name. (toolbar_add_button): Make private. (toolbar_add_label): Ditto. (toolbar_add_button_separator): Ditto. (toolbar_remove_button): Ditto. (tollbar_insert_button): Ditto. * library/srcbar.itcl: Adjust to the above syntax. * library/plugins/rhabout/rhabout.itcl: Ditto.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r--gdb/gdbtk/ChangeLog22
-rw-r--r--gdb/gdbtk/library/gdbtoolbar.itcl143
-rw-r--r--gdb/gdbtk/library/plugins/rhabout/rhabout.itcl4
-rw-r--r--gdb/gdbtk/library/srcbar.itcl110
4 files changed, 164 insertions, 115 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index 990dc71988e..1b0da186a2b 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,5 +1,27 @@
2001-02-01 Fernando Nasser <fnasser@redhat.com>
+ * library/gdbtoolbar.itcl (add): New method. Emulate the style of the
+ toolbar iwidget commands.
+ (toolbar_show): Old name.
+ (show): New name.
+ (toolbar_create_button): Old name.
+ (create): New name.
+ (toolbar_configure_button): Old name.
+ (itemconfigure): New name.
+ (toolbar_bind_button): Old name.
+ (itembind): New name.
+ (toolbar_set_button_balloon): Old name.
+ (itemballoon): New name.
+ (toolbar_add_button): Make private.
+ (toolbar_add_label): Ditto.
+ (toolbar_add_button_separator): Ditto.
+ (toolbar_remove_button): Ditto.
+ (tollbar_insert_button): Ditto.
+ * library/srcbar.itcl: Adjust to the above syntax.
+ * library/plugins/rhabout/rhabout.itcl: Ditto.
+
+2001-02-01 Fernando Nasser <fnasser@redhat.com>
+
* library/gdbmenubar.itcl (constructor): Remove unused code.
(add): New method. Emulate the style of the menubar iwidget commands.
(menubar_show): Old name.
diff --git a/gdb/gdbtk/library/gdbtoolbar.itcl b/gdb/gdbtk/library/gdbtoolbar.itcl
index 572f44f64c6..5586f86212f 100644
--- a/gdb/gdbtk/library/gdbtoolbar.itcl
+++ b/gdb/gdbtk/library/gdbtoolbar.itcl
@@ -54,9 +54,9 @@ class GDBToolBar {
}
# ------------------------------------------------------------------
- # METHOD: toolbar_show - show the toolbar
+ # METHOD: show - show the toolbar
# ------------------------------------------------------------------
- public method toolbar_show {} {
+ public method show {} {
if {[llength $button_list]} {
eval standard_toolbar $ButtonFrame $button_list
@@ -77,7 +77,7 @@ class GDBToolBar {
# debug "$type $state \{$class_list\}"
foreach button $class_list {
# debug "$type $button $state"
- toolbar_configure_button $button -state $state
+ itemconfigure $button -state $state
}
}
}
@@ -87,6 +87,67 @@ class GDBToolBar {
####################################################################
# Methods that deal with buttons.
####################################################################
+
+ # ------------------------------------------------------------------
+ # METHOD: add - Add something.
+ # It can be a button a separator or a label.
+ #
+ # type - what we want to add
+ # args - arguments appropriate to what is being added
+ #
+ # ------------------------------------------------------------------
+ method add {type args} {
+
+ switch $type {
+ button {
+ eval toolbar_add_button $args
+ }
+ label {
+ eval toolbar_add_label $args
+ }
+ separator {
+ toolbar_add_button_separator
+ }
+ default {
+ error "Invalid item type: $type"
+ }
+ }
+ }
+
+ # ------------------------------------------------------------------
+ # PRIVATE METHOD: toolbar_add_button - Creates a button, and inserts
+ # it at the end of the button list. Call this when
+ # the toolbar is being set up, but has not yet been
+ # made.
+ # ------------------------------------------------------------------
+ private method toolbar_add_button {name class command balloon args} {
+
+ lappend button_list \
+ [eval _register_button 1 \$name \$class \$command \$balloon $args]
+
+ }
+
+ # ------------------------------------------------------------------
+ # PRIVATE METHOD: toolbar_add_label - Create a label to be inserted
+ # in the toolbar.
+ # ------------------------------------------------------------------
+
+ private method toolbar_add_label {name text balloon args} {
+ set lname $ButtonFrame.$name
+ set Buttons($name) $lname
+ set Buttons($lname,align) $button_align
+ eval label $lname -text \$text $args
+ balloon register $lname $balloon
+ lappend button_list $lname
+ }
+
+ # ------------------------------------------------------------------
+ # PRIVATE METHOD: toolbar_add_button_separator -
+ # ------------------------------------------------------------------
+
+ private method toolbar_add_button_separator {} {
+ lappend button_list -
+ }
# ------------------------------------------------------------------
# PRIVATE METHOD: _register_button - Creates all the bookkeeping
@@ -129,64 +190,45 @@ class GDBToolBar {
}
# ------------------------------------------------------------------
- # METHOD: toolbar_create_button - Creates all the bookkeeping for a button,
+ # METHOD: create - Creates all the bookkeeping for a button,
# without actually inserting it in the toolbar.
# ------------------------------------------------------------------
- method toolbar_create_button {name class command balloon args} {
+ method create {name class command balloon args} {
return [eval _register_button 0 \$name \$class \$command \$balloon $args]
}
# ------------------------------------------------------------------
- # METHOD: toolbar_add_button - Creates a button, and inserts it at the end
- # of the button list. Call this when the toolbar is being
- # set up, but has not yet been made.
- # ------------------------------------------------------------------
- method toolbar_add_button {name class command balloon args} {
-
- lappend button_list \
- [eval _register_button 1 \$name \$class \$command \$balloon $args]
-
- }
-
- # ------------------------------------------------------------------
- # METHOD: toolbar_add_button_separator -
+ # METHOD: itemconfigure -
# ------------------------------------------------------------------
-
- method toolbar_add_button_separator {} {
- lappend button_list -
+
+ method itemconfigure {button args} {
+ eval $Buttons($button) configure $args
}
# ------------------------------------------------------------------
- # METHOD: toolbar_button_right_justify -
+ # METHOD: itembind -
# ------------------------------------------------------------------
- method toolbar_button_right_justify {} {
- lappend button_list --
- set button_align "right"
+ method itembind {button key cmd} {
+ eval [list bind $Buttons($button) $key $cmd]
}
# ------------------------------------------------------------------
- # METHOD: toolbar_add_label - Create a label to be inserted in the
- # toolbar.
+ # METHOD: itemballoon -
# ------------------------------------------------------------------
-
- method toolbar_add_label {name text balloon args} {
- set lname $ButtonFrame.$name
- set Buttons($name) $lname
- set Buttons($lname,align) $button_align
- eval label $lname -text \$text $args
- balloon register $lname $balloon
- lappend button_list $lname
+
+ method itemballoon {button text} {
+ eval [list balloon register $Buttons($button) $text]
}
# ------------------------------------------------------------------
- # METHOD: toolbar_insert_button - Inserts button "name" before
+ # PRIVATE METHOD: toolbar_insert_button - Inserts button "name" before
# button "before".
# The toolbar must be made, and the buttons must have been
# created before you run this.
# ------------------------------------------------------------------
- method toolbar_insert_button {name before} {
+ private method toolbar_insert_button {name before} {
if {[string first "-" $name] == 0} {
set name [string range $name 1 end]
@@ -225,10 +267,10 @@ class GDBToolBar {
}
# ------------------------------------------------------------------
- # METHOD: toolbar_remove_button -
+ # PRIVATE METHOD: toolbar_remove_button -
# ------------------------------------------------------------------
- method toolbar_remove_button {name} {
+ private method toolbar_remove_button {name} {
if {[string first "-" $name] == 0} {
set name [string range $name 1 end]
@@ -264,27 +306,12 @@ class GDBToolBar {
}
# ------------------------------------------------------------------
- # METHOD: toolbar_configure_button -
- # ------------------------------------------------------------------
-
- method toolbar_configure_button {button args} {
- eval $Buttons($button) configure $args
- }
-
- # ------------------------------------------------------------------
- # METHOD: toolbar_bind_button -
- # ------------------------------------------------------------------
-
- method toolbar_bind_button {button key cmd} {
- eval [list bind $Buttons($button) $key $cmd]
- }
-
- # ------------------------------------------------------------------
- # METHOD: toolbar_set_button_balloon -
+ # METHOD: toolbar_button_right_justify -
# ------------------------------------------------------------------
- method toolbar_set_button_balloon {button text} {
- eval [list balloon register $Buttons($button) $text]
+ method toolbar_button_right_justify {} {
+ lappend button_list --
+ set button_align "right"
}
# ------------------------------------------------------------------
diff --git a/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl b/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
index 6295a9c853e..0f56c5d8e09 100644
--- a/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
+++ b/gdb/gdbtk/library/plugins/rhabout/rhabout.itcl
@@ -21,11 +21,11 @@ class RHAbout {
$menubar show
# Do you want a toolbar?
- $toolbar toolbar_add_button con Other {ManagedWin::open Console} \
+ $toolbar add button con Other {ManagedWin::open Console} \
"Console (Ctrl+N)" -image console_img
# The toolbar will only show up if you do this:
- $toolbar toolbar_show
+ $toolbar show
# Now, fill the childsite with some graphics and text
diff --git a/gdb/gdbtk/library/srcbar.itcl b/gdb/gdbtk/library/srcbar.itcl
index 033a629fbf6..32746b88441 100644
--- a/gdb/gdbtk/library/srcbar.itcl
+++ b/gdb/gdbtk/library/srcbar.itcl
@@ -59,7 +59,7 @@ class SrcBar {
# First give the necessary info about each button and their position
create_buttons
# Then effectively create the tollbar widget
- $Tool toolbar_show
+ $Tool show
# Pack the toolbar
pack $Tool -expand 1 -fill both
@@ -450,18 +450,18 @@ class SrcBar {
private method create_buttons {} {
global enable_external_editor
- $Tool toolbar_add_button stop None {} {}
+ $Tool add button stop None {} {}
_set_runstop
if {[pref get gdb/mode]} {
- $Tool toolbar_add_button tstop Control \
+ $Tool add button tstop Control \
[list $this do_tstop] "Start Collection" \
-image Movie_on_img
- $Tool toolbar_add_button view Other [list $this set_control_mode 1] \
+ $Tool add button view Other [list $this set_control_mode 1] \
"Switch to Browse Mode" -image watch_movie_img
- $Tool toolbar_add_button_separator
+ $Tool add separator
}
@@ -479,31 +479,31 @@ class SrcBar {
create_trace_buttons 1
}
- $Tool toolbar_add_button_separator
+ $Tool add separator
create_window_buttons
# Random bits of obscurity...
- $Tool toolbar_bind_button reg <Button-3> "ManagedWin::open RegWin -force"
- $Tool toolbar_bind_button mem <Button-3> "ManagedWin::open MemWin -force"
- $Tool toolbar_bind_button watch <Button-3> \
+ $Tool itembind reg <Button-3> "ManagedWin::open RegWin -force"
+ $Tool itembind mem <Button-3> "ManagedWin::open MemWin -force"
+ $Tool itembind watch <Button-3> \
"ManagedWin::open WatchWin -force"
- $Tool toolbar_bind_button vars <Button-3> \
+ $Tool itembind vars <Button-3> \
"ManagedWin::open LocalsWin -force"
- $Tool toolbar_add_button_separator
+ $Tool add separator
if {[info exists enable_external_editor] && $enable_external_editor} {
- $Tool toolbar_add_button edit Other [code $source edit] "Edit Source" \
+ $Tool add button edit Other [code $source edit] "Edit Source" \
-image edit_img
- $Tool toolbar_add_button_separator
+ $Tool add separator
}
- $Tool toolbar_add_label addr $address "Address" -width 10 -relief sunken \
+ $Tool add label addr $address "Address" -width 10 -relief sunken \
-bd 1 -anchor e -font src-font
- $Tool toolbar_add_label line $line "Line Number" -width 6 -relief sunken \
+ $Tool add label line $line "Line Number" -width 6 -relief sunken \
-bd 1 -anchor e -font src-font
$Tool toolbar_button_right_justify
@@ -524,26 +524,26 @@ class SrcBar {
# ------------------------------------------------------------------
private method create_control_buttons {} {
- $Tool toolbar_add_button step Control [code $source inferior step] \
+ $Tool add button step Control [code $source inferior step] \
"Step (S)" -image step_img
- $Tool toolbar_add_button next Control [code $source inferior next] \
+ $Tool add button next Control [code $source inferior next] \
"Next (N)" -image next_img
- $Tool toolbar_add_button finish Control [code $source inferior finish] \
+ $Tool add button finish Control [code $source inferior finish] \
"Finish (F)" -image finish_img
- $Tool toolbar_add_button continue Control [code $source inferior continue] \
+ $Tool add button continue Control [code $source inferior continue] \
"Continue (C)" -image continue_img
# A spacer before the assembly-level items looks good. It helps
# to indicate that these are somehow different.
- $Tool toolbar_add_button_separator
+ $Tool add separator
- $Tool toolbar_add_button stepi Control [code $source inferior stepi] \
+ $Tool add button stepi Control [code $source inferior stepi] \
"Step Asm Inst (S)" -image stepi_img
- $Tool toolbar_add_button nexti Control [code $source inferior nexti] \
+ $Tool add button nexti Control [code $source inferior nexti] \
"Next Asm Inst (N)" -image nexti_img
_set_stepi
@@ -559,9 +559,9 @@ class SrcBar {
private method create_trace_buttons {{show 0}} {
if {$show} {
- set command $Tool toolbar_add_button
+ set command $Tool add button
} else {
- set command $Tool toolbar_create_button
+ set command $Tool create
}
$command tfindstart Trace {tfind_cmd "tfind start"} "First Hit <F>" \
@@ -586,36 +586,36 @@ class SrcBar {
# ------------------------------------------------------------------
private method create_window_buttons {} {
- $Tool toolbar_add_button reg Other {ManagedWin::open RegWin} \
+ $Tool add button reg Other {ManagedWin::open RegWin} \
"Registers (Ctrl+R)" -image reg_img
- $Tool toolbar_add_button mem Other {ManagedWin::open MemWin} \
+ $Tool add button mem Other {ManagedWin::open MemWin} \
"Memory (Ctrl+M)" -image memory_img
- $Tool toolbar_add_button stack Other {ManagedWin::open StackWin} \
+ $Tool add button stack Other {ManagedWin::open StackWin} \
"Stack (Ctrl+S)" -image stack_img
- $Tool toolbar_add_button watch Other {ManagedWin::open WatchWin} \
+ $Tool add button watch Other {ManagedWin::open WatchWin} \
"Watch Expressions (Ctrl+W)" -image watch_img
- $Tool toolbar_add_button vars Other {ManagedWin::open LocalsWin} \
+ $Tool add button vars Other {ManagedWin::open LocalsWin} \
"Local Variables (Ctrl+L)" -image vars_img
if {[pref get gdb/control_target]} {
- $Tool toolbar_add_button bp Other {ManagedWin::open BpWin} \
+ $Tool add button bp Other {ManagedWin::open BpWin} \
"Breakpoints (Ctrl+B)" -image bp_img
}
if {[pref get gdb/mode]} {
- $Tool toolbar_add_button tp Other \
+ $Tool add button tp Other \
{ManagedWin::open BpWin -tracepoints 1} \
"Tracepoints (Ctrl+T)" -image tp_img
- $Tool toolbar_add_button tdump Trace {ManagedWin::open TdumpWin} \
+ $Tool add button tdump Trace {ManagedWin::open TdumpWin} \
"Tdump (Ctrl+D)" -image tdump_img
}
- $Tool toolbar_add_button con Other {ManagedWin::open Console} \
+ $Tool add button con Other {ManagedWin::open Console} \
"Console (Ctrl+N)" -image console_img
}
@@ -625,15 +625,15 @@ class SrcBar {
private method create_stack_buttons {} {
- $Tool toolbar_add_button down {Trace Control} \
+ $Tool add button down {Trace Control} \
[code $source stack down] \
"Down Stack Frame" -image down_img
- $Tool toolbar_add_button up {Trace Control} \
+ $Tool add button up {Trace Control} \
[code $source stack up] \
"Up Stack Frame" -image up_img
- $Tool toolbar_add_button bottom {Trace Control} \
+ $Tool add button bottom {Trace Control} \
[code $source stack bottom] \
"Go to Bottom of Stack" -image bottom_img
@@ -693,22 +693,22 @@ class SrcBar {
switch $runstop {
busy {
- $Tool toolbar_configure_button stop -state disabled
+ $Tool itemconfigure stop -state disabled
}
downloading {
- $Tool toolbar_configure_button stop -state normal -image stop_img \
+ $Tool itemconfigure stop -state normal -image stop_img \
-command [code $this cancel_download]
- $Tool toolbar_set_button_balloon stop "Stop"
+ $Tool itemballoon stop "Stop"
}
running {
- $Tool toolbar_configure_button stop -state normal -image stop_img \
+ $Tool itemconfigure stop -state normal -image stop_img \
-command [code $source inferior stop]
- $Tool toolbar_set_button_balloon stop "Stop"
+ $Tool itemballoon stop "Stop"
}
normal {
- $Tool toolbar_configure_button stop -state normal -image run_img \
+ $Tool itemconfigure stop -state normal -image run_img \
-command [code $source inferior run]
- $Tool toolbar_set_button_balloon stop "Run (R)"
+ $Tool itemballoon stop "Run (R)"
}
default {
dbug W "unknown state $runstop"
@@ -731,8 +731,8 @@ class SrcBar {
} else {
set state normal
}
- $Tool toolbar_configure_button stepi -state $state
- $Tool toolbar_configure_button nexti -state $state
+ $Tool itemconfigure stepi -state $state
+ $Tool itemconfigure nexti -state $state
}
}
@@ -770,9 +770,9 @@ class SrcBar {
debug "set_control_mode called with mode $mode"
if {$mode} {
set Browsing 1
- $Tool toolbar_configure_button view -image run_expt_img \
+ $Tool itemconfigure view -image run_expt_img \
-command "$this set_control_mode 0"
- $Tool toolbar_set_button_balloon view "Switch to Control mode"
+ $Tool itemballoon view "Switch to Control mode"
# Now swap out the buttons...
$Tool toolbar_swap_button_lists $Trace_control_buttons \
$Run_control_buttons
@@ -782,9 +782,9 @@ class SrcBar {
tfind_cmd {tfind none}
}
set Browsing 0
- $Tool toolbar_configure_button view -image watch_movie_img \
+ $Tool itemconfigure view -image watch_movie_img \
-command "$this set_control_mode 1"
- $Tool toolbar_set_button_balloon view "Switch to Browse mode"
+ $Tool itemballoon view "Switch to Browse mode"
# Now swap out the buttons...
$Tool toolbar_swap_button_lists $Run_control_buttons \
$Trace_control_buttons
@@ -1044,8 +1044,8 @@ Do you want to continue?" \
if {[tstart]} {
# FIXME: Must enable the Stop Collection menu item and
# disable the Start Collection item
- $Tool toolbar_configure_button tstop -image Movie_off_img
- $Tool toolbar_set_button_balloon tstop "End Collection"
+ $Tool itemconfigure tstop -image Movie_off_img
+ $Tool itemballoon tstop "End Collection"
set Collecting 1
} else {
tk_messageBox -title Error \
@@ -1060,8 +1060,8 @@ Do you want to continue?" \
if {[tstop]} {
# FIXME: Must enable the Stop Collection menu item and
# disable the Start Collection item
- $Tool toolbar_configure_button tstop -image Movie_on_img
- $Tool toolbar_set_button_balloon tstop "Start Collection"
+ $Tool itemconfigure tstop -image Movie_on_img
+ $Tool itemballoon tstop "Start Collection"
set Collecting 0
}
}
@@ -1119,12 +1119,12 @@ Do you want to continue?" \
# This holds the text that is shown in the address label.
public variable address {} {
- $Tool toolbar_configure_button addr -text $address -font src-font
+ $Tool itemconfigure addr -text $address -font src-font
}
# This holds the text that is shown in the line label.
public variable line {} {
- $Tool toolbar_configure_button line -text $line
+ $Tool itemconfigure line -text $line
}
# This holds the source window's display mode. Valid values are