public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Memory Preferences Now Permanent
@ 2000-11-03 17:30 Larry Smith
  2000-11-06 11:05 ` Syd Polk
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Smith @ 2000-11-03 17:30 UTC (permalink / raw)
  To: insight

This patch adds code to save and restore the preferences selected
in displaying memory, and fixes a bug that prevented one from
changing the color of the memory display window.

2000-11-03  Larry Smith  <lsmith@redhat.com>
        * mempref.itb (constructor): Added code to retrieve
        memory display preferences.
        * mempref.itb (build_win): Added code to retrieve
        memory display preferences, corrected bug preventing
        display of color background preference for memory display.
        * mempref.itb (apply): Added code to save new preferences.
        * memwin.itb (buildwin): added retrieval of memory display
        preferences
        * prefs.tcl (pref_save): added new memory section for memory
        display preferences.
        * prefs.tcl (pref_set_defaults): added defaults for new memory
        section

Index: mempref.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/mempref.itb,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mempref.itb
--- mempref.itb	2000/02/07 00:19:42	1.1.1.1
+++ mempref.itb	2000/11/04 01:27:19
@@ -10,8 +10,8 @@
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
+#
 
-
 # ------------------------------------------------------------------
 #  METHOD:  constructor - build the dialog
 # ------------------------------------------------------------------
@@ -20,7 +20,15 @@
   window_name "Memory Preferences"
 
   eval itk_initialize $args
-  
+
+  set size [ pref get gdb/memory/size ]
+  set format [ pref get gdb/memory/format ]
+  set numbytes [ pref get gdb/memory/numbytes ]
+  set bpr [ pref get gdb/memory/bytesperrow ]
+  set ascii [ pref get gdb/memory/dispascii ]
+  set ascii_char [ pref get gdb/memory/ctrlchar ]
+  set color [pref get gdb/memory/color ]
+
   if {$float_size == ""} {
     set float_size [gdb_eval sizeof(float)]
     set double_size [gdb_eval sizeof(double)]
@@ -144,10 +152,12 @@
   # MISC
   Labelledframe $f.1 -anchor nw -text "Miscellaneous"
   set fr [$f.1 get_frame] 
+
   frame $fr.1
   label $fr.1.plabel -height 1 -width 1 -bg $color -relief raised  
   set Widgets(b-color) [button $fr.1.pc -text "Change color..."  \
 			  -command [code $this pick $fr.1.plabel]]
+
   grid $fr.1.plabel $fr.1.pc
   frame $fr.2
   label $fr.2.l -text "Bytes Per Row "
@@ -169,10 +179,13 @@
   frame $fr.4
   set Widgets(e-ascii_char) [entry $fr.4.e -textvariable [scope gascii_char] -width 1]
   label $fr.4.l -text "Control Char"
-  grid $fr.4.e $fr.4.l -sticky we
-  grid $fr.2 x $fr.3 -sticky w -padx 4
-  grid $fr.4 -sticky w -padx 4
-  grid columnconfigure $fr 1 -weight 1
+  grid $fr.4.e -row 0 -column 0 -ipadx 10
+  grid $fr.4.l -row 0 -column 1 -sticky e -ipadx 10
+  grid $fr.2 -row 1 -column 0 -sticky e
+  grid $fr.3 -row 1 -column 1 -sticky w -ipadx 8
+  grid $fr.1 -row 2 -column 0 -sticky e -ipadx 10
+  grid $fr.4 -row 2 -column 1 -sticky w -ipadx 10
+  # grid columnconfigure $fr 1 -weight 1
 
   grid $f.f1 -padx 5 -pady 6 -sticky news
   grid $f.f2 -padx 5 -pady 6 -sticky news
@@ -328,6 +341,16 @@
     -color $color
   
   $win reconfig
+
+  pref set gdb/memory/size $size
+  pref set gdb/memory/format $format
+  pref set gdb/memory/numbytes $numbytes
+  pref set gdb/memory/bytesperrow $gbpr
+  pref set gdb/memory/dispascii $gascii
+  pref set gdb/memory/ctrlchar $gascii_char
+  pref set gdb/memory/color $color
+
+  pref_save
 
   gdbtk_idle
   idle
Index: memwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.itb,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 memwin.itb
--- memwin.itb	2000/02/07 00:19:42	1.1.1.1
+++ memwin.itb	2000/11/04 01:27:19
@@ -51,6 +51,14 @@
 body MemWin::build_win {} {
   global tcl_platform gdb_ImageDir _mem ${this}_memval
 
+  set size [ pref get gdb/memory/size ]
+  set format [ pref get gdb/memory/format ]
+  set numbytes [ pref get gdb/memory/numbytes ]
+  set bpr [ pref get gdb/memory/bytesperrow ]
+  set ascii [ pref get gdb/memory/dispascii ]
+  set ascii_char [ pref get gdb/memory/ctrlchar ]
+  set color [pref get gdb/memory/color ]
+
   set maxlen 0
   set maxalen 0
   set saved_value ""
Index: prefs.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
retrieving revision 1.3
diff -u -r1.3 prefs.tcl
--- prefs.tcl	2000/04/04 00:17:47	1.3
+++ prefs.tcl	2000/11/04 01:27:20
@@ -172,7 +172,7 @@
 
     #now loop through all sections writing out values
     lappend secs load console src reg stack locals watch bp search \
-      process geometry help browser kod window
+      process geometry help browser memory kod window
 
     foreach section $secs {
       puts $fd "\[$section\]"
@@ -262,6 +262,7 @@
   pref define gdb/console/prompt_fg       DarkGreen
   pref define gdb/console/error_fg        red
   pref define gdb/console/font            src-font
+  pref define gdb/console/wrap            0
 
   # Source window defaults
   pref define gdb/src/PC_TAG              green
@@ -326,6 +327,16 @@
   pref define gdb/browser/top_height       0
   pref define gdb/browser/view_height      -1
   pref define gdb/browser/view_is_open    0
+
+  # Memory
+  pref define gdb/memory/size             4; # Word
+  pref define gdb/memory/format           x; # hex
+  pref define gdb/memory/numbytesdepends  0; # on window size
+  pref define gdb/memory/numbytes         0
+  pref define gdb/memory/bytesperrow      16
+  pref define gdb/memory/dispascii        1
+  pref define gdb/memory/ctrlchar         .
+  pref define gdb/memory/color            green
 
   # BP (breakpoint)
   pref define gdb/bp/show_threads         0

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

* Re: [RFA] Memory Preferences Now Permanent
  2000-11-03 17:30 [RFA] Memory Preferences Now Permanent Larry Smith
@ 2000-11-06 11:05 ` Syd Polk
  2000-11-06 13:24   ` Fernando Nasser
  0 siblings, 1 reply; 3+ messages in thread
From: Syd Polk @ 2000-11-06 11:05 UTC (permalink / raw)
  To: Larry Smith, insight

At 08:30 PM 11/3/00 -0500, Larry Smith wrote:

>This patch adds code to save and restore the preferences selected
>in displaying memory, and fixes a bug that prevented one from
>changing the color of the memory display window.
>
>2000-11-03  Larry Smith  <lsmith@redhat.com>
>         * mempref.itb (constructor): Added code to retrieve
>         memory display preferences.
>         * mempref.itb (build_win): Added code to retrieve
>         memory display preferences, corrected bug preventing
>         display of color background preference for memory display.
>         * mempref.itb (apply): Added code to save new preferences.
>         * memwin.itb (buildwin): added retrieval of memory display
>         preferences
>         * prefs.tcl (pref_save): added new memory section for memory
>         display preferences.
>         * prefs.tcl (pref_set_defaults): added defaults for new memory
>         section

Style nits.


>Index: mempref.itb
>===================================================================
>RCS file: /cvs/src/src/gdb/gdbtk/library/mempref.itb,v
>retrieving revision 1.1.1.1
>diff -u -r1.1.1.1 mempref.itb
>--- mempref.itb 2000/02/07 00:19:42     1.1.1.1
>+++ mempref.itb 2000/11/04 01:27:19
>@@ -10,8 +10,8 @@
>  # but WITHOUT ANY WARRANTY; without even the implied warranty of
>  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  # GNU General Public License for more details.
>+#
>
>-
>  # ------------------------------------------------------------------
>  #  METHOD:  constructor - build the dialog
>  # ------------------------------------------------------------------
>@@ -20,7 +20,15 @@
>    window_name "Memory Preferences"
>
>    eval itk_initialize $args
>-
>+
>+  set size [ pref get gdb/memory/size ]
>+  set format [ pref get gdb/memory/format ]
>+  set numbytes [ pref get gdb/memory/numbytes ]
>+  set bpr [ pref get gdb/memory/bytesperrow ]
>+  set ascii [ pref get gdb/memory/dispascii ]
>+  set ascii_char [ pref get gdb/memory/ctrlchar ]
>+  set color [pref get gdb/memory/color ]
>+

This is not using the same coding standard as the rest of the file. It 
should be:

     set size [pref get gdb/memory/size]

etc.

The Tcl code in Insight uses the Tcl coding standards.

>    if {$float_size == ""} {
>      set float_size [gdb_eval sizeof(float)]
>      set double_size [gdb_eval sizeof(double)]
>@@ -144,10 +152,12 @@
>    # MISC
>    Labelledframe $f.1 -anchor nw -text "Miscellaneous"
>    set fr [$f.1 get_frame]
>+
>    frame $fr.1
>    label $fr.1.plabel -height 1 -width 1 -bg $color -relief raised
>    set Widgets(b-color) [button $fr.1.pc -text "Change color..."  \
>                           -command [code $this pick $fr.1.plabel]]
>+
>    grid $fr.1.plabel $fr.1.pc
>    frame $fr.2
>    label $fr.2.l -text "Bytes Per Row "
>@@ -169,10 +179,13 @@
>    frame $fr.4
>    set Widgets(e-ascii_char) [entry $fr.4.e -textvariable [scope 
> gascii_char] -width 1]
>    label $fr.4.l -text "Control Char"
>-  grid $fr.4.e $fr.4.l -sticky we
>-  grid $fr.2 x $fr.3 -sticky w -padx 4
>-  grid $fr.4 -sticky w -padx 4
>-  grid columnconfigure $fr 1 -weight 1
>+  grid $fr.4.e -row 0 -column 0 -ipadx 10
>+  grid $fr.4.l -row 0 -column 1 -sticky e -ipadx 10
>+  grid $fr.2 -row 1 -column 0 -sticky e
>+  grid $fr.3 -row 1 -column 1 -sticky w -ipadx 8
>+  grid $fr.1 -row 2 -column 0 -sticky e -ipadx 10
>+  grid $fr.4 -row 2 -column 1 -sticky w -ipadx 10
>+  # grid columnconfigure $fr 1 -weight 1
>

Please don't leave commented out code sitting around.

>    grid $f.f1 -padx 5 -pady 6 -sticky news
>    grid $f.f2 -padx 5 -pady 6 -sticky news
>@@ -328,6 +341,16 @@
>      -color $color
>
>    $win reconfig
>+
>+  pref set gdb/memory/size $size
>+  pref set gdb/memory/format $format
>+  pref set gdb/memory/numbytes $numbytes
>+  pref set gdb/memory/bytesperrow $gbpr
>+  pref set gdb/memory/dispascii $gascii
>+  pref set gdb/memory/ctrlchar $gascii_char
>+  pref set gdb/memory/color $color
>+
>+  pref_save
>
>    gdbtk_idle
>    idle
>Index: memwin.itb
>===================================================================
>RCS file: /cvs/src/src/gdb/gdbtk/library/memwin.itb,v
>retrieving revision 1.1.1.1
>diff -u -r1.1.1.1 memwin.itb
>--- memwin.itb  2000/02/07 00:19:42     1.1.1.1
>+++ memwin.itb  2000/11/04 01:27:19
>@@ -51,6 +51,14 @@
>  body MemWin::build_win {} {
>    global tcl_platform gdb_ImageDir _mem ${this}_memval
>
>+  set size [ pref get gdb/memory/size ]
>+  set format [ pref get gdb/memory/format ]
>+  set numbytes [ pref get gdb/memory/numbytes ]
>+  set bpr [ pref get gdb/memory/bytesperrow ]
>+  set ascii [ pref get gdb/memory/dispascii ]
>+  set ascii_char [ pref get gdb/memory/ctrlchar ]
>+  set color [pref get gdb/memory/color ]
>+
>    set maxlen 0
>    set maxalen 0
>    set saved_value ""
>Index: prefs.tcl
>===================================================================
>RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
>retrieving revision 1.3
>diff -u -r1.3 prefs.tcl
>--- prefs.tcl   2000/04/04 00:17:47     1.3
>+++ prefs.tcl   2000/11/04 01:27:20
>@@ -172,7 +172,7 @@
>
>      #now loop through all sections writing out values
>      lappend secs load console src reg stack locals watch bp search \
>-      process geometry help browser kod window
>+      process geometry help browser memory kod window
>
>      foreach section $secs {
>        puts $fd "\[$section\]"
>@@ -262,6 +262,7 @@
>    pref define gdb/console/prompt_fg       DarkGreen
>    pref define gdb/console/error_fg        red
>    pref define gdb/console/font            src-font
>+  pref define gdb/console/wrap            0
>
>    # Source window defaults
>    pref define gdb/src/PC_TAG              green
>@@ -326,6 +327,16 @@
>    pref define gdb/browser/top_height       0
>    pref define gdb/browser/view_height      -1
>    pref define gdb/browser/view_is_open    0
>+
>+  # Memory
>+  pref define gdb/memory/size             4; # Word
>+  pref define gdb/memory/format           x; # hex
>+  pref define gdb/memory/numbytesdepends  0; # on window size
>+  pref define gdb/memory/numbytes         0
>+  pref define gdb/memory/bytesperrow      16
>+  pref define gdb/memory/dispascii        1
>+  pref define gdb/memory/ctrlchar         .
>+  pref define gdb/memory/color            green
>
>    # BP (breakpoint)
>    pref define gdb/bp/show_threads         0

With the above fixes, I would approve this.


Syd Polk		spolk@redhat.com
Engineering Manager	+1 415 777 9810 x 241
Red Hat, Inc.



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

* Re: [RFA] Memory Preferences Now Permanent
  2000-11-06 11:05 ` Syd Polk
@ 2000-11-06 13:24   ` Fernando Nasser
  0 siblings, 0 replies; 3+ messages in thread
From: Fernando Nasser @ 2000-11-06 13:24 UTC (permalink / raw)
  To: Syd Polk; +Cc: Larry Smith, insight

Syd Polk wrote:
> 
> At 08:30 PM 11/3/00 -0500, Larry Smith wrote:
> 
> >This patch adds code to save and restore the preferences selected
> >in displaying memory, and fixes a bug that prevented one from
> >changing the color of the memory display window.
> >
> >2000-11-03  Larry Smith  <lsmith@redhat.com>
> >         * mempref.itb (constructor): Added code to retrieve
> >         memory display preferences.
> >         * mempref.itb (build_win): Added code to retrieve
> >         memory display preferences, corrected bug preventing
> >         display of color background preference for memory display.
> >         * mempref.itb (apply): Added code to save new preferences.
> >         * memwin.itb (buildwin): added retrieval of memory display
> >         preferences
> >         * prefs.tcl (pref_save): added new memory section for memory
> >         display preferences.
> >         * prefs.tcl (pref_set_defaults): added defaults for new memory
> >         section
> 
> Style nits.
> 
> With the above fixes, I would approve this.
> 

I don't know why we didn't store those preferences.  I tried to think
of a reason but I couldn't.

So I also agree with the changes (after the fixed noted by Syd).

Thanks again.


-- 
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] 3+ messages in thread

end of thread, other threads:[~2000-11-06 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-03 17:30 [RFA] Memory Preferences Now Permanent Larry Smith
2000-11-06 11:05 ` Syd Polk
2000-11-06 13:24   ` Fernando Nasser

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