This is the mail archive of the insight@sourceware.cygnus.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Register Window Height Patch


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                      

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]