[Kst] extragear/graphics/kst/src/libkstapp

George Staikos staikos at kde.org
Thu May 25 22:48:49 CEST 2006


Please see: http://developer.kde.org/policies/commitpolicy.html

In particular, sections 6 through 13.  I'll come back to this tomorrow.

On Thursday 25 May 2006 14:37, Andrew Walker wrote:
> SVN commit 544672 by arwalker:
>
> BUG:127536 Ensure that when mocing sticky borders apply to all objects and
> not just top-level objects.
>
>  M  +10 -43    ksttoplevelview.cpp
>  M  +39 -0     kstviewobject.cpp
>  M  +2 -0      kstviewobject.h
>
>
> --- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.cpp
> #544671:544672 @@ -704,54 +704,21 @@
>    r.moveTopLeft(topLeft);
>    _moveOffsetSticky = QPoint(0, 0);
>
> -  int iXMin = STICKY_THRESHOLD;
> -  int iYMin = STICKY_THRESHOLD;
> +  int xMin = STICKY_THRESHOLD;
> +  int yMin = STICKY_THRESHOLD;
>
> -  // check for "sticky" borders
> -  for (KstViewObjectList::Iterator i = _children.begin(); i !=
> _children.end(); ++i) { -    if (_selectionList.find(*i) ==
> _selectionList.end() && _pressTarget != *i) { -      const QRect
> rect((*i)->geometry());
> +  snapToBorders(&xMin, &yMin, _selectionList, _pressTarget, r);
>
> -      int overlapLo = r.top() > rect.top() ? r.top() : rect.top();
> -      int overlapHi = r.bottom() < rect.bottom() ? r.bottom() :
> rect.bottom(); -      if (overlapHi - overlapLo > 0) {
> -        if (labs(r.left() - rect.left()) < labs(iXMin)) {
> -          iXMin = r.left() - rect.left();
> -        } else if (labs(r.left() - rect.right()) < labs(iXMin)) {
> -          iXMin = r.left() - rect.right();
> -        } else if (labs(r.right() - rect.left()) < labs(iXMin)) {
> -          iXMin = r.right() - rect.left();
> -        } else if (labs(r.right() - rect.right()) < labs(iXMin)) {
> -          iXMin = r.right() - rect.right();
> -        }
> -      }
> -
> -      overlapLo = r.left() > rect.left() ? r.left() : rect.left();
> -      overlapHi = r.right() < rect.right() ? r.right() : rect.right();
> -      if (overlapHi - overlapLo > 0) {
> -        if (labs(r.top() - rect.top()) < labs(iYMin)) {
> -          iYMin = r.top() - rect.top();
> -        } else if (labs(r.top() - rect.bottom()) < labs(iYMin)) {
> -          iYMin = r.top() - rect.bottom();
> -        } else if (labs(r.bottom() - rect.top()) < labs(iYMin)) {
> -          iYMin = r.bottom() - rect.top();
> -        } else if (labs(r.bottom() - rect.bottom()) < labs(iYMin)) {
> -          iYMin = r.bottom() - rect.bottom();
> -        }
> -      }
> -    }
> +  if (labs(xMin) < STICKY_THRESHOLD) {
> +    _moveOffsetSticky.setX(xMin);
> +    topLeft.setX(topLeft.x() - xMin);
>    }
> -
> -  if (labs(iXMin) < STICKY_THRESHOLD) {
> -    _moveOffsetSticky.setX(iXMin);
> -    topLeft.setX(topLeft.x() - iXMin);
> +  if (labs(yMin) < STICKY_THRESHOLD) {
> +    _moveOffsetSticky.setY(yMin);
> +    topLeft.setY(topLeft.y() - yMin);
>    }
> -  if (labs(iYMin) < STICKY_THRESHOLD) {
> -    _moveOffsetSticky.setY(iYMin);
> -    topLeft.setY(topLeft.y() - iYMin);
> -  }
>
> -  r.moveTopLeft(topLeft);
> +  r.moveTopLeft(topLeft);
>
>    if (!_geom.contains(r, true)) {
>      slideInto(_geom, r);
> --- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp
> #544671:544672 @@ -1470,6 +1470,45 @@
>  }
>
>
> +void KstViewObject::snapToBorders(int *xMin, int *yMin, const
> KstViewObjectList &selectionList, const KstViewObjectPtr &pressTarget,
> const QRect &r) const { +  for (KstViewObjectList::ConstIterator i =
> _children.begin(); i != _children.end(); ++i) { +   
> (*i)->snapToBorders(xMin, yMin, selectionList, pressTarget, r); +
> +    if (selectionList.find(*i) == selectionList.end() && pressTarget !=
> *i) { +      const QRect rect((*i)->geometry());
> +
> +      int overlapLo = r.top() > rect.top() ? r.top() : rect.top();
> +      int overlapHi = r.bottom() < rect.bottom() ? r.bottom() :
> rect.bottom(); +      if (overlapHi - overlapLo > 0) {
> +        if (labs(r.left() - rect.left()) < labs(*xMin)) {
> +          *xMin = r.left() - rect.left();
> +        } else if (labs(r.left() - rect.right()) < labs(*xMin)) {
> +          *xMin = r.left() - rect.right();
> +        } else if (labs(r.right() - rect.left()) < labs(*xMin)) {
> +          *xMin = r.right() - rect.left();
> +        } else if (labs(r.right() - rect.right()) < labs(*xMin)) {
> +          *xMin = r.right() - rect.right();
> +        }
> +      }
> +
> +      overlapLo = r.left() > rect.left() ? r.left() : rect.left();
> +      overlapHi = r.right() < rect.right() ? r.right() : rect.right();
> +      if (overlapHi - overlapLo > 0) {
> +        if (labs(r.top() - rect.top()) < labs(*yMin)) {
> +          *yMin = r.top() - rect.top();
> +        } else if (labs(r.top() - rect.bottom()) < labs(*yMin)) {
> +          *yMin = r.top() - rect.bottom();
> +        } else if (labs(r.bottom() - rect.top()) < labs(*yMin)) {
> +          *yMin = r.bottom() - rect.top();
> +        } else if (labs(r.bottom() - rect.bottom()) < labs(*yMin)) {
> +          *yMin = r.bottom() - rect.bottom();
> +        }
> +      }
> +    }
> +  }
> +}
> +
> +
>  bool KstViewObject::isSelected() const {
>    return _selected;
>  }
> --- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.h
> #544671:544672 @@ -163,6 +163,8 @@
>      virtual void updateSelection(const QRect& region);
>      bool isContainer() const;
>
> +    virtual void snapToBorders(int *xMin, int *yMin, const
> KstViewObjectList &selectionList, const KstViewObjectPtr &pressTarget,
> const QRect &r) const; +
>      KstViewObjectPtr parent() const;
>
>      void recursively(void (KstViewObject::*)(), bool self = false);
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/


More information about the Kst mailing list