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

Thomas Gallinari tg8187 at yahoo.fr
Sun Feb 11 14:26:36 UTC 2007


SVN commit 632515 by gallinari:

addition of a movable dash line for parallel and alternative combined fragments


 M  +1 -0      CMakeLists.txt  
 M  +46 -0     combinedfragmentwidget.cpp  
 M  +9 -1      combinedfragmentwidget.h  
 M  +2 -2      dialog_utils.cpp  
 M  +1 -0      umlnamespace.h  


--- branches/work/isi-umbrello/umbrello/umbrello/CMakeLists.txt #632514:632515
@@ -278,6 +278,7 @@
    enum.cpp 
    enumliteral.cpp 
    enumwidget.cpp 
+   floatingdashlinewidget.cpp
    floatingtextwidget.cpp 
    floatingtextwidgetcontroller.cpp
    folder.cpp
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.cpp #632514:632515
@@ -47,6 +47,7 @@
     int w = width();
     int h = height();
     int line_width = 45;
+    int old_Y;
 
     UMLWidget::setPen(p);
 
@@ -110,7 +111,32 @@
 			w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "assert");
         break;
 
+        case Alt :
+                p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY ,
+			w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "alt");
+                // dash line
+                m_dashLine->setX(getX());
+                old_Y = m_dashLine->getYMin();
+                m_dashLine->setYMin(getY());
+                m_dashLine->setYMax(getY() + getHeight());
+                m_dashLine->setY(getY() + m_dashLine->getY() - old_Y);
+                m_dashLine->setSize(w, 0);
+                
+        break;
 
+        case Par :
+                p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY ,
+			w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "parallel");
+                // dash line
+                m_dashLine->setX(getX());
+                old_Y = m_dashLine->getYMin();
+                m_dashLine->setYMin(getY());
+                m_dashLine->setYMax(getY() + getHeight());
+                m_dashLine->setY(getY() + m_dashLine->getY() - old_Y);
+                m_dashLine->setSize(w, 0);
+                
+        break;
+
 	default : break;
     }
 }
@@ -146,6 +172,22 @@
 
     m_CombinedFragment = combinedfragmentType;
     UMLWidget::m_bResizable =  true ; //(m_CombinedFragment == Normal);
+
+    // creates a dash line if the combined fragment type is alternative or parallel
+    if(m_CombinedFragment == Alt || m_CombinedFragment == Par)
+    {
+        m_dashLine = new FloatingDashLineWidget(m_pView);
+        if(m_CombinedFragment == Alt)
+        {
+            m_dashLine->setText("else");
+        }
+        m_dashLine->setX(getX());
+        m_dashLine->setYMin(getY());
+        m_dashLine->setYMax(getY() + getHeight());
+        m_dashLine->setY(getY() + getHeight() / 2);
+        m_dashLine->setSize(getWidth(), 0);
+        m_pView->setupNewWidget(m_dashLine);
+    }
 }
 
 CombinedFragmentWidget::CombinedFragmentType CombinedFragmentWidget::getCombinedFragmentType(QString type) const {
@@ -163,6 +205,10 @@
         return (CombinedFragmentWidget::Crit);
     if(type == "Assertion")
         return (CombinedFragmentWidget::Ass);
+    if(type == "Alternative")
+        return (CombinedFragmentWidget::Alt);
+    if(type == "Parallel")
+        return (CombinedFragmentWidget::Par);
 
 }
 
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.h #632514:632515
@@ -14,6 +14,7 @@
 
 #include "umlwidget.h"
 #include "worktoolbar.h"
+#include "floatingdashlinewidget.h"
 
 #define COMBINED_FRAGMENT_MARGIN 5
 #define COMBINED_FRAGMENT_WIDTH 100
@@ -43,7 +44,9 @@
         Loop,
         Neg,
         Crit,
-        Ass
+        Ass,
+        Alt,
+        Par
     };
 
     /**
@@ -117,6 +120,11 @@
      */
     CombinedFragmentType m_CombinedFragment;
 
+private:
+    /**
+     * Dash line of an alternative or parallel combined fragment
+     */
+    FloatingDashLineWidget *m_dashLine ;
 };
 
 #endif
--- branches/work/isi-umbrello/umbrello/umbrello/dialog_utils.cpp #632514:632515
@@ -62,8 +62,8 @@
                       const QString& dialogPrompt, const QString& defaultName) {
 
     bool pressedOK = false;
-    const QStringList list = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion";
-    const QStringList select = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion";;
+    const QStringList list = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
+    const QStringList select = QStringList() << "Reference" << "Option" << "Break" << "Loop" << "Negative" << "Critical" << "Assertion" << "Alternative" << "Parallel" ;
     QStringList result = KInputDialog::getItemList (dialogTitle, dialogPrompt, list, select, false, &pressedOK, UMLApp::app());
 
     if (pressedOK) {
--- branches/work/isi-umbrello/umbrello/umbrello/umlnamespace.h #632514:632515
@@ -107,6 +107,7 @@
     wt_ForkJoin,                // does not have UMLObject representation
     wt_Precondition,		// does not have UMLObject representation
     wt_CombinedFragment,	// does not have UMLObject representation
+    wt_FloatingDashLine,        // does not have UMLObject representation
     wt_Signal,	                // does not have UMLObject representation
     wt_EndOfLife		
 };




More information about the umbrello-devel mailing list