public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* I wish....
@ 2000-12-01 21:49 Taeho Oh
  2000-12-02 11:46 ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Taeho Oh @ 2000-12-01 21:49 UTC (permalink / raw)
  To: insight

Add new variable to the variable window
( local variable, global variable, or arbitrary memory address )
( I want to see array variable easily. )

View arbitrary variable ( or memory address ) as user defined type and add
variable window. I want to see void pointer type variable as user defined
type ( such as tcpheader struct type )

Use until command in the gui ( I use "until" command very often )

Disassemble arbitrary memory in the gui.

console windows autowrap configuration.
( vertical scroll bar is good for me but I don't want horizontal scroll bar. I want
to configure that )

--
Taeho Oh ( ohhara@4dl.com, ohhara@postech.edu )     http://ohhara.sarang.net
4DL ( 4th Dimension Laboratory )                              http://4dl.com
Postech ( Pohang University of Science and Technology )   http://postech.edu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-01 21:49 I wish Taeho Oh
@ 2000-12-02 11:46 ` Tom Tromey
  2000-12-02 14:54   ` Fernando Nasser
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2000-12-02 11:46 UTC (permalink / raw)
  To: Taeho Oh; +Cc: insight

>>>>> ">" == Taeho Oh <ohhara@4dl.com> writes:

>> Add new variable to the variable window
>> ( local variable, global variable, or arbitrary memory address )
>> ( I want to see array variable easily. )

I'm not sure I understand.  Can't you add anything you want to the
`watch expressions' window?  The `local variable' window is just
a specialized form of the watch window.

>> View arbitrary variable ( or memory address ) as user defined type
>> and add variable window. I want to see void pointer type variable
>> as user defined type ( such as tcpheader struct type )

Can't you use a cast to make this happen?
Try something like `(struct tcpheader *) p'.
Again, do this in the watch expressions window.

>> Use until command in the gui ( I use "until" command very often )

You can already do this.  Use the right button in the lefthand column
of an executable line (where the breakpoint indicator would go).  On
the popup menu you will see "Continue to here" -- that is the `until'
command.

>> Disassemble arbitrary memory in the gui.

This is definitely on the to-do list already.  Fernando was talking
about it just this week.

>> console windows autowrap configuration.
>> ( vertical scroll bar is good for me but I don't want horizontal
>> scroll bar. I want to configure that )

Could you submit a PR for this feature?
You should be able to find the bug-reporting page from the insight
home page:   http://sources.redhat.com/insight/

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-02 11:46 ` Tom Tromey
@ 2000-12-02 14:54   ` Fernando Nasser
  2000-12-02 15:27     ` Tom Tromey
  2000-12-03 18:13     ` Taeho Oh
  0 siblings, 2 replies; 12+ messages in thread
From: Fernando Nasser @ 2000-12-02 14:54 UTC (permalink / raw)
  To: tromey; +Cc: Taeho Oh, insight

Tom Tromey wrote:
> 
> >> console windows autowrap configuration.
> >> ( vertical scroll bar is good for me but I don't want horizontal
> >> scroll bar. I want to configure that )
> 
> Could you submit a PR for this feature?
> You should be able to find the bug-reporting page from the insight
> home page:   http://sources.redhat.com/insight/
> 

I believe Larry Smith has just fixed that.  If you get the current sources
(or wait for gdb/insight 5.1) you'll get the vertical scrollbar and text will
wrap around correctly.

But, by all means, thanks for the feedback.

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-02 14:54   ` Fernando Nasser
@ 2000-12-02 15:27     ` Tom Tromey
  2000-12-04 10:12       ` Fernando Nasser
  2000-12-04 10:16       ` Keith Seitz
  2000-12-03 18:13     ` Taeho Oh
  1 sibling, 2 replies; 12+ messages in thread
From: Tom Tromey @ 2000-12-02 15:27 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: Taeho Oh, insight

Fernando> I believe Larry Smith has just fixed that.  If you get the
Fernando> current sources (or wait for gdb/insight 5.1) you'll get the
Fernando> vertical scrollbar and text will wrap around correctly.

Interesting -- I missed that.

Two nits on that code:

1. Choosing `wrap text in console window' in the global preferences
dialog doesn't affect an existing console window.  Instead you have to
close the console and reopen it.  That's a bit annoying.  Is there
some larger plan covering this decision?  I'm generally in favor of
"hot" GUIs, which update in place in response to user requests.  This
takes more work to implement, but I find it nicer as a user.

2. Console::_build_win chooses `-wrap word' for the underlying text
widget.  I think `char' would be more natural.  I expect the console
to work more or less like a terminal.  With word wrap enabled, the
console occasionally makes strange choices about where to place line
breaks.

Weirdly, #1 seems hard to implement.  Options in the global preference
window directly manipulate the underlying preference values.  This
rules out the obvious implementation of adding a preference hook to
the console window which dynamically tracks the underlying options.
(I actually think this is a bug in the preference window.)

Here's a patch that makes these changes.  However, until the
preference window is fixed I think the hook code in the constructor
and the destructor should be commented out, along with a comment
explaining why.

Comments?

2000-12-02  Tom Tromey  <tromey@redhat.com>

	* console.ith (_set_wrap): Declare.
	(_update_option): Likewise.
	* console.itb (Console::constructor): Install preference hooks.
	(Console::destructor): Remove preference hooks.
	(Console::_set_wrap): New method.
	(Console::_update_option): New method.
	(Console::_build_win): Use _set_wrap.

Tom

Index: console.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
retrieving revision 1.4
diff -u -r1.4 console.itb
--- console.itb	2000/11/01 22:15:37	1.4
+++ console.itb	2000/12/02 23:25:19
@@ -22,6 +22,12 @@
   add_hook gdb_busy_hook [list $this busy]
   add_hook gdb_idle_hook [list $this idle]
   add_hook gdb_no_inferior_hook [list $this idle]
+
+  foreach option {gdb/console/wrap gdb/console/prompt_fg \
+		    gdb/console/error_fg gdb/console/font} {
+    pref add_hook $option [code $this _update_option]
+  }
+
   set gdbtk_state(console) $this
 }
 
@@ -31,26 +37,20 @@
   remove_hook gdb_busy_hook [list $this busy]
   remove_hook gdb_idle_hook [list $this idle]
   remove_hook gdb_no_inferior_hook [list $this idle]
