sp-guide.cpp revision 2ad27e8a03245a6b9d62b54b5830b7ec9292eff3
/*
* Inkscape guideline implementation
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Peter Moulder <pmoulder@mail.csse.monash.edu.au>
* Johan Engelen
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2000-2002 authors
* Copyright (C) 2004 Monash University
* Copyright (C) 2007 Johan Engelen
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <algorithm>
#include <cstring>
#include <string>
#include "desktop-handles.h"
#include "display/sp-canvas.h"
#include "display/guideline.h"
#include "svg/stringstream.h"
#include "attributes.h"
#include "sp-guide.h"
#include <sp-item-notify-moveto.h>
#include <sp-item.h>
#include <sp-guide-constraint.h>
#include <remove-last.h>
#include "sp-metrics.h"
#include "inkscape.h"
#include "desktop.h"
#include "sp-namedview.h"
#include "document.h"
#include "document-undo.h"
#include "verbs.h"
using Inkscape::DocumentUndo;
enum {
};
static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
{
0,
0xffffffff,
0xff000000,
0,
0xffffffff,
0xff000000,
}
{
}
static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec */*pspec*/)
{
switch (prop_id) {
case PROP_COLOR:
}
break;
case PROP_HICOLOR:
break;
}
}
static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec */*pspec*/)
{
switch (prop_id) {
case PROP_COLOR:
break;
case PROP_HICOLOR:
break;
}
}
{
}
/* Register */
}
{
}
// Unregister ourselves
}
}
}
{
switch (key) {
case SP_ATTR_INKSCAPE_LABEL:
if (value) {
} else {
}
break;
case SP_ATTR_ORIENTATION:
{
/* Visual representation of a horizontal line, constrain vertically (y coordinate). */
} else if (value) {
} else {
// default to vertical line for bad arguments
}
} else {
// default to vertical line for bad arguments
}
}
break;
case SP_ATTR_POSITION:
{
if (value) {
if (success == 2) {
} else if (success == 1) {
// before 0.46 style guideline definition.
} else {
}
}
} else {
// default to (0,0) for bad arguments
}
// update position in non-committing way
// fixme: perhaps we need to add an update method instead, and request_update here
}
break;
default:
}
break;
}
}
{
if (namedview) {
}
return guide;
}
void
sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts) {
for (std::list<std::pair<Geom::Point, Geom::Point> >::iterator i = pts.begin(); i != pts.end(); ++i) {
}
}
void
}
void
}
}
{
}
{
return;
}
}
}
{
return;
}
}
}
{
return -(pt - point_on_line);
}
{
}
/**
* \arg commit False indicates temporary moveto in response to motion event while dragging,
* true indicates a "committing" version: in response to button release event after
* dragging a guideline, or clicking OK in guide editing dialog.
*/
{
}
/* Calling sp_repr_set_point must precede calling sp_item_notify_moveto in the commit
case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
if (commit) {
//XML Tree being used here directly while it shouldn't be.
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
for (vector<SPGuideAttachment>::const_iterator i(guide.attached_items.begin()),
iEnd(guide.attached_items.end());
i != iEnd; ++i)
{
SPGuideAttachment const &att = *i;
sp_item_notify_moveto(*att.item, guide, att.snappoint_ix, position, commit);
}
*/
}
/**
* \arg commit False indicates temporary moveto in response to motion event while dragging,
* true indicates a "committing" version: in response to button release event after
* dragging a guideline, or clicking OK in guide editing dialog.
*/
{
}
/* Calling sp_repr_set_svg_point must precede calling sp_item_notify_moveto in the commit
case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */
if (commit) {
//XML Tree being used directly while it shouldn't be
}
/* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan)
for (vector<SPGuideAttachment>::const_iterator i(guide.attached_items.begin()),
iEnd(guide.attached_items.end());
i != iEnd; ++i)
{
SPGuideAttachment const &att = *i;
sp_item_notify_moveto(*att.item, guide, att.snappoint_ix, position, commit);
}
*/
}
void sp_guide_set_color(SPGuide &guide, const unsigned r, const unsigned g, const unsigned b, bool const commit)
{
}
if (commit){
//XML Tree being used directly while it shouldn't be
}
}
{
}
if (commit){
//XML Tree being used directly while it shouldn't be
}
}
/**
* Returns a human-readable description of the guideline for use in dialog boxes and status bar.
* If verbose is false, only positioning information is included (useful for dialogs).
*
* The caller is responsible for freeing the string.
*/
{
using Geom::X;
using Geom::Y;
char *descr = 0;
// Guide has probably been deleted and no longer has an attached namedview.
} else {
gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete"));
} else {
}
if (verbose) {
}
}
return descr;
}
{
i != iEnd; ++i)
{
SPGuideAttachment const &att = *i;
}
//XML Tree being used directly while it shouldn't be.
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :