[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Nov 27 20:33:07 UTC 2005


SVN commit 483762 by okellogg:

mousePressEvent(): Remove, use parent method.
onWidget(): Use UMLWidget::onWidget() also for creation messages.
slotWidgetMoved(): Return early if the id arg matches neither of the
 attached object widgets.
calculateDimensionsCreation(): Recompute m_nY.


 M  +20 -20    messagewidget.cpp  
 M  +0 -5      messagewidget.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/messagewidget.cpp #483761:483762
@@ -246,7 +246,7 @@
 }
 
 int MessageWidget::onWidget(const QPoint & p) {
-    if (m_sequenceMessageType == Uml::sequence_message_asynchronous) {
+    if (m_sequenceMessageType != Uml::sequence_message_synchronous) {
         return UMLWidget::onWidget(p);
     }
     // Synchronous message:
@@ -349,12 +349,20 @@
 }
 
 void MessageWidget::slotWidgetMoved(Uml::IDType id) {
-    if(m_pOw[Uml::A] -> getLocalID() == id || m_pOw[Uml::B] -> getLocalID() == id) {
-        m_nY = getY();
-        m_nY = m_nY < getMinHeight()?getMinHeight():m_nY;
-        m_nY = m_nY > getMaxHeight()?getMaxHeight():m_nY;
-        calculateWidget();
+    const Uml::IDType idA = m_pOw[Uml::A]->getLocalID();
+    const Uml::IDType idB = m_pOw[Uml::B]->getLocalID();
+    if (idA != id && idB != id) {
+        kdDebug() << "MessageWidget::slotWidgetMoved(" << ID2STR(id)
+            << "): ignoring for idA=" << ID2STR(idA)
+            << ", idB=" << ID2STR(idB) << endl;
+        return;
     }
+    m_nY = getY();
+    if (m_nY < getMinHeight())
+        m_nY = getMinHeight();
+    if (m_nY > getMaxHeight())
+        m_nY = getMaxHeight();
+    calculateWidget();
     if( !m_pFText )
         return;
     if( m_pView -> getSelectCount() > 1 )
@@ -514,7 +522,7 @@
     int x1 = m_pOw[Uml::A]->getX();
     int x2 = m_pOw[Uml::B]->getX();
     int w1 = m_pOw[Uml::A]->getWidth() / 2;
-    int w2 =  m_pOw[Uml::B]->getWidth() / 2;
+    int w2 = m_pOw[Uml::B]->getWidth() / 2;
     x1 += w1;
     x2 += w2;
 
@@ -546,8 +554,8 @@
 
     int x1 = m_pOw[Uml::A]->getX();
     int x2 = m_pOw[Uml::B]->getX();
-    int w1 = m_pOw[Uml::A] -> getWidth() / 2;
-    int w2 =  m_pOw[Uml::B] -> getWidth() / 2;
+    int w1 = m_pOw[Uml::A]->getWidth() / 2;
+    int w2 = m_pOw[Uml::B]->getWidth() / 2;
     x1 += w1;
     x2 += w2;
 
@@ -579,8 +587,8 @@
 
     int x1 = m_pOw[Uml::A]->getX();
     int x2 = m_pOw[Uml::B]->getX();
-    int w1 = m_pOw[Uml::A] -> getWidth() / 2;
-    int w2 =  m_pOw[Uml::B] -> getWidth();
+    int w1 = m_pOw[Uml::A]->getWidth() / 2;
+    int w2 = m_pOw[Uml::B]->getWidth();
     x1 += w1;
     if (x1 > x2)
         x2 += w2;
@@ -597,6 +605,7 @@
     x += 1;
     widgetWidth -= 2;
     m_nPosX = x;
+    m_nY = m_pOw[Uml::B]->getY() + m_pOw[Uml::B]->getHeight() / 2;
     setSize(widgetWidth, widgetHeight);
 }
 
@@ -725,15 +734,6 @@
     return (height - this->height());
 }
 
-void MessageWidget::mousePressEvent(QMouseEvent* me) {
-    // resize only applies to asynchronous messages between different objects
-    if ( m_sequenceMessageType == Uml::sequence_message_asynchronous &&
-            m_pOw[Uml::A] != m_pOw[Uml::B] ) {
-        return;
-    }
-    UMLWidget::mousePressEvent(me);
-}
-
 void MessageWidget::setWidget(ObjectWidget * ow, Uml::Role_Type role) {
     m_pOw[role] = ow;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/messagewidget.h #483761:483762
@@ -326,11 +326,6 @@
     int onWidget(const QPoint & p);
 
     /**
-     * Overrides the standard operation.
-     */
-    virtual void mousePressEvent(QMouseEvent *me);
-
-    /**
      * Saves to the <messagewidget> XMI element.
      */
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );




More information about the umbrello-devel mailing list