selection-chemistry.cpp revision 8d10164b2636a9ee8b6ab5c5182143c0e50de3d4
#define __SP_SELECTION_CHEMISTRY_C__
/*
* Miscellanous operations on selected items
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Andrius R. <knutux@gmail.com>
*
* Copyright (C) 1999-2006 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 <gtkmm/clipboard.h>
#include "inkscape.h"
#include "desktop.h"
#include "desktop-style.h"
#include "selection.h"
#include "tools-switch.h"
#include "desktop-handles.h"
#include "message-stack.h"
#include "sp-item-transform.h"
#include "marker.h"
#include "sp-use.h"
#include "sp-textpath.h"
#include "sp-tspan.h"
#include "sp-flowtext.h"
#include "sp-flowregion.h"
#include "text-editing.h"
#include "text-context.h"
#include "connector-context.h"
#include "sp-path.h"
#include "sp-conn-end.h"
#include "dropper-context.h"
#include "libnr/nr-matrix-rotate-ops.h"
#include "libnr/nr-matrix-translate-ops.h"
#include "libnr/nr-rotate-fns.h"
#include "libnr/nr-scale-ops.h"
#include "libnr/nr-scale-translate-ops.h"
#include "libnr/nr-translate-matrix-ops.h"
#include "libnr/nr-translate-scale-ops.h"
#include "style.h"
#include "document-private.h"
#include "sp-gradient.h"
#include "sp-gradient-reference.h"
#include "sp-linear-gradient-fns.h"
#include "sp-pattern.h"
#include "sp-radial-gradient-fns.h"
#include "sp-namedview.h"
#include "prefs-utils.h"
#include "sp-offset.h"
#include "sp-clippath.h"
#include "sp-mask.h"
#include "file.h"
#include "helper/png-write.h"
#include "layer-fns.h"
#include "context-fns.h"
#include <map>
#include "sp-item.h"
#include "unit-constants.h"
using NR::X;
using NR::Y;
#include "selection-chemistry.h"
/* fixme: find a better place */
/**
* Copies repr and its inherited css style elements, along with the accumulated transform 'full_t',
* then prepends the copy to 'clip'.
*/
{
// copy complete inherited style
// write the complete accumulated transform passed to us
// (we're dealing with unattached repr, so we write to its attr
// instead of using sp_item_set_transform)
}
void sp_selection_copy_impl (const GSList *items, GSList **clip, GSList **defs_clip, SPCSSAttr **style_clip)
{
// Copy stuff referenced by all items to defs_clip:
if (defs_clip) {
}
}
// Store style:
if (style_clip) {
}
if (clip) {
// Sort items:
// Copy item reprs:
}
}
}
/**
* Iterates through 'defs_clip', and for each item it adds the data
* repr into the global defs.
*/
void
{
if (!defs_clip)
return;
}
}
}
GSList *sp_selection_paste_impl (SPDocument *document, SPObject *parent, GSList **clip, GSList **defs_clip)
{
// add objects to document
// premultiply the item transform by the accumulated parent transform in the paste layer
if (!local.test_identity()) {
if (t_str)
// (we're dealing with unattached repr, so we write to its attr instead of using sp_item_set_transform)
}
}
return copied;
}
{
}
}
}
void sp_selection_delete()
{
return;
}
_("Delete text"));
return;
}
// check if something is selected
return;
}
/* a tool may have set up private information in it's selection context
* that depends on desktop items. I think the only sane way to deal with
* this currently is to reset the current tool, which will reset it's
* associated selection context. For example: deleting an object
* while moving it around the canvas.
*/
_("Delete"));
}
/* fixme: sequencing */
void sp_selection_duplicate()
{
return;
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to duplicate."));
return;
}
// sorting items from different parents sorts each parent's subset without possibly mixing them, just what we need
while (reprs) {
}
_("Duplicate"));
}
void sp_edit_clear_all()
{
if (!dt)
return;
while (items) {
}
_("Delete all"));
}
GSList *
get_all_items (GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, const GSList *exclude)
{
for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
if (SP_IS_ITEM(child) &&
)
{
}
}
}
return list;
}
{
if (!dt)
return;
PrefsSelectionContext inlayer = (PrefsSelectionContext)prefs_get_int_attribute ("options.kbselection", "inlayer", PREFS_SELECTION_LAYER);
if (invert) {
}
if (force_all_layers)
switch (inlayer) {
case PREFS_SELECTION_LAYER: {
return;
}
}
}
}
}
break;
}
case PREFS_SELECTION_LAYER_RECURSIVE: {
break;
}
default: {
break;
}
}
if (items) {
}
}
void sp_edit_select_all ()
{
sp_edit_select_all_full (false, false);
}
void sp_edit_select_all_in_all_layers ()
{
sp_edit_select_all_full (true, false);
}
void sp_edit_invert ()
{
sp_edit_select_all_full (false, true);
}
void sp_edit_invert_in_all_layers ()
{
sp_edit_select_all_full (true, true);
}
void sp_selection_group()
{
return;
// Check if something is selected.
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>some objects</b> to group."));
return;
}
// Remember the position and parent of the topmost object.
while (p) {
topmost --; // only reduce count for those items deleted from topmost_parent
} else { // move it to topmost_parent first
// At this point, current may already have no item, due to its being a clone whose original is already moved away
// So we copy it artificially calculating the transform from its repr->attr("transform") and the parent transform
if (t_str)
//FIXME: when moving both clone and original from a transformed group (either by
//parent becomes embedded into original itself, and this affects its clones. Fix
//this by remembering the transform diffs we write to each item into an array and
//then, if this is clone, looking up its original in that array and pre-multiplying
//it by the inverse of that original's transform diff.
// paste into topmost_parent (temporarily)
GSList *copied = sp_selection_paste_impl (document, document->getObjectByRepr(topmost_parent), &temp_clip, NULL);
if (copied) { // if success,
// take pasted object (now in topmost_parent)
// make a copy
// remove pasted
// put its copy into group
}
}
p = g_slist_remove(p, current);
}
// Add the new group to the topmost members' parent
// Move to the position of the topmost, reduced by the number of items deleted from topmost_parent
_("Group"));
}
void sp_selection_ungroup()
{
return;
return;
}
// Get a copy of current selection.
bool ungrouped = false;
i != NULL;
i = i->next)
{
// when ungrouping cloned groups with their originals, some objects that were selected may no more exist due to unlinking
if (!SP_IS_OBJECT(group)) {
continue;
}
/* We do not allow ungrouping <svg> etc. (lauris) */
if (strcmp(SP_OBJECT_REPR(group)->name(), "svg:g") && strcmp(SP_OBJECT_REPR(group)->name(), "svg:switch")) {
// keep the non-group item in the new selection
continue;
}
/* This is not strictly required, but is nicer to rely on group ::destroy (lauris) */
ungrouped = true;
// Add ungrouped items to the new selection.
}
if (new_select) { // Set new selection.
}
if (!ungrouped) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No groups</b> to ungroup in the selection."));
}
_("Ungroup"));
}
static SPGroup *
{
if (!items) {
return NULL;
}
/* Strictly speaking this CAN happen, if user selects <svg> from XML editor */
if (!SP_IS_GROUP(parent)) {
return NULL;
}
return NULL;
}
}
}
/** Finds out the minimum common bbox of the selected items
*/
{
}
return r;
}
SPObject *
{
if (!SP_IS_GROUP(parent)) {
return NULL;
}
return i;
}
return NULL;
}
void
{
if (!desktop)
return;
if (!items) {
return;
}
if (!group) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from <b>different groups</b> or <b>layers</b>."));
return;
}
/* construct reverse-ordered list of selected children */
// find out the common bbox of the selected items
// for all objects in the selection (starting from top)
if (selected) {
while (rev) {
// for each selected object, find the next sibling
// if the sibling is an item AND overlaps our selection,
// AND if it's not one of our selected objects,
// move the selected object after that sibling
}
break;
}
}
}
} else {
}
_("Raise"));
}
void sp_selection_raise_to_top()
{
return;
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to raise to top."));
return;
}
if (!group) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from <b>different groups</b> or <b>layers</b>."));
return;
}
}
_("Raise to top"));
}
void
{
return;
if (!items) {
return;
}
if (!group) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from <b>different groups</b> or <b>layers</b>."));
return;
}
// find out the common bbox of the selected items
/* construct direct-ordered list of selected children */
// for all objects in the selection (starting from top)
if (selected) {
while (rev) {
// for each selected object, find the prev sibling
// if the sibling is an item AND overlaps our selection,
// AND if it's not one of our selected objects,
// move the selected object before that sibling
if (put_after)
else
}
break;
}
}
}
} else {
}
_("Lower"));
}
void sp_selection_lower_to_bottom()
{
return;
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to lower to bottom."));
return;
}
if (!group) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You cannot raise/lower objects from <b>different groups</b> or <b>layers</b>."));
return;
}
minpos = 0;
while (!SP_IS_ITEM(pc)) {
minpos += 1;
}
}
_("Lower to bottom"));
}
void
{
}
void
{
}
void sp_selection_cut()
{
}
{
while (ref) {
// climb up the refs, copying each one in the chain
}
}
{
while (ref) {
// climb up the refs, copying each one in the chain
// items in the pattern may also use gradients and other patterns, so we need to recurse here as well
for (SPObject *child = sp_object_first_child(SP_OBJECT(ref)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
if (!SP_IS_ITEM (child))
continue;
}
}
}
{
}
{
if (!path)
return;
if (items && g_slist_find ((GSList *) items, path)) // do not copy it to defs if it is already in the list of items copied
return;
}
/**
* Copies things like patterns, markers, gradients, etc.
*/
{
if (SP_IS_PATTERN (server))
}
if (SP_IS_PATTERN (server))
}
// For shapes, copy all of the shape's markers into defs_clip
if (SP_IS_SHAPE (item)) {
for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
}
}
}
if (SP_IS_TEXT_TEXTPATH (item)) {
}
}
// recurse into the mask for its gradients etc.
if (SP_IS_ITEM(o))
}
}
if (SP_IS_FILTER(filter)) {
}
}
// recurse
if (SP_IS_ITEM(o))
}
}
/**
* \pre item != NULL
*/
{
// write the complete cascaded style, context-free
return NULL;
// if this is a text with exactly one tspan child, merge the style of that tspan as well
// If this is a group, merge the style of its topmost (last) child with style
for (SPObject *last_element = item->lastChild(); last_element != NULL; last_element = SP_OBJECT_PREV (last_element)) {
if (temp) {
}
break;
}
}
}
// do not copy text properties from non-text objects, it's confusing
}
if (ex != 1.0) {
}
return css;
}
void sp_selection_copy()
{
return;
return; // copied color under cursor, nothing else to do
}
// check if something is selected
return;
}
// 0. Copy text to system clipboard
// FIXME: for non-texts, put serialized XML as text to the clipboard;
//for this sp_repr_write_stream needs to be rewritten with iostream instead of FILE
}
if (texts > 0) // if more than one text object is copied, separate them by spaces
text += " ";
if (this_text) {
}
texts++;
}
}
}
}
// clear old defs clipboard
while (defs_clipboard) {
}
// clear style clipboard
if (style_clipboard) {
}
//clear main clipboard
while (clipboard) {
}
if (tools_isactive (desktop, TOOLS_TEXT)) { // take style from cursor/text selection, overwriting the style just set by copy_impl
// clear style clipboard
if (style_clipboard) {
}
//sp_repr_css_print (css);
}
}
}
}
void sp_selection_paste(bool in_place)
{
return;
}
return;
}
return; // pasted from system clipboard into text, nothing else to do
}
// check if something is in the clipboard
return;
}
GSList *copied = sp_selection_paste_impl(document, desktop->currentLayer(), &clipboard, &defs_clipboard);
// add pasted objects to selection
if (!in_place) {
/* Snap the offset of the new item(s) to the grid */
/* FIXME: this gridsnap fiddling is a hack. */
s.setDistance(NR_HUGE);
}
_("Paste"));
}
void sp_selection_paste_style()
{
// check if something is in the clipboard
return;
}
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to paste style to."));
return;
}
_("Paste style"));
}
{
// check if something is in the clipboard
return;
}
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to paste size to."));
return;
}
return;
}
_("Paste size"));
}
{
// check if something is in the clipboard
return;
}
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to paste size to."));
return;
}
continue;
}
}
_("Paste size separately"));
}
void sp_selection_to_next_layer ()
{
// check if something is selected
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to move to the layer above."));
return;
}
bool no_more = false; // Set to true, if no more layers above
if (next) {
sp_selection_copy_impl (items, &temp_clip, NULL, NULL); // we're in the same doc, so no need to copy defs
next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
if(next) {
} else {
no_more = true;
}
_("Raise to next layer"));
} else {
no_more = true;
}
if (no_more) {
}
}
void sp_selection_to_prev_layer ()
{
// check if something is selected
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to move to the layer below."));
return;
}
bool no_more = false; // Set to true, if no more layers below
if (next) {
sp_selection_copy_impl (items, &temp_clip, NULL, NULL); // we're in the same doc, so no need to copy defs
next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer()); // Fixes bug 1482973: crash while moving layers
if(next) {
} else {
no_more = true;
}
_("Lower to previous layer"));
} else {
no_more = true;
}
if (no_more) {
}
}
bool
{
bool contains_original = false;
{
if (item_use == item_use_first)
break;
}
return contains_original;
}
bool
{
bool clone_with_original = false;
if (clone_with_original)
break;
}
return clone_with_original;
}
/** Apply matrix to the selection. \a set_i2d is normally true, which means objects are in the
original transform, synced with their reprs, and need to jump to the new transform in one go. A
value of set_i2d==false is only used by seltrans when it's dragging objects live (not outlines); in
that case, items are already in the new position, but the repr is in the old, and this function
then simply updates the repr from item->transform.
*/
void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const &affine, bool set_i2d)
{
return;
#if 0 /* Re-enable this once persistent guides have a graphical indication.
At the time of writing, this is the only place to re-enable. */
#endif
// we're moving both a clone and its original or any ancestor in clone chain?
// ...both a text-on-path and its path?
bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item (SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))) ));
// ...both a flowtext and its frame?
bool transform_flowtext_with_frame = (SP_IS_FLOWTEXT(item) && selection->includes( SP_FLOWTEXT(item)->get_frame (NULL))); // (only the first frame is checked so far)
// ...both an offset and its source?
bool transform_offset_with_source = (SP_IS_OFFSET(item) && SP_OFFSET (item)->sourceHref) && selection->includes( sp_offset_get_source (SP_OFFSET(item)) );
// If we're moving a connector, we want to detach it
// from shapes that aren't part of the selection, but
// leave it attached if they are
if (cc_item_is_connector(item)) {
for (int n = 0; n < 2; ++n) {
sp_conn_end_detach(item, n);
}
}
}
// "clones are unmoved when original is moved" preference
int compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
// If this is a clone and it's selected along with its original, do not move it; it will feel the
// transform of its original and respond to it itself. Without this, a clone is doubly
// transformed, very unintuitive.
// Same for textpath if we are also doing ANY transform to its path: do not touch textpath,
// letters cannot be squeezed or rotated anyway, they only refill the changed path.
// Same for linked offset if we are also moving its source: do not move it.
// restore item->transform field from the repr, in case it was changed by seltrans
} else if (transform_flowtext_with_frame) {
// apply the inverse of the region's transform to the <use> so that the flow remains
// the same (even though the output itself gets transformed)
continue;
}
}
} else if (transform_clone_with_original) {
// We are transforming a clone along with its original. The below matrix juggling is
// necessary to ensure that they transform as a whole, i.e. the clone's induced
// transform and its move compensation are both cancelled out.
// restore item->transform field from the repr, in case it was changed by seltrans
// calculate the matrix we need to apply to the clone to cancel its induced transform from its original
NR::Matrix t = parent_transform * matrix_to_desktop (matrix_from_desktop (affine, item), item) * parent_transform.inverse();
NR::Matrix t_inv =parent_transform * matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item) * parent_transform.inverse();
// we need to cancel out the move compensation, too
// find out the clone move, same as in sp_use_move_compensate
if (prefs_parallel) {
} else if (prefs_unmoved) {
//if (SP_IS_USE(sp_use_get_original(SP_USE(item))))
// clone_move = NR::identity();
}
} else {
// just apply the result
}
} else {
if (set_i2d) {
}
}
// if we're moving the actual object, not just updating the repr, we can transform the
// center by the same matrix (only necessary for non-translations)
}
}
}
{
return;
while (l != NULL) {
l = l->next;
}
_("Remove transform"));
}
void
{
return;
return;
}
}
void sp_selection_scale_relative(Inkscape::Selection *selection, NR::Point const &align, NR::scale const &scale)
{
return;
return;
}
// FIXME: ARBITRARY LIMIT: don't try to scale above 1 Mpx, it won't display properly and will crash sooner or later anyway
{
return;
}
}
void
sp_selection_rotate_relative(Inkscape::Selection *selection, NR::Point const ¢er, gdouble const angle_degrees)
{
}
void
sp_selection_skew_relative(Inkscape::Selection *selection, NR::Point const &align, double dx, double dy)
{
dx, 1,
0, 0);
}
{
}
{
}
/**
* \brief sp_selection_rotate_90
*
* This function rotates selected objects 90 degrees clockwise.
*
*/
void sp_selection_rotate_90_cw()
{
return;
}
_("Rotate 90° CW"));
}
/**
* \brief sp_selection_rotate_90_ccw
*
* This function rotates selected objects 90 degrees counter-clockwise.
*
*/
void sp_selection_rotate_90_ccw()
{
return;
}
_("Rotate 90° CCW"));
}
void
{
return;
( ( angle_degrees > 0 )
? "selector:rotate:ccw"
: "selector:rotate:cw" ),
_("Rotate"));
}
/**
\param angle the angle in "angular pixels", i.e. how many visible pixels must move the outermost point of the rotated object
*/
void
{
return;
( (angle > 0)
? "selector:rotate:ccw"
: "selector:rotate:cw" ),
_("Rotate by pixels"));
}
void
{
return;
// you can't scale "do nizhe pola" (below zero)
return;
}
( (grow > 0)
? "selector:scale:larger"
: "selector:scale:smaller" ),
_("Scale"));
}
void
{
}
void
{
return;
_("Scale by whole factor"));
}
void
{
return;
}
if (dx == 0) {
sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
_("Move vertically"));
} else if (dy == 0) {
sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
_("Move horizontally"));
} else {
_("Move"));
}
}
void
{
return;
}
// same as sp_selection_move but divide deltas by zoom factor
if (dx == 0) {
sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:vertical", SP_VERB_CONTEXT_SELECT,
_("Move vertically by pixels"));
} else if (dy == 0) {
sp_document_maybe_done(sp_desktop_document(desktop), "selector:move:horizontal", SP_VERB_CONTEXT_SELECT,
_("Move horizontally by pixels"));
} else {
_("Move"));
}
}
namespace {
template <typename D>
template <typename D>
struct Forward {
};
struct Reverse {
}
}
g_slist_free(i);
}
}
private:
}
return list;
}
};
}
void
sp_selection_item_next(void)
{
PrefsSelectionContext inlayer = (PrefsSelectionContext)prefs_get_int_attribute ("options.kbselection", "inlayer", PREFS_SELECTION_LAYER);
if (PREFS_SELECTION_ALL != inlayer) {
} else {
}
SPItem *item=next_item_from_list<Forward>(desktop, selection->itemList(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive);
if (item) {
if ( SP_CYCLING == SP_CYCLE_FOCUS ) {
}
}
}
void
sp_selection_item_prev(void)
{
PrefsSelectionContext inlayer = (PrefsSelectionContext)prefs_get_int_attribute ("options.kbselection", "inlayer", PREFS_SELECTION_LAYER);
if (PREFS_SELECTION_ALL != inlayer) {
} else {
}
SPItem *item=next_item_from_list<Reverse>(desktop, selection->itemList(), root, SP_CYCLING == SP_CYCLE_VISIBLE, inlayer, onlyvisible, onlysensitive);
if (item) {
if ( SP_CYCLING == SP_CYCLE_FOCUS ) {
}
}
}
namespace {
template <typename D>
SPObject *root, bool only_in_viewport, PrefsSelectionContext inlayer, bool onlyvisible, bool onlysensitive)
{
while (items) {
{
break;
}
}
}
// first, try from the current object
if (!next) { // if we ran out of objects, start over at the root
}
return next;
}
template <typename D>
{
if (path) {
found = next_item<D>(desktop, path->next, object, only_in_viewport, inlayer, onlyvisible, onlysensitive);
}
} else {
}
}
} else if ( SP_IS_ITEM(object) &&
{
}
}
return found;
}
}
/**
* If \a item is not entirely visible then adjust visible area to centre on the centre on of
* \a item.
*/
{
}
}
void
{
return;
// check if something is selected
return;
}
// sorting items from different parents sorts each parent's subset without possibly mixing them, just what we need
while (reprs) {
sp_repr_set_attr(clone, "inkscape:transform-center-x", sel_repr->attribute("inkscape:transform-center-x"));
sp_repr_set_attr(clone, "inkscape:transform-center-y", sel_repr->attribute("inkscape:transform-center-y"));
// add the new clone to the top of the original's parent
}
_("Clone"));
}
void
{
if (!desktop)
return;
return;
}
// Get a copy of current selection.
bool unlinked = false;
{
// keep the non-yse item in the new selection
continue;
}
unlinked = true;
// Add ungrouped items to the new selection.
}
if (new_select) { // set new selection
}
if (!unlinked) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No clones to unlink</b> in the selection."));
}
_("Unlink clone"));
}
void
{
return;
const gchar *error = _("Select a <b>clone</b> to go to its original. Select a <b>linked offset</b> to go to its source. Select a <b>text on path</b> to go to the path. Select a <b>flowed text</b> to go to its frame.");
// Check if other than two objects are selected
return;
}
} else if (SP_IS_TEXT_TEXTPATH(item)) {
} else if (SP_IS_FLOWTEXT(item)) {
} else { // it's an object that we don't know what to do with
return;
}
if (!original) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>Cannot find</b> the object to select (orphaned clone, offset, textpath, flowed text?)"));
return;
}
if (SP_IS_DEFS (o)) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The object you're trying to select is <b>not visible</b> (it is in <defs>)"));
return;
}
}
if (original) {
if (SP_CYCLING == SP_CYCLE_FOCUS) {
}
}
}
void
sp_selection_tile(bool apply)
{
return;
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to pattern."));
return;
}
if (r.isEmpty()) {
return;
}
// calculate the transform to be applied to objects to move them to 0,0
NR::Point move_p = NR::Point(0, sp_document_height(document)) - (r.min() + NR::Point (0, r.extent(NR::Y)));
// bottommost object, after sorting
// remember the position of the first item
// create a list of duplicates
}
if (apply) {
// delete objects so that their clones don't get alerted; this object will be restored shortly
item->deleteObject (false);
}
}
// Hack: Temporarily set clone compensation to unmoved, so that we can move clone-originals
// without disturbing clones.
// See ActorAlign::on_button_click() in src/ui/dialog/align-and-distribute.cpp
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
NR::Matrix(NR::translate(desktop->dt2doc(NR::Point(r.min()[NR::X], r.max()[NR::Y])))) * parent_transform.inverse(), parent_transform * move);
// restore compensation setting
if (apply) {
// restore parent and position
}
_("Objects to pattern"));
}
void
{
return;
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select an <b>object with pattern fill</b> to extract objects from."));
return;
}
bool did = false;
continue;
if (!SP_IS_PATTERN(server))
continue;
did = true;
for (SPObject *child = sp_object_first_child(SP_OBJECT(pattern)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
// FIXME: relink clones to the new canvas objects
// use SPObject::setid when mental finishes it to steal ids of
// this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
}
}
if (!did) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("<b>No pattern fills</b> in the selection."));
} else {
_("Pattern to objects"));
}
}
void
sp_selection_get_export_hints (Inkscape::Selection *selection, const char **filename, float *xdpi, float *ydpi)
{
return;
}
bool filename_search = TRUE;
bool xdpi_search = TRUE;
bool ydpi_search = TRUE;
xdpi_search &&
const gchar * dpi_string;
if (filename_search) {
}
if (xdpi_search) {
dpi_string = NULL;
if (dpi_string != NULL) {
xdpi_search = FALSE;
}
}
if (ydpi_search) {
dpi_string = NULL;
if (dpi_string != NULL) {
ydpi_search = FALSE;
}
}
}
}
void
{
const gchar * dpi_string;
dpi_string = NULL;
if (dpi_string != NULL) {
}
dpi_string = NULL;
if (dpi_string != NULL) {
}
}
void
{
return;
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to make a bitmap copy."));
return;
}
// Get the bounding box of the selection
if (NR_RECT_DFLS_TEST_EMPTY(&bbox)) {
return; // exceptional situation, so not bother with a translatable error message, just quit quietly
}
// List of the items to show; all others will be hidden
// Sort items so that the topmost comes last
// Generate a random value from the current time (you may create bitmap from the same object(s)
// multiple times, and this is done so that they don't clash)
g_get_current_time (&cu);
// Create the filename
gchar *filename = g_strdup_printf ("%s-%s-%u.png", document->name, SP_OBJECT_REPR(items->data)->attribute("id"), current);
// Imagemagick is known not to handle spaces in filenames, so we replace anything but letters,
// digits, and a few other chars, with "_"
filename = g_strcanon (filename, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.=+~$#@^&!?", '_');
// Build the complete path by adding document->base if set
//g_print ("%s\n", filepath);
// Remember parent and z-order of the topmost one
// Calculate resolution
double res;
if (0 < prefs_res) {
// If it's given explicitly in prefs, take it
} else if (0 < prefs_min) {
// If minsize is given, look up minimum bitmap size (default 250 pixels) and calculate resolution from it
} else {
const char *hint_filename;
// take resolution hint from the selected objects
if (hint_xdpi != 0) {
} else {
// take resolution hint from the document
if (hint_xdpi != 0) {
} else {
// if all else fails, take the default 90 dpi
}
}
}
// The width and height of the bitmap in pixels
// Find out if we have to run a filter
if (filter) {
// filter command is given;
// see if we have a parameter to pass to it
if (param1) {
// if the param string ends with %, interpret it as a percentage of the image's max dimension
// the first param is always the image filename, the second is param1
} else {
// otherwise pass the param1 unchanged
}
} else {
// run without extra parameter
}
}
// Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
shift_y = -round (-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
}
// Do the export
(guint32) 0xffffff00,
true, /*bool force_overwrite,*/
items);
// Run filter, if any
if (run) {
}
// Import the image back
if (pb) {
// Create the repr for the image
} else {
}
// Write transform
gchar *c=sp_svg_transform_write(t);
g_free(c);
// add the new repr to the parent
// move to the saved position
// Set selection to the new image
// Clean up
// Complete undoable transaction
_("Create bitmap"));
}
}
/**
* \brief sp_selection_set_mask
*
* This function creates a mask or clipPath from selection
* Two different modes:
* and is applied to current layer
* otherwise, topmost object is used as mask for other objects
* If \a apply_clip_path parameter is true, clipPath is created, otherwise mask
*
*/
void
{
return;
// check if something is selected
if ( apply_to_layer && is_empty) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to create clippath or mask from."));
return;
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select mask object and <b>object(s)</b> to apply clippath or mask to."));
return;
}
// FIXME: temporary patch to prevent crash!
if (clone_with_original) {
}
// /END FIXME
// create a list of duplicates
if (apply_to_layer) {
// all selected items are used for mask, which is applied to a layer
if (remove_original) {
}
}
} else if (!topmost) {
// topmost item is used as a mask, which is applied to other items in a selection
if (remove_original) {
}
}
} else {
}
if (remove_original) {
}
}
// inverted object transform should be applied to a mask object,
// as mask is calculated in user space (after applying transform)
}
if (apply_clip_path) {
} else {
}
}
item->deleteObject (false);
}
if (apply_clip_path)
else
}
void sp_selection_unset_mask(bool apply_clip_path) {
return;
// check if something is selected
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to remove clippath or mask from."));
return;
}
if (remove_original) {
if (apply_clip_path) {
} else {
}
// collect distinct mask object (and associate with item to apply transform)
}
}
}
// restore mask objects into a document
for ( std::map<SPObject*,SPItem*>::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) {
for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
}
if (!obj->isReferenced()) {
// delete from defs if no other object references this mask
obj->deleteObject(false);
}
// insert into parent, restore pos
// transform mask, so it is moved the same spot where mask was applied
}
}
if (apply_clip_path)
else
}
if (!nr_rect_d_test_empty(&bbox)) {
}
};
if (!nr_rect_d_test_empty(&bbox)) {
}
};
} else {
}
_("Fit page to 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 :