-}
-  
-body Console::_build_win {} {
-  set wrap [pref get gdb/console/wrap]
 
-  if { $wrap } {
-    set hsm none
-  } else {
-    set hsm dynamic
+  foreach option {gdb/console/wrap gdb/console/prompt_fg \
+		    gdb/console/error_fg gdb/console/font} {
+    pref remove_hook $option [code $this _update_option]
   }
-  iwidgets::scrolledtext $itk_interior.stext -hscrollmode $hsm \
+}
+
+body Console::_build_win {} {
+  iwidgets::scrolledtext $itk_interior.stext \
     -vscrollmode dynamic -textbackground white
 
   set _twin [$itk_interior.stext component text]
 
-  if {$wrap} {
-    $_twin configure -wrap word
-  } else {
-    $_twin configure -wrap none
-  }
+  _set_wrap [pref get gdb/console/wrap]
 
   $_twin tag configure prompt_tag -foreground [pref get gdb/console/prompt_fg]
   $_twin tag configure err_tag -foreground [pref get gdb/console/error_fg]
@@ -613,4 +613,44 @@
 body Console::_reset_tab {} {
   bind $_twin <KeyPress> {}
   set _saw_tab 0
+}
+
+
+# ------------------------------------------------------------------
+#  METHOD:  _set_wrap - Set wrap mode
+# ------------------------------------------------------------------
+body Console::_set_wrap {wrap} {
+  if { $wrap } {
+    set hsm none
+    set wv char
+  } else {
+    set hsm dynamic
+    set wv none
+  }
+
+  $itk_interior.stext configure -hscrollmode $hsm
+  $_twin configure -wrap $wv
+}
+
+# ------------------------------------------------------------------
+#  METHOD:  _update_option - Update in response to preference change
+# ------------------------------------------------------------------
+body Console::_update_option {name value} {
+  switch -- $name {
+    gdb/console/wrap {
+      _set_wrap $value
+    }
+
+    gdb/console/prompt_fg {
+      $_twin tag configure prompt_tag -foreground $value
+    }
+
+    gdb/console/error_fg {
+      $_twin tag configure err_tag -foreground $value
+    }
+
+    gdb/console/font {
+      $_twin configure -font $value
+    }
+  }
 }
Index: console.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 console.ith
--- console.ith	2000/02/07 00:19:42	1.1.1.1
+++ console.ith	2000/12/02 23:25:19
@@ -61,5 +61,7 @@
     method _search_history {}
     method _rsearch_history {}
     method _setprompt {{prompt {}}}
+    method _set_wrap {wrap}
+    method _update_option {name value}
   }
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-02 14:54   ` Fernando Nasser
  2000-12-02 15:27     ` Tom Tromey
@ 2000-12-03 18:13     ` Taeho Oh
  1 sibling, 0 replies; 12+ messages in thread
From: Taeho Oh @ 2000-12-03 18:13 UTC (permalink / raw)
  To: Fernando Nasser, tromey; +Cc: Taeho Oh, insight

 Thank you very much!!

--
Taeho Oh ( ohhara@4dl.com, ohhara@postech.edu )     http://ohhara.sarang.net
4DL ( 4th Dimension Laboratory )                              http://4dl.com
Postech ( Pohang University of Science and Technology )   http://postech.edu
----- Original Message ----- 
From: "Fernando Nasser" <fnasser@cygnus.com>
To: <tromey@redhat.com>
Cc: "Taeho Oh" <ohhara@postech.edu>; <insight@sourceware.cygnus.com>
Sent: Sunday, December 03, 2000 7:53 AM
Subject: Re: I wish....


> Tom Tromey wrote:
> > 
> > >> console windows autowrap configuration.
> > >> ( vertical scroll bar is good for me but I don't want horizontal
> > >> scroll bar. I want to configure that )
> > 
> > Could you submit a PR for this feature?
> > You should be able to find the bug-reporting page from the insight
> > home page:   http://sources.redhat.com/insight/
> > 
> 
> I believe Larry Smith has just fixed that.  If you get the current sources
> (or wait for gdb/insight 5.1) you'll get the vertical scrollbar and text will
> wrap around correctly.
> 
> But, by all means, thanks for the feedback.
> 
> -- 
> Fernando Nasser
> Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-02 15:27     ` Tom Tromey
@ 2000-12-04 10:12       ` Fernando Nasser
  2000-12-04 10:18         ` Syd Polk
  2000-12-04 10:16       ` Keith Seitz
  1 sibling, 1 reply; 12+ messages in thread
From: Fernando Nasser @ 2000-12-04 10:12 UTC (permalink / raw)
  To: tromey; +Cc: Taeho Oh, insight, Jim Ingham

Tom Tromey wrote:
> 
> Fernando> I believe Larry Smith has just fixed that.  If you get the
> Fernando> current sources (or wait for gdb/insight 5.1) you'll get the
> Fernando> vertical scrollbar and text will wrap around correctly.
> 
> Interesting -- I missed that.
> 
> Two nits on that code:
> 
> 1. Choosing `wrap text in console window' in the global preferences
> dialog doesn't affect an existing console window.  Instead you have to
> close the console and reopen it.  That's a bit annoying.  Is there
> some larger plan covering this decision?  I'm generally in favor of
> "hot" GUIs, which update in place in response to user requests.  This
> takes more work to implement, but I find it nicer as a user.
> 

I agree.  But Larry had a limited amount of time to fix this as there were
many other things to do.

The idea is that implementing something that does some improvement is 
always good. Eventually someone will want something fancier and
contribute a patch.


> 2. Console::_build_win chooses `-wrap word' for the underlying text
> widget.  I think `char' would be more natural.  I expect the console
> to work more or less like a terminal.  With word wrap enabled, the
> console occasionally makes strange choices about where to place line
> breaks.
> 

Yes, it should be "char".  You can go ahead change it if you want.


> Weirdly, #1 seems hard to implement.  Options in the global preference
> window directly manipulate the underlying preference values.  This
> rules out the obvious implementation of adding a preference hook to
> the console window which dynamically tracks the underlying options.
> (I actually think this is a bug in the preference window.)
> 
> Here's a patch that makes these changes.  However, until the
> preference window is fixed I think the hook code in the constructor
> and the destructor should be commented out, along with a comment
> explaining why.
> 
As I was saying... :-)

> Comments?
> 

It would be nice to have it working.  Could you please open a PR?

W.r.t the checking in of your patch, we need to consult the other maintainers.

We haven't established a police regarding if we check in the new code
commented out as you suggested of if we just keep it with the PR.
In gdb core land it would be the latter, but I particularly think that
in our case, at the least in the present moment, it would be better to
have it checked in.  It would get documented in CVS and would help people
who are working in improving the code to see it in place.

Jim and Syd, which approach do you prefer, the former or the latter? 




> 2000-12-02  Tom Tromey  <tromey@redhat.com>
> 
>         * console.ith (_set_wrap): Declare.
>         (_update_option): Likewise.
>         * console.itb (Console::constructor): Install preference hooks.
>         (Console::destructor): Remove preference hooks.
>         (Console::_set_wrap): New method.
>         (Console::_update_option): New method.
>         (Console::_build_win): Use _set_wrap.
> 
> Tom
> 
> Index: console.itb
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
> retrieving revision 1.4
> diff -u -r1.4 console.itb
> --- console.itb 2000/11/01 22:15:37     1.4
> +++ console.itb 2000/12/02 23:25:19
> @@ -22,6 +22,12 @@
>    add_hook gdb_busy_hook [list $this busy]
>    add_hook gdb_idle_hook [list $this idle]
>    add_hook gdb_no_inferior_hook [list $this idle]
> +
> +  foreach option {gdb/console/wrap gdb/console/prompt_fg \
> +                   gdb/console/error_fg gdb/console/font} {
> +    pref add_hook $option [code $this _update_option]
> +  }
> +
>    set gdbtk_state(console) $this
>  }
> 
> @@ -31,26 +37,20 @@
>    remove_hook gdb_busy_hook [list $this busy]
>    remove_hook gdb_idle_hook [list $this idle]
>    remove_hook gdb_no_inferior_hook [list $this idle]
> -}
> -
> -body Console::_build_win {} {
> -  set wrap [pref get gdb/console/wrap]
> 
> -  if { $wrap } {
> -    set hsm none
> -  } else {
> -    set hsm dynamic
> +  foreach option {gdb/console/wrap gdb/console/prompt_fg \
> +                   gdb/console/error_fg gdb/console/font} {
> +    pref remove_hook $option [code $this _update_option]
>    }
> -  iwidgets::scrolledtext $itk_interior.stext -hscrollmode $hsm \
> +}
> +
> +body Console::_build_win {} {
> +  iwidgets::scrolledtext $itk_interior.stext \
>      -vscrollmode dynamic -textbackground white
> 
>    set _twin [$itk_interior.stext component text]
> 
> -  if {$wrap} {
> -    $_twin configure -wrap word
> -  } else {
> -    $_twin configure -wrap none
> -  }
> +  _set_wrap [pref get gdb/console/wrap]
> 
>    $_twin tag configure prompt_tag -foreground [pref get gdb/console/prompt_fg]
>    $_twin tag configure err_tag -foreground [pref get gdb/console/error_fg]
> @@ -613,4 +613,44 @@
>  body Console::_reset_tab {} {
>    bind $_twin <KeyPress> {}
>    set _saw_tab 0
> +}
> +
> +
> +# ------------------------------------------------------------------
> +#  METHOD:  _set_wrap - Set wrap mode
> +# ------------------------------------------------------------------
> +body Console::_set_wrap {wrap} {
> +  if { $wrap } {
> +    set hsm none
> +    set wv char
> +  } else {
> +    set hsm dynamic
> +    set wv none
> +  }
> +
> +  $itk_interior.stext configure -hscrollmode $hsm
> +  $_twin configure -wrap $wv
> +}
> +
> +# ------------------------------------------------------------------
> +#  METHOD:  _update_option - Update in response to preference change
> +# ------------------------------------------------------------------
> +body Console::_update_option {name value} {
> +  switch -- $name {
> +    gdb/console/wrap {
> +      _set_wrap $value
> +    }
> +
> +    gdb/console/prompt_fg {
> +      $_twin tag configure prompt_tag -foreground $value
> +    }
> +
> +    gdb/console/error_fg {
> +      $_twin tag configure err_tag -foreground $value
> +    }
> +
> +    gdb/console/font {
> +      $_twin configure -font $value
> +    }
> +  }
>  }
> Index: console.ith
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 console.ith
> --- console.ith 2000/02/07 00:19:42     1.1.1.1
> +++ console.ith 2000/12/02 23:25:19
> @@ -61,5 +61,7 @@
>      method _search_history {}
>      method _rsearch_history {}
>      method _setprompt {{prompt {}}}
> +    method _set_wrap {wrap}
> +    method _update_option {name value}
>    }
>  }

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-02 15:27     ` Tom Tromey
  2000-12-04 10:12       ` Fernando Nasser
@ 2000-12-04 10:16       ` Keith Seitz
  2000-12-04 11:10         ` Tom Tromey
  1 sibling, 1 reply; 12+ messages in thread
From: Keith Seitz @ 2000-12-04 10:16 UTC (permalink / raw)
  To: tromey; +Cc: insight

Tom Tromey wrote:
> 
> Weirdly, #1 seems hard to implement.  Options in the global preference
> window directly manipulate the underlying preference values.  This
> rules out the obvious implementation of adding a preference hook to
> the console window which dynamically tracks the underlying options.
> (I actually think this is a bug in the preference window.)

OOOHHHHHH. Is THAT how it's supposed to work? I never did figure that
out. The convention I noticed somewhere was to create a "reconfig"
method which would get called whenever ANY preference changed. Not very
nice, but it worked...

