[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Mar 10 10:46:03 UTC 2005


CVS commit by okellogg: 

Patch by Matthias Kretz fixes top/bottom relationship association attachments.
CCMAIL:kretz at kde.org


  M +5 -1      associationwidget.cpp   1.141
  M +19 -8     linepath.cpp   1.39
  M +17 -0     linepath.h   1.20


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.140:1.141
@@ -2584,6 +2584,10 @@ void AssociationWidget::updateRegionLine
         if (role == A)
                 m_LinePath.setPoint( 0, pt );
-        else
+        else {
                 m_LinePath.setPoint( m_LinePath.count() - 1, pt );
+                LinePath::Region r = ( region == South || region == North ) ?
+                        LinePath::TopBottom : LinePath::LeftRight;
+                m_LinePath.setDockRegion( r );
+        }
 }
 

--- kdesdk/umbrello/umbrello/linepath.cpp  #1.38:1.39
@@ -577,12 +577,19 @@ void LinePath::updateHead() {
                                 return;
                         }
-                        //FIXME fix for when association is on top/bottom of widget
+                        {
+                                int xoffset = 0;
+                                int yoffset = 0;
+                                if( m_DockRegion == TopBottom )
+                                        xoffset = 8;
+                                else
+                                        yoffset = 8;
                         line = m_HeadList.at( 0 );
                         line->setPoints( m_PointArray[2].x(), m_PointArray[2].y(),
-                                         m_PointArray[0].x(), m_PointArray[0].y()-8 );
+                                                 m_PointArray[0].x()-xoffset, m_PointArray[0].y()-yoffset );
 
                         line = m_HeadList.at( 1 );
                         line->setPoints( m_PointArray[2].x(), m_PointArray[2].y(),
-                                         m_PointArray[0].x(), m_PointArray[0].y()+8 );
+                                                 m_PointArray[0].x()+xoffset, m_PointArray[0].y()+yoffset );
+                        }
 
                 case Uml::at_Generalization:
@@ -853,4 +860,8 @@ void LinePath::cleanup() {
 }
 
+void LinePath::setDockRegion( Region region ) {
+        m_DockRegion = region;
+}
+
 bool LinePath::hasPoints () {
         int count = m_LineList.count();

--- kdesdk/umbrello/umbrello/linepath.h  #1.19:1.20
@@ -69,4 +69,16 @@ public:
         LinePath & operator=( LinePath & rhs );
 
+        /**
+        *   Enum to tell whether the line docks top/bottom or left/right
+        */
+        enum Region {
+                TopBottom, LeftRight
+        };
+
+        /**
+        *   Tell the line where the line docks
+        */
+        void setDockRegion( Region region );
+
         bool hasPoints ();
         void dumpPoints ();
@@ -337,4 +349,9 @@ protected:
         QPointArray m_ParallelLines;
 
+        /**
+        *   Region where the line docks
+        */
+        Region m_DockRegion;
+
         bool m_bHeadCreated;
 






More information about the umbrello-devel mailing list