~danieljabailey/inkscape/arc_node_editor

« back to all changes in this revision

Viewing changes to src/sp-item.cpp

  • Committer: knutux
  • Date: 2006-04-20 16:06:59 UTC
  • Revision ID: knutux@users.sourceforge.net-20060420160659-vyt0xz1up0dcl9yb
SVG 1.1 Conditional Processing Module rendering support (<switch> element, requiredReatures/requiredExtensions/systemLanguage attributes).
Two more W3C SVG Test Suite testes pass after this change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "sp-text.h"
45
45
#include "sp-item-rm-unsatisfied-cns.h"
46
46
#include "sp-pattern.h"
 
47
#include "sp-switch.h"
47
48
#include "gradient-chemistry.h"
48
49
#include "prefs-utils.h"
49
50
#include "conn-avoid-ref.h"
 
51
#include "conditions.h"
50
52
 
51
53
#include "libnr/nr-matrix-div.h"
52
54
#include "libnr/nr-matrix-fns.h"
130
132
static void
131
133
sp_item_init(SPItem *item)
132
134
{
133
 
    SPObject *object = SP_OBJECT(item);
134
 
 
135
 
    item->sensitive = TRUE;
136
 
 
137
 
    item->transform_center_x = 0;
138
 
    item->transform_center_y = 0;
139
 
 
140
 
    item->transform = NR::identity();
141
 
 
142
 
    item->display = NULL;
143
 
 
144
 
    item->clip_ref = new SPClipPathReference(SP_OBJECT(item));
 
135
    item->init();
 
136
}
 
137
 
 
138
void SPItem::init() {
 
139
    this->sensitive = TRUE;
 
140
 
 
141
    this->transform_center_x = 0;
 
142
    this->transform_center_y = 0;
 
143
 
 
144
    this->_is_evaluated = true;
 
145
    this->_evaluated_status = StatusCalculated;
 
146
 
 
147
    this->transform = NR::identity();
 
148
 
 
149
    this->display = NULL;
 
150
 
 
151
    this->clip_ref = new SPClipPathReference(this);
145
152
                {
146
 
                        sigc::signal<void, SPObject *, SPObject *> cs1=item->clip_ref->changedSignal();
147
 
                        sigc::slot2<void,SPObject*, SPObject *> sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), item);
 
153
                        sigc::signal<void, SPObject *, SPObject *> cs1=this->clip_ref->changedSignal();
 
154
                        sigc::slot2<void,SPObject*, SPObject *> sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this);
148
155
                        cs1.connect(sl1);
149
156
                }
150
157
 
151
 
    item->mask_ref = new SPMaskReference(SP_OBJECT(item));
152
 
                sigc::signal<void, SPObject *, SPObject *> cs2=item->mask_ref->changedSignal();
153
 
                sigc::slot2<void,SPObject*, SPObject *> sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), item);
 
158
    this->mask_ref = new SPMaskReference(this);
 
159
                sigc::signal<void, SPObject *, SPObject *> cs2=this->mask_ref->changedSignal();
 
160
                sigc::slot2<void,SPObject*, SPObject *> sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this);
154
161
    cs2.connect(sl2);
155
162
 
156
 
    if (!object->style) object->style = sp_style_new_from_object(SP_OBJECT(item));
157
 
 
158
 
    item->avoidRef = new SPAvoidRef(item);
159
 
 
160
 
    new (&item->_transformed_signal) sigc::signal<void, NR::Matrix const *, SPItem *>();
 
163
    if (!this->style) this->style = sp_style_new_from_object(this);
 
164
 
 
165
    this->avoidRef = new SPAvoidRef(this);
 
166
 
 
167
    new (&this->_transformed_signal) sigc::signal<void, NR::Matrix const *, SPItem *>();
161
168
}
162
169
 
163
170
bool SPItem::isVisibleAndUnlocked() const {
183
190
}
184
191
 
185
192
bool SPItem::isHidden() const {
 
193
    if (!isEvaluated())
 
194
        return true;
186
195
    return style->display.computed == SP_CSS_DISPLAY_NONE;
187
196
}
188
197
 
195
204
}
196
205
 
197
206
bool SPItem::isHidden(unsigned display_key) const {
 
207
    if (!isEvaluated())
 
208
        return true;
198
209
    for ( SPItemView *view(display) ; view ; view = view->next ) {
199
210
        if ( view->key == display_key ) {
200
211
            g_assert(view->arenaitem != NULL);
211
222
    return true;
212
223
}
213
224
 
 
225
void SPItem::setEvaluated(bool evaluated) {
 
226
    _is_evaluated = evaluated;
 
227
    _evaluated_status = StatusSet;
 
228
}
 
229
 
 
230
void SPItem::resetEvaluated() {
 
231
    if ( StatusCalculated == _evaluated_status ) {
 
232
        _evaluated_status = StatusUnknown;
 
233
        bool oldValue = _is_evaluated;
 
234
        if ( oldValue != isEvaluated() ) {
 
235
            requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
 
236
        }
 
237
    } if ( StatusSet == _evaluated_status ) {
 
238
        SPObject const *const parent = SP_OBJECT_PARENT(this);
 
239
        if (SP_IS_SWITCH(parent)) {
 
240
            SP_SWITCH(parent)->resetChildEvaluated();
 
241
        }
 
242
    }
 
243
}
 
244
 
 
245
bool SPItem::isEvaluated() const {
 
246
    if ( StatusUnknown == _evaluated_status ) {
 
247
        _is_evaluated = sp_item_evaluate(this);
 
248
        _evaluated_status = StatusCalculated;
 
249
    }
 
250
    return _is_evaluated;
 
251
}
 
252
 
214
253
/**
215
254
 * Returns something suitable for the `Hide' checkbox in the Object Properties dialog box.
216
255
 *  Corresponds to setExplicitlyHidden.
466
505
                item->transform_center_y = 0;
467
506
            }
468
507
            break;
 
508
        case SP_PROP_SYSTEM_LANGUAGE:
 
509
        case SP_PROP_REQUIRED_FEATURES:
 
510
        case SP_PROP_REQUIRED_EXTENSIONS:
 
511
            {
 
512
                item->resetEvaluated();
 
513
                // pass to default handler
 
514
            }
469
515
        default:
470
516
            if (SP_ATTRIBUTE_IS_CSS(key)) {
471
517
                sp_style_read_from_object(object->style, object);
741
787
NR::Rect sp_item_bbox_desktop(SPItem *item)
742
788
{
743
789
    NRRect ret;
744
 
    sp_item_bbox_desktop(item, &ret);
 
790
    sp_item_invoke_bbox(item, &ret, sp_item_i2d_affine(item), TRUE);
745
791
    return NR::Rect(ret);
746
792
}
747
793