From: dvlierop2 Date: Wed, 30 Apr 2008 18:54:13 +0000 (+0000) Subject: Use radiobutton for "always snap" in the document-properties dialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2ac3daad6d54543f35505d043b98e25c540bd6e6;p=inkscape.git Use radiobutton for "always snap" in the document-properties dialog --- diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h index ad9466eb8..6c39860b9 100644 --- a/src/display/canvas-axonomgrid.h +++ b/src/display/canvas-axonomgrid.h @@ -17,7 +17,7 @@ #include "ui/widget/registered-widget.h" #include "ui/widget/registry.h" -#include "ui/widget/tolerance-slider.h" +//#include "ui/widget/tolerance-slider.h" #include "xml/node-event-vector.h" diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 8ae26d4c4..0ff2c65f1 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -23,7 +23,7 @@ #include "ui/widget/scalar-unit.h" #include "ui/widget/registered-widget.h" #include "ui/widget/registry.h" -#include "ui/widget/tolerance-slider.h" +//#include "ui/widget/tolerance-slider.h" #include "xml/node-event-vector.h" #include "snapper.h" #include "line-snapper.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index e7aca0edc..6396a6103 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -274,20 +274,20 @@ DocumentProperties::build_snap() { _page_snap.show(); - _rsu_sno.init (_("Snap _distance"), _("Snap only when _closer than:"), - _("Snapping distance, in screen pixels, for snapping to objects"), + _rsu_sno.init (_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"), + _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"), _("If set, objects only snap to another object when it's within the range specified below"), "objecttolerance", _wr); //Options for snapping to grids - _rsu_sn.init (_("Snap d_istance"), _("Snap only when c_loser than:"), - _("Snapping distance, in screen pixels, for snapping to grid"), + _rsu_sn.init (_("Snap d_istance"), _("Snap only when c_loser than:"), _("Always snap"), + _("Snapping distance, in screen pixels, for snapping to grid"), _("Always snap to grids, regardless of the distance"), _("If set, objects only snap to a grid line when it's within the range specified below"), "gridtolerance", _wr); //Options for snapping to guides - _rsu_gusn.init (_("Snap dist_ance"), _("Snap only when close_r than:"), - _("Snapping distance, in screen pixels, for snapping to guides"), + _rsu_gusn.init (_("Snap dist_ance"), _("Snap only when close_r than:"), _("Always snap"), + _("Snapping distance, in screen pixels, for snapping to guides"), _("Always snap to guides, regardless of the distance"), _("If set, objects only snap to a guide when it's within the range specified below"), "guidetolerance", _wr); diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index 0110a6c4c..3a36127f4 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -54,7 +54,7 @@ ToleranceSlider::~ToleranceSlider() } void -ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr) +ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr) { // hbox = label + slider // @@ -87,17 +87,26 @@ ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, Gtk::Label *theLabel2 = manage (new Gtk::Label (label2)); theLabel2->set_use_underline(); - _button = manage (new Gtk::CheckButton); - _tt.set_tip (*_button, tip2); - _button->add (*theLabel2); - _button->set_alignment (0.0, 0.5); + Gtk::Label *theLabel3 = manage (new Gtk::Label (label3)); + theLabel3->set_use_underline(); + _button1 = manage (new Gtk::RadioButton); + _radio_button_group = _button1->get_group(); + _button2 = manage (new Gtk::RadioButton); + _button2->set_group(_radio_button_group); + _tt.set_tip (*_button1, tip2); + _tt.set_tip (*_button2, tip3); + _button1->add (*theLabel3); + _button1->set_alignment (0.0, 0.5); + _button2->add (*theLabel2); + _button2->set_alignment (0.0, 0.5); - _vbox->add (*_button); + _vbox->add (*_button1); + _vbox->add (*_button2); // Here we need some extra pixels to get the vertical spacing right. Why? _vbox->pack_end(*_hbox, true, true, 3); // add 3 px. _key = key; _scale_changed_connection = _hscale->signal_value_changed().connect (sigc::mem_fun (*this, &ToleranceSlider::on_scale_changed)); - _btn_toggled_connection = _button->signal_toggled().connect (sigc::mem_fun (*this, &ToleranceSlider::on_toggled)); + _btn_toggled_connection = _button2->signal_toggled().connect (sigc::mem_fun (*this, &ToleranceSlider::on_toggled)); _wr = ≀ _vbox->show_all_children(); } @@ -113,13 +122,15 @@ ToleranceSlider::setValue (double val) if (val > 9999.9) // magic value 10000.0 { - _button->set_active (false); + _button1->set_active (true); + _button2->set_active (false); _hbox->set_sensitive (false); val = 50.0; } else { - _button->set_active (true); + _button1->set_active (false); + _button2->set_active (true); _hbox->set_sensitive (true); } _hscale->set_value (val); @@ -142,7 +153,7 @@ ToleranceSlider::on_scale_changed() void ToleranceSlider::on_toggled() { - if (!_button->get_active()) + if (!_button2->get_active()) { _old_val = _hscale->get_value(); _hbox->set_sensitive (false); diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h index e395ede14..3d0324c1f 100644 --- a/src/ui/widget/tolerance-slider.h +++ b/src/ui/widget/tolerance-slider.h @@ -16,6 +16,7 @@ #include #include +#include namespace Inkscape { namespace UI { @@ -29,8 +30,10 @@ public: ~ToleranceSlider(); void init (const Glib::ustring& label1, const Glib::ustring& label2, + const Glib::ustring& label3, const Glib::ustring& tip1, const Glib::ustring& tip2, + const Glib::ustring& tip3, const Glib::ustring& key, Registry& wr); void setValue (double); @@ -43,7 +46,9 @@ protected: void update (double val); Gtk::HBox *_hbox; Gtk::HScale *_hscale; - Gtk::CheckButton *_button; + Gtk::RadioButtonGroup _radio_button_group; + Gtk::RadioButton *_button1; + Gtk::RadioButton *_button2; Gtk::Tooltips _tt; Registry *_wr; Glib::ustring _key;