public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Register Window Height Patch
@ 2000-04-03 15:03 Steven Johnson
  2000-04-03 15:32 ` James Ingham
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Johnson @ 2000-04-03 15:03 UTC (permalink / raw)
  To: insight

Attached is a patch to the Register Window Code that allow the number of
registers vertically to
be specified in the .gdbtkinit file. (Usefull if you have lots of target
registers like the PowerPC.)

This is my first patch for Insight. If I have done anything wrong, or it
is prefered to be done in a different
way, let me know.

Steven Johnson.

diff ./regwin.itb /opt/powerpc-gdb/share/gdbtcl/regwin.itb
350c350,354
<   set rows 16
---
>   set rows [pref get gdb/reg/rows]
>   if {$rows == ""} {
>     set rows 16
>     pref setd gdb/reg/rows 16
>   }



Also, with regard to the register window I find that hiding registers
does not work. Does anyone else have this problem?

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

* Re: Register Window Height Patch
  2000-04-03 15:03 Register Window Height Patch Steven Johnson
@ 2000-04-03 15:32 ` James Ingham
  2000-04-03 16:10   ` Steven Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: James Ingham @ 2000-04-03 15:32 UTC (permalink / raw)
  To: Steven Johnson; +Cc: insight

Steven,

Allowing the user to set the default # of rows is a good idea.  

Actually, better would be to have the register window able to resize
in some reasonable way.  I haven't done this yet, because I also want
to convert the window to use the TkTable widget (the one that the
Memory window uses.)  Tables made out of lots of entries draw very
slowly on Windows, whereas the TkTable widget doesn't have this
problem.  Just haven't had the time to do this yet...

Anyway, on to your patch.  First of all, you have to either call "pref
define" on your preference before you call "pref get", or call "pref
getd" to get its value.  If you call "pref get" on an undefined
preference, then you will get an error.  You probably didn't see this
because you had already put the preference in your preference file
before you put the "pref get" call in your code, which effectively
causes it to get defined.

The way we set up preferences in Insight is to put the definition of
the preference in the file prefs.tcl, using the "prefs define"
command.  We only use "pref getd" in cases when we are auto-gening
the names of preferences. 

The main reason for this is to provide a central location for all the
preferences in the program.  Otherwise it will just be too hard to
figure out all the settable things in Insight.  

Also, it would be nice at some point to add a type to the "pref
define" command so you could say:

pref define gdb/reg/rows 16 integer

and have the pref system check all pref set's & pref get's against
this type.  Centralizing this information now will allow us to play
this sort of game in the future.

Oh, by the way, there are two prefs.tcl, one in libgui/library, and
one in gdb/gdbtk/library.  The former implements the preference
system, and the latter is Insight's list of preferences, and some UI
stuff.  You want to put your pref define in the latter.

Finally, as to removing registers.  This works for me, at least,
though the set of removed registers is not remembered when you close
the register window & open it again.  This is a known bug.  We really
need to come up with a nicer UI for organizing register sets and so
on.

Jim

 > Attached is a patch to the Register Window Code that allow the number of
 > registers vertically to
 > be specified in the .gdbtkinit file. (Usefull if you have lots of target
 > registers like the PowerPC.)
 > 
 > This is my first patch for Insight. If I have done anything wrong, or it
 > is prefered to be done in a different
 > way, let me know.
 > 
 > Steven Johnson.
 > 
 > diff ./regwin.itb /opt/powerpc-gdb/share/gdbtcl/regwin.itb
 > 350c350,354
 > <   set rows 16
 > ---
 > >   set rows [pref get gdb/reg/rows]
 > >   if {$rows == ""} {
 > >     set rows 16
 > >     pref setd gdb/reg/rows 16
 > >   }
 > 
 > 
 > 
 > Also, with regard to the register window I find that hiding registers
 > does not work. Does anyone else have this problem?
 > 

-- 
++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++
Jim Ingham                                              jingham@cygnus.com
Cygnus Solutions, a Red Hat Company                      

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

* Re: Register Window Height Patch
  2000-04-03 15:32 ` James Ingham
@ 2000-04-03 16:10   ` Steven Johnson
  2000-04-03 16:44     ` James Ingham
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Johnson @ 2000-04-03 16:10 UTC (permalink / raw)
  To: James Ingham; +Cc: insight

Jim,
  I agree with you on the vertical height resizing. I did this as
something quick so that
  I can have a window higher than 16 which is too small when your CPU
has 165 registers.

  Thanks for the info, Following is a revised patch, that icorporates
your comments. 
  (Hopefully in a better format than the previous one)

Steven Johnson


