[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello

Hassan Kouch hkouch at hotmail.com
Sun Mar 4 00:55:17 UTC 2007


SVN commit 639011 by kouch:

We can also create a pin at the left or the right of an activity (UML2.0)


 M  +17 -7     pinwidget.cpp  


--- branches/work/isi-umbrello/umbrello/umbrello/pinwidget.cpp #639010:639011
@@ -63,13 +63,25 @@
     int y;
 
     int x = m_pOw[Uml::A]->getX() + (width_Activity/2);
-    setX(x);
+   
 
     if ( (offsetY + height_Activity/2) <= m_pOw[Uml::A]->getY() + height_Activity){
        y = m_pOw[Uml::A]->getY()-5;
     } else if((offsetY + height_Activity/2) > m_pOw[Uml::A]->getY() + height_Activity){
        y = (m_pOw[Uml::A]->getY() + height_Activity)-5;
-    }  
+    }
+
+    if (offsetX + width_Activity/4 <= m_pOw[Uml::A]->getX() + width_Activity/2 
+         && (offsetY > m_pOw[Uml::A]->getY() +5 && offsetY < m_pOw[Uml::A]->getY() + height_Activity - 5) ){
+        x = m_pOw[Uml::A]->getX() -5;
+        y = m_pOw[Uml::A]->getY() + (height_Activity/2) -5;
+    } else if (offsetX + width_Activity/4 > m_pOw[Uml::A]->getX() + width_Activity/2
+         && (offsetY > m_pOw[Uml::A]->getY() +5 && offsetY < m_pOw[Uml::A]->getY() + height_Activity - 5) ){
+        x = m_pOw[Uml::A]->getX() + width_Activity -5;
+        y = m_pOw[Uml::A]->getY() + (height_Activity/2) -5;
+    }
+
+    setX(x);
     setY(y);
 
 
@@ -86,11 +98,10 @@
         if ( UMLWidget::getUseFillColour() ) { 
             p.setBrush( UMLWidget::getFillColour() ); 
         }
-        
         p.drawRect(x,y,w, h); 
         UMLWidget::setPen(p);
-    if(m_bSelected)
-        drawSelected(&p, offsetX, offsetY);
+        if(m_bSelected)
+             drawSelected(&p, offsetX, offsetY);
 }
  
 int PinWidget::getMinY() {
@@ -98,8 +109,7 @@
         return 0;
     }
     int heightA = m_pOw[Uml::A]->getY() + m_pOw[Uml::A]->getHeight();
-    int height = heightA;
-    return height;
+    return heightA;
 }
 
 // int PinWidget::getMaxY() {




More information about the umbrello-devel mailing list