~ubuntu-branches/debian/sid/inkscape/sid

« back to all changes in this revision

Viewing changes to src/draw-anchor.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-06-21 15:13:32 UTC
  • mfrom: (10.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130621151332-uo22shomzjut843h
Tags: 0.48.4-1
* Upload to unstable
* debian/control: added myself to Uploaders
* debian/patches/: patchset updated
  - 04-Fix_FTBFS_on_gcc-4.8.patch added (Closes: #701297)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "display/sodipodi-ctrl.h"
22
22
#include "display/curve.h"
23
23
 
 
24
#define FILL_COLOR_NORMAL 0xffffff7f
 
25
#define FILL_COLOR_MOUSEOVER 0xff0000ff
 
26
 
24
27
/**
25
28
 * Creates an anchor object and initializes it.
26
29
 */
27
 
SPDrawAnchor *
28
 
sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean start, Geom::Point delta)
 
30
SPDrawAnchor *sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean start, Geom::Point delta)
29
31
{
30
32
    if (SP_IS_LPETOOL_CONTEXT(dc)) {
31
33
        // suppress all kinds of anchors in LPEToolContext
44
46
    a->dp = delta;
45
47
    a->ctrl = sp_canvas_item_new(sp_desktop_controls(dt), SP_TYPE_CTRL,
46
48
                                 "size", 6.0,
47
 
                                 "filled", 0,
48
 
                                 "fill_color", 0xff00007f,
 
49
                                 "filled", 1,
 
50
                                 "fill_color", FILL_COLOR_NORMAL,
49
51
                                 "stroked", 1,
50
52
                                 "stroke_color", 0x000000ff,
51
53
                                 NULL);
58
60
/**
59
61
 * Destroys the anchor's canvas item and frees the anchor object.
60
62
 */
61
 
SPDrawAnchor *
62
 
sp_draw_anchor_destroy(SPDrawAnchor *anchor)
 
63
SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor)
63
64
{
64
65
    if (anchor->curve) {
65
66
        anchor->curve->unref();
77
78
 * Test if point is near anchor, if so fill anchor on canvas and return
78
79
 * pointer to it or NULL.
79
80
 */
80
 
SPDrawAnchor *
81
 
sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate)
 
81
SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate)
82
82
{
83
83
    SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(anchor->dc);
84
84
 
85
85
    if ( activate && ( Geom::LInfty( w - dt->d2w(anchor->dp) ) <= A_SNAP ) ) {
86
86
        if (!anchor->active) {
87
 
            sp_canvas_item_set((GtkObject *) anchor->ctrl, "filled", TRUE, NULL);
 
87
            sp_canvas_item_set((GtkObject *) anchor->ctrl, "fill_color", FILL_COLOR_MOUSEOVER, NULL);
88
88
            anchor->active = TRUE;
89
89
        }
90
90
        return anchor;
91
91
    }
92
92
 
93
93
    if (anchor->active) {
94
 
        sp_canvas_item_set((GtkObject *) anchor->ctrl, "filled", FALSE, NULL);
 
94
        sp_canvas_item_set((GtkObject *) anchor->ctrl, "fill_color", FILL_COLOR_NORMAL, NULL);
95
95
        anchor->active = FALSE;
96
96
    }
97
97
    return NULL;