diff -C2 -r ../gdb_cvs/src/gdb/gdbtk/library/prefs.tcl
src/gdb/gdbtk/library/prefs.tcl
*** ../gdb_cvs/src/gdb/gdbtk/library/prefs.tcl  Tue Mar 28 11:59:40 2000
--- src/gdb/gdbtk/library/prefs.tcl     Mon Apr  3 22:59:46 2000
***************
*** 311,314 ****
--- 311,315 ----
    # Register Window
    pref define gdb/reg/highlight_fg        blue
+   pref define gdb/reg/rows                16
  
    # Global Prefs Dialogs
diff -C2 -r ../gdb_cvs/src/gdb/gdbtk/library/regwin.itb
src/gdb/gdbtk/library/regwin.itb
*** ../gdb_cvs/src/gdb/gdbtk/library/regwin.itb Wed Mar 29 09:04:13 2000
--- src/gdb/gdbtk/library/regwin.itb    Mon Apr  3 22:59:47 2000
***************
*** 348,352 ****
  # ------------------------------------------------------------------
  body RegWin::dimensions {} {
!   set rows 16
    #    set rows [expr int(floor(sqrt($num_regs)))]
    set cols [expr {int(ceil(sqrt($num_regs)))}]
--- 348,352 ----
  # ------------------------------------------------------------------
  body RegWin::dimensions {} {
!   set rows [pref get gdb/reg/rows]
    #    set rows [expr int(floor(sqrt($num_regs)))]
    set cols [expr {int(ceil(sqrt($num_regs)))}]

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

* Re: Register Window Height Patch
  2000-04-03 16:10   ` Steven Johnson
@ 2000-04-03 16:44     ` James Ingham
  0 siblings, 0 replies; 4+ messages in thread
From: James Ingham @ 2000-04-03 16:44 UTC (permalink / raw)
  To: Steven Johnson; +Cc: James Ingham, insight

Steven,

That looks good, I will check it in.  One other point of protocol,
when you post patches, you should put a ChangeLog entry in the patch
submission.  BUT, you should not put it in the patch itself, since
ChangeLog patches almost never apply cleanly.  Instead, stick it in
the message just before the patch.

Don't worry about it this time - I will add one.  Just for the future.

Again, thanks for the patch.

Jim
 > Jim,
 >   I agree with you on the vertical height resizing. I did this as
 > something quick so that
 >   I can have a window higher than 16 which is too small when your CPU
 > has 165 registers.
 > 
 >   Thanks for the info, Following is a revised patch, that icorporates
 > your comments. 
 >   (Hopefully in a better format than the previous one)
 > 
 > Steven Johnson
 > 
 > 
 > diff -C2 -r ../gdb_cvs/src/gdb/gdbtk/library/prefs.tcl
 > src/gdb/gdbtk/library/prefs.tcl
 > *** ../gdb_cvs/src/gdb/gdbtk/library/prefs.tcl  Tue Mar 28 11:59:40 2000
 > --- src/gdb/gdbtk/library/prefs.tcl     Mon Apr  3 22:59:46 2000
 > ***************
 > *** 311,314 ****
 > --- 311,315 ----
 >     # Register Window
 >     pref define gdb/reg/highlight_fg        blue
 > +   pref define gdb/reg/rows                16
 >   
 >     # Global Prefs Dialogs
 > diff -C2 -r ../gdb_cvs/src/gdb/gdbtk/library/regwin.itb
 > src/gdb/gdbtk/library/regwin.itb
 > *** ../gdb_cvs/src/gdb/gdbtk/library/regwin.itb Wed Mar 29 09:04:13 2000
 > --- src/gdb/gdbtk/library/regwin.itb    Mon Apr  3 22:59:47 2000
 > ***************
 > *** 348,352 ****
 >   # ------------------------------------------------------------------
 >   body RegWin::dimensions {} {
 > !   set rows 16
 >     #    set rows [expr int(floor(sqrt($num_regs)))]
 >     set cols [expr {int(ceil(sqrt($num_regs)))}]
 > --- 348,352 ----
 >   # ------------------------------------------------------------------
 >   body RegWin::dimensions {} {
 > !   set rows [pref get gdb/reg/rows]
 >     #    set rows [expr int(floor(sqrt($num_regs)))]
 >     set cols [expr {int(ceil(sqrt($num_regs)))}]
 > 

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

end of thread, other threads:[~2000-04-03 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-03 15:03 Register Window Height Patch Steven Johnson
2000-04-03 15:32 ` James Ingham
2000-04-03 16:10   ` Steven Johnson
2000-04-03 16:44     ` James Ingham

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).