~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to src/arc-context.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 
56
56
static void sp_arc_drag(SPArcContext *ec, Geom::Point pt, guint state);
57
57
static void sp_arc_finish(SPArcContext *ec);
 
58
static void sp_arc_cancel(SPArcContext *ec);
58
59
 
59
60
static SPEventContextClass *parent_class;
60
61
 
269
270
                sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings
270
271
                if (!event_context->within_tolerance) {
271
272
                    // we've been dragging, finish the arc
272
 
                    sp_arc_finish(ac);
 
273
                        sp_arc_finish(ac);
273
274
                } else if (event_context->item_to_select) {
274
275
                    // no dragging, select clicked item if any
275
276
                    if (event->button.state & GDK_SHIFT_MASK) {
321
322
                    }
322
323
                    break;
323
324
                case GDK_Escape:
324
 
                    sp_desktop_selection(desktop)->clear();
325
 
                    //TODO: make dragging escapable by Esc
326
 
                    break;
327
 
 
 
325
                        if (dragging) {
 
326
                                dragging = false;
 
327
                                sp_event_context_snap_window_closed(event_context);
 
328
                                // if drawing, cancel, otherwise pass it up for deselecting
 
329
                                                sp_arc_cancel(ac);
 
330
                                                ret = TRUE;
 
331
                                        }
 
332
                        break;
328
333
                case GDK_space:
329
334
                    if (dragging) {
330
335
                        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
332
337
                        dragging = false;
333
338
                        sp_event_context_snap_window_closed(event_context);
334
339
                        if (!event_context->within_tolerance) {
335
 
                            // we've been dragging, finish the rect
 
340
                            // we've been dragging, finish the arc
336
341
                            sp_arc_finish(ac);
337
342
                        }
338
343
                        // do not return true, so that space would work switching to selector
461
466
    ac->_message_context->clear();
462
467
 
463
468
    if (ac->item != NULL) {
464
 
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
 
469
 
 
470
        SPGenericEllipse *ge = SP_GENERICELLIPSE(SP_ARC(ac->item));
 
471
                if (ge->rx.computed == 0 || ge->ry.computed == 0) {
 
472
                        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
 
473
                        return;
 
474
                }
 
475
 
 
476
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
465
477
 
466
478
        SP_OBJECT(ac->item)->updateRepr();
467
479
 
475
487
    }
476
488
}
477
489
 
 
490
static void sp_arc_cancel(SPArcContext *ac)
 
491
{
 
492
        SPDesktop *desktop = SP_EVENT_CONTEXT(ac)->desktop;
 
493
 
 
494
        sp_desktop_selection(desktop)->clear();
 
495
        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
 
496
 
 
497
    if (ac->item != NULL) {
 
498
        SP_OBJECT(ac->item)->deleteObject();
 
499
        ac->item = NULL;
 
500
    }
 
501
 
 
502
    ac->within_tolerance = false;
 
503
    ac->xp = 0;
 
504
    ac->yp = 0;
 
505
    ac->item_to_select = NULL;
 
506
 
 
507
    sp_canvas_end_forced_full_redraws(desktop->canvas);
 
508
 
 
509
    sp_document_cancel(sp_desktop_document(desktop));
 
510
}
 
511
 
478
512
 
479
513
/*
480
514
  Local Variables: