connector-toolbar.cpp revision 6d8430ca47c35cff45dee59e1f9c025567d0af49
/**
* @file
* Connector aux toolbar
*/
/* Authors:
* MenTaLguY <mental@rydia.net>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Frank Felfe <innerspace@iname.com>
* John Cliff <simarilius@yahoo.com>
* David Turner <novalis@gnu.org>
* Josh Andler <scislac@scislac.com>
* Jon A. Cruz <jon@joncruz.org>
* Maximilian Albert <maximilian.albert@gmail.com>
* Tavmjong Bah <tavmjong@free.fr>
* Abhishek Sharma
* Kris De Gussem <Kris.DeGussem@gmail.com>
*
* Copyright (C) 2004 David Turner
* Copyright (C) 2003 MenTaLguY
* Copyright (C) 1999-2011 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 "ui/widget/spinbutton.h"
#include "toolbox.h"
#include "connector-toolbar.h"
#include "../desktop.h"
#include "../desktop-handles.h"
#include "document-undo.h"
#include "../verbs.h"
#include "../inkscape.h"
#include "../selection-chemistry.h"
#include "../selection.h"
#include "../ege-adjustment-action.h"
#include "../ege-output-action.h"
#include "../ege-select-one-action.h"
#include "../ink-action.h"
#include "../ink-comboboxentry-action.h"
#include "../widgets/spinbutton-events.h"
#include "../widgets/spw-utilities.h"
#include "../widgets/widget-sizes.h"
#include "../xml/node-event-vector.h"
#include "ui/uxmanager.h"
#include "../ui/icon-names.h"
#include "../helper/unit-menu.h"
#include "../helper/unit-tracker.h"
#include "../pen-context.h"
#include "../sp-namedview.h"
#include "../conn-avoid-ref.h"
#include "../connector-context.h"
#include "../graphlayout.h"
#include "../sp-path.h"
using Inkscape::UnitTracker;
using Inkscape::DocumentUndo;
//#########################
//## Connector ##
//#########################
static void sp_connector_path_set_avoid(void)
{
cc_selection_set_avoid(true);
}
static void sp_connector_path_set_ignore(void)
{
cc_selection_set_avoid(false);
}
{
return;
}
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
bool modmade = false;
while (l) {
if (cc_item_is_connector(item)) {
modmade = true;
}
l = l->next;
}
if (!modmade) {
} else {
}
}
{
return;
}
// quit if run by the _changed callbacks
return;
}
// in turn, prevent callbacks from responding
bool modmade = false;
while (l) {
if (cc_item_is_connector(item)) {
modmade = true;
}
l = l->next;
}
if (!modmade) {
}
else {
_("Change connector curvature"));
}
}
{
return;
}
// Don't need to update the repr if the attribute doesn't
// exist and it is being set to the default value -- as will
// happen at startup.
return;
}
// quit if run by the attr_changed listener
return;
}
// in turn, prevent listener from responding
bool modmade = false;
avoid_item_move(&m, item);
modmade = true;
}
if (items) {
}
if(modmade) {
_("Change connector spacing"));
}
}
static void sp_connector_graph_layout(void)
{
if (!SP_ACTIVE_DESKTOP) {
return;
}
// hack for clones, see comment in align-and-distribute.cpp
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
DocumentUndo::done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Arrange connector network"));
}
{
}
{
}
{
}
{
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
{
if (SP_IS_PATH(item))
{
}
}
{
{
_("Avoid"),
_("Make connectors avoid selected objects"),
INKSCAPE_ICON("connector-avoid"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_avoid), holder );
}
{
_("Ignore"),
_("Make connectors ignore selected objects"),
INKSCAPE_ICON("connector-ignore"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_path_set_ignore), holder );
}
// Orthogonal connectors toggle button
{
_("Orthogonal"),
_("Make connector orthogonal or polyline"),
INKSCAPE_ICON("connector-orthogonal"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_connector_orthogonal_toggled), holder );
}
EgeAdjustmentAction* eact = 0;
// Curvature spinbox
_("Connector Curvature"), _("Curvature:"),
_("The amount of connectors curvature"),
0, 100, 1.0, 10.0,
0, 0, 0,
connector_curvature_changed, 1, 0 );
// Spacing spinbox
_("Connector Spacing"), _("Spacing:"),
_("The amount of space left around objects by auto-routing connectors"),
0, 100, 1.0, 10.0,
0, 0, 0,
connector_spacing_changed, 1, 0 );
// Graph (connector network) layout
{
_("Graph"),
_("Nicely arrange selected connector network"),
INKSCAPE_ICON("distribute-graph"),
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_connector_graph_layout), holder );
}
// Default connector length spinbox
_("Connector Length"), _("Length:"),
_("Ideal length for connectors when layout is applied"),
10, 1000, 10.0, 100.0,
0, 0, 0,
connector_length_changed, 1, 0 );
// Directed edges toggle button
{
_("Downwards"),
_("Make connectors with end-markers (arrows) point downwards"),
INKSCAPE_ICON("distribute-graph-directed"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_directed_graph_layout_toggled), holder );
sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_connector_toolbox_selection_changed), holder));
}
// Avoid overlaps toggle button
{
_("Remove overlaps"),
_("Do not allow overlapping shapes"),
INKSCAPE_ICON("distribute-remove-overlaps"),
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_nooverlaps_graph_layout_toggled), holder );
}
// Code to watch for changes to the connector-spacing attribute in
// the XML.
if (repr) {
}
} // end of sp_connector_toolbox_prep()
/*
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 :