~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu5

« back to all changes in this revision

Viewing changes to src/arc-context.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
static void sp_arc_context_finish(SPEventContext *ec)
117
117
{
118
118
    SPArcContext *ac = SP_ARC_CONTEXT(ec);
119
 
        SPDesktop *desktop = ec->desktop;
 
119
    SPDesktop *desktop = ec->desktop;
120
120
 
121
 
        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME);
122
 
        sp_arc_finish(ac);
 
121
    sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME);
 
122
    sp_arc_finish(ac);
123
123
    ac->sel_changed_connection.disconnect();
124
124
 
125
125
    if (((SPEventContextClass *) parent_class)->finish) {
126
 
                ((SPEventContextClass *) parent_class)->finish(ec);
127
 
        }
 
126
        ((SPEventContextClass *) parent_class)->finish(ec);
 
127
    }
128
128
}
129
129
 
130
130
static void sp_arc_context_dispose(GObject *object)
244
244
                /* Snap center */
245
245
                SnapManager &m = desktop->namedview->snap_manager;
246
246
                m.setup(desktop);
247
 
                Geom::Point pt2g = to_2geom(ac->center);
248
 
                m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE);
249
 
                ac->center = from_2geom(pt2g);
 
247
                m.freeSnapReturnByRef(ac->center, Inkscape::SNAPSOURCE_NODE_HANDLE);
250
248
 
251
249
                sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
252
250
                                    GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
276
274
                gobble_motion_events(GDK_BUTTON1_MASK);
277
275
 
278
276
                ret = TRUE;
 
277
            } else if (!sp_event_context_knot_mouseover(ac)){
 
278
                SnapManager &m = desktop->namedview->snap_manager;
 
279
                m.setup(desktop);
 
280
 
 
281
                Geom::Point const motion_w(event->motion.x, event->motion.y);
 
282
                Geom::Point motion_dt(desktop->w2d(motion_w));
 
283
                m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
279
284
            }
280
285
            break;
281
286
        case GDK_BUTTON_RELEASE:
285
290
                sp_event_context_discard_delayed_snap_event(event_context);
286
291
                if (!event_context->within_tolerance) {
287
292
                    // we've been dragging, finish the arc
288
 
                        sp_arc_finish(ac);
 
293
                       sp_arc_finish(ac);
289
294
                } else if (event_context->item_to_select) {
290
295
                    // no dragging, select clicked item if any
291
296
                    if (event->button.state & GDK_SHIFT_MASK) {
337
342
                    }
338
343
                    break;
339
344
                case GDK_Escape:
340
 
                        if (dragging) {
341
 
                                dragging = false;
342
 
                                sp_event_context_discard_delayed_snap_event(event_context);
343
 
                                // if drawing, cancel, otherwise pass it up for deselecting
344
 
                                                sp_arc_cancel(ac);
345
 
                                                ret = TRUE;
346
 
                                        }
347
 
                        break;
 
345
                    if (dragging) {
 
346
                        dragging = false;
 
347
                        sp_event_context_discard_delayed_snap_event(event_context);
 
348
                        // if drawing, cancel, otherwise pass it up for deselecting
 
349
                        sp_arc_cancel(ac);
 
350
                        ret = TRUE;
 
351
                    }
 
352
                    break;
348
353
                case GDK_space:
349
354
                    if (dragging) {
350
355
                        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
482
487
 
483
488
    if (ac->item != NULL) {
484
489
 
485
 
        SPGenericEllipse *ge = SP_GENERICELLIPSE(SP_ARC(ac->item));
486
 
                if (ge->rx.computed == 0 || ge->ry.computed == 0) {
487
 
                        sp_arc_cancel(ac); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point
488
 
                        return;
489
 
                }
 
490
        SPGenericEllipse *ge = SP_GENERICELLIPSE(SP_ARC(ac->item));
 
491
        if (ge->rx.computed == 0 || ge->ry.computed == 0) {
 
492
            sp_arc_cancel(ac); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point
 
493
            return;
 
494
        }
490
495
 
491
 
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
 
496
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
492
497
 
493
498
        SP_OBJECT(ac->item)->updateRepr();
494
499
 
504
509
 
505
510
static void sp_arc_cancel(SPArcContext *ac)
506
511
{
507
 
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
 
512
    SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
508
513
 
509
 
        sp_desktop_selection(desktop)->clear();
510
 
        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
 
514
    sp_desktop_selection(desktop)->clear();
 
515
    sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
511
516
 
512
517
    if (ac->item != NULL) {
513
 
        SP_OBJECT(ac->item)->deleteObject();
514
 
        ac->item = NULL;
 
518
        SP_OBJECT(ac->item)->deleteObject();
 
519
        ac->item = NULL;
515
520
    }
516
521
 
517
522
    ac->within_tolerance = false;