diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-08-01 07:44:34 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-08-01 07:44:34 +0000 |
| commit | 4bf94479b67e9e9436f72ff6470cb4b9f576df3d (patch) | |
| tree | 90f20c678cb2228a9fb2dd29c5992ae21bff7c46 /src/ui | |
| parent | UI. Fix for Bug #614500 (Cursor icon for Select/transform tool) by ~suv. (diff) | |
| download | inkscape-4bf94479b67e9e9436f72ff6470cb4b9f576df3d.tar.gz inkscape-4bf94479b67e9e9436f72ff6470cb4b9f576df3d.zip | |
Fix for 512247 : Show the direction in Object/Transform/Rotate
(bzr r11578)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 57 | ||||
| -rw-r--r-- | src/ui/dialog/transformation.h | 5 | ||||
| -rw-r--r-- | src/ui/widget/labelled.cpp | 6 | ||||
| -rw-r--r-- | src/ui/widget/labelled.h | 1 |
4 files changed, 69 insertions, 0 deletions
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index cae2ec131..15ad41d02 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -34,6 +34,9 @@ #include "macros.h" #include "sp-item.h" #include "util/glib-list-iterators.h" +#include "ui/icon-names.h" +#include "widgets/icon.h" + namespace Inkscape { namespace UI { @@ -87,6 +90,9 @@ Transformation::Transformation() _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")), @@ -272,15 +278,48 @@ void Transformation::layoutPageRotate() _scalar_rotate.setDigits(3); _scalar_rotate.setIncrements(0.1, 1.0); + _counterclockwise_rotate.add(*manage( Glib::wrap( + sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("object-rotate-left"))))); + _counterclockwise_rotate.set_mode(false); + _counterclockwise_rotate.set_relief(Gtk::RELIEF_NONE); + _counterclockwise_rotate.set_tooltip_text(_("Rotate in a counterclockwise direction")); + + _clockwise_rotate.add(*manage( Glib::wrap( + sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("object-rotate-right"))))); + _clockwise_rotate.set_mode(false); + _clockwise_rotate.set_relief(Gtk::RELIEF_NONE); + _clockwise_rotate.set_tooltip_text(_("Rotate in a clockwise direction")); + + Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group(); + _clockwise_rotate.set_group(group); + _page_rotate.table() .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); _page_rotate.table() .attach(_units_rotate, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + _page_rotate.table() + .attach(_counterclockwise_rotate, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + + _page_rotate.table() + .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { + _counterclockwise_rotate.set_active(); + onRotateCounterclockwiseClicked(); + } else { + _clockwise_rotate.set_active(); + onRotateClockwiseClicked(); + } + _scalar_rotate.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onRotateValueChanged)); + _counterclockwise_rotate.signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onRotateCounterclockwiseClicked)); + _clockwise_rotate.signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onRotateClockwiseClicked)); + //TODO: honour rotation center? } @@ -730,6 +769,10 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) double angle = _scalar_rotate.getValue(DEG); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (!prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { + angle *= -1; + } + if (prefs->getBool("/dialogs/transformation/applyseparately")) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { SPItem *item = SP_ITEM(l->data); @@ -917,6 +960,20 @@ void Transformation::onRotateValueChanged() setResponseSensitive(Gtk::RESPONSE_APPLY, true); } +void Transformation::onRotateCounterclockwiseClicked() +{ + _scalar_rotate.setTooltipText(_("Rotation angle (positive = counterclockwise)")); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/dialogs/transformation/rotateCounterClockwise", TRUE); +} + +void Transformation::onRotateClockwiseClicked() +{ + _scalar_rotate.setTooltipText(_("Rotation angle (positive = clockwise)")); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/dialogs/transformation/rotateCounterClockwise", FALSE); +} + void Transformation::onSkewValueChanged() { setResponseSensitive(Gtk::RESPONSE_APPLY, true); diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h index 5df9fd57e..68c6a1e8e 100644 --- a/src/ui/dialog/transformation.h +++ b/src/ui/dialog/transformation.h @@ -151,6 +151,9 @@ protected: UI::Widget::Scalar _scalar_transform_e; UI::Widget::Scalar _scalar_transform_f; + Gtk::RadioButton _counterclockwise_rotate; + Gtk::RadioButton _clockwise_rotate; + UI::Widget::CheckButton _check_move_relative; UI::Widget::CheckButton _check_scale_proportional; UI::Widget::CheckButton _check_apply_separately; @@ -182,6 +185,8 @@ protected: void onScaleXValueChanged(); void onScaleYValueChanged(); void onRotateValueChanged(); + void onRotateCounterclockwiseClicked(); + void onRotateClockwiseClicked(); void onSkewValueChanged(); void onTransformValueChanged(); void onReplaceMatrixToggled(); diff --git a/src/ui/widget/labelled.cpp b/src/ui/widget/labelled.cpp index df800545a..2dda941f2 100644 --- a/src/ui/widget/labelled.cpp +++ b/src/ui/widget/labelled.cpp @@ -71,6 +71,12 @@ Labelled::setLabelText(const Glib::ustring &str) _label->set_text(str); } +void +Labelled::setTooltipText(const Glib::ustring &tooltip) +{ + _label->set_tooltip_text(tooltip); + _widget->set_tooltip_text(tooltip); +} } // namespace Widget } // namespace UI diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index e49b289fe..030fd0d93 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -54,6 +54,7 @@ public: Gtk::Label const *getLabel() const; void setLabelText(const Glib::ustring &str); + void setTooltipText(const Glib::ustring &tooltip); protected: Gtk::Widget *_widget; |
