This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Patch: view menu -vs- multiple source windows
- To: Syd Polk <spolk at redhat dot com>
- Subject: Re: Patch: view menu -vs- multiple source windows
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Thu, 07 Dec 2000 07:36:21 +0000
- CC: tromey at redhat dot com, Insight List <insight at sourceware dot cygnus dot com>
- Organization: Red Hat Canada Ltd. - Toronto
- References: <87ofypnleq.fsf@creche.redhat.com> <3A2F11D6.A42B4F69@redhat.com>
Unfortunately this change applies to an obsolete code.
Tom was not around when we were talking about some code restructuring
and I was not aware he was going to change anything in there.
I will try to incorporate this feature in the new code, but it may not
be in the first version.
Sorry,
Fernando
Syd Polk wrote:
>
> I still think we need to use
>
> if {[string compare $foo $bar] == 0} {
>
> rather than
>
> if {$foo == $bar} {
>
> The reason is that if foo or bar start with "0" or "0x" they will be
> converted to integers during the compare, which can generate incorrect
> results.
>
> However, if the rest of gdbtk does this, then I am fine. This is a
> really cool feature. Thanks, Tom.
>
> Tom Tromey wrote:
> >
> > This patch adds support for multiple source windows to the View menu.
> > It requires my earlier multiple source window patch (not yet
> > approved).
> >
> > The idea here is that each available source window is listed on the
> > view menu. Also, an "Open Another Source Window" command is added to
> > the view menu.
> >
> > 2000-12-06 Tom Tromey <tromey@redhat.com>
> >
> > * toolbar.tcl (create_view_menu): Call _post_menu before View menu
> > is posted. Added command to open another source window.
> > (_post_menu): New method.
> >
> > Tom
> >
> > Index: toolbar.tcl
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbtk/library/toolbar.tcl,v
> > retrieving revision 1.1.1.1
> > diff -u -r1.1.1.1 toolbar.tcl
> > --- toolbar.tcl 2000/02/07 00:19:42 1.1.1.1
> > +++ toolbar.tcl 2000/12/06 23:53:57
> > @@ -605,7 +605,8 @@
> > # ------------------------------------------------------------------
> >
> > method create_view_menu {} {
> > - new_menu view "View" 0
> > + set vmenu [new_menu view "View" 0]
> > + $vmenu configure -postcommand [code $this _post_menu $vmenu]
> >
> > add_menu_command Other "Stack" {ManagedWin::open StackWin} \
> > -underline 0 -accelerator "Ctrl+S"
> > @@ -638,7 +639,7 @@
> >
> > add_menu_command Other "Console" {ManagedWin::open Console} \
> > -underline 2 -accelerator "Ctrl+N"
> > -
> > +
> > add_menu_command Other "Function Browser" {ManagedWin::open BrowserWin} \
> > -underline 1 -accelerator "Ctrl+F"
> > add_menu_command Other "Thread List" {ManagedWin::open ProcessWin} \
> > @@ -648,6 +649,17 @@
> > add_menu_command Other "Debug Window" {ManagedWin::open DebugWin} \
> > -underline 3 -accelerator "Ctrl+U"
> > }
> > +
> > + # Note that the layout from here down is relied on in _post_menu.
> > + add_menu_separator
> > + # This is a dummy entry that will be overwritten when the menu is
> > + # posted for the first time.
> > + add_menu_command Other "Source Window" \
> > + {ManagedWin::open SrcWin}
> > +
> > + add_menu_separator
> > + add_menu_command Other "Open Another Source Window" \
> > + {ManagedWin::open SrcWin -force} -underline 0
> > }
> >
> > # ------------------------------------------------------------------
> > @@ -771,6 +783,43 @@
> >
> > global gdb_kod_cmd
> > set gdb_kod_cmd $value
> > + }
> > + }
> > +
> > + # ------------------------------------------------------------------
> > + # METHOD: _post_menu - Called when View menu posted
> > + # ------------------------------------------------------------------
> > + method _post_menu {menu} {
> > + # We search from the bottom of the window. Source window entries
> > + # appear between the last two separators.
> > + set index [$menu index end]
> > + set firstSep -1
> > + set lastSep -1
> > + while {$index >= 0} {
> > + if {[$menu type $index] == "separator"} {
> > + if {$lastSep == -1} {
> > + set lastSep [expr {$index - 1}]
> > + } else {
> > + set firstSep [expr {$index + 1}]
> > + break
> > + }
> > + }
> > + incr index -1
> > + }
> > +
> > + if {$index == -1} {
> > + error "programming error in _post_menu"
> > + }
> > +
> > + $menu delete $firstSep $lastSep
> > + foreach src [ManagedWin::find SrcWin] {
> > + set file [$src get_file]
> > + if {$file == ""} {
> > + set file "Source Window"
> > + }
> > + $menu insert $firstSep command -label $file \
> > + -command [list $src reveal]
> > + incr firstSep
> > }
> > }
> >
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9