diff options
author | Keith Seitz <keiths@redhat.com> | 2001-08-16 18:55:50 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2001-08-16 18:55:50 +0000 |
commit | da1ce328f3d09c044c665e195762b9b5335a9613 (patch) | |
tree | 9afc422008ae3b1aafce8e508602296fbf2cccc0 /gdb/gdbtk | |
parent | 3857391f3fcd2a359478e3abe08ad5ec4ed602ad (diff) | |
download | gdb-da1ce328f3d09c044c665e195762b9b5335a9613.tar.gz |
* library/globalpref.ith (_change_font, _change_size): New
private methods.
(_size): New private variable.
(font_changed, wfont_changed): Removed.
* library/globalpref.itb (make_font_item): Change combobox
callback to use _change_font.
Replace tixControl with iwidgets::spinint.
(font_changed, wfont_changed): Removed.
(_change_font, _change_size): New private methods.
* tclIndex: Regenerate.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r-- | gdb/gdbtk/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/gdbtk/library/globalpref.itb | 72 | ||||
-rw-r--r-- | gdb/gdbtk/library/globalpref.ith | 5 | ||||
-rw-r--r-- | gdb/gdbtk/library/tclIndex | 4 |
4 files changed, 62 insertions, 32 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index 89e9cb32bcf..b592be0faf2 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,5 +1,18 @@ 2001-08-16 Keith Seitz <keiths@redhat.com> + * library/globalpref.ith (_change_font, _change_size): New + private methods. + (_size): New private variable. + (font_changed, wfont_changed): Removed. + * library/globalpref.itb (make_font_item): Change combobox + callback to use _change_font. + Replace tixControl with iwidgets::spinint. + (font_changed, wfont_changed): Removed. + (_change_font, _change_size): New private methods. + * tclIndex: Regenerate. + +2001-08-16 Keith Seitz <keiths@redhat.com> + * generic/gdbtk.c (gdbtk_init): Make sure we're working with absolute pathnames in the *_LIBRAY variables. diff --git a/gdb/gdbtk/library/globalpref.itb b/gdb/gdbtk/library/globalpref.itb index bdef899859d..7b342c81d9d 100644 --- a/gdb/gdbtk/library/globalpref.itb +++ b/gdb/gdbtk/library/globalpref.itb @@ -243,22 +243,25 @@ body GlobalPref::make_font_item {f name label font_list} { font create test-$name-font -family $Original($name,family) \ -size $Original($name,size) label $f.${name}x -text $label - + combobox::combobox $f.${name}n -editable 0 -value $Original($name,family) \ - -command [code $this wfont_changed family $name] - + -command [code $this _change_font $name] + foreach a $font_list { $f.${name}n list insert end $a } - tixControl $f.${name}s -label Size: -integer true -max 18 -min 6 \ - -value $Original(${name},size) -command [code $this font_changed size $name] - [$f.${name}s subwidget entry] configure -width 2 + itk_component add $name-size { + iwidgets::spinint $f.${name}s -labeltext "Size:" -range {6 18} -step 1 \ + -fixed 2 -width 2 -textvariable [scope _size($name)] -wrap 0 \ + -increment [code $this _change_size up $name] \ + -decrement [code $this _change_size down $name] + } {} label $f.${name}l -text ABCDEFabcdef0123456789 -font test-$name-font - + set _size($name) $Original($name,size) + grid $f.${name}x $f.${name}n $f.${name}s $f.${name}l -sticky we -padx 5 -pady 5 grid columnconfigure $f 3 -weight 1 - } # ------------------------------------------------------------------ @@ -287,29 +290,42 @@ body GlobalPref::change_icons {w args} { } # ------------------------------------------------------------------ -# PRIVATE METHOD: wfont_changed - callback from font comboboxes -# PRIVATE METHOD: font_changed - callback from font tixControls +# NAME: private method GlobalPref::_change_font +# DESCRIPTION: Change the given font's family +# +# ARGUMENTS: +# font - the font whose family is to be +# changed +# stupid - the comobox widget which changed +# implementation - the new value of the combobox +# RETURNS: Nothing +# +# NOTES: The combobox has a really non-standard callback +# mechanism: it always adds two args to the callback. # ------------------------------------------------------------------ -body GlobalPref::wfont_changed {attribute font w val} { - font_changed $attribute $font $val +body GlobalPref::_change_font {font stupid implementation} { + font configure test-$font-font -family $implementation } -body GlobalPref::font_changed {attribute font val} { - # val will be a size or a font name - - switch $attribute { - size { - set oldval [font configure test-$font-font -size] - font configure test-$font-font -size $val - } - - family { - set oldval [font configure test-$font-font -family] - font configure test-$font-font -family $val - } - - default { debug "GlobalPref::font_changed -- invalid change" } - } +# ------------------------------------------------------------------ +# NAME: private method GlobalPref::_change_size +# DESCRIPTION: Change the given font's size +# +# ARGUMENTS: +# direction - the direction of the change (up/down) +# font - the font that is changing +# RETURNS: Nothing +# +# NOTES: See comments for purpose of "direction". Sigh. +# ------------------------------------------------------------------ +body GlobalPref::_change_size {direction font} { + + # Almost as stupid as the comobox, the iwidgets::spinint class + # will not treat its -increment and -decrement commands + # as command callbacks. Instead it OVERRIDES all behavior. + # Thus, we need to call the stupid spinint's callback. + $itk_component($font-size) $direction + font configure test-$font-font -size $_size($font) } # ------------------------------------------------------------------ diff --git a/gdb/gdbtk/library/globalpref.ith b/gdb/gdbtk/library/globalpref.ith index 34ef45e77a0..36edd38cdc6 100644 --- a/gdb/gdbtk/library/globalpref.ith +++ b/gdb/gdbtk/library/globalpref.ith @@ -18,6 +18,7 @@ class GlobalPref { private { variable icondirlist "" variable Original ;# Original settings + variable _size ;# Array tracking spinint values variable Fonts ;# List of all available fonts for editing common tracing_labels common inited 0 @@ -28,8 +29,8 @@ class GlobalPref { method make_font_item {f name label font_list} method resize_font_item_height {} method change_icons {w args} - method wfont_changed {attribute font w val} - method font_changed {attribute font val} + method _change_font {font stupid implementation} + method _change_size {direction font} method toggle_tracing_mode {} method ok {} method apply {{deleteMe 0}} diff --git a/gdb/gdbtk/library/tclIndex b/gdb/gdbtk/library/tclIndex index 4120960f267..2af5c7b4cf5 100644 --- a/gdb/gdbtk/library/tclIndex +++ b/gdb/gdbtk/library/tclIndex @@ -310,8 +310,8 @@ set auto_index(::GlobalPref::build_win) [list source [file join $dir globalpref. set auto_index(::GlobalPref::make_font_item) [list source [file join $dir globalpref.itb]] set auto_index(::GlobalPref::resize_font_item_height) [list source [file join $dir globalpref.itb]] set auto_index(::GlobalPref::change_icons) [list source [file join $dir globalpref.itb]] -set auto_index(::GlobalPref::wfont_changed) [list source [file join $dir globalpref.itb]] -set auto_index(::GlobalPref::font_changed) [list source [file join $dir globalpref.itb]] +set auto_index(::GlobalPref::_change_font) [list source [file join $dir globalpref.itb]] +set auto_index(::GlobalPref::_change_size) [list source [file join $dir globalpref.itb]] set auto_index(::GlobalPref::toggle_tracing_mode) [list source [file join $dir globalpref.itb]] set auto_index(::GlobalPref::toggle_tracing) [list source [file join $dir globalpref.itb]] set auto_index(::GlobalPref::ok) [list source [file join $dir globalpref.itb]] |