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

Florence Mattler florence.mattler at libertysurf.fr
Tue Feb 6 17:08:41 UTC 2007


SVN commit 630883 by mattler:

Correct a bug to allow the user drawing several preconditions in sequence diagram.
Test if there isn't an end of life widget yet on the selected object in sequence 
diagram.


 M  +3 -1      endoflifewidget.h  
 M  +0 -4      toolbarstateother.cpp  
 M  +28 -5     toolbarstatesequence.cpp  
 M  +1 -1      toolbarstatesequence.h  


--- branches/work/isi-umbrello/umbrello/umbrello/endoflifewidget.h #630882:630883
@@ -108,6 +108,8 @@
      */
     bool loadFromXMI( QDomElement & qElement );
 
+	ObjectWidget * m_pOw[1];
+
 protected:
     /**
      * Overrides method from UMLWidget
@@ -124,7 +126,7 @@
     void slotWidgetMoved(Uml::IDType id);
 
 private:
-    ObjectWidget * m_pOw[1];
+    
     int m_nY;
 };
 
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstateother.cpp #630882:630883
@@ -149,10 +149,6 @@
         Dialog_Utils::askNameForWidget(
             umlWidget, i18n("Enter Activity Name"),
             i18n("Enter the name of the new activity:"), i18n("new activity"));
-    } else if (getButton() == WorkToolBar::tbb_Seq_Precondition) {
-        Dialog_Utils::askNameForWidget(
-            umlWidget, i18n("Enter Precondition Name"),
-            i18n("Enter the precondition"), i18n("new precondition"));
     } else if (getButton() == WorkToolBar::tbb_Seq_Combined_Fragment) {
         Dialog_Utils::askNameForWidgetType(
             umlWidget, i18n("Enter Combined Fragment Name"),
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstatesequence.cpp #630882:630883
@@ -29,7 +29,11 @@
 #include <klocale.h>
 #include <kmessagebox.h>
 
+
+using namespace Uml;
+
 ToolBarStateSequence::ToolBarStateSequence(UMLView *umlView) : ToolBarStatePool(umlView) {
+    m_umlView = umlView;
     m_firstObject = 0;
 }
 
@@ -54,12 +58,11 @@
 
 void ToolBarStateSequence::setCurrentElement() {
     m_isObjectWidgetLine = false;
-
     ObjectWidget* objectWidgetLine = m_pUMLView->onWidgetLine(m_pMouseEvent->pos());
     if (objectWidgetLine) {
         setCurrentWidget(objectWidgetLine);
         m_isObjectWidgetLine = true;
-        return;
+	return;
     }
 
     UMLWidget *widget = m_pUMLView->testOnWidget(m_pMouseEvent->pos());
@@ -70,19 +73,38 @@
 }
 
 void ToolBarStateSequence::mouseReleaseWidget() {
-    
+    Uml::Widget_Type widgetType = getWidgetType();
+    UMLWidget * widget = 0;
+
+    if (widgetType == Uml::wt_Precondition) {
+	m_firstObject = 0;
+    }
+    else if (widgetType == Uml::wt_EndOfLife) {
+	//test if there isn't an endoflife widget on the selected widget yet
+	UMLWidgetListIt w_it(m_umlView->getWidgetList());
+	while( ( widget = w_it.current() ) ) {
+            ++w_it;
+            if (widget->getBaseType() == Uml::wt_EndOfLife) {
+		if (dynamic_cast<EndOfLifeWidget*>(widget)->m_pOw[Uml::A]->getID() == getCurrentWidget()->getID())
+		    return;
+		else
+		     m_firstObject = 0;
+	    }
+	}
+    }
     if (m_pMouseEvent->button() != Qt::LeftButton ||
                 getCurrentWidget()->getBaseType() != Uml::wt_Object) {
         return;
     }
-    
+
     if (!m_isObjectWidgetLine && !m_firstObject) {
-        return;
+	return;
     }
 
     if (!m_firstObject) {
         setWidget(static_cast<ObjectWidget*>(getCurrentWidget()));
     } 
+
 }
 
 void ToolBarStateSequence::mouseReleaseEmpty() {
@@ -112,6 +134,7 @@
     if (umlwidget != NULL) {
             m_pUMLView->setupNewWidget(umlwidget);
     }
+
 }
 
 
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstatesequence.h #630882:630883
@@ -127,7 +127,7 @@
      */
     ObjectWidget* m_firstObject;
 
-
+    UMLView * m_umlView;
     /**
      * If there is a current widget, it is true if the press event happened on
      * the line of an object, or false if it happened on a normal UMLWidget.




More information about the umbrello-devel mailing list