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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [gdbtcl/] [toolbar.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# OBSOLETE: Please see gdbmenubar, gdbtoolbar, srcmenubar and srctoolbar
2
#
3
# Menu, toolbar, and status window for GDBtk.
4
# Copyright 1997, 1998, 1999 Cygnus Solutions
5
#
6
# This program is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License (GPL) as published by
8
# the Free Software Foundation; either version 2 of the License, or (at
9
# your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
 
16
 
17
# Implements a menu, toolbar, and status window for GDB
18
# This class has methods for adding buttons & menus, and 
19
# a collection of methods for the standard GDB menu sets
20
# and button sets.  It does not actually add any buttons or
21
# menus on its own, however.
22
 
23
class oldGDBToolBar {
24
  inherit itk::Widget
25
 
26
  # ------------------------------------------------------------------
27
  #  CONSTRUCTOR - create new console window
28
  # ------------------------------------------------------------------
29
  constructor {src} {
30
    set source $src
31
    _load_images
32
    _load_src_images
33
 
34
    build_win
35
    add_hook gdb_idle_hook "$this enable_ui 1"
36
    add_hook gdb_busy_hook "$this enable_ui 0"
37
    add_hook gdb_no_inferior_hook "$this enable_ui 2"
38
    add_hook gdb_set_hook "$this set_hook"
39
  }
40
 
41
  # ------------------------------------------------------------------
42
  #  METHOD:  build_win - build the main toolbar window
43
  # ------------------------------------------------------------------
44
  public method build_win {} {
45
 
46
    set OtherMenus {}
47
    set ControlMenus {}
48
    set OtherButtons {}
49
    set ControlButtons {}
50
 
51
    set Menu [menu $itk_interior.m -tearoff 0]
52
    if {! [create_menu_items]} {
53
      destroy $Menu
54
      set Menu {}
55
    } else {
56
      [winfo toplevel $itk_interior] configure -menu $Menu
57
    }
58
 
59
    # Make a subframe so that the menu can't accidentally conflict
60
    # with a name created by some subclass.
61
    set ButtonFrame [frame $itk_interior.t]
62
    create_buttons
63
 
64
    if {! [llength $button_list]} {
65
      destroy $ButtonFrame
66
    } else {
67
      eval standard_toolbar $ButtonFrame $button_list
68
      pack $ButtonFrame $itk_interior -fill both -expand true
69
    }
70
  }
71
 
72
  # ------------------------------------------------------------------
73
  #  DESTRUCTOR - destroy window containing widget
74
  # ------------------------------------------------------------------
75
  destructor {
76
    remove_hook gdb_idle_hook "$this enable_ui 1"
77
    remove_hook gdb_busy_hook "$this enable_ui 0"
78
    remove_hook gdb_no_inferior_hook "$this enable_ui 2"
79
    remove_hook gdb_set_hook "$this set_hook"
80
    #destroy $this
81
  }
82
 
83
  # ------------------------------------------------------------------
84
  #  METHOD:  reconfig - used when preferences change
85
  # ------------------------------------------------------------------
86
  public method reconfig {} {
87
    debug "toolbar::reconfig"
88
    _load_images 1
89
  }
90
 
91
  public method _set_stepi {} {
92
  }
93
 
94
  # ------------------------------------------------------------------
95
  #  METHOD:  create_buttons - Add some buttons to the toolbar.  Returns
96
  #                         list of buttons in form acceptable to
97
  #                         standard_toolbar.
98
  # ------------------------------------------------------------------
99
  public method create_buttons {} {
100
    _load_images
101
    create_buttons
102
  }
103
 
104
  method add_label {name text balloon args} {
105
    set lname $ButtonFrame.$name
106
    eval label $lname -text \$text $args
107
    balloon register $lname $balloon
108
    lappend button_list $lname
109
  }
110
 
111
 
112
  # ------------------------------------------------------------------
113
  #  METHOD:  create_button - Creates all the bookkeeping for a button,
114
  #           without actually inserting it in the toolbar.
115
  # ------------------------------------------------------------------
116
  method create_button {name class command balloon args} {
117
    set bname $ButtonFrame.$name
118
    set Buttons($name) $bname
119
 
120
    eval button $bname -command \$command $args
121
    balloon register $bname $balloon
122
    foreach elem $class {
123
      switch $elem {
124
        None {}
125
        default {
126
          lappend ${elem}Buttons $bname
127
        }
128
      }
129
    }
130
 
131
    return $bname
132
  }
133
 
134
  # ------------------------------------------------------------------
135
  #  METHOD:  add_button - Creates a button, and inserts it at the end
136
  #           of the button list.  Call this when the toolbar is being
137
  #           set up, but has not yet been made.
138
  # ------------------------------------------------------------------
139
  method add_button {name class command balloon args} {
140
 
141
    lappend button_list [eval create_button \$name \$class \$command \$balloon $args]
142
 
143
  }
144
 
145
  # ------------------------------------------------------------------
146
  #  METHOD:  insert_button - Inserts button "name" before button "before".
147
  #           the toolbar must be made, and the buttons must have been created
148
  #           before you run this.
149
  # ------------------------------------------------------------------
150
  method insert_button {name before} {
151
 
152
    if {[string first "-" $name] == 0} {
153
      set name [string range $name 1 end]
154
      set add_sep 1
155
    } else {
156
      set add_sep 0
157
    }
158
 
159
    if {![info exists Buttons($name)] || ![info exists Buttons($before)]} {
160
      error "insert_buttons called with non-existant button"
161
    }
162
 
163
    set before_col [gridCGet $Buttons($before) -column]
164
    set before_row [gridCGet $Buttons($before) -row]
165
 
166
    set slaves [grid slaves $ButtonFrame]
167
 
168
    set incr [expr 1 + $add_sep]
169
    foreach slave $slaves {
170
      set slave_col [gridCGet $slave -column]
171
      if {$slave_col >= $before_col} {
172
        grid configure $slave -column [expr $slave_col + $incr]
173
      }
174
    }
175
    if {$add_sep} {
176
      grid $Buttons(-$name) -column $before_col -row $before_row
177
    }
178
 
179
    # Now grid our button.  Have to put in the pady since this button
180
    # may not have been originally inserted by the libgui toolbar
181
    # proc.
182
 
183
    grid $Buttons($name) -column [expr $before_col + $add_sep] \
184
      -row $before_row -pady 2
185
 
186
  }
187
 
188
  method remove_button {name} {
189
 
190
    if {[string first "-" $name] == 0} {
191
      set name [string range $name 1 end]
192
      set remove_sep 1
193
    } else {
194
      set remove_sep 0
195
    }
196
 
197
    if {![info exists Buttons($name)] } {
198
      error "remove_buttons called with non-existant button $name"
199
    }
200
 
201
    set name_col [gridCGet $Buttons($name) -column]
202
    set name_row [gridCGet $Buttons($name) -row]
203
 
204
    grid remove $Buttons($name)
205
    if {$remove_sep} {
206
      set Buttons(-$name) [grid slaves $ButtonFrame \
207
                             -column [expr $name_col - 1] \
208
                            -row $name_row]
209
      grid remove $Buttons(-$name)
210
    }
211
 
212
    set slaves [grid slaves $ButtonFrame -row $name_row]
213
 
214
    foreach slave $slaves {
215
      set slave_col [gridCGet $slave -column]
216
      if {$slave_col > $name_col} {
217
        grid configure $slave -column [expr $slave_col - 1]
218
      }
219
    }
220
  }
221
 
222
  method add_button_separator {} {
223
    lappend button_list -
224
  }
225
 
226
  method button_right_justify {} {
227
    lappend button_list --
228
  }
229
 
230
  method swap_button_lists {in_list out_list} {
231
    # Now swap out the buttons...
232
    set first_out [lindex $out_list 0]
233
    if {[info exists Buttons($first_out)] && [grid info $Buttons($first_out)] != ""} {
234
      foreach button $in_list {
235
        insert_button $button $first_out
236
      }
237
      foreach button $out_list {
238
        remove_button $button
239
      }
240
    } elseif {[info exists Buttons($first_out)]} {
241
      debug "Error in swap_button_list - $first_out not gridded..."
242
    } else {
243
      debug "Button $first_out is not in button list"
244
    }
245
  }
246
 
247
  ############################################################
248
  # The next set of commands control the menubar associated with the
249
  # toolbar.  Currently, only sequential addition of submenu's and menu
250
  # entries is allowed.  Here's what you do.  First, create a submenu
251
  # with the "new_menu" command.  This submenu is the targeted menu. 
252
  # Subsequent calls to add_menu_separator, and add_menu_command add
253
  # separators and commands to the end of this submenu.
254
  # If you need to edit a submenu, call clear_menu and then add all the
255
  # items again.
256
  #
257
  # Each menu command also has a class list.  Transitions between states
258
  #  of gdb will enable and disable different classes of menus.
259
  #
260
  # FIXME - support insert_command, and also cascade menus, whenever
261
  # we need it...
262
  # FIXME - The toolbar and the Menubar support are glommed together in
263
  # one class for historical reasons, but there is no good reason for this.
264
  ############################################################
265
 
266
  # ------------------------------------------------------------------
267
  #  METHOD:  create_menu_items - Add some menu items to the menubar.
268
  #                               Returns 1 if any items added.
269
  # 
270
  # num = number of last menu entry
271
  # ------------------------------------------------------------------
272
  method create_menu_items {} {
273
    # Empty - This is overridden in child classes.
274
  }
275
 
276
  # ------------------------------------------------------------------
277
  #  METHOD:  new_menu - Add a new cascade menu to the Toolbar's main menu.
278
  #                      Also target this menu for subsequent add_menu_command
279
  #                      calls.
280
  #
281
  #  name - the token for the new menu
282
  #  label - The label used for the label
283
  #  underline - the index of the underlined character for this menu item.
284
  #
285
  #  RETURNS: then item number of the menu.
286
  # ------------------------------------------------------------------
287
  method new_menu {name label underline} {
288
    set current_menu $Menu.$name
289
    set menu_list($name) [$Menu add cascade -menu  $current_menu \
290
                             -label $label -underline $underline]
291
    menu $current_menu -tearoff 0
292
 
293
    set item_number -1
294
    return $current_menu
295
  }
296
 
297
  # ------------------------------------------------------------------
298
  #  METHOD:  menu_exists - Report whether a menu keyed by NAME exists.
299
  # 
300
  #  name - the token for the menu sought
301
  #
302
  #  RETURNS: 1 if the menu exists, 0 otherwise.
303
  # ------------------------------------------------------------------
304
  method menu_exists {name} {
305
    return [info exists menu_list($name)]
306
 
307
  }
308
 
309
  # ------------------------------------------------------------------
310
  #  METHOD:  clear_menu - Deletes the items from one of the cascade menus
311
  #                        in the Toolbar's main menu.  Also makes this menu
312
  #                        the target menu.
313
  # 
314
  #  name - the token for the new menu
315
  #
316
  #  RETURNS: then item number of the menu, or "" if the menu is not found.
317
  # ------------------------------------------------------------------
318
  method clear_menu {name} {
319
    if {[info exists menu_list($name)]} {
320
      set current_menu [$Menu entrycget $menu_list($name) -menu]
321
      $current_menu delete 0 end
322
      set item_number -1
323
      return $current_menu
324
    } else {
325
      return ""
326
    }
327
  }
328
 
329
 
330
  # ------------------------------------------------------------------
331
  #  METHOD:  add_menu_separator - Adds a menu separator to the currently
332
  #                        targeted submenu of the Toolbar's main menu.
333
  # 
334
  # ------------------------------------------------------------------
335
  method add_menu_separator {} {
336
    incr item_number
337
    $current_menu add separator
338
  }
339
 
340
  # ------------------------------------------------------------------
341
  #  METHOD:  add_menu_command - Adds a menu command item to the currently
342
  #                        targeted submenu of the Toolbar's main menu.
343
  #
344
  #  class - The class of the command, used for disabling entries.
345
  #  label - The text for the command.
346
  #  command - The command for the menu entry
347
  #  args  - Passed to the menu entry creation command (eval'ed) 
348
  # ------------------------------------------------------------------
349
  method add_menu_command {class label command args} {
350
 
351
    eval $current_menu add command -label \$label -command \$command \
352
          $args
353
 
354
    incr item_number
355
 
356
    switch $class {
357
      None {}
358
      default {
359
        foreach elem $class {
360
          lappend menu_classes($elem) [list $current_menu $item_number]
361
        }
362
      }
363
    }
364
  }
365
 
366
 
367
  # ------------------------------------------------------------------
368
  #  METHOD:  _load_images - Load standard images.  Private method.
369
  # ------------------------------------------------------------------
370
  public method _load_images { {reconfig 0} } {
371
    global gdb_ImageDir
372
    if {!$reconfig && $_loaded_images} {
373
      return
374
    }
375
    set _loaded_images 1
376
 
377
    lappend imgs console reg stack vmake vars watch memory bp
378
    foreach name $imgs {
379
      image create photo ${name}_img -file [file join $gdb_ImageDir ${name}.gif]
380
    }
381
  }
382
 
383
 
384
  # ------------------------------------------------------------------
385
  #  METHOD:  _load_src_images - Load standard images.  Private method.
386
  # ------------------------------------------------------------------
387
  method _load_src_images { {reconf 0} } {
388
    global gdb_ImageDir
389
 
390
    if {!$reconf && $_loaded_src_images} {
391
      return
392
    }
393
    set _loaded_src_images 1
394
 
395
    foreach name {run stop step next finish continue edit \
396
                    stepi nexti up down bottom Movie_on Movie_off \
397
                    next_line next_check next_hit rewind prev_hit \
398
                  watch_movie run_expt tdump tp} {
399
      image create photo ${name}_img -file [file join $gdb_ImageDir ${name}.gif]
400
    }
401
  }
402
 
403
 # ------------------------------------------------------------------
404
  # METHOD:  enable_ui - enable/disable the appropriate buttons and menus
405
  # Called from the busy, idle, and no_inferior hooks.
406
  #
407
  # on must be:
408
  # value      Control    Other    Trace    State
409
  #   0          off       off      off     gdb is busy
410
  #   1          on        on       off     gdb has inferior, and is idle
411
  #   2          off       on       off     gdb has no inferior, and is idle
412
  # ------------------------------------------------------------------
413
  public method enable_ui {on} {
414
    global tcl_platform
415
    debug "Toolbar::enable_ui $on - Browsing=$Browsing"
416
 
417
    # Do the enabling so that all the disabling happens first, this way if a
418
    # button belongs to two groups, enabling takes precedence, which is probably right.
419
 
420
    switch $on {
421
 
422
        set enable_list {Control disabled \
423
                           Other disabled \
424
                           Trace disabled \
425
                           Attach disabled \
426
                           Detach disabled}
427
      }
428
      1 {
429
        if {!$Browsing} {
430
          set enable_list {Trace disabled \
431
                             Control normal \
432
                             Other normal \
433
                             Attach disabled \
434
                             Detach normal }
435
          # set the states of stepi and nexti correctly
436
          _set_stepi
437
        } else {
438
          set enable_list {Control disabled Other normal Trace normal}
439
        }
440
 
441
      }
442
      2 {
443
        set enable_list {Control disabled \
444
                           Trace disabled \
445
                           Other normal \
446
                           Attach normal \
447
                           Detach disabled }
448
      }
449
      default {
450
        debug "Unknown type: $on in enable_ui"
451
        return
452
      }
453
    }
454
 
455
    debug "Enable list is: $enable_list"
456
    foreach {type state} $enable_list {
457
      if {[info exists ${type}Buttons]} {
458
        foreach button [set ${type}Buttons] {
459
          $button configure -state $state
460
        }
461
      }
462
      if {[info exists menu_classes($type)]} {
463
        change_menu_state $menu_classes($type) $state
464
      }
465
    }
466
 
467
  }
468
 
469
  # ------------------------------------------------------------------
470
  # METHOD:  change_menu_state - Does the actual job of enabling menus...
471
  #          Pass normal or disabled for the state.
472
  # ------------------------------------------------------------------
473
  method change_menu_state {menuList state} {
474
 
475
    foreach elem $menuList {
476
      [lindex $elem 0] entryconfigure [lindex $elem 1] -state $state
477
    }
478
  }
479
 
480
 
481
  # 
482
  # The next set of functions are the generic button groups that gdb uses.
483
  # Then toolbars that derive from this class can just mix and match
484
  # from the standard set as they please.
485
  #
486
 
487
  # ------------------------------------------------------------------
488
  #  METHOD:  create_control_buttons - Creates the step, continue, etc buttons.
489
  # ------------------------------------------------------------------
490
 
491
  method create_control_buttons {} {
492
    add_button step Control [code $source inferior step] \
493
      "Step (S)" -image step_img
494
 
495
    add_button next Control [code $source inferior next] \
496
      "Next (N)" -image next_img
497
 
498
    add_button finish Control [code $source inferior finish] \
499
      "Finish (F)" -image finish_img
500
 
501
    add_button continue Control [code $source inferior continue] \
502
      "Continue (C)" -image continue_img
503
 
504
    # A spacer before the assembly-level items looks good.  It helps
505
    # to indicate that these are somehow different.
506
    add_button_separator
507
 
508
    add_button stepi Control [code $source inferior stepi] \
509
      "Step Asm Inst (S)" -image stepi_img
510
 
511
    add_button nexti Control [code $source inferior nexti] \
512
      "Next Asm Inst (N)" -image nexti_img
513
 
514
    _set_stepi
515
 
516
    set Run_control_buttons {step next finish continue -stepi nexti}
517
 
518
  }
519
 
520
  # ------------------------------------------------------------------
521
  #  METHOD:  create_trace_buttons - Creates the next hit, etc.
522
  # ------------------------------------------------------------------
523
 
524
  method create_trace_buttons {{show 0}} {
525
 
526
    if {$show} {
527
      set command add_button
528
    } else {
529
      set command create_button
530
    }
531
 
532
    $command tfindstart Trace {tfind_cmd "tfind start"} "First Hit <F>" \
533
      -image rewind_img
534
 
535
    $command tfind Trace {tfind_cmd tfind} "Next Hit <N>" -image next_hit_img
536
 
537
    $command tfindprev Trace {tfind_cmd "tfind -"} "Previous Hit <P>" \
538
      -image prev_hit_img
539
 
540
    $command tfindline Trace {tfind_cmd "tfind line"} "Next Line Hit <L>" \
541
      -image next_line_img
542
 
543
    $command tfindtp Trace { tfind_cmd "tfind tracepoint"} \
544
      "Next Hit Here <H>" -image next_check_img
545
 
546
    set Trace_control_buttons {tfindstart tfind tfindprev tfindline tfindtp}
547
 
548
    # This is a bit of a hack, but I need to bind the standard_toolbar bindings
549
    # and appearances to these externally, since I am not inserting them in 
550
    # the original toolbar...  Have to add a method to the libgui toolbar to do this.
551
 
552
    if {!$show} {
553
      foreach name $Trace_control_buttons {
554
        # Make sure the button acts the way we want, not the default Tk
555
        # way.
556
        set button $Buttons($name)
557
        $button configure -takefocus 0 -highlightthickness 0 \
558
          -relief flat -borderwidth 1
559
        set index [lsearch -exact [bindtags $button] Button]
560
        bindtags $button [lreplace [bindtags $button] $index $index \
561
                            ToolbarButton]
562
      }
563
    }
564
  }
565
 
566
 
567
  # ------------------------------------------------------------------
568
  #  METHOD:  create_window_buttons - Creates the registers, etc, buttons
569
  # ------------------------------------------------------------------
570
 
571
  method create_window_buttons {} {
572
    add_button reg Other {ManagedWin::open RegWin} "Registers (Ctrl+R)" -image reg_img
573
 
574
    add_button mem Other {ManagedWin::open MemWin} "Memory (Ctrl+M)" -image memory_img
575
 
576
    add_button stack Other {ManagedWin::open StackWin} "Stack (Ctrl+S)" -image stack_img
577
 
578
    add_button watch Other {ManagedWin::open WatchWin} "Watch Expressions (Ctrl+W)" \
579
      -image watch_img
580
 
581
    add_button vars Other {ManagedWin::open LocalsWin} "Local Variables (Ctrl+L)" \
582
      -image vars_img
583
 
584
    if {[pref get gdb/control_target]} {
585
      add_button bp Other {ManagedWin::open BpWin} "Breakpoints (Ctrl+B)" -image bp_img
586
    }
587
 
588
    if {[pref get gdb/mode]} {
589
      add_button tp Other {ManagedWin::open BpWin -tracepoints 1} \
590
        "Tracepoints (Ctrl+T)" -image tp_img
591
 
592
      add_button tdump Trace  {ManagedWin::open TdumpWin} "Tdump (Ctrl+D)" -image tdump_img
593
    }
594
 
595
    add_button con Other {ManagedWin::open Console} "Console (Ctrl+N)" \
596
      -image console_img
597
  }
598
 
599
  #
600
  # The next set of functions create the common menu groupings that
601
  # are used in gdb menus.
602
  #
603
 
604
 
605
  # ------------------------------------------------------------------
606
  #  METHOD:  create_view_menu - Creates the standard view menu
607
  # ------------------------------------------------------------------
608
 
609
  method create_view_menu {} {
610
    new_menu view "View" 0
611
 
612
    add_menu_command Other "Stack" {ManagedWin::open StackWin} \
613
      -underline 0 -accelerator "Ctrl+S"
614
 
615
    add_menu_command Other "Registers" {ManagedWin::open RegWin} \
616
      -underline 0 -accelerator "Ctrl+R"
617
 
618
    add_menu_command Other "Memory" {ManagedWin::open MemWin} \
619
      -underline 0 -accelerator "Ctrl+M"
620
 
621
    add_menu_command Other "Watch Expressions" {ManagedWin::open WatchWin} \
622
      -underline 0 -accelerator "Ctrl+W"
623
    add_menu_command Other "Local Variables" {ManagedWin::open LocalsWin} \
624
      -underline 0 -accelerator "Ctrl+L"
625
 
626
    if {[pref get gdb/control_target]} {
627
      add_menu_command Other "Breakpoints" \
628
        {ManagedWin::open BpWin -tracepoints 0} \
629
        -underline 0 -accelerator "Ctrl+B"
630
    }
631
 
632
    if {[pref get gdb/mode]} {
633
      add_menu_command Other "Tracepoints" \
634
        {ManagedWin::open BpWin -tracepoints 1} \
635
        -underline 0 -accelerator "Ctrl+T"
636
      add_menu_command Other "Tdump" {ManagedWin::open TdumpWin} \
637
        -underline 2 -accelerator "Ctrl+U"
638
 
639
    }
640
 
641
    add_menu_command Other "Console" {ManagedWin::open Console} \
642
      -underline 2 -accelerator "Ctrl+N"
643
 
644
    add_menu_command Other "Function Browser" {ManagedWin::open BrowserWin} \
645
      -underline 1 -accelerator "Ctrl+F"
646
    add_menu_command Other "Thread List" {ManagedWin::open ProcessWin} \
647
      -underline 0 -accelerator "Ctrl+H"
648
    if {[info exists ::env(GDBTK_DEBUG)] && $::env(GDBTK_DEBUG)} {
649
      add_menu_separator
650
      add_menu_command Other "Debug Window" {ManagedWin::open DebugWin} \
651
        -underline 3 -accelerator "Ctrl+U"
652
    }
653
  }
654
 
655
  # ------------------------------------------------------------------
656
  #  METHOD:  create_control_menu - Creates the standard control menu
657
  # ------------------------------------------------------------------
658
 
659
  method create_control_menu {} {
660
    new_menu cntrl "Control" 0
661
 
662
    add_menu_command Control "Step" [code $source inferior step] \
663
      -underline 0 -accelerator S
664
 
665
    add_menu_command Control "Next" [code $source inferior next] \
666
      -underline 0 -accelerator N
667
 
668
    add_menu_command Control "Finish" [code $source inferior finish] \
669
      -underline 0 -accelerator F
670
 
671
    add_menu_command Control "Continue" \
672
      [code $source inferior continue] \
673
      -underline 0 -accelerator C
674
 
675
    add_menu_separator
676
    add_menu_command Control "Step Asm Inst" \
677
      [code $source inferior stepi] \
678
      -underline 1 -accelerator S
679
 
680
    add_menu_command Control "Next Asm Inst" \
681
      [code $source inferior nexti] \
682
      -underline 1 -accelerator N
683
 
684
    # add_menu_separator
685
    # add_menu_command Other "Automatic Step" auto_step
686
 
687
  }
688
 
689
  # ------------------------------------------------------------------
690
  #  METHOD:  create_trace_menu - Creates the standard trace menu
691
  # ------------------------------------------------------------------
692
 
693
  method create_trace_menu {} {
694
    new_menu trace "Trace" 0
695
 
696
    add_menu_command Other "Save Trace Commands..." "save_trace_commands" \
697
      -underline 0
698
 
699
    add_menu_separator
700
 
701
    add_menu_command Trace "Next Hit" {tfind_cmd tfind} \
702
      -underline 0 -accelerator N
703
 
704
    add_menu_command Trace "Previous Hit" {tfind_cmd "tfind -"} \
705
      -underline 0 -accelerator P
706
 
707
    add_menu_command Trace "First Hit" {tfind_cmd "tfind start"} \
708
      -underline 0 -accelerator F
709
 
710
    add_menu_command Trace "Next Line Hit" {tfind_cmd "tfind line"} \
711
      -underline 5 -accelerator L
712
 
713
    add_menu_command Trace "Next Hit Here" {tfind_cmd "tfind tracepoint"} \
714
      -underline 9 -accelerator H
715
 
716
    add_menu_separator
717
    add_menu_command Trace "Tfind Line..." \
718
      "ManagedWin::open TfindArgs -Type LN" \
719
      -underline 9 -accelerator E
720
 
721
    add_menu_command Trace "Tfind PC..." \
722
      "ManagedWin::open TfindArgs -Type PC" \
723
      -underline 7 -accelerator C
724
 
725
    add_menu_command Trace "Tfind Tracepoint..." \
726
      "ManagedWin::open TfindArgs -Type TP" \
727
      -underline 6 -accelerator T
728
 
729
    add_menu_command Trace "Tfind Frame..." \
730
      "ManagedWin::open TfindArgs -Type FR" \
731
      -underline 6 -accelerator F
732
  }
733
 
734
  # ------------------------------------------------------------------
735
  #  METHOD:  create_help_menu - Creates the standard help menu
736
  # ------------------------------------------------------------------  
737
  method create_help_menu {} {
738
    new_menu help "Help" 0
739
    add_menu_command Other "Help Topics" {HtmlViewer::open_help index.html} \
740
      -underline 0
741
    add_menu_separator
742
    add_menu_command Other "About GDB..." {ManagedWin::open About -transient} \
743
      -underline 0
744
  }
745
 
746
  # ------------------------------------------------------------------
747
  #  METHOD:  set_hook - run when user enters a `set' command.
748
  # ------------------------------------------------------------------  
749
  method set_hook {varname value} {
750
    debug "Got $varname = $value"
751
    if {$varname == "os"} {
752
      set save_menu $current_menu
753
      set current_menu $Menu.view
754
      set title "Kernel Objects"
755
      if {[catch {$current_menu index $title} index]} {
756
        set index none
757
      }
758
      if {$value == ""} {
759
        # No OS, so remove KOD from View menu.
760
        if {$index != "none"} {
761
          $current_menu delete $index
762
        }
763
      } else {
764
        # Add KOD to View menu, but only if it isn't already there.
765
        if {$index == "none"} {
766
          add_menu_command Other $title {ManagedWin::open KodWin} \
767
            -underline 0 -accelerator "Ctrl+K"
768
        }
769
      }
770
      set current_menu $save_menu
771
 
772
      global gdb_kod_cmd
773
      set gdb_kod_cmd $value
774
    }
775
  }
776
 
777
  #
778
  #  PROTECTED DATA
779
  #
780
 
781
  #
782
  # FIXME - Need to break the images into the sets needed for
783
  # each button group, and load them when the button group is
784
  # created.
785
 
786
  # This is set if we've already loaded the standard images.
787
  private common _loaded_images 0
788
 
789
  # This is set if we've already loaded the standard images.  Private
790
  # variable.
791
  private common _loaded_src_images 0
792
 
793
  #
794
  #  PUBLIC DATA
795
  #
796
 
797
  # This is a handle on our parent source window.
798
  protected variable source {}
799
 
800
  public variable Tracing 0     ;# Is tracing enabled for this gdb?
801
  public variable Browsing   0  ;# Are we currently browsing a trace experiment?
802
  public variable Collecting 0  ;# Are we currently collecting a trace experiment?
803
 
804
  # The list of all control buttons (ones which should be disabled when
805
  # not running anything or when inferior is running)
806
  protected variable ControlButtons {}
807
 
808
  # The list of all other buttons (which are disabled when inderior is
809
  # running)
810
  protected variable OtherButtons {}
811
 
812
  # The list of buttons that are enabled when we are in trace browse
813
  # mode...
814
  protected variable TraceButtons {}
815
 
816
  # This is the list of buttons that are being built up
817
  #
818
  private variable button_list {}
819
 
820
  #
821
  # This is an array of buttons names -> Tk Window names
822
  #
823
 
824
  protected variable Buttons
825
 
826
  # The main window's menu
827
  private variable Menu
828
 
829
  #The frame to contain the buttons:
830
  protected variable ButtonFrame
831
 
832
  # This array holds the menu classes.  The key is the class name,
833
  # and the value is the list of menus belonging to this class.
834
 
835
  protected variable menu_classes
836
 
837
  # These buttons go in the control area when we are browsing
838
  protected variable Trace_control_buttons
839
 
840
  # And these go in the control area when we are running
841
  protected variable Run_control_buttons
842
 
843
  protected variable item_number -1
844
  protected variable current_menu {}
845
}

powered by: WebSVN 2.1.0

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