You're right, though: we need to allow the preference hooks to run. It
would be SO much easier. The whole preferences code is amongst the
oldest (== really screwed up). I see that Martin continued on this silly
route when he did the managedwin rewrite...

Sigh.
Keith

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-04 10:12       ` Fernando Nasser
@ 2000-12-04 10:18         ` Syd Polk
  2000-12-04 11:15           ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Syd Polk @ 2000-12-04 10:18 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: tromey, Taeho Oh, insight, Jim Ingham

 
> W.r.t the checking in of your patch, we need to consult the other maintainers.
> 
> We haven't established a police regarding if we check in the new code
> commented out as you suggested of if we just keep it with the PR.
> In gdb core land it would be the latter, but I particularly think that
> in our case, at the least in the present moment, it would be better to
> have it checked in.  It would get documented in CVS and would help people
> who are working in improving the code to see it in place.
> 
> Jim and Syd, which approach do you prefer, the former or the latter?

In general, I don't like commented out code. Even if the code works for
something and left commented out for a reason, it is a strong candidate
for bit rot.

However, if the developer will never see the code because it is buried
in a PR, then it is better to leave a detailed comment in the code with
an explanation as to what has to happen for the code to make it in.
 
> > 2000-12-02  Tom Tromey  <tromey@redhat.com>
> >
> >         * console.ith (_set_wrap): Declare.
> >         (_update_option): Likewise.
> >         * console.itb (Console::constructor): Install preference hooks.
> >         (Console::destructor): Remove preference hooks.
> >         (Console::_set_wrap): New method.
> >         (Console::_update_option): New method.
> >         (Console::_build_win): Use _set_wrap.
> >
> > Tom
> >
> > Index: console.itb
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
> > retrieving revision 1.4
> > diff -u -r1.4 console.itb
> > --- console.itb 2000/11/01 22:15:37     1.4
> > +++ console.itb 2000/12/02 23:25:19
> > @@ -22,6 +22,12 @@
> >    add_hook gdb_busy_hook [list $this busy]
> >    add_hook gdb_idle_hook [list $this idle]
> >    add_hook gdb_no_inferior_hook [list $this idle]
> > +
> > +  foreach option {gdb/console/wrap gdb/console/prompt_fg \
> > +                   gdb/console/error_fg gdb/console/font} {
> > +    pref add_hook $option [code $this _update_option]
> > +  }
> > +
> >    set gdbtk_state(console) $this
> >  }
> >
> > @@ -31,26 +37,20 @@
> >    remove_hook gdb_busy_hook [list $this busy]
> >    remove_hook gdb_idle_hook [list $this idle]
> >    remove_hook gdb_no_inferior_hook [list $this idle]
> > -}
> > -
> > -body Console::_build_win {} {
> > -  set wrap [pref get gdb/console/wrap]
> >
> > -  if { $wrap } {
> > -    set hsm none
> > -  } else {
> > -    set hsm dynamic
> > +  foreach option {gdb/console/wrap gdb/console/prompt_fg \
> > +                   gdb/console/error_fg gdb/console/font} {
> > +    pref remove_hook $option [code $this _update_option]
> >    }
> > -  iwidgets::scrolledtext $itk_interior.stext -hscrollmode $hsm \
> > +}
> > +
> > +body Console::_build_win {} {
> > +  iwidgets::scrolledtext $itk_interior.stext \
> >      -vscrollmode dynamic -textbackground white
> >
> >    set _twin [$itk_interior.stext component text]
> >
> > -  if {$wrap} {
> > -    $_twin configure -wrap word
> > -  } else {
> > -    $_twin configure -wrap none
> > -  }
> > +  _set_wrap [pref get gdb/console/wrap]
> >
> >    $_twin tag configure prompt_tag -foreground [pref get gdb/console/prompt_fg]
> >    $_twin tag configure err_tag -foreground [pref get gdb/console/error_fg]
> > @@ -613,4 +613,44 @@
> >  body Console::_reset_tab {} {
> >    bind $_twin <KeyPress> {}
> >    set _saw_tab 0
> > +}
> > +
> > +
> > +# ------------------------------------------------------------------
> > +#  METHOD:  _set_wrap - Set wrap mode
> > +# ------------------------------------------------------------------
> > +body Console::_set_wrap {wrap} {
> > +  if { $wrap } {
> > +    set hsm none
> > +    set wv char
> > +  } else {
> > +    set hsm dynamic
> > +    set wv none
> > +  }
> > +
> > +  $itk_interior.stext configure -hscrollmode $hsm
> > +  $_twin configure -wrap $wv
> > +}
> > +
> > +# ------------------------------------------------------------------
> > +#  METHOD:  _update_option - Update in response to preference change
> > +# ------------------------------------------------------------------
> > +body Console::_update_option {name value} {
> > +  switch -- $name {
> > +    gdb/console/wrap {
> > +      _set_wrap $value
> > +    }
> > +
> > +    gdb/console/prompt_fg {
> > +      $_twin tag configure prompt_tag -foreground $value
> > +    }
> > +
> > +    gdb/console/error_fg {
> > +      $_twin tag configure err_tag -foreground $value
> > +    }
> > +
> > +    gdb/console/font {
> > +      $_twin configure -font $value
> > +    }
> > +  }
> >  }
> > Index: console.ith
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
> > retrieving revision 1.1.1.1
> > diff -u -r1.1.1.1 console.ith
> > --- console.ith 2000/02/07 00:19:42     1.1.1.1
> > +++ console.ith 2000/12/02 23:25:19
> > @@ -61,5 +61,7 @@
> >      method _search_history {}
> >      method _rsearch_history {}
> >      method _setprompt {{prompt {}}}
> > +    method _set_wrap {wrap}
> > +    method _update_option {name value}
> >    }
> >  }
> 
> --
> Fernando Nasser
> Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-04 10:16       ` Keith Seitz
@ 2000-12-04 11:10         ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2000-12-04 11:10 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

Keith> OOOHHHHHH. Is THAT how it's supposed to work? I never did
Keith> figure that out.

Yeah.  gdb always worked differently from the other tools using the
libgui preference code, though.

Keith> The convention I noticed somewhere was to create a "reconfig"
Keith> method which would get called whenever ANY preference
Keith> changed. Not very nice, but it worked...

I never liked this.

Looking at the global preferences a bit more, I notice:

* The Cancel button doesn't really cancel all the option settings.
  It cancels some of them.
  (It isn't even clear to me that "Cancel" should change the settings
  anyway.  Maybe the button should just be "Close"?)

* The "Tracing features" button's text changes depending on whether
  the checkbutton is selected.  This really confused me until I looked
  at the code.

I don't have much time left on Insight hacking, and I don't think the
preferences window is as important as the other things on my wish
list, so I'm just going to submit a PR explaining what (IMO, of
course) is broken.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-04 10:18         ` Syd Polk
@ 2000-12-04 11:15           ` Tom Tromey
  2000-12-04 11:17             ` Syd Polk
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2000-12-04 11:15 UTC (permalink / raw)
  To: Syd Polk; +Cc: Fernando Nasser, Taeho Oh, insight, Jim Ingham

