~ubuntu-branches/ubuntu/natty/inkscape/natty

« back to all changes in this revision

Viewing changes to src/star-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:
259
259
            /* Snap center */
260
260
            SnapManager &m = desktop->namedview->snap_manager;
261
261
            m.setup(desktop, true);
262
 
            Geom::Point pt2g = to_2geom(sc->center);
263
 
            m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE);
264
 
            sc->center = from_2geom(pt2g);
 
262
            m.freeSnapReturnByRef(sc->center, Inkscape::SNAPSOURCE_NODE_HANDLE);
265
263
 
266
264
            sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
267
265
                                GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
293
291
            gobble_motion_events(GDK_BUTTON1_MASK);
294
292
 
295
293
            ret = TRUE;
 
294
        } else if (!sp_event_context_knot_mouseover(event_context)) {
 
295
            SnapManager &m = desktop->namedview->snap_manager;
 
296
            m.setup(desktop);
 
297
 
 
298
            Geom::Point const motion_w(event->motion.x, event->motion.y);
 
299
            Geom::Point motion_dt(desktop->w2d(motion_w));
 
300
            m.preSnap(Inkscape::SnapCandidatePoint(motion_dt, Inkscape::SNAPSOURCE_NODE_HANDLE));
296
301
        }
297
302
        break;
298
303
    case GDK_BUTTON_RELEASE:
437
442
    SnapManager &m = desktop->namedview->snap_manager;
438
443
    m.setup(desktop, true, sc->item);
439
444
    Geom::Point pt2g = to_2geom(p);
440
 
    m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, pt2g, Inkscape::SNAPSOURCE_HANDLE);
 
445
    m.freeSnapReturnByRef(pt2g, Inkscape::SNAPSOURCE_NODE_HANDLE);
441
446
 
442
447
    Geom::Point const p0 = desktop->dt2doc(sc->center);
443
448
    Geom::Point const p1 = desktop->dt2doc(pt2g);
474
479
    sc->_message_context->clear();
475
480
 
476
481
    if (sc->item != NULL) {
477
 
        SPStar *star = SP_STAR(sc->item);
478
 
        if (star->r[1] == 0) {
479
 
                sp_star_cancel(sc); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point
480
 
                return;
481
 
        }
482
 
 
483
 
        SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop;
 
482
        SPStar *star = SP_STAR(sc->item);
 
483
        if (star->r[1] == 0) {
 
484
            sp_star_cancel(sc); // Don't allow the creating of zero sized arc, for example when the start and and point snap to the snap grid point
 
485
            return;
 
486
        }
 
487
 
 
488
        // Set transform center, so that odd stars rotate correctly
 
489
        // LP #462157
 
490
        sc->item->setCenter(sc->center);
 
491
 
 
492
        SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop;
484
493
        SPObject *object = SP_OBJECT(sc->item);
485
494
 
486
495
        sp_shape_set_shape(SP_SHAPE(sc->item));
499
508
 
500
509
static void sp_star_cancel(SPStarContext *sc)
501
510
{
502
 
        SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop;
 
511
    SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop;
503
512
 
504
 
        sp_desktop_selection(desktop)->clear();
505
 
        sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
 
513
    sp_desktop_selection(desktop)->clear();
 
514
    sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), 0);
506
515
 
507
516
    if (sc->item != NULL) {
508
 
        SP_OBJECT(sc->item)->deleteObject();
509
 
        sc->item = NULL;
 
517
        SP_OBJECT(sc->item)->deleteObject();
 
518
        sc->item = NULL;
510
519
    }
511
520
 
512
521
    sc->within_tolerance = false;