~pac72/ubuntu/lucid/ddd/devel

« back to all changes in this revision

Viewing changes to ddd/Box.C

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2004-07-22 03:49:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040722034937-cysl08t1jvba4jrx
Tags: 1:3.3.9-3
USERINFO has been renamed to USERINFO.txt; adjust debian/rules code
to match, to get correct information on the About DDD dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: Box.C,v 1.14 1999/08/19 11:27:05 andreas Exp $
 
1
// $Id$
2
2
// Boxes
3
3
 
4
4
// Copyright (C) 1995 Technische Universitaet Braunschweig, Germany.
26
26
// `http://www.gnu.org/software/ddd/',
27
27
// or send a mail to the DDD developers <ddd@gnu.org>.
28
28
 
29
 
#ifdef __GNUG__
30
 
#pragma implementation
31
 
#endif
32
 
 
33
29
char Box_rcsid[] = 
34
 
    "$Id: Box.C,v 1.14 1999/08/19 11:27:05 andreas Exp $";
 
30
    "$Id$";
35
31
 
36
32
#include <string.h>
37
33
 
38
34
#include "assert.h"
39
 
#include "return.h"
40
35
#include <X11/X.h>
41
36
#include <X11/Xlib.h>
42
37
#include <X11/Intrinsic.h>
62
57
        return;
63
58
 
64
59
    if (VSEFlag(show_draw))
65
 
        cout << "\n[" << r;
 
60
        std::cout << "\n[" << r;
66
61
 
67
62
    // Make sure we have enough space
68
63
    assert(!(size() > r.space()));
75
70
    _draw(w, r, exposed, gc, context_selected);
76
71
 
77
72
    if (VSEFlag(show_draw))
78
 
        cout << "]";
 
73
        std::cout << "]";
79
74
}
80
75
 
81
76
 
100
95
{
101
96
    if (VSEFlag(show_match_boxes))
102
97
    {
103
 
        cout << "\nBox match: " << *this << " ? " << b;
104
 
        cout.flush();
 
98
        std::cout << "\nBox match: " << *this << " ? " << b;
 
99
        std::cout.flush();
105
100
    }
106
101
 
107
102
    bool flag = (this == &b) || matchMe().matches(b.matchMe(), &b);
109
104
    if (VSEFlag(show_match_boxes))
110
105
    {
111
106
        if (flag)
112
 
            cout << "\nBox match: " << *this << " == " << b;
 
107
            std::cout << "\nBox match: " << *this << " == " << b;
113
108
        else
114
 
            cout << "\nBox match: " << *this << " != " << b;
 
109
            std::cout << "\nBox match: " << *this << " != " << b;
115
110
 
116
 
        cout.flush();
 
111
        std::cout.flush();
117
112
    }
118
113
    
119
114
    return flag;
131
126
}
132
127
 
133
128
// Region of the TagBox at P; if P is not given, use top-most tag
134
 
BoxRegion Box::region(BoxPoint p) const RETURNS(r)
 
129
BoxRegion Box::region(const BoxPoint& p) const
135
130
{
136
 
    RETURN_OBJECT(BoxRegion, r);
137
131
    const TagBox *t = findTag(p);
138
 
    if (t)
139
 
        r = t->__region();
140
 
    else
141
 
        r = BoxRegion(BoxPoint(0,0), BoxSize(0,0));
142
 
    RETURN(r);
 
132
    return (t) ?
 
133
      t->__region() :
 
134
      BoxRegion(BoxPoint(0,0), BoxSize(0,0));
143
135
}
144
136
 
145
137
// Data of the TagBox at P
146
 
Data *Box::data(BoxPoint p) const
 
138
Data *Box::data(const BoxPoint& p) const
147
139
{
148
140
    const TagBox *t = findTag(p);
149
141
    if (t == 0)
152
144
}
153
145
 
154
146
// Name of the TagBox at P
155
 
string Box::name(BoxPoint p) const RETURNS(name)
 
147
string Box::name(const BoxPoint& p) const
156
148
{
157
 
    RETURN_OBJECT(string, name);
158
149
    const TagBox *t = findTag(p);
159
 
    if (t)
160
 
        name = t->__name();
161
 
    else
162
 
        name = "";
163
 
    RETURN(name);
 
150
    return (t) ?
 
151
      t->__name() :
 
152
      "";
164
153
}
165
154
 
166
155
// Information of the TagBox at P
167
 
string Box::info(BoxPoint p) const RETURNS(info)
 
156
string Box::info(const BoxPoint &p) const
168
157
{
169
 
    RETURN_OBJECT(string, info);
170
158
    const TagBox *t = findTag(p);
171
 
    if (t)
172
 
        info = t->__info();
173
 
    else
174
 
        info = "";
175
 
    RETURN(info);
 
159
    return (t) ?
 
160
      t->__info():
 
161
      "";
176
162
}
177
163
 
178
164
// `Selected' property of TagBox at P
179
 
bool Box::selected(BoxPoint p) const
 
165
bool Box::selected(const BoxPoint& p) const
180
166
{
181
167
    const TagBox *t = findTag(p);
182
168
    if (t == 0)
188
174
// Debugging
189
175
 
190
176
// Dump Box
191
 
ostream &operator << (ostream& s, const Box& b)
 
177
std::ostream &operator << (std::ostream& s, const Box& b)
192
178
{
193
179
    if (VSEFlags::max_info_nesting != 0)
194
180
    {