Syd> In general, I don't like commented out code. Even if the code
Syd> works for something and left commented out for a reason, it is a
Syd> strong candidate for bit rot.

I agree.

Syd> However, if the developer will never see the code because it is
Syd> buried in a PR, then it is better to leave a detailed comment in
Syd> the code with an explanation as to what has to happen for the
Syd> code to make it in.

How about the appended?
If you'd prefer that I just delete the code I will just check in a
much smaller fix that changes the wrap mode to `char'.

2000-12-02  Tom Tromey  <tromey@redhat.com>

	* console.ith (_set_wrap): Declare.
	(_update_option): Likewise.
	* console.itb (Console::constructor): Install preference hooks
	(commented out pending a bug fix).
	(Console::destructor): Remove preference hooks.
	(Console::_set_wrap): New method.
	(Console::_update_option): New method.
	(Console::_build_win): Use _set_wrap.

Tom

Index: library/console.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
retrieving revision 1.4
diff -u -r1.4 console.itb
--- console.itb	2000/11/01 22:15:37	1.4
+++ console.itb	2000/12/04 19:14:38
@@ -22,6 +22,18 @@
   add_hook gdb_busy_hook [list $this busy]
   add_hook gdb_idle_hook [list $this idle]
   add_hook gdb_no_inferior_hook [list $this idle]
+
+  # Right now the preferences window directly uses preference
+  # variables.  This means that if we track the preference changes
+  # here, things will appear weird to the user -- the console window
+  # will change before the user chooses Accpet in the prefs window.
+  # Until the preference window is fixed we can't enable this
+  # dynamic tracking.  FIXME.
+  # foreach option {gdb/console/wrap gdb/console/prompt_fg \
+  #		    gdb/console/error_fg gdb/console/font} {
+  #  pref add_hook $option [code $this _update_option]
+  # }
+
   set gdbtk_state(console) $this
 }
 
@@ -31,26 +43,20 @@
   remove_hook gdb_busy_hook [list $this busy]
   remove_hook gdb_idle_hook [list $this idle]
   remove_hook gdb_no_inferior_hook [list $this idle]
+
+  # foreach option {gdb/console/wrap gdb/console/prompt_fg \
+  # 		    gdb/console/error_fg gdb/console/font} {
+  #   pref remove_hook $option [code $this _update_option]
+  # }
 }
-  
-body Console::_build_win {} {
-  set wrap [pref get gdb/console/wrap]
 
-  if { $wrap } {
-    set hsm none
-  } else {
-    set hsm dynamic
-  }
-  iwidgets::scrolledtext $itk_interior.stext -hscrollmode $hsm \
+body Console::_build_win {} {
+  iwidgets::scrolledtext $itk_interior.stext \
     -vscrollmode dynamic -textbackground white
 
   set _twin [$itk_interior.stext component text]
 
-  if {$wrap} {
-    $_twin configure -wrap word
-  } else {
-    $_twin configure -wrap none
-  }
+  _set_wrap [pref get gdb/console/wrap]
 
   $_twin tag configure prompt_tag -foreground [pref get gdb/console/prompt_fg]
   $_twin tag configure err_tag -foreground [pref get gdb/console/error_fg]
@@ -613,4 +619,44 @@
 body Console::_reset_tab {} {
   bind $_twin <KeyPress> {}
   set _saw_tab 0
+}
+
+
+# ------------------------------------------------------------------
+#  METHOD:  _set_wrap - Set wrap mode
+# ------------------------------------------------------------------
+body Console::_set_wrap {wrap} {
+  if { $wrap } {
+    set hsm none
+    set wv char
+  } else {
+    set hsm dynamic
+    set wv none
+  }
+
+  $itk_interior.stext configure -hscrollmode $hsm
+  $_twin configure -wrap $wv
+}
+
+# ------------------------------------------------------------------
+#  METHOD:  _update_option - Update in response to preference change
+# ------------------------------------------------------------------
+body Console::_update_option {name value} {
+  switch -- $name {
+    gdb/console/wrap {
+      _set_wrap $value
+    }
+
+    gdb/console/prompt_fg {
+      $_twin tag configure prompt_tag -foreground $value
+    }
+
+    gdb/console/error_fg {
+      $_twin tag configure err_tag -foreground $value
+    }
+
+    gdb/console/font {
+      $_twin configure -font $value
+    }
+  }
 }
Index: library/console.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 console.ith
--- console.ith	2000/02/07 00:19:42	1.1.1.1
+++ console.ith	2000/12/04 19:14:38
@@ -61,5 +61,7 @@
     method _search_history {}
     method _rsearch_history {}
     method _setprompt {{prompt {}}}
+    method _set_wrap {wrap}
+    method _update_option {name value}
   }
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-04 11:15           ` Tom Tromey
@ 2000-12-04 11:17             ` Syd Polk
  2000-12-04 11:26               ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Syd Polk @ 2000-12-04 11:17 UTC (permalink / raw)
  To: tromey; +Cc: Fernando Nasser, Taeho Oh, insight, Jim Ingham

I like this.

Tom Tromey wrote:
> 
> Syd> In general, I don't like commented out code. Even if the code
> Syd> works for something and left commented out for a reason, it is a
> Syd> strong candidate for bit rot.
> 
> I agree.
> 
> Syd> However, if the developer will never see the code because it is
> Syd> buried in a PR, then it is better to leave a detailed comment in
> Syd> the code with an explanation as to what has to happen for the
> Syd> code to make it in.
> 
> How about the appended?
> If you'd prefer that I just delete the code I will just check in a
> much smaller fix that changes the wrap mode to `char'.
> 
> 2000-12-02  Tom Tromey  <tromey@redhat.com>
> 
>         * console.ith (_set_wrap): Declare.
>         (_update_option): Likewise.
>         * console.itb (Console::constructor): Install preference hooks
>         (commented out pending a bug fix).
>         (Console::destructor): Remove preference hooks.
>         (Console::_set_wrap): New method.
>         (Console::_update_option): New method.
>         (Console::_build_win): Use _set_wrap.
> 
> Tom
> 
> Index: library/console.itb
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/console.itb,v
> retrieving revision 1.4
> diff -u -r1.4 console.itb
> --- console.itb 2000/11/01 22:15:37     1.4
> +++ console.itb 2000/12/04 19:14:38
> @@ -22,6 +22,18 @@
>    add_hook gdb_busy_hook [list $this busy]
>    add_hook gdb_idle_hook [list $this idle]
>    add_hook gdb_no_inferior_hook [list $this idle]
> +
> +  # Right now the preferences window directly uses preference
> +  # variables.  This means that if we track the preference changes
> +  # here, things will appear weird to the user -- the console window
> +  # will change before the user chooses Accpet in the prefs window.
> +  # Until the preference window is fixed we can't enable this
> +  # dynamic tracking.  FIXME.
> +  # foreach option {gdb/console/wrap gdb/console/prompt_fg \
> +  #                gdb/console/error_fg gdb/console/font} {
> +  #  pref add_hook $option [code $this _update_option]
> +  # }
> +
>    set gdbtk_state(console) $this
>  }
> 
> @@ -31,26 +43,20 @@
>    remove_hook gdb_busy_hook [list $this busy]
>    remove_hook gdb_idle_hook [list $this idle]
>    remove_hook gdb_no_inferior_hook [list $this idle]
> +
> +  # foreach option {gdb/console/wrap gdb/console/prompt_fg \
> +  #                gdb/console/error_fg gdb/console/font} {
> +  #   pref remove_hook $option [code $this _update_option]
> +  # }
>  }
> -
> -body Console::_build_win {} {
> -  set wrap [pref get gdb/console/wrap]
> 
> -  if { $wrap } {
> -    set hsm none
> -  } else {
> -    set hsm dynamic
> -  }
> -  iwidgets::scrolledtext $itk_interior.stext -hscrollmode $hsm \
> +body Console::_build_win {} {
> +  iwidgets::scrolledtext $itk_interior.stext \
>      -vscrollmode dynamic -textbackground white
> 
>    set _twin [$itk_interior.stext component text]
> 
> -  if {$wrap} {
> -    $_twin configure -wrap word
> -  } else {
> -    $_twin configure -wrap none
> -  }
> +  _set_wrap [pref get gdb/console/wrap]
> 
>    $_twin tag configure prompt_tag -foreground [pref get gdb/console/prompt_fg]
>    $_twin tag configure err_tag -foreground [pref get gdb/console/error_fg]
> @@ -613,4 +619,44 @@
>  body Console::_reset_tab {} {
>    bind $_twin <KeyPress> {}
>    set _saw_tab 0
> +}
> +
> +
> +# ------------------------------------------------------------------
> +#  METHOD:  _set_wrap - Set wrap mode
> +# ------------------------------------------------------------------
> +body Console::_set_wrap {wrap} {
> +  if { $wrap } {
> +    set hsm none
> +    set wv char
> +  } else {
> +    set hsm dynamic
> +    set wv none
> +  }
> +
> +  $itk_interior.stext configure -hscrollmode $hsm
> +  $_twin configure -wrap $wv
> +}
> +
> +# ------------------------------------------------------------------
> +#  METHOD:  _update_option - Update in response to preference change
> +# ------------------------------------------------------------------
> +body Console::_update_option {name value} {
> +  switch -- $name {
> +    gdb/console/wrap {
> +      _set_wrap $value
> +    }
> +
> +    gdb/console/prompt_fg {
> +      $_twin tag configure prompt_tag -foreground $value
> +    }
> +
> +    gdb/console/error_fg {
> +      $_twin tag configure err_tag -foreground $value
> +    }
> +
> +    gdb/console/font {
> +      $_twin configure -font $value
> +    }
> +  }
>  }
> Index: library/console.ith
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/console.ith,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 console.ith
> --- console.ith 2000/02/07 00:19:42     1.1.1.1
> +++ console.ith 2000/12/04 19:14:38
> @@ -61,5 +61,7 @@
>      method _search_history {}
>      method _rsearch_history {}
>      method _setprompt {{prompt {}}}
> +    method _set_wrap {wrap}
> +    method _update_option {name value}
>    }
>  }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: I wish....
  2000-12-04 11:17             ` Syd Polk
@ 2000-12-04 11:26               ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2000-12-04 11:26 UTC (permalink / raw)
  To: Syd Polk; +Cc: Fernando Nasser, Taeho Oh, insight, Jim Ingham

Syd> I like this.

Thanks, I'm taking that as approval and checking it in.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2000-12-04 11:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-01 21:49 I wish Taeho Oh
2000-12-02 11:46 ` Tom Tromey
2000-12-02 14:54   ` Fernando Nasser
2000-12-02 15:27     ` Tom Tromey
2000-12-04 10:12       ` Fernando Nasser
2000-12-04 10:18         ` Syd Polk
2000-12-04 11:15           ` Tom Tromey
2000-12-04 11:17             ` Syd Polk
2000-12-04 11:26               ` Tom Tromey
2000-12-04 10:16       ` Keith Seitz
2000-12-04 11:10         ` Tom Tromey
2000-12-03 18:13     ` Taeho Oh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).