[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Fri Oct 1 14:46:19 UTC 2004


CVS commit by okellogg: 

LinkWidget::constrainY(): New.  Finally, class FloatingText has no more
direct dependency on MessageWidget or AssociationWidget.


  M +1 -8      floatingtext.cpp   1.60
  M +4 -0      linkwidget.cpp   1.5
  M +5 -0      linkwidget.h   1.5
  M +10 -0     messagewidget.cpp   1.50
  M +9 -0      messagewidget.h   1.22


--- kdesdk/umbrello/umbrello/floatingtext.cpp  #1.59:1.60
@@ -16,5 +16,4 @@
 
 // local includes
-#include "associationwidget.h"
 #include "association.h"
 #include "umlview.h"
@@ -22,5 +21,4 @@
 #include "uml.h"
 #include "classifier.h"
-#include "messagewidget.h"
 #include "listpopupmenu.h"
 #include "operation.h"
@@ -289,10 +287,5 @@ void FloatingText::mouseMoveEvent(QMouse
         //implement specific rules for a sequence diagram
         if (m_Role == Uml::tr_Seq_Message) {
-                MessageWidget *pMessage = static_cast<MessageWidget*>(m_pLink);
-                const int minHeight = pMessage->getMinHeight();
-                newY = newY < minHeight ? minHeight : newY;
-                const int maxHeight = pMessage->getMaxHeight() - height() - 5;
-                newY = newY < maxHeight ? newY : maxHeight;
-                pMessage->setY( newY + height() );
+                m_pLink->constrainY(newY, height());
         }
         m_nOldX = newX;

--- kdesdk/umbrello/umbrello/linkwidget.cpp  #1.4:1.5
@@ -83,4 +83,8 @@ void LinkWidget::updateMessagePos(int /*
 }
 
+void LinkWidget::constrainY(int & /*y*/, int /*height*/) {
+        // Only applicable to MessageWidget.
+}
+ 
 void LinkWidget::calculateNameTextSegment() {
         // Only applicable to MessageWidget and AssociationWidget.

--- kdesdk/umbrello/umbrello/linkwidget.h  #1.4:1.5
@@ -156,4 +156,9 @@ public:
 
         /**
+         * Motivated by FloatingText::mouseMoveEvent()
+         */
+        void constrainY(int &y, int height);
+ 
+        /**
          * Motivated by FloatingText::setLink(). Bad.
          */

--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.49:1.50
@@ -273,4 +273,14 @@ void MessageWidget::updateMessagePos(int
 }
 
+void MessageWidget::constrainY(int &y, int height) {
+        const int minHeight = getMinHeight();
+        const int maxHeight = getMaxHeight() - height - 5;
+        if (y < minHeight)
+                y = minHeight;
+        else if (y > maxHeight)
+                y = maxHeight;
+        setY( y + height );
+}
+ 
 void MessageWidget::setupAfterFTsetLink(FloatingText* /*ft*/) {
         setTextPosition();

--- kdesdk/umbrello/umbrello/messagewidget.h  #1.21:1.22
@@ -250,4 +250,13 @@ public:
 
         /**
+         * Constrains the Y value supplied.
+         * Overrides operation from LinkWidget.
+         *
+         * @param y             Y value (may be modified by the constraint.)
+         * @param height        Height of the associated FloatingText.
+         */
+        void constrainY(int &y, int height);
+
+        /**
          * Used to cleanup any other widget it may need to delete.
          */






More information about the umbrello-devel mailing list