Code: Select all
Transformation::Transformation()
: UI::Widget::Panel ("", "/dialogs/transformation", SP_VERB_DIALOG_TRANSFORM),
_page_move (4, 2),
_page_scale (4, 2),
_page_rotate (4, 2),
_page_skew (4, 2),
_page_transform (3, 3),
_scalar_move_horizontal (_("_Horizontal:"), _("Horizontal displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR,
"", "transform-move-horizontal", &_units_move),
_scalar_move_vertical (_("_Vertical:"), _("Vertical displacement (relative) or position (absolute)"), UNIT_TYPE_LINEAR,
"", "transform-move-vertical", &_units_move),
_scalar_scale_horizontal(_("_Width:"), _("Horizontal size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS,
"", "transform-scale-horizontal", &_units_scale),
_scalar_scale_vertical (_("_Height:"), _("Vertical size (absolute or percentage of current)"), UNIT_TYPE_DIMENSIONLESS,
"", "transform-scale-vertical", &_units_scale),
_scalar_rotate (_("A_ngle:"), _("Rotation angle (positive = counterclockwise)"), UNIT_TYPE_RADIAL,
"", "transform-rotate", &_units_rotate),
_scalar_skew_horizontal (_("_Horizontal:"), _("Horizontal skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR,
"", "transform-skew-horizontal", &_units_skew),
_scalar_skew_vertical (_("_Vertical:"), _("Vertical skew angle (positive = counterclockwise), or absolute displacement, or percentage displacement"), UNIT_TYPE_LINEAR,
"", "transform-skew-vertical", &_units_skew),
_scalar_transform_a ("_A:", _("Transformation matrix element A")),
_scalar_transform_b ("_B:", _("Transformation matrix element B")),
_scalar_transform_c ("_C:", _("Transformation matrix element C")),
_scalar_transform_d ("_D:", _("Transformation matrix element D")),
_scalar_transform_e ("_E:", _("Transformation matrix element E")),
_scalar_transform_f ("_F:", _("Transformation matrix element F")),
_counterclockwise_rotate (),
_clockwise_rotate (),
_check_move_relative (_("Rela_tive move"), _("Add the specified relative displacement to the current position; otherwise, edit the current absolute position directly")),
_check_scale_proportional (_("_Scale proportionally"), _("Preserve the width/height ratio of the scaled objects")),
_check_apply_separately (_("Apply to each _object separately"), _("Apply the scale/rotate/skew to each selected object separately; otherwise, transform the selection as a whole")),
_check_replace_matrix (_("Edit c_urrent matrix"), _("Edit the current transform= matrix; otherwise, post-multiply transform= by this matrix"))
{
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
// Notebook for individual transformations
contents->pack_start(_notebook, true, true);
_notebook.append_page(_page_move, _("_Move"), true);
layoutPageMove();
_notebook.append_page(_page_scale, _("_Scale"), true);
layoutPageScale();
_notebook.append_page(_page_rotate, _("_Rotate"), true);
layoutPageRotate();
_notebook.append_page(_page_skew, _("Ske_w"), true);
layoutPageSkew();
_notebook.append_page(_page_transform, _("Matri_x"), true);
layoutPageTransform();
_notebook.signal_switch_page().connect(sigc::mem_fun(*this, &Transformation::onSwitchPage));
// Apply separately
contents->pack_start(_check_apply_separately, true, true);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_check_apply_separately.set_active(prefs->getBool("/dialogs/transformation/applyseparately"));
_check_apply_separately.signal_toggled().connect(sigc::mem_fun(*this, &Transformation::onApplySeparatelyToggled));
// make sure all spinbuttons activate Apply on pressing Enter
((Gtk::Entry *) (_scalar_move_horizontal.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_move_vertical.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_scale_horizontal.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_scale_vertical.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_rotate.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_skew_horizontal.getWidget()))->set_activates_default(true);
((Gtk::Entry *) (_scalar_skew_vertical.getWidget()))->set_activates_default(true);
updateSelection(PAGE_MOVE, _getSelection());
resetButton = addResponseButton(Gtk::Stock::CLEAR, 0);
if (resetButton) {
resetButton->set_tooltip_text(_("Reset the values on the current tab to defaults"));
resetButton->set_sensitive(true);
resetButton->signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onClear));
}
applyButton = addResponseButton(Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY);
if (applyButton) {
applyButton->set_tooltip_text(_("Apply transformation to selection"));
applyButton->set_sensitive(false);
}
// Connect to the global selection changed & modified signals
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
g_signal_connect (G_OBJECT (INKSCAPE), "modify_selection", G_CALLBACK (on_selection_modified), this);
_desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &Transformation::setDesktop) );
_deskTrack.connect(GTK_WIDGET(gobj()));
show_all_children();
}