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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [gdbtk/] [library/] [locals.tcl] - Blame information for rev 1774

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

Line No. Rev Author Line
1 578 markom
# Local variable window for Insight.
2
# Copyright 1997, 1998, 1999, 2001 Red Hat
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
class LocalsWin {
16
    inherit VariableWin
17
 
18
    # ------------------------------------------------------------------
19
    #  CONSTRUCTOR - create new locals window
20
    # ------------------------------------------------------------------
21
    constructor {args} {
22
        update dummy
23
    }
24
 
25
    # ------------------------------------------------------------------
26
    # DESTRUCTOR - delete locals window
27
    # ------------------------------------------------------------------
28
    destructor {
29
    }
30
 
31
    method build_win {f} {
32
        global tcl_platform
33
        build_menu_helper Variable
34
        if {$tcl_platform(platform) == "windows"} {
35
            frame $f.f
36
            VariableWin::build_win $f.f
37
            pack $f.f -expand yes -fill both -side top
38
            frame $f.stat
39
            pack $f.stat -side bottom -fill x
40
        } else {
41
            VariableWin::build_win $f
42
        }
43
    }
44
 
45
 
46
    # ------------------------------------------------------------------
47
    # METHOD: reconfig
48
    # Overrides VarialbeWin::reconfig method.  Have to make sure the locals
49
    #  will get redrawn after everything is destroyed...
50
    # ------------------------------------------------------------------
51
    method reconfig {} {
52
        VariableWin::reconfig
53
        populate {}
54
    }
55
 
56
    # ------------------------------------------------------------------
57
    # METHOD: getVariablesBlankPath
58
    # Overrides VarialbeWin::getVariablesBlankPath. For a Locals Window,
59
    # this method returns a list of local variables.
60
    # ------------------------------------------------------------------
61
    method getVariablesBlankPath {} {
62
        global Update
63
        debug
64
 
65
        return [$_frame variables]
66
    }
67
 
68
    method update {event} {
69
        global Update Display
70
 
71
        debug "START LOCALS UPDATE CALLBACK"
72
        # Check that a context switch has not occured
73
        if {[context_switch]} {
74
            debug "CONTEXT SWITCH"
75
 
76
            # our context has changed... repopulate with new variables
77
            # destroy the old tree and create a new one
78
            #
79
            # We need to be more intelligent about saving window state
80
            # when browsing the stack or stepping into new frames, but
81
            # for now, we'll have to settle for just getting this working.
82
            deleteTree
83
            set ChangeList {}
84
 
85
            # context_switch will have already created the new frame for
86
            # us, so all we need to do is shove stuff into the window.
87
            debug "_frame=$_frame"
88
            if {$_frame != ""} {
89
                debug "vars=[$_frame variables]"
90
            }
91
            if {$_frame != "" && [$_frame variables] != ""} {
92
                populate {}
93
            }
94
        }
95
 
96
        # Erase old variables
97
        if {$_frame != ""} {
98
            foreach var [$_frame old] {
99
                $Hlist delete entry $var
100
                $_frame deleteOld
101
                unset Update($this,$var)
102
            }
103
 
104
            # Add new variables
105
            foreach var [$_frame new] {
106
                set Update($this,$var) 1
107
                $Hlist add $var                 \
108
                    -itemtype text              \
109
                    -text [label $var]
110
                if {[$var numChildren] > 0} {
111
                    # Make sure we get this labeled as openable
112
                    $Tree setmode $var open
113
                }
114
            }
115
        }
116
 
117
        # Update variables in window
118
        VariableWin::update dummy
119
 
120
        debug "END LOCALS UPDATE CALLBACK"
121
    }
122
}
123
 

powered by: WebSVN 2.1.0

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