index 262aa690bbda854a36e51bcb465616a0a0ba68d7..35ee7b806389536c3f176e5aff7d7a8069301795 100644 (file)
#include "dialogs/unclump.h"
#include "removeoverlap/removeoverlap.h"
+#include "graphlayout/graphlayout.h"
#include <gtkmm/spinbutton.h>
}
};
+class ActionGraphLayout : public Action {
+public:
+ ActionGraphLayout(Glib::ustring const &id,
+ Glib::ustring const &tiptext,
+ guint row,
+ guint column,
+ AlignAndDistribute &dialog) :
+ Action(id, tiptext, row, column + 4,
+ dialog.graphLayout_table(), dialog.tooltips(), dialog)
+ {}
+
+private :
+ virtual void on_button_click()
+ {
+ if (!SP_ACTIVE_DESKTOP) return;
+
+ // see comment in ActionAlign above
+ int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
+ prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
+
+ graphlayout(SP_DT_SELECTION(SP_ACTIVE_DESKTOP)->itemList());
+
+ // restore compensation setting
+ prefs_set_int_attribute("options.clonecompensation", "value", saved_compensation);
+
+ sp_document_done(SP_DT_DOCUMENT(SP_ACTIVE_DESKTOP));
+ }
+};
+
class ActionUnclump : public Action {
public :
ActionUnclump(const Glib::ustring &id,
_alignFrame(_("Align")),
_distributeFrame(_("Distribute")),
_removeOverlapFrame(_("Remove overlaps")),
+ _graphLayoutFrame(_("Connector network layout")),
_nodesFrame(_("Nodes")),
_alignTable(2, 6, true),
_distributeTable(3, 6, true),
_removeOverlapTable(1, 5, false),
+ _graphLayoutTable(1, 5, false),
_nodesTable(1, 4, true),
_anchorLabel(_("Relative to: "))
{
addRemoveOverlapsButton("remove_overlaps",
_("Move objects as little as possible so that their bounding boxes do not overlap"),
0, 0);
+ //Graph Layout
+ addGraphLayoutButton("graph_layout",
+ _("Nicely arrange selected connector network"),
+ 0, 0);
//Node Mode buttons
addNodeButton("node_halign",
_alignFrame.add(_alignBox);
_distributeFrame.add(_distributeTable);
_removeOverlapFrame.add(_removeOverlapTable);
+ _graphLayoutFrame.add(_graphLayoutTable);
_nodesFrame.add(_nodesTable);
// Top level vbox
vbox->pack_start(_alignFrame, true, true);
vbox->pack_start(_distributeFrame, true, true);
vbox->pack_start(_removeOverlapFrame, true, true);
+ vbox->pack_start(_graphLayoutFrame, true, true);
vbox->pack_start(_nodesFrame, true, true);
//Connect to the global tool change signal
((_alignFrame).*(mSel))();
((_distributeFrame).*(mSel))();
((_removeOverlapFrame).*(mSel))();
+ ((_graphLayoutFrame).*(mSel))();
((_nodesFrame).*(mNode))();
}
@@ -950,6 +989,15 @@ void AlignAndDistribute::addRemoveOverlapsButton(const Glib::ustring &id, const
);
}
+void AlignAndDistribute::addGraphLayoutButton(const Glib::ustring &id, const Glib::ustring tiptext,
+ guint row, guint col)
+{
+ _actionList.push_back(
+ new ActionGraphLayout(
+ id, tiptext, row, col, *this)
+ );
+}
+
void AlignAndDistribute::addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col)
{