From: dvlierop2 Date: Thu, 19 Apr 2007 20:06:28 +0000 (+0000) Subject: Improve readability and remove some unused code X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d7616e3b1a716d7db8b2a763d790edb316a9fd3;p=inkscape.git Improve readability and remove some unused code --- diff --git a/src/guide-snapper.cpp b/src/guide-snapper.cpp index 9fd13705c..1e4eb02d8 100644 --- a/src/guide-snapper.cpp +++ b/src/guide-snapper.cpp @@ -26,7 +26,7 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point { LineList s; - if ( NULL == _named_view || willSnapSomething() == false) { + if ( NULL == _named_view || ThisSnapperMightSnap() == false) { return s; } @@ -47,7 +47,7 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point /** * \return true if this Snapper will snap at least one kind of point. */ -bool Inkscape::GuideSnapper::willSnapSomething() const +bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const { return _named_view == NULL ? false : (_enabled && _snap_to != 0 && _named_view->showguides); } diff --git a/src/guide-snapper.h b/src/guide-snapper.h index 37ea08701..15f484711 100644 --- a/src/guide-snapper.h +++ b/src/guide-snapper.h @@ -30,7 +30,7 @@ class GuideSnapper : public LineSnapper public: GuideSnapper(SPNamedView const *nv, NR::Coord const d); - bool willSnapSomething() const; + bool ThisSnapperMightSnap() const; private: LineList _getSnapLines(NR::Point const &p) const; diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index e39d398b1..d63376e14 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -38,7 +38,7 @@ void Inkscape::ObjectSnapper::_findCandidates(std::list& c, std::list const &it, NR::Point const &p) const { - if (willSnapSomething()) { + if (ThisSnapperMightSnap()) { SPDesktop const *desktop = SP_ACTIVE_DESKTOP; for (SPObject* o = sp_object_first_child(r); o != NULL; o = SP_OBJECT_NEXT(o)) { if (SP_IS_ITEM(o) && !SP_ITEM(o)->isLocked() && !desktop->itemIsHidden(SP_ITEM(o))) { @@ -186,7 +186,7 @@ Inkscape::SnappedPoint Inkscape::ObjectSnapper::_doConstrainedSnap(NR::Point con /** * \return true if this Snapper will snap at least one kind of point. */ -bool Inkscape::ObjectSnapper::willSnapSomething() const +bool Inkscape::ObjectSnapper::ThisSnapperMightSnap() const { return (_enabled && _snap_to != 0 && (_snap_to_paths || _snap_to_nodes)); } diff --git a/src/object-snapper.h b/src/object-snapper.h index f9c7a9817..47ac14545 100644 --- a/src/object-snapper.h +++ b/src/object-snapper.h @@ -43,7 +43,7 @@ public: return _snap_to_paths; } - bool willSnapSomething() const; + bool ThisSnapperMightSnap() const; private: SnappedPoint _doFreeSnap(NR::Point const &p, diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 82632d456..cfc784dac 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1342,7 +1342,7 @@ void Inkscape::SelTrans::stretch(SPSelTransHandle const &handle, NR::Point &pt, NR::Point p1 = _approximate_bbox->min() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin)); NR::Point p2 = _approximate_bbox->max() * (NR::translate(-scale_origin) * NR::Matrix(s) * NR::translate(scale_origin)); - //Find the ones at the lower-left and upper-right, as required by get_scale_transform_with_stroke + //Find the corners at the lower-left and upper-right, as required by get_scale_transform_with_stroke NR::Point new_bbox_min = NR::Point(std::min(p1[NR::X], p2[NR::X]), std::min(p1[NR::Y], p2[NR::Y])); NR::Point new_bbox_max = NR::Point(std::max(p1[NR::X], p2[NR::X]), std::max(p1[NR::Y], p2[NR::Y])); @@ -1380,7 +1380,7 @@ void Inkscape::SelTrans::scale(NR::Point &pt, guint state) NR::Point p1 = _approximate_bbox->min() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin)); NR::Point p2 = _approximate_bbox->max() * (NR::translate(-_origin) * NR::Matrix(s) * NR::translate(_origin)); - //Find the ones at the lower-left and upper-right, as required by get_scale_transform_with_stroke + //Find the corners at the lower-left and upper-right, as required by get_scale_transform_with_stroke NR::Point new_bbox_min = NR::Point(std::min(p1[NR::X], p2[NR::X]), std::min(p1[NR::Y], p2[NR::Y])); NR::Point new_bbox_max = NR::Point(std::max(p1[NR::X], p2[NR::X]), std::max(p1[NR::Y], p2[NR::Y])); diff --git a/src/snap.cpp b/src/snap.cpp index b03b3f89d..3dda92ecb 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -81,11 +81,11 @@ SnapManager::getGridSnappers() const * \return true if one of the snappers will try to snap something. */ -bool SnapManager::willSnapSomething() const +bool SnapManager::SomeSnapperMightSnap() const { SnapperList const s = getSnappers(); SnapperList::const_iterator i = s.begin(); - while (i != s.end() && (*i)->willSnapSomething() == false) { + while (i != s.end() && (*i)->ThisSnapperMightSnap() == false) { i++; } @@ -303,7 +303,7 @@ std::pair SnapManager::_snapTransformed( */ /* Quick check to see if we have any snappers that are enabled */ - if (willSnapSomething() == false) { + if (SomeSnapperMightSnap() == false) { return std::make_pair(transformation, false); } diff --git a/src/snap.h b/src/snap.h index 4185b051a..e0217948f 100644 --- a/src/snap.h +++ b/src/snap.h @@ -42,7 +42,7 @@ public: typedef std::list SnapperList; - bool willSnapSomething() const; + bool SomeSnapperMightSnap() const; Inkscape::SnappedPoint freeSnap(Inkscape::Snapper::PointType t, NR::Point const &p, diff --git a/src/snapper.h b/src/snapper.h index 21e96b019..25e345305 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -47,7 +47,7 @@ public: /** * \return true if this Snapper will snap at least one kind of point. */ - virtual bool willSnapSomething() const {return (_enabled && _snap_to != 0);} // will likely be overridden by derived classes + virtual bool ThisSnapperMightSnap() const {return (_enabled && _snap_to != 0);} // will likely be overridden by derived classes void setEnabled(bool s); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index c3a1c58ad..d8215eaa2 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -233,7 +233,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va } object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_OBJECTTOLERANCE: + case SP_ATTR_OBJECTTOLERANCE: nv->objecttoleranceunit = &px; nv->objecttolerance = DEFAULTTOLERANCE; if (value) { @@ -314,7 +314,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va nv->pageshadow = value? atoi(value) : 2; // 2 is the default object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_SHOWPAGESHADOW: + case SP_ATTR_SHOWPAGESHADOW: nv->showpageshadow = (value) ? sp_str_to_bool(value) : TRUE; object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; @@ -346,36 +346,11 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va nv->window_y = value ? atoi(value) : -1; // -1 means not set object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; -/* case SP_ATTR_INKSCAPE_GRID_BBOX: - nv->snap_manager.grid.setSnapTo(Inkscape::Snapper::BBOX_POINT, value ? sp_str_to_bool(value) : TRUE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; - case SP_ATTR_INKSCAPE_GRID_POINTS: - nv->snap_manager.grid.setSnapTo(Inkscape::Snapper::SNAP_POINT, value ? sp_str_to_bool(value) : FALSE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; - case SP_ATTR_INKSCAPE_GUIDE_BBOX: - nv->snap_manager.guide.setSnapTo(Inkscape::Snapper::BBOX_POINT, value ? sp_str_to_bool(value) : TRUE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; - case SP_ATTR_INKSCAPE_GUIDE_POINTS: - nv->snap_manager.guide.setSnapTo(Inkscape::Snapper::SNAP_POINT, value ? sp_str_to_bool(value) : FALSE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; - case SP_ATTR_INKSCAPE_OBJECT_BBOX: - nv->snap_manager.object.setSnapTo(Inkscape::Snapper::BBOX_POINT, (value) ? sp_str_to_bool(value) : FALSE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; - case SP_ATTR_INKSCAPE_OBJECT_POINTS: - nv->snap_manager.object.setSnapTo(Inkscape::Snapper::SNAP_POINT, (value) ? sp_str_to_bool(value) : FALSE); - object->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; -*/ - case SP_ATTR_INKSCAPE_OBJECT_PATHS: + case SP_ATTR_INKSCAPE_OBJECT_PATHS: nv->snap_manager.object.setSnapToPaths(value ? sp_str_to_bool(value) : FALSE); object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_INKSCAPE_OBJECT_NODES: + case SP_ATTR_INKSCAPE_OBJECT_NODES: nv->snap_manager.object.setSnapToNodes(value ? sp_str_to_bool(value) : FALSE); object->requestModified(SP_OBJECT_MODIFIED_FLAG); break; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index af847149e..f84b11920 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -266,12 +266,6 @@ DocumentProperties::build_snap() { _page_snap.show(); -/* _rcbsnbo.init (_("_Snap bounding boxes to objects"), - _("Snap the edges of the object bounding boxes to other objects"), - "inkscape:object-bbox", _wr); - _rcbsnnob.init (_("Snap nodes _to objects"), - _("Snap the nodes of objects to other objects"), - "inkscape:object-points", _wr);*/ _rcbsnop.init (_("Snap to object _paths"), _("Snap to other object paths"), "inkscape:object-paths", _wr); @@ -282,22 +276,10 @@ DocumentProperties::build_snap() _("Snapping distance, in screen pixels, for snapping to objects"), _("If set, objects snap to the nearest object, regardless of distance"), "objecttolerance", _wr); -/* _rcbsnbb.init (_("Snap _bounding boxes to grid"), - _("Snap the edges of the object bounding boxes"), - "inkscape:grid-bbox", _wr); - _rcbsnnod.init (_("Snap nodes to _grid"), - _("Snap path nodes, text baselines, ellipse centers, etc."), - "inkscape:grid-points", _wr);*/ _rsu_sn.init (_("Snap sens_itivity:"), _("Always snap"), _("Snapping distance, in screen pixels, for snapping to grid"), _("If set, objects snap to the nearest grid line, regardless of distance"), "gridtolerance", _wr); -/* _rcb_snpgui.init (_("Snap bounding boxes to g_uides"), - _("Snap the edges of the object bounding boxes"), - "inkscape:guide-bbox", _wr); - _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:"), _("Always snap"), _("Snapping distance, in screen pixels, for snapping to guides"), _("If set, objects snap to the nearest guide, regardless of distance"), @@ -312,20 +294,14 @@ DocumentProperties::build_snap() const Gtk::Widget* array[] = { label_o, 0, -// 0, _rcbsnbo._button, -// 0, _rcbsnnob._button, 0, _rcbsnop._button, 0, _rcbsnon._button, 0, _rsu_sno._vbox, 0, 0, label_gr, 0, -// 0, _rcbsnbb._button, -// 0, _rcbsnnod._button, 0, _rsu_sn._vbox, 0, 0, label_gu, 0, -// 0, _rcb_snpgui._button, -// 0, _rcb_snbgui._button, 0, _rsu_gusn._vbox, }; @@ -436,18 +412,12 @@ DocumentProperties::update() _rcp_hgui.setRgba32 (nv->guidehicolor); //-----------------------------------------------------------snap - //_rcbsnbo.setActive (nv->snap_manager.object.getSnapTo(Inkscape::Snapper::BBOX_POINT)); - //_rcbsnnob.setActive (nv->snap_manager.object.getSnapTo(Inkscape::Snapper::SNAP_POINT)); _rcbsnop.setActive (nv->snap_manager.object.getSnapToPaths()); _rcbsnon.setActive (nv->snap_manager.object.getSnapToNodes()); _rsu_sno.setValue (nv->objecttolerance); - //_rcbsnbb.setActive (nv->snap_manager.grid.getSnapTo(Inkscape::Snapper::BBOX_POINT)); - //_rcbsnnod.setActive (nv->snap_manager.grid.getSnapTo(Inkscape::Snapper::SNAP_POINT)); _rsu_sn.setValue (nv->gridtolerance); - //_rcb_snpgui.setActive (nv->snap_manager.guide.getSnapTo(Inkscape::Snapper::BBOX_POINT)); - //_rcb_snbgui.setActive (nv->snap_manager.guide.getSnapTo(Inkscape::Snapper::SNAP_POINT)); _rsu_gusn.setValue (nv->guidetolerance); //-----------------------------------------------------------grids page diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 294bbab43..65fd29417 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -66,14 +66,14 @@ protected: RegisteredUnitMenu _rum_deflt; PageSizer _page_sizer; //--------------------------------------------------------------- - RegisteredCheckButton _rcbgrid; //_rcbsnbb, _rcbsnnod + RegisteredCheckButton _rcbgrid; RegisteredUnitMenu _rums; //--------------------------------------------------------------- - RegisteredCheckButton _rcb_sgui; //_rcb_snpgui, _rcb_snbgui + RegisteredCheckButton _rcb_sgui; RegisteredUnitMenu _rum_gusn; RegisteredColorPicker _rcp_gui, _rcp_hgui; //--------------------------------------------------------------- - RegisteredCheckButton _rcbsnop, _rcbsnon; //_rcbsnbo, _rcbsnnob + RegisteredCheckButton _rcbsnop, _rcbsnon; RegisteredUnitMenu _rumso; ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn; RegisteredRadioButtonPair _rrb_pix;