OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [gdbtk/] [library/] [srcpref.itb] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Source preferences dialog for GDBtk.
2
# Copyright 1998, 1999 Cygnus Solutions
3
#
4
# This program is free software; you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License (GPL) as published by
6
# the Free Software Foundation; either version 2 of the License, or (at
7
# your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
 
14
 
15
# ------------------------------------------------------------------
16
#  CONSTRUCTOR - create new source preferences window
17
# ------------------------------------------------------------------
18
body SrcPref::constructor {args} {
19
  window_name "Source Preferences"
20
 
21
  build_win
22
  set saved(gdb/src/PC_TAG)           [pref get gdb/src/PC_TAG]
23
  set saved(gdb/src/STACK_TAG)        [pref get gdb/src/STACK_TAG]
24
  set saved(gdb/src/BROWSE_TAG)       [pref get gdb/src/BROWSE_TAG]
25
  set saved(gdb/src/run_attach)       [pref get gdb/src/run_attach]
26
  set saved(gdb/src/run_load)         [pref get gdb/src/run_load]
27
  set saved(gdb/src/run_run)          [pref get gdb/src/run_run]
28
  set saved(gdb/src/run_cont)         [pref get gdb/src/run_cont]
29
  set saved(gdb/src/bp_fg)            [pref get gdb/src/bp_fg]
30
  set saved(gdb/src/temp_bp_fg)       [pref get gdb/src/temp_bp_fg]
31
  set saved(gdb/src/trace_fg)         [pref get gdb/src/trace_fg]
32
  set saved(gdb/src/thread_fg)        [pref get gdb/src/thread_fg]
33
  set saved(gdb/src/variableBalloons) [pref get gdb/src/variableBalloons]
34
  set saved(gdb/src/source2_fg)       [pref get gdb/src/source2_fg]
35
  set saved(gdb/src/tab_size)         [pref get gdb/src/tab_size]
36
  set saved(gdb/mode)                 [pref get gdb/mode]
37
}
38
 
39
# ------------------------------------------------------------------
40
#  METHOD:  build_win - build the dialog
41
# ------------------------------------------------------------------
42
body SrcPref::build_win {} {
43
  frame $itk_interior.f
44
  frame $itk_interior.f.a
45
  frame $itk_interior.f.b
46
  set f $itk_interior.f.a
47
 
48
  # Colors frame
49
  Labelledframe $f.colors -anchor nw -text {Colors}
50
  set w [$f.colors get_frame]
51
 
52
  set color [pref get gdb/src/PC_TAG]
53
  label $w.pcl -text {PC}
54
  button $w.pcb -text {     } -activebackground $color -bg $color \
55
    -command [code $this _pick $color $w.pcb PC_TAG]
56
 
57
  set color [pref get gdb/src/STACK_TAG]
58
  label $w.stl -text {Stack}
59
  button $w.stb -text {     } -activebackground $color -bg $color \
60
    -command [code $this _pick $color $w.stb STACK_TAG]
61
 
62
  set color [pref get gdb/src/BROWSE_TAG]
63
  label $w.brl -text {Browse}
64
  button $w.brb -text {     } -activebackground $color -bg $color\
65
    -command [code $this _pick $color $w.brb BROWSE_TAG]
66
 
67
  set color [pref get gdb/src/source2_fg]
68
  label $w.s2l -text {Mixed Source}
69
  button $w.s2b -text {     } -activebackground $color -bg $color \
70
    -command [code $this _pick $color $w.s2b source2_fg]
71
 
72
  set color [pref get gdb/src/bp_fg]
73
  label $w.nbpl -text {Normal Breakpoint}
74
  button $w.nbpb -text {     } -activebackground $color -bg $color\
75
    -command [code $this _pick $color $w.nbpb bp_fg]
76
 
77
  set color [pref get gdb/src/temp_bp_fg]
78
  label $w.tbpl -text {Temporary Breakpoint}
79
  button $w.tbpb -text {     } -activebackground $color -bg $color \
80
    -command [code $this _pick $color $w.tbpb temp_bp_fg]
81
 
82
  set color [pref get gdb/src/thread_fg]
83
  label $w.dbpl -text {Thread Breakpoint}
84
  button $w.dbpb -text {     } -activebackground $color -bg $color \
85
    -command [code $this _pick $color $w.dbpb thread_fg]
86
 
87
  set color [pref get gdb/src/trace_fg]
88
  label $w.tpl -text {Tracepoint}
89
  button $w.tpb -text {     } -activebackground $color -bg $color \
90
    -command [code $this _pick $color $w.tpb trace_fg]
91
 
92
  grid $w.pcl $w.pcb $w.nbpl $w.nbpb -padx 10 -pady 2 -sticky w
93
  grid $w.stl $w.stb $w.tbpl $w.tbpb -padx 10 -pady 2 -sticky w
94
  grid $w.brl $w.brb $w.dbpl $w.dbpb -padx 10 -pady 2 -sticky w
95
  grid $w.s2l $w.s2b $w.tpl  $w.tpb  -padx 10 -pady 2 -sticky w
96
 
97
  frame $f.rmv
98
 
99
  # Debug Mode frame
100
  Labelledframe $f.rmv.mode -anchor nw -text "Mouse Button-1 Behavior"
101
  set w [$f.rmv.mode get_frame]
102
  set var [pref varname gdb/B1_behavior]
103
  if {[pref get gdb/mode]} {
104
    set state normal
105
  } else {
106
    pref set gdb/B1_behavior 1
107
    set state disabled
108
  }
109
 
110
  radiobutton $w.async -text "Set/Clear Tracepoints" -variable $var \
111
    -value 0 -state $state
112
  radiobutton $w.sync  -text "Set/Clear Breakpoints" -variable $var  \
113
    -value 1 -state $state
114
 
115
  pack $w.async $w.sync -side top
116
 
117
  # Variable Balloons
118
  Labelledframe $f.rmv.var -anchor nw -text "Variable Balloons"
119
  set w [$f.rmv.var get_frame]
120
  set var [pref varname gdb/src/variableBalloons]
121
  radiobutton $w.var_on -text "On " -variable $var -value 1
122
  radiobutton $w.var_off -text "Off" -variable $var -value 0
123
  pack $w.var_on $w.var_off -side top
124
  grid $f.rmv.mode -sticky nsew -pady 5 -row 0 -col 0
125
  grid $f.rmv.var -sticky nsew -pady 5 -row 0 -col 2
126
  grid columnconfigure $f.rmv 0 -weight 1
127
  grid columnconfigure $f.rmv 1 -minsize 4
128
  grid columnconfigure $f.rmv 2 -weight 1
129
  grid rowconfigure $f.rmv 0 -weight 1
130
 
131
 
132
  frame $f.x
133
  # Tab size
134
  tixControl $f.x.size -label "Tab Size" -integer true -max 16 -min 1 \
135
    -variable [pref varname gdb/src/tab_size] \
136
    -options { entry.width 2    entry.font src-font}
137
 
138
  # Linenumbers
139
  # commented out because this option isn't really useful
140
#  checkbutton $f.x.linenum -text "Line Numbers" \
141
#    -variable [pref varname gdb/src/linenums]
142
#  pack $f.x.size $f.x.linenum -side left -padx 5 -pady 5
143
  pack $f.x.size -side left -padx 5 -pady 5
144
 
145
  # Disassembly flavor - We tell whether this architecture supports
146
  # the flag by checking whether the flag exists.
147
 
148
  set have_disassembly_flavor 0
149
  set vals [list_disassembly_flavors]
150
  if {[llength $vals] != 0} {
151
    set have_disassembly_flavor 1
152
    frame $f.dis
153
    label $f.dis.l -text "Disassembly Flavor: "
154
    combobox::combobox $f.dis.combo -maxheight 15 -width 15 -font src-font -editable 0 \
155
      -command [code $this set_flavor]
156
 
157
    foreach elem $vals {
158
      $f.dis.combo list insert end $elem
159
    }
160
 
161
    set current_disassembly_flavor [get_disassembly_flavor]
162
    $f.dis.combo entryset $current_disassembly_flavor
163
 
164
    pack $f.dis.l -side left
165
    pack $f.dis.combo -side left -padx 4
166
 
167
  } else {
168
    set current_disassembly_flavor ""
169
  }
170
 
171
  pack $f.colors -fill both -expand 1
172
  pack $f.rmv  -fill both -expand yes
173
  pack $f.x -fill x -expand yes
174
 
175
  if {$have_disassembly_flavor} {
176
    pack $f.dis -side top -fill x -padx 4
177
  }
178
 
179
  button $itk_interior.f.b.ok -text OK -width 7 -underline 0 -command [code $this _save]
180
  button $itk_interior.f.b.apply -text Apply -width 7 -underline 0 -command [code $this _apply]
181
  button $itk_interior.f.b.quit -text Cancel -width 7 -underline 0 -command [code $this _cancel]
182
  standard_button_box $itk_interior.f.b
183
  pack $itk_interior.f.a $itk_interior.f.b $itk_interior.f -expand yes -fill both -padx 5 -pady 5
184
}
185
 
186
# ------------------------------------------------------------------
187
#  METHOD:  apply - apply changes
188
# ------------------------------------------------------------------
189
body SrcPref::_apply {} {
190
  if {$current_disassembly_flavor != ""} {
191
    gdb_cmd "set disassembly-flavor $current_disassembly_flavor"
192
    pref set gdb/src/disassembly-flavor $current_disassembly_flavor
193
  }
194
  ManagedWin::restart
195
}
196
 
197
# ------------------------------------------------------------------
198
#  METHOD:  cancel
199
# ------------------------------------------------------------------
200
body SrcPref::_cancel {} {
201
  set any_changed 0
202
 
203
  foreach elem [array names _saved] {
204
    set cur_val [pref get $elem]
205
    if {[string compare $cur_val $_saved($elem)] != 0} {
206
      set any_changed 1
207
      pref set $elem $_saved($elem)
208
    }
209
  }
210
 
211
  if {$any_changed} {
212
    _save
213
  } else {
214
    unpost
215
  }
216
}
217
 
218
# ------------------------------------------------------------------
219
#  METHOD:  save - apply changes and quit
220
# ------------------------------------------------------------------
221
body SrcPref::_save {} {
222
  _apply
223
  unpost
224
}
225
 
226
# ------------------------------------------------------------------
227
#  METHOD:  set_flavor - sets the disassembly flavor.  The set disassembly-flavor
228
#           gdb command is already known to exist, so I don't have to check...
229
# ------------------------------------------------------------------
230
body SrcPref::set_flavor {w new_mode} {
231
  $w entryset $new_mode
232
  set current_disassembly_flavor $new_mode
233
}
234
 
235
 
236
# ------------------------------------------------------------------
237
#  METHOD:  pick - pick colors
238
# ------------------------------------------------------------------
239
body SrcPref::_pick {color win tag} {
240
  set new_color [tk_chooseColor -initialcolor $color -title "Choose color"]
241
  if {$new_color != $color && $new_color != {}} {
242
    pref set gdb/src/$tag $new_color
243
    $win configure -activebackground $new_color -bg $new_color
244
  }
245
}
246
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.