diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-12-08 02:02:40 +0000 |
|---|---|---|
| committer | jabiertxof <jabier.arraiza@marker.es> | 2015-12-08 02:02:40 +0000 |
| commit | 2f87fb8f6ee1c0d16ef54e546462ac659acab51f (patch) | |
| tree | 9948abff72f547c04c1c5d19a5578cb30e6c4d95 /src/ui | |
| parent | static code analysis (diff) | |
| parent | update to trunk (diff) | |
| download | inkscape-2f87fb8f6ee1c0d16ef54e546462ac659acab51f.tar.gz inkscape-2f87fb8f6ee1c0d16ef54e546462ac659acab51f.zip | |
merge lp:~inkscape.dev/inkscape/lock_guides
(bzr r14512)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/control-manager.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/guides.cpp | 25 | ||||
| -rw-r--r-- | src/ui/dialog/guides.h | 1 | ||||
| -rw-r--r-- | src/ui/interface.cpp | 3 | ||||
| -rw-r--r-- | src/ui/view/edit-widget-interface.h | 3 |
5 files changed, 37 insertions, 1 deletions
diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index 5a3c5a496..7a5620684 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -298,7 +298,11 @@ void ControlManagerImpl::updateItem(SPCanvasItem *item) double target = _sizeTable[item->ctrlType][_size - 1]; if ((item->ctrlType == CTRL_TYPE_ORIGIN) && SP_IS_CTRLPOINT(item)) { - sp_ctrlpoint_set_radius(SP_CTRLPOINT(item), target / 2.0); + if (SP_CTRLPOINT(item)->is_circle ) { + sp_ctrlpoint_set_lenght(SP_CTRLPOINT(item), target ); + } else { + sp_ctrlpoint_set_lenght(SP_CTRLPOINT(item), target + 2 ); + } } else { if (_sizeChangers.count(item->ctrlType) && _manager.isSelected(item)) { target += 2; diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index af8e2cc31..e0efcde36 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -44,6 +44,7 @@ namespace Dialogs { GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop) : _desktop(desktop), _guide(guide), + _locked_toggle(_("Lo_cked"), _("Lock the movement of guides")), _relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")), _spin_button_x(C_("Guides", "_X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), _spin_button_y(C_("Guides", "_Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu), @@ -100,6 +101,9 @@ void GuidelinePropertiesDialog::_onOK() double rad_angle = Geom::deg_to_rad( deg_angle ); normal = Geom::rot90(Geom::Point::polar(rad_angle, 1.0)); } + //To allow reposition from dialog + _guide->set_locked(false, true); + _guide->set_normal(normal, true); double const points_x = _spin_button_x.getValue("px"); @@ -113,6 +117,11 @@ void GuidelinePropertiesDialog::_onOK() const gchar* name = g_strdup( _label_entry.getEntry()->get_text().c_str() ); _guide->set_label(name, true); + + const bool locked = _locked_toggle.get_active(); + + _guide->set_locked(locked, true); + g_free((gpointer) name); #if WITH_GTKMM_3_0 @@ -269,6 +278,12 @@ void GuidelinePropertiesDialog::_setup() { _relative_toggle.set_valign(Gtk::ALIGN_FILL); _relative_toggle.set_hexpand(); _layout_table.attach(_relative_toggle, 1, 7, 2, 1); + + // locked radio button + _locked_toggle.set_halign(Gtk::ALIGN_FILL); + _locked_toggle.set_valign(Gtk::ALIGN_FILL); + _locked_toggle.set_hexpand(); + _layout_table.attach(_locked_toggle, 1, 8, 2, 1); #else _layout_table.attach(_spin_angle, 1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); @@ -276,11 +291,21 @@ void GuidelinePropertiesDialog::_setup() { // mode radio button _layout_table.attach(_relative_toggle, 1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); + + // locked radio button + _layout_table.attach(_locked_toggle, + 1, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); #endif _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); _relative_toggle.set_active(_relative_toggle_status); + bool global_guides_lock = _desktop->namedview->lockguides; + if(global_guides_lock){ + _locked_toggle.set_sensitive(false); + } + _locked_toggle.set_active(_guide->getLocked()); + // don't know what this exactly does, but it results in that the dialog closes when entering a value and pressing enter (see LP bug 484187) g_signal_connect_swapped(G_OBJECT(_spin_button_x.getWidget()->gobj()), "activate", G_CALLBACK(gtk_window_activate_default), gobj()); diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 4ff7b4fde..5dce0d6ed 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -79,6 +79,7 @@ private: Gtk::Label _label_name; Gtk::Label _label_descr; + Inkscape::UI::Widget::CheckButton _locked_toggle; Inkscape::UI::Widget::CheckButton _relative_toggle; static bool _relative_toggle_status; // remember the status of the _relative_toggle_status button across instances Inkscape::UI::Widget::UnitMenu _unit_menu; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 6fd5bed07..91301fb60 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -577,6 +577,9 @@ static gboolean checkitem_update(GtkWidget *widget, GdkEventExpose * /*event*/, if (!strcmp(action->id, "ToggleGrid")) { ison = dt->gridsEnabled(); } + else if (!strcmp(action->id, "EditGuidesToggleLock")) { + ison = dt->namedview->lockguides; + } else if (!strcmp(action->id, "ToggleGuides")) { ison = dt->namedview->getGuides(); } diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index 55683871d..fcba0c6da 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -116,6 +116,9 @@ struct EditWidgetInterface /// Toggle CMS on/off and set preference value accordingly virtual void toggleColorProfAdjust() = 0; + /// Toggle lock guides on/off and set namedview value accordingly + virtual void toggleGuidesLock() = 0; + /// Is CMS on/off virtual bool colorProfAdjustEnabled() = 0; |
