~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/sp-conn-end.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
 
2
#include <cstring>
 
3
#include <string>
 
4
 
2
5
#include "display/curve.h"
3
6
#include "libnr/nr-matrix-div.h"
4
7
#include "libnr/nr-matrix-fns.h"
34
37
}
35
38
 
36
39
static void
37
 
sp_conn_end_move_compensate(NR::Matrix const *mp, SPItem *moved_item,
 
40
sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
38
41
                            SPPath *const path,
39
42
                            bool const updatePathRepr = true)
40
43
{
41
 
    // TODO: SPItem::invokeBbox gives the wrong result for some objects
 
44
    // TODO: SPItem::getBounds gives the wrong result for some objects
42
45
    //       that have internal representations that are updated later
43
46
    //       by the sp_*_update functions, e.g., text.
44
47
    sp_document_ensure_up_to_date(path->document);
64
67
        /* Initial end-points: centre of attached object. */
65
68
        NR::Point h2endPt_icoordsys[2];
66
69
        NR::Matrix h2i2anc[2];
67
 
        NR::Rect h2bbox_icoordsys[2] = {
68
 
            h2attItem[0]->invokeBbox(NR::identity()),
69
 
            h2attItem[1]->invokeBbox(NR::identity())
70
 
        };
 
70
        NR::Rect h2bbox_icoordsys[2];
71
71
        NR::Point last_seg_endPt[2] = {
72
72
            sp_curve_second_point(path->curve),
73
73
            sp_curve_penultimate_point(path->curve)
74
74
        };
75
75
        for (unsigned h = 0; h < 2; ++h) {
 
76
            NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(NR::identity());
 
77
            if (!bbox) {
 
78
                if (updatePathRepr) {
 
79
                    path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 
80
                    path->updateRepr();
 
81
                }
 
82
                return;
 
83
            }
 
84
            h2bbox_icoordsys[h] = *bbox;
76
85
            h2i2anc[h] = i2anc_affine(h2attItem[h], ancestor);
77
86
            h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint();
78
87
        }
107
116
 
108
117
        NR::Rect otherpt_rect = NR::Rect(other_endpt, other_endpt);
109
118
        NR::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect };
110
 
        h2bbox_icoordsys[ind] = h2attItem[ind]->invokeBbox(NR::identity());
 
119
        NR::Maybe<NR::Rect> bbox = h2attItem[ind]->getBounds(NR::identity());
 
120
        if (!bbox) {
 
121
            if (updatePathRepr) {
 
122
                path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 
123
                path->updateRepr();
 
124
            }
 
125
            return;
 
126
        }
111
127
 
 
128
        h2bbox_icoordsys[ind] = *bbox;
112
129
        h2i2anc = i2anc_affine(h2attItem[ind], ancestor);
113
130
        h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint();
114
131
 
263
280
}
264
281
 
265
282
void
266
 
sp_conn_end_href_changed(SPObject *old_ref, SPObject *ref,
 
283
sp_conn_end_href_changed(SPObject */*old_ref*/, SPObject */*ref*/,
267
284
                         SPConnEnd *connEndPtr, SPPath *const path, unsigned const handle_ix)
268
285
{
269
286
    g_return_if_fail(connEndPtr != NULL);