summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21feb65)
raw | patch | inline | side by side (parent: 21feb65)
author | rwst <rwst@users.sourceforge.net> | |
Thu, 2 Feb 2006 18:09:26 +0000 (18:09 +0000) | ||
committer | rwst <rwst@users.sourceforge.net> | |
Thu, 2 Feb 2006 18:09:26 +0000 (18:09 +0000) |
modes
src/ui/dialog/document-properties.cpp | patch | blob | history | |
src/ui/widget/tolerance-slider.cpp | patch | blob | history | |
src/ui/widget/tolerance-slider.h | patch | blob | history |
index f9a280b8604dcd9aee25bc9a869ba849a504859a..03cef543a733f963cefb40b6cf236396508a0158 100644 (file)
_rcbsnon.init (_("Snap to object _nodes"),
_("Snap to other object nodes"),
"inkscape:object-nodes", _wr);
- _rsu_sno.init (_("Snap s_ensitivity:"),
+ _rsu_sno.init (_("Snap s_ensitivity:"), _("Always snap"),
_("Controls max. snapping distance from object"),
+ _("If set, objects snap to the nearest object when moved, regardless of distance"),
"objecttolerance", _wr);
_rcbsnbb.init (_("Snap _bounding boxes to grid"),
_("Snap the edges of the object bounding boxes"),
_rcbsnnod.init (_("Snap nodes to _grid"),
_("Snap path nodes, text baselines, ellipse centers, etc."),
"inkscape:grid-points", _wr);
- _rsu_sn.init (_("Snap sens_itivity:"),
+ _rsu_sn.init (_("Snap sens_itivity:"), _("Always snap"),
_("Controls max. snapping distance from grid"),
+ _("If set, objects snap to the nearest grid line when moved, regardless of distance"),
"gridtolerance", _wr);
_rcb_snpgui.init (_("Snap bounding boxes to g_uides"),
_("Snap the edges of the object bounding boxes"),
_rcb_snbgui.init (_("Snap p_oints to guides"),
_("Snap path nodes, text baselines, ellipse centers, etc."),
"inkscape:guide-points", _wr);
- _rsu_gusn.init (_("Snap sensiti_vity:"),
- _("Controls max. snapping distance from guides"), "guidetolerance", _wr);
- _rrb_pix.init (_("Sensitivity:"), _("S_creen pixels"), _("p_x units"),
- _("Sensitivity is always the same, regardless of zoom."),
- _("Sensitivity changes with zoom; zooming in will enlarge max. snapping distance."),
- _("inkscape:has_abs_tolerance"), _wr);
+ _rsu_gusn.init (_("Snap sensiti_vity:"), _("Always snap"),
+ _("Controls max. snapping distance from guides"),
+ _("If set, objects snap to the nearest guide when moved, regardless of distance"),
+ "guidetolerance", _wr);
+// _rrb_pix.init (_("Sensitivity:"), _("S_creen pixels"), _("p_x units"),
+// _("Sensitivity is always the same, regardless of zoom."),
+// _("Sensitivity changes with zoom; zooming in will enlarge max. snapping distance."),
+// _("inkscape:has_abs_tolerance"), _wr);
Gtk::Label *label_o = manage (new Gtk::Label);
label_o->set_markup (_("<b>Object Snapping</b>"));
Gtk::Label *label_gr = manage (new Gtk::Label);
0, _rcbsnnob._button,
0, _rcbsnop._button,
0, _rcbsnon._button,
- 0, _rsu_sno._hbox,
+ 0, _rsu_sno._vbox,
0, 0,
label_gr, 0,
0, _rcbsnbb._button,
0, _rcbsnnod._button,
- 0, _rsu_sn._hbox,
+ 0, _rsu_sn._vbox,
0, 0,
label_gu, 0,
0, _rcb_snpgui._button,
0, _rcb_snbgui._button,
- 0, _rsu_gusn._hbox,
- 0, 0,
- 0, _rrb_pix._hbox,
+ 0, _rsu_gusn._vbox,
+// 0, 0,
+// 0, _rrb_pix._hbox,
};
attach_all (_page_snap.table(), array, sizeof(array));
_rcb_snpgui.setActive (nv->snap_guide_bbox);
_rcb_snbgui.setActive (nv->snap_guide_point);
_rsu_gusn.setValue (nv->guidetolerance, nv->has_abs_tolerance);
- _rrb_pix.setValue (true);
+// _rrb_pix.setValue (true);
_wr.setUpdating (false);
}
index 1ea90a7eeb75683c14b9951b84b8cd5886f7858a..25d332c592634fb38d3148474b7036236554f7f2 100644 (file)
//====================================================
ToleranceSlider::ToleranceSlider()
-: _hbox(0)
+: _vbox(0)
{
}
ToleranceSlider::~ToleranceSlider()
{
- if (_hbox) delete _hbox;
+ if (_vbox) delete _vbox;
_scale_changed_connection.disconnect();
}
void
-ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr)
+ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& tip1, const Glib::ustring& tip2, const Glib::ustring& key, Registry& wr)
{
- _hbox = new Gtk::HBox;
+ _vbox = new Gtk::VBox;
+ _hbox = manage (new Gtk::HBox);
Gtk::Label *theLabel1 = manage (new Gtk::Label (label1));
theLabel1->set_use_underline();
_hbox->add (*theLabel1);
@@ -65,19 +66,26 @@ ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& tip, co
_hscale->set_draw_value (true);
_hscale->set_value_pos (Gtk::POS_RIGHT);
_hscale->set_size_request (100, -1);
- _tt.set_tip (*_hscale, tip);
+ _tt.set_tip (*_hscale, tip1);
_hbox->add (*_hscale);
-// Gtk::Label *theLabel2 = manage (new Gtk::Label (label2));
-// _hbox->add (*theLabel2);
+ _vbox->add (*_hbox);
+ 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);
+ _vbox->add (*_button);
_key = key;
- _scale_changed_connection = _hscale->signal_value_changed().connect (sigc::mem_fun (*this, &ToleranceSlider::update));
+ _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));
_wr = ≀
+ _vbox->show_all_children();
}
void
ToleranceSlider::setValue (double val, bool is_absolute)
{
- _hscale->set_value (val);
Gtk::Adjustment *adj = _hscale->get_adjustment();
if (is_absolute)
{
adj->set_upper (50.1);
adj->set_step_increment (0.1);
}
- update();
+
+ if (val > 9999.9) // magic value 10000.0
+ {
+ _button->set_active (true);
+ _hbox->set_sensitive (false);
+ val = 50.0;
+ }
+ else
+ {
+ _button->set_active (false);
+ _hbox->set_sensitive (true);
+ }
+ _hscale->set_value (val);
+ _hbox->show_all();
}
void
}
void
-ToleranceSlider::update()
+ToleranceSlider::on_scale_changed()
+{
+ update (_hscale->get_value());
+}
+
+void
+ToleranceSlider::on_toggled()
+{
+ if (_button->get_active())
+ {
+ _hbox->set_sensitive (false);
+ _hbox->show_all();
+ setValue (10000.0);
+ update (10000.0);
+ }
+ else
+ {
+ _hbox->set_sensitive (true);
+ _hbox->show_all();
+ setValue (50.0);
+ update (50.0);
+ }
+}
+
+void
+ToleranceSlider::update (double val)
{
if (_wr->isUpdating())
return;
return;
Inkscape::SVGOStringStream os;
- os << _hscale->get_value();
+ os << val;
_wr->setUpdating (true);
index 9860f1e4a84b19a9d27f7114c1edbd21609ec710..1cdcdc31781fe1aecc624f007c9bbc4a81c23cff 100644 (file)
#define INKSCAPE_UI_WIDGET_TOLERANCE_SLIDER__H_
#include <gtkmm/tooltips.h>
+#include <gtkmm/checkbutton.h>
namespace Inkscape {
namespace UI {
namespace Widget {
class Registry;
+
class ToleranceSlider {
public:
ToleranceSlider();
~ToleranceSlider();
void init (const Glib::ustring& label1,
-// const Glib::ustring& label2,
- const Glib::ustring& tip,
+ const Glib::ustring& label2,
+ const Glib::ustring& tip1,
+ const Glib::ustring& tip2,
const Glib::ustring& key,
Registry& wr);
- void setValue (double, bool);
+ void setValue (double, bool=true);
void setLimits (double, double);
- Gtk::HBox* _hbox;
+ Gtk::VBox* _vbox;
protected:
void on_scale_changed();
- void update();
- sigc::connection _scale_changed_connection;
- Gtk::HScale *_hscale;
- Gtk::Tooltips _tt;
- Registry *_wr;
- Glib::ustring _key;
+ void on_toggled();
+ void update (double val);
+ Gtk::HBox *_hbox;
+ Gtk::HScale *_hscale;
+ Gtk::CheckButton *_button;
+ Gtk::Tooltips _tt;
+ Registry *_wr;
+ Glib::ustring _key;
+ sigc::connection _scale_changed_connection;
+ sigc::connection _btn_toggled_connection;
};