void AddToIcon::set_pixbuf() { bool active = property_active().get_value(); GdkPixbuf *pixbuf = sp_pixbuf_new(Inkscape::ICON_SIZE_BUTTON, active ? INKSCAPE_ICON("list-add") : INKSCAPE_ICON("edit-delete")); property_pixbuf() = Glib::wrap(pixbuf); }
LPESimplify::LPESimplify(LivePathEffectObject *lpeobject) : Effect(lpeobject), steps(_("Steps:"),_("Change number of simplify steps "), "steps", &wr, this,1), threshold(_("Roughly threshold:"), _("Roughly threshold:"), "threshold", &wr, this, 0.002), smooth_angles(_("Smooth angles:"), _("Max degree difference on handles to perform a smooth"), "smooth_angles", &wr, this, 0.), helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5), simplify_individual_paths(_("Paths separately"), _("Simplifying paths (separately)"), "simplify_individual_paths", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")), simplify_just_coalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplify_just_coalesce", &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")) { registerParameter(&steps); registerParameter(&threshold); registerParameter(&smooth_angles); registerParameter(&helper_size); registerParameter(&simplify_individual_paths); registerParameter(&simplify_just_coalesce); threshold.param_set_range(0.0001, Geom::infinity()); threshold.param_set_increments(0.0001, 0.0001); threshold.param_set_digits(6); steps.param_set_range(0, 100); steps.param_set_increments(1, 1); steps.param_set_digits(0); smooth_angles.param_set_range(0.0, 360.0); smooth_angles.param_set_increments(10, 10); smooth_angles.param_set_digits(2); helper_size.param_set_range(0.0, 999.0); helper_size.param_set_increments(5, 5); helper_size.param_set_digits(2); radius_helper_nodes = 6.0; }
AlignAndDistribute::AlignAndDistribute() : UI::Widget::Panel ("", "/dialogs/align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE), randomize_bbox(), _alignFrame(_("Align")), _distributeFrame(_("Distribute")), _rearrangeFrame(_("Rearrange")), _removeOverlapFrame(_("Remove overlaps")), _nodesFrame(_("Nodes")), #if WITH_GTKMM_3_0 _alignTable(), _distributeTable(), _rearrangeTable(), _removeOverlapTable(), _nodesTable(), #else _alignTable(2, 6, true), _distributeTable(2, 6, true), _rearrangeTable(1, 5, false), _removeOverlapTable(1, 5, false), _nodesTable(1, 4, true), #endif _anchorLabel(_("Relative to: ")), _selgrpLabel(_("_Treat selection as group: "), 1) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //Instanciate the align buttons addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"), _("Align right edges of objects to the left edge of the anchor"), 0, 0); addAlignButton(INKSCAPE_ICON("align-horizontal-left"), _("Align left edges"), 0, 1); addAlignButton(INKSCAPE_ICON("align-horizontal-center"), _("Center on vertical axis"), 0, 2); addAlignButton(INKSCAPE_ICON("align-horizontal-right"), _("Align right sides"), 0, 3); addAlignButton(INKSCAPE_ICON("align-horizontal-left-to-anchor"), _("Align left edges of objects to the right edge of the anchor"), 0, 4); addAlignButton(INKSCAPE_ICON("align-vertical-bottom-to-anchor"), _("Align bottom edges of objects to the top edge of the anchor"), 1, 0); addAlignButton(INKSCAPE_ICON("align-vertical-top"), _("Align top edges"), 1, 1); addAlignButton(INKSCAPE_ICON("align-vertical-center"), _("Center on horizontal axis"), 1, 2); addAlignButton(INKSCAPE_ICON("align-vertical-bottom"), _("Align bottom edges"), 1, 3); addAlignButton(INKSCAPE_ICON("align-vertical-top-to-anchor"), _("Align top edges of objects to the bottom edge of the anchor"), 1, 4); //Baseline aligns addBaselineButton(INKSCAPE_ICON("align-horizontal-baseline"), _("Align baseline anchors of texts horizontally"), 0, 5, this->align_table(), Geom::X, false); addBaselineButton(INKSCAPE_ICON("align-vertical-baseline"), _("Align baselines of texts"), 1, 5, this->align_table(), Geom::Y, false); //The distribute buttons addDistributeButton(INKSCAPE_ICON("distribute-horizontal-gaps"), _("Make horizontal gaps between objects equal"), 0, 4, true, Geom::X, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-left"), _("Distribute left edges equidistantly"), 0, 1, false, Geom::X, 1., 0.); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-center"), _("Distribute centers equidistantly horizontally"), 0, 2, false, Geom::X, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-right"), _("Distribute right edges equidistantly"), 0, 3, false, Geom::X, 0., 1.); addDistributeButton(INKSCAPE_ICON("distribute-vertical-gaps"), _("Make vertical gaps between objects equal"), 1, 4, true, Geom::Y, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-vertical-top"), _("Distribute top edges equidistantly"), 1, 1, false, Geom::Y, 0, 1); addDistributeButton(INKSCAPE_ICON("distribute-vertical-center"), _("Distribute centers equidistantly vertically"), 1, 2, false, Geom::Y, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-vertical-bottom"), _("Distribute bottom edges equidistantly"), 1, 3, false, Geom::Y, 1., 0.); //Baseline distribs addBaselineButton(INKSCAPE_ICON("distribute-horizontal-baseline"), _("Distribute baseline anchors of texts horizontally"), 0, 5, this->distribute_table(), Geom::X, true); addBaselineButton(INKSCAPE_ICON("distribute-vertical-baseline"), _("Distribute baselines of texts vertically"), 1, 5, this->distribute_table(), Geom::Y, true); // Rearrange //Graph Layout addGraphLayoutButton(INKSCAPE_ICON("distribute-graph"), _("Nicely arrange selected connector network"), 0, 0); addExchangePositionsButton(INKSCAPE_ICON("exchange-positions"), _("Exchange positions of selected objects - selection order"), 0, 1); addExchangePositionsByZOrderButton(INKSCAPE_ICON("exchange-positions-zorder"), _("Exchange positions of selected objects - stacking order"), 0, 2); addExchangePositionsClockwiseButton(INKSCAPE_ICON("exchange-positions-clockwise"), _("Exchange positions of selected objects - clockwise rotate"), 0, 3); //Randomize & Unclump addRandomizeButton(INKSCAPE_ICON("distribute-randomize"), _("Randomize centers in both dimensions"), 0, 4); addUnclumpButton(INKSCAPE_ICON("distribute-unclump"), _("Unclump objects: try to equalize edge-to-edge distances"), 0, 5); //Remove overlaps addRemoveOverlapsButton(INKSCAPE_ICON("distribute-remove-overlaps"), _("Move objects as little as possible so that their bounding boxes do not overlap"), 0, 0); //Node Mode buttons // NOTE: "align nodes vertically" means "move nodes vertically until they align on a common // _horizontal_ line". This is analogous to what the "align-vertical-center" icon means. // There is no doubt some ambiguity. For this reason the descriptions are different. addNodeButton(INKSCAPE_ICON("align-vertical-node"), _("Align selected nodes to a common horizontal line"), 0, Geom::X, false); addNodeButton(INKSCAPE_ICON("align-horizontal-node"), _("Align selected nodes to a common vertical line"), 1, Geom::Y, false); addNodeButton(INKSCAPE_ICON("distribute-horizontal-node"), _("Distribute selected nodes horizontally"), 2, Geom::X, true); addNodeButton(INKSCAPE_ICON("distribute-vertical-node"), _("Distribute selected nodes vertically"), 3, Geom::Y, true); //Rest of the widgetry _combo.append(_("Last selected")); _combo.append(_("First selected")); _combo.append(_("Biggest object")); _combo.append(_("Smallest object")); _combo.append(_("Page")); _combo.append(_("Drawing")); _combo.append(_("Selection")); _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); _anchorBox.pack_end(_combo, false, false); _anchorBox.pack_end(_anchorLabel, false, false); _selgrpLabel.set_mnemonic_widget(_selgrp); _selgrpBox.pack_end(_selgrp, false, false); _selgrpBox.pack_end(_selgrpLabel, false, false); _selgrp.set_active(prefs->getBool("/dialogs/align/sel-as-groups")); _selgrp.signal_toggled().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_selgrp_toggled)); // Right align the buttons _alignTableBox.pack_end(_alignTable, false, false); _distributeTableBox.pack_end(_distributeTable, false, false); _rearrangeTableBox.pack_end(_rearrangeTable, false, false); _removeOverlapTableBox.pack_end(_removeOverlapTable, false, false); _nodesTableBox.pack_end(_nodesTable, false, false); _alignBox.pack_start(_anchorBox); _alignBox.pack_start(_selgrpBox); _alignBox.pack_start(_alignTableBox); _alignFrame.add(_alignBox); _distributeFrame.add(_distributeTableBox); _rearrangeFrame.add(_rearrangeTableBox); _removeOverlapFrame.add(_removeOverlapTableBox); _nodesFrame.add(_nodesTableBox); Gtk::Box *contents = _getContents(); contents->set_spacing(4); // Notebook for individual transformations contents->pack_start(_alignFrame, true, true); contents->pack_start(_distributeFrame, true, true); contents->pack_start(_rearrangeFrame, true, true); contents->pack_start(_removeOverlapFrame, true, true); contents->pack_start(_nodesFrame, true, true); //Connect to the global tool change signal g_signal_connect (G_OBJECT (INKSCAPE), "set_eventcontext", G_CALLBACK (on_tool_changed), this); // Connect to the global selection change, to invalidate cached randomize_bbox g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); randomize_bbox = Geom::OptRect(); _desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &AlignAndDistribute::setDesktop) ); _deskTrack.connect(GTK_WIDGET(gobj())); show_all_children(); on_tool_changed (NULL, NULL, this); // set current mode }