path-chemistry.cpp revision 6e66aacc81082dea65863fbf9d872c31d9cd5eb3
/*
* Here are handlers for modifying selections, specific to paths
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 1999-2008 Authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <cstring>
#include <string>
#include "color.h"
#include <glib.h>
#include "sp-path.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "text-editing.h"
#include "style.h"
#include "desktop.h"
#include "document.h"
#include "document-undo.h"
#include "message-stack.h"
#include "selection.h"
#include "box3d.h"
#include "selection-chemistry.h"
#include "path-chemistry.h"
#include "verbs.h"
using Inkscape::DocumentUndo;
{
}
void
{
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to combine."));
return;
}
// set "busy" cursor
}
}
for (std::vector<Inkscape::XML::Node*>::const_iterator i = converted.begin(); i != converted.end(); i++)
// remember the position, id, transform and style of the topmost path, they will be assigned to the combined one
char const *path_effect = NULL;
if (did) {
}
if (!path) {
continue;
}
if (!did) {
did = true;
}
// FIXME: merge styles of combined objects instead of using the first one's style
//c->transform(item->transform);
curve = c;
} else {
c->unref();
// reduce position only if the same parent
position--;
}
// delete the object for real, so that its clones can take appropriate action
item->deleteObject();
}
}
if (did) {
first->deleteObject(false);
// delete the topmost.
// restore id, transform, path effect, and style
if (transform) {
}
// set path data corresponding to new curve
if (path_effect) {
} else {
}
// add the new group to the parent of the topmost
// move to the position of the topmost, reduced by the number of deleted items
_("Combine"));
} else {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to combine in the selection."));
}
}
void
{
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to break apart."));
return;
}
// set "busy" cursor
bool did = false;
if (!path) {
continue;
}
continue;
}
did = true;
// XML Tree being used directly here while it shouldn't be...
// XML Tree being used directly here while it shouldn't be...
// it's going to resurrect as one of the pieces, so we delete without advertisement
item->deleteObject(false);
if (path_effect)
else
// add the new repr to the parent
// move to the saved position
// if it's the first one, restore id
if (l == list)
}
}
if (did) {
_("Break apart"));
} else {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No path(s)</b> to break apart in the selection."));
}
}
/* This function is an entry point from GUI */
void
{
if (interactive && desktop)
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path."));
return;
}
bool did = false;
if (interactive && desktop) {
// set "busy" cursor
}
if (interactive && desktop) {
if (did) {
_("Object to path"));
} else {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No objects</b> to convert to path in the selection."));
return;
}
}
}
/** Converts the selected items to LPEItems if they are not already so; e.g. SPRects) */
{
return;
}
}
bool
sp_item_list_to_curves(const std::vector<SPItem*> &items, std::vector<SPItem*>& selected, std::vector<Inkscape::XML::Node*> &to_select, bool skip_all_lpeitems)
{
bool did = false;
if ( skip_all_lpeitems &&
!group ) // also convert objects in an SPGroup when skip_all_lpeitems is set.
{
continue;
}
// remove connector attributes
did = true;
}
continue; // already a path, and no path effect
}
if (box) {
// convert 3D box to ordinary group of paths; replace the old element in 'selected' with the new group
if (repr) {
did = true;
}
continue;
}
if (group) {
group->removeAllPathEffects(true);
did = true;
continue;
}
if (!repr)
continue;
did = true;
// remember the position of the item
// remember parent
// remember id
// remember title
// remember description
// remember highlight color
guint32 highlight_color = 0;
if (item->isHighlightSet())
// It's going to resurrect, so we delete without notifying listeners.
item->deleteObject(false);
// restore id
// add the new repr to the parent
}
}
if (highlight_color && newObj) {
}
// move to the saved position
/* Buglet: We don't re-add the (new version of the) object to the selection of any other
* desktops where it was previously selected. */
}
return did;
}
{
if (!item)
return NULL;
// Special treatment for text: convert each glyph to separate path, then group the paths
/* Mask */
if ( mask_str )
/* Clip path */
if ( clip_path_str )
/* Rotation center */
g_repr->setAttribute("inkscape:transform-center-x", item->getRepr()->attribute("inkscape:transform-center-x"), false);
g_repr->setAttribute("inkscape:transform-center-y", item->getRepr()->attribute("inkscape:transform-center-y"), false);
/* Whole text's style */
item->style->write( SP_STYLE_FLAG_IFDIFF, item->parent ? item->parent->style : NULL); // TODO investigate posibility
do {
break;
/* This glyph's style */
void *rawptr = 0;
break;
}
pos_obj->style->write( SP_STYLE_FLAG_IFDIFF, pos_obj->parent ? pos_obj->parent->style : NULL); // TODO investigate posibility
// get path from iter to iter_next:
if (!curve) { // error converting this glyph
continue;
}
continue;
}
// For accessibility, store original string
if( original_text.size() > 0 ) {
}
break;
} while (true);
return g_repr;
}
{
if (shape) {
}
}
if (!curve)
return NULL;
// Prevent empty paths from being added to the document
// otherwise we end up with zomby markup in the SVG file
{
return NULL;
}
/* Transformation */
/* Style */
item->style->write( SP_STYLE_FLAG_IFDIFF, item->parent ? item->parent->style : NULL); // TODO investigate posibility
/* Mask */
if ( mask_str )
/* Clip path */
if ( clip_path_str )
/* Rotation center */
repr->setAttribute("inkscape:transform-center-x", item->getRepr()->attribute("inkscape:transform-center-x"), false);
repr->setAttribute("inkscape:transform-center-y", item->getRepr()->attribute("inkscape:transform-center-y"), false);
/* Definition */
return repr;
}
void
{
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>path(s)</b> to reverse."));
return;
}
// set "busy" cursor
bool did = false;
if (!path) {
continue;
}
did = true;
if ( path->hasPathEffectRecursive() ) {
} else {
}
// reverse nodetypes order (Bug #179866)
if ( nodetypes ) {
}
}
if (did) {
_("Reverse path"));
} else {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No paths</b> to reverse in the selection."));
}
}
/*
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:fileencoding=utf-8:textwidth=99 :