[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Sep 30 22:35:11 UTC 2004


CVS commit by okellogg: 

FloatingText::setLinePosition{Relatively}: Remove.


  M +0 -39     floatingtext.cpp   1.57
  M +0 -19     floatingtext.h   1.23
  M +11 -1     messagewidget.cpp   1.49


--- kdesdk/umbrello/umbrello/floatingtext.cpp  #1.56:1.57
@@ -71,43 +71,4 @@ void FloatingText::draw(QPainter & p, in
 void FloatingText::resizeEvent(QResizeEvent * /*re*/) {}
 
-void FloatingText::setLinePos(int x, int y) {
-        bool xIsValid = (x >= restrictPositionMin && x <= restrictPositionMax);
-        bool yIsValid = (y >= restrictPositionMin && y <= restrictPositionMax);
-        if (xIsValid && yIsValid) { // fine
-                setX(x);
-                setY(y);
-        } else { // something is broken
-                kdDebug() << "FloatingText::setLinePos( " << x << " , " << y << " ) "
-                        << "- was blocked because at least one value is out of bounds: ["
-                        << restrictPositionMin << "..." << restrictPositionMax << "]  "
-                        << "origX: " << getX() << ", origY: " << getY()
-                        << endl;
-                // Let's just leave them at their original values.
-        }
-}
-
-void FloatingText::setLinePositionRelatively(int newX, int newY, int oldX, int oldY) {
-        int myNewX = getX() + (newX-oldX);
-        int myNewY = getY() + (newY-oldY);
-        bool xIsValid = (myNewX >= restrictPositionMin && myNewX <= restrictPositionMax);
-        bool yIsValid = (myNewY >= restrictPositionMin && myNewY <= restrictPositionMax);
-        if (xIsValid && yIsValid) { // fine
-                bool oldIgnoreSnapToGrid = m_bIgnoreSnapToGrid;
-                m_bIgnoreSnapToGrid = true;
-                setX(myNewX);
-                setY(myNewY);
-                m_bIgnoreSnapToGrid = oldIgnoreSnapToGrid;
-        } else { // something is broken
-                kdDebug() << "FloatingText::setLinePositionRelatively( " << myNewX
-                        << " , " << myNewY << " ) - was Blocked because at least one value is out of bounds: ["
-                        << restrictPositionMin << "..." << restrictPositionMax << "]\n"
-                        << "ToX: " << newX << ", ToY: " << newY
-                        << "FromX: " << oldX << ", FromY: " << oldY
-                        << "CurrentPointX: " << getX() << ", CurrentPointY: " << getY()
-                        << endl;
-                // Let's just leave them at their original values.
-        }
-}
-
 void FloatingText::calculateSize() {
         QFontMetrics &fm = getFontMetrics(FT_NORMAL);

--- kdesdk/umbrello/umbrello/floatingtext.h  #1.22:1.23
@@ -60,23 +60,4 @@ public:
 
         /**
-         * Called to set the position of the FloatingText.
-         *
-         * @param x     Vertical co-ordinate of the point.
-         * @param y     Horizontal co-ordinate of the point.
-         */
-        void setLinePos(int x, int y);
-
-        /**
-         * Called to set the position of the FloatingText by the difference
-         * between the two points.
-         *
-         * @param newX  The new X coordinate.
-         * @param newY  The new Y coordinate.
-         * @param oldX  The old X coordinate.
-         * @param oldY  The old Y coordinate.
-         */
-        void setLinePositionRelatively(int newX, int newY, int oldX, int oldY);
-
-        /**
          * Set the main body of text to display.
          *

--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.48:1.49
@@ -248,5 +248,15 @@ void MessageWidget::setTextPosition() {
                         ftX = xUpperBound;
         }
-        m_pFText->setLinePos(ftX, getY() - m_pFText->getHeight());
+        int ftY = getY() - m_pFText->getHeight();
+        if ( (ftX < 0 || ftX > FloatingText::restrictPositionMax) ||
+             (ftY < 0 || ftY > FloatingText::restrictPositionMax) ) {
+                kdDebug() << "MessageWidget::setTextPosition( " << ftX << " , " << ftY << " ) "
+                        << "- was blocked because at least one value is out of bounds: ["
+                        << "0 ... " << FloatingText::restrictPositionMax << "]"
+                        << endl;
+                return;
+        }
+        m_pFText->setX( ftX );
+        m_pFText->setY( ftY );
 }
 






More information about the umbrello-devel mailing list