Exemple #1
0
gint
sp_guide_compare (gconstpointer a, gconstpointer b)
{
	SPGuide * ga, * gb;

	ga = SP_GUIDE (a);
	gb = SP_GUIDE (b);

	if (ga->position < gb->position) return -1;
	if (ga->position > gb->position) return 1;
	return 0;
}
void satisfied_guide_cns(SPDesktop const &desktop,
                         std::vector<Inkscape::SnapCandidatePoint> const &snappoints,
                         std::vector<SPGuideConstraint> &cns)
{
    SPNamedView const &nv = *sp_desktop_namedview(&desktop);
    for (GSList const *l = nv.guides; l != NULL; l = l->next) {
        SPGuide &g = *SP_GUIDE(l->data);
        for (unsigned int i = 0; i < snappoints.size(); ++i) {
            if (approx_equal( g.getDistanceFrom(snappoints[i].getPoint()), 0) ) {
                cns.push_back(SPGuideConstraint(&g, i));
            }
        }
    }
}
Exemple #3
0
static void
sp_guide_get_property (GObject * object, guint prop_id, GValue *value, GParamSpec *pspec)
{
	SPGuide * guide;

	guide = SP_GUIDE (object);

	switch (prop_id) {
	case PROP_COLOR:
		g_value_set_uint(value, guide->color);
		break;
	case PROP_HICOLOR:
		g_value_set_uint(value, guide->hicolor);
		break;
	}
}
Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Point const &/*p*/) const
{
    LineList s;

    if ( NULL == _snapmanager->getNamedView() || ThisSnapperMightSnap() == false) {
        return s;
    }

    SPGuide const *guide_to_ignore = _snapmanager->getGuideToIgnore();

    for (GSList const *l = _snapmanager->getNamedView()->guides; l != NULL; l = l->next) {
        SPGuide const *g = SP_GUIDE(l->data);
        if (g != guide_to_ignore) {
            s.push_back(std::make_pair(g->normal_to_line, g->point_on_line));
        }
    }

    return s;
}
Exemple #5
0
static void
sp_guide_set_property (GObject * object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
	SPGuide * guide;
	GSList * l;

	guide = SP_GUIDE (object);

	switch (prop_id) {
	case PROP_COLOR:
		guide->color = g_value_get_uint (value);
		for (l = guide->views; l != NULL; l = l->next) {
			sp_guideline_set_color (SP_GUIDELINE (l->data), guide->color);
		}
		break;
	case PROP_HICOLOR:
		guide->hicolor = g_value_get_uint (value);
		break;
	}
}
Exemple #6
0
static void
sp_guide_set (SPObject *object, unsigned int key, const gchar *value)
{
	SPGuide *guide;

	guide = SP_GUIDE (object);

	switch (key) {
	case SP_ATTR_ORIENTATION:
		if (value && !strcmp (value, "horizontal")) {
			guide->orientation = SP_GUIDE_HORIZONTAL;
		} else {
			guide->orientation = SP_GUIDE_VERTICAL;
		}
		break;
	case SP_ATTR_POSITION:
		sp_svg_number_read_d (value, &guide->position);
		break;
	default:
		if (((SPObjectClass *) (parent_class))->set)
			((SPObjectClass *) (parent_class))->set (object, key, value);
		break;
	}
}