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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [gdbtcl/] [pluginwin.itcl] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# PluginWindow
2
# Copyright 2001 Red Hat, Inc.
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
# Implements a menu and a toolbar that are attached to a source window.
16
#
17
#   PUBLIC ATTRIBUTES:
18
#
19
#
20
#   METHODS:
21
#
22
#     configure ....... used to change public attributes
23
#
24
#   PRIVATE METHODS
25
#
26
#   X11 OPTION DATABASE ATTRIBUTES
27
#
28
#
29
# ----------------------------------------------------------------------
30
 
31
class PluginWindow {
32
  inherit ManagedWin GDBEventHandler
33
 
34
  # ------------------------------------------------------------------
35
  #  CONSTRUCTOR - create widget
36
  # ------------------------------------------------------------------
37
  constructor {args} {
38
 
39
    # Create a menu widget for the plug-in window
40
    set menubar [GDBMenuBar $itk_interior.menubar]
41
 
42
    # Create a toolbar widget for the plug-in window
43
    set toolbar [GDBToolBar $itk_interior.toolbar]
44
 
45
    # Pack the toolbar
46
    pack $toolbar -expand 1 -fill both
47
 
48
    # Create a frame for the subclass to use
49
    set child [frame $itk_interior.child]
50
 
51
    # Pack the childsite
52
    pack $child -expand 1 -fill both
53
 
54
    eval itk_initialize $args
55
    add_hook gdb_no_inferior_hook [code $this no_inferior]
56
  }
57
 
58
  # ------------------------------------------------------------------
59
  #  DESTRUCTOR - destroy window containing widget
60
  # ------------------------------------------------------------------
61
  destructor {
62
    remove_hook gdb_no_inferior_hook [code $this no_inferior]
63
 
64
    #destroy $this
65
  }
66
 
67
  # ------------------------------------------------------------------
68
  #  ACCESSOR METHOD - Retrieve childsite
69
  # ------------------------------------------------------------------
70
  public method childsite {} {
71
    return $child
72
  }
73
 
74
  ####################################################################
75
  #
76
  # State control methods used by both the menu and the toolbar
77
  #
78
  ####################################################################
79
 
80
  # ------------------------------------------------------------------
81
  #  METHOD:  idle - handle IdleEvent
82
  # ------------------------------------------------------------------
83
  protected method idle {event} {
84
    debug "PluginWindow::idle"
85
    enable_ui 1
86
  }
87
 
88
  # ------------------------------------------------------------------
89
  #  METHOD:  busy - BusyEvent handler
90
  #             Invoked when gdb is going to run the inferior
91
  # ------------------------------------------------------------------
92
  public method busy {event} {
93
    debug "PluginWindow::busy"
94
    enable_ui 0
95
  }
96
 
97
  # ------------------------------------------------------------------
98
  #  METHOD:  no_inferior
99
  #             Invoked when gdb detects the inferior is gone
100
  # ------------------------------------------------------------------
101
  protected method no_inferior {} {
102
    debug
103
    enable_ui 2
104
  }
105
 
106
  ####################################################################
107
  # The following method enables/disables both menus and buttons.
108
  ####################################################################
109
 
110
  # ------------------------------------------------------------------
111
  # METHOD:  enable_ui - enable/disable the appropriate buttons and menus
112
  # Called from the busy, idle, and no_inferior hooks.
113
  #
114
  # on must be:
115
  # value      Control    Other     State
116
  #   0          off       off      gdb is busy
117
  #   1          on        on       gdb has inferior, and is idle
118
  #   2          off       on       gdb has no inferior, and is idle
119
  # ------------------------------------------------------------------
120
  public method enable_ui {on} {
121
    global tcl_platform
122
    debug "$on"
123
 
124
    # Do the enabling so that all the disabling happens first, this way if a
125
    # button belongs to two groups, enabling takes precedence, which is
126
    #  probably right.
127
 
128
    switch $on {
129
 
130
        # Busy
131
        set enable_list {Control disabled \
132
                           Other disabled}
133
      }
134
      1 {
135
        # Idle, with inferior
136
        set enable_list {Control normal \
137
                           Other normal}
138
      }
139
      2 {
140
        # Idle, no inferior
141
        set enable_list {Control disabled \
142
                           Other normal}
143
      }
144
      default {
145
        debug "Unknown type: $on in enable_ui"
146
        return
147
      }
148
    }
149
 
150
    $menubar set_class_state $enable_list
151
    $toolbar set_class_state $enable_list
152
  }
153
 
154
  ####################################################################
155
  #
156
  #  PRIVATE DATA
157
  #
158
  ####################################################################
159
 
160
  # The childsite
161
  private variable child
162
 
163
  ####################################################################
164
  #
165
  #  PROTECTED DATA
166
  #
167
  ####################################################################
168
 
169
  # The GdbMenuBar component
170
  protected variable menubar
171
 
172
  # The GdbToolBar component
173
  protected variable toolbar
174
 
175
  ####################################################################
176
  #
177
  #  PUBLIC DATA
178
  #
179
  ####################################################################
180
 
181
  # None.
182
}

powered by: WebSVN 2.1.0

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