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

Caroline Bourdeu d'Aguerre cbda at free.fr
Thu Mar 22 10:46:15 UTC 2007


SVN commit 645323 by bourdeu:

modify the prototype of ShowProperties. Add the text for the alternative combined fragment


 M  +32 -16    combinedfragmentwidget.cpp  
 M  +0 -6      combinedfragmentwidget.h  
 M  +1 -4      objectnodewidget.cpp  
 M  +1 -2      objectnodewidget.h  
 M  +0 -4      regionwidget.cpp  
 M  +0 -6      regionwidget.h  
 M  +1 -14     signalwidget.cpp  
 M  +1 -2      signalwidget.h  
 M  +1 -1      umlwidget.cpp  
 M  +1 -1      umlwidget.h  


--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.cpp #645322:645323
@@ -116,9 +116,17 @@
         break;
 
         case Alt :
+                if (combined_fragment_value != "-")
+                {
+                     temp = "[" + combined_fragment_value + "]";
+			p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY + 20,w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, temp);
+                }
                 p.drawText(offsetX + COMBINED_FRAGMENT_MARGIN, offsetY ,
 			w - COMBINED_FRAGMENT_MARGIN * 2, fontHeight, Qt::AlignLeft, "alt");
                 // dash lines
+		if (m_dashLines.size() == 1) {
+			m_dashLines.first()->setY(getY() + h/2); 
+		}
                 m_dashLines.first()->draw(p,getX(),getY());
                 for(QList<FloatingDashLineWidget*>::iterator it=m_dashLines.begin() ; it!=m_dashLines.end() ; ++it) {
                     (*it)->setX(getX());
@@ -167,6 +175,8 @@
     width = textWidth + 60 > COMBINED_FRAGMENT_WIDTH ? textWidth + 60: COMBINED_FRAGMENT_WIDTH;
     if ( m_CombinedFragment == Loop )
          width += textWidth * 0.4;
+    if ( m_CombinedFragment == Alt )
+         height += fontHeight + 40;
     height = height > COMBINED_FRAGMENT_HEIGHT ? height : COMBINED_FRAGMENT_HEIGHT;
     width += COMBINED_FRAGMENT_MARGIN * 2;
     height += COMBINED_FRAGMENT_MARGIN * 2;
@@ -181,7 +191,6 @@
 
     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_dashLines.isEmpty())
     {
@@ -226,21 +235,6 @@
     setCombinedFragmentType(getCombinedFragmentType(combinedfragmentType) );
 }
 
-bool CombinedFragmentWidget::showProperties() {
-//     DocWindow *docwindow = UMLApp::app()->getDocWindow();
-//     docwindow->updateDocumentation(false);
-// 
-//     ActivityDialog dialog(m_pView, this);
-//     bool modified = false;
-//     if (dialog.exec() && dialog.getChangesMade()) {
-//         docwindow->showDocumentation(this, true);
-//         UMLApp::app()->getDocument()->setModified(true);
-//         modified = true;
-//     }
-
-    return true;
-}
-
 void CombinedFragmentWidget::askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
                       const QString& dialogPrompt, const QString& defaultName) {
 
@@ -256,6 +250,8 @@
             Dialog_Utils::askNameForWidget(targetWidget, i18n("Enter the name of the diagram referenced"), i18n("Enter the name of the diagram referenced"), i18n("Diagram name"));
         if (type == "Loop")
             Dialog_Utils::askNameForWidget(targetWidget, i18n("Enter the guard of the loop"), i18n("Enter the guard of the loop"), i18n("-"));
+        if (type == "Alternative")
+            Dialog_Utils::askNameForWidget(targetWidget, i18n("Enter the first alternative name"), i18n("Enter the first alternative name"), i18n("-"));
     } else {
         targetWidget->cleanup();
         delete targetWidget;
@@ -318,6 +314,9 @@
 
 void CombinedFragmentWidget::slotMenuSelection(int sel) {
     UMLWidget::slotMenuSelection(sel);
+    bool ok = false;
+    bool done = false;
+    QString name = m_Text;
     switch (sel) {
         // for alternative or parallel combined fragments
         case ListPopupMenu::mt_AddInteractionOperand:
@@ -332,10 +331,27 @@
             m_dashLines.back()->setY(getY() + getHeight() / 2);
             m_dashLines.back()->setSize(getWidth(), 0);
             m_pView->setupNewWidget(m_dashLines.back());
+        done = true;
             break;
+	case ListPopupMenu::mt_Rename:
+	    if (m_CombinedFragment == Alt) {
+        	name = KInputDialog::getText( i18n("Enter first alternative"), i18n("Enter first alternative :"), m_Text, &ok );
+	    }
+	    else if (m_CombinedFragment == Ref) {
+		name = KInputDialog::getText( i18n("Enter referenced diagram name"), i18n("Enter referenced diagram name :"), m_Text, &ok );
+	    }
+	    else if (m_CombinedFragment == Loop) {
+		name = KInputDialog::getText( i18n("Enter the guard of the loop"), i18n("Enter the guard of the loop:"), m_Text, &ok );
+	    }
+            if( ok && name.length() > 0 )
+                m_Text = name;
+        	done = true;
+            break;
         default:
             break;
     }
+   if( !done )
+        UMLWidget::slotMenuSelection( sel );
 }
 
 
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.h #645322:645323
@@ -81,12 +81,6 @@
      */
     void setCombinedFragmentType( CombinedFragmentType combinedfragmentType );
     void setCombinedFragmentType( QString combinedfragmentType );
-    /**
-     * Show a properties dialog for a CombinedFragmentWidget.
-     *
-     * @return  True if we modified the Combined Fragment.
-     */
-    bool showProperties();
 
     void askNameForWidgetType(UMLWidget* &targetWidget, const QString& dialogTitle,
                       const QString& dialogPrompt, const QString& defaultName);
--- branches/work/isi-umbrello/umbrello/umbrello/objectnodewidget.cpp #645322:645323
@@ -209,19 +209,16 @@
         UMLWidget::slotMenuSelection( sel );
 }
 
-bool ObjectNodeWidget::showProperties() {
+void ObjectNodeWidget::showProperties() {
     DocWindow *docwindow = UMLApp::app()->getDocWindow();
     docwindow->updateDocumentation(false);
 
     ObjectNodeDialog dialog(m_pView, this);
-    bool modified = false;
     if (dialog.exec() && dialog.getChangesMade()) {
         docwindow->showDocumentation(this, true);
         UMLApp::app()->getDocument()->setModified(true);
-        modified = true;
     }
 
-    return modified;
 }
 
 
--- branches/work/isi-umbrello/umbrello/umbrello/objectnodewidget.h #645322:645323
@@ -88,9 +88,8 @@
     /**
      * Show a properties dialog for an ObjectNodeWidget.
      *
-     * @return  True if we modified the object node.
      */
-    bool showProperties();
+    virtual void showProperties();
 
 
     /**
--- branches/work/isi-umbrello/umbrello/umbrello/regionwidget.cpp #645322:645323
@@ -82,10 +82,6 @@
     return m_Text;
 }
 
-bool RegionWidget::showProperties() 
-{
-    return true;
-}
 
 void RegionWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
     QDomElement regionElement = qDoc.createElement( "regionwidget" );
--- branches/work/isi-umbrello/umbrello/umbrello/regionwidget.h #645322:645323
@@ -54,12 +54,6 @@
      */
     virtual QString getName() const;
 
-    /**
-     * Show a properties dialog for a Region.
-     *
-     * @return  True if we modified the REGION.
-     */
-    bool showProperties();
 
     /**
      * Creates the <REGIONwidget> XMI element.
--- branches/work/isi-umbrello/umbrello/umbrello/signalwidget.cpp #645322:645323
@@ -215,20 +215,7 @@
 }
 
 
-bool SignalWidget::showProperties() {
-//     DocWindow *docwindow = UMLApp::app()->getDocWindow();
-//     docwindow->updateDocumentation(false);
-//
-//     SignalDialog dialog(m_pView, this);
-//     bool modified = false;
-//     if (dialog.exec() && dialog.getChangesMade()) {
-//         docwindow->showDocumentation(this, true);
-//         UMLApp::app()->getDocument()->setModified(true);
-//         modified = true;
-//     }
-//
-    return true;
-}
+void SignalWidget::showProperties() {}
 
 void SignalWidget::mouseMoveEvent(QMouseEvent* me) {
     UMLWidget::mouseMoveEvent(me);
--- branches/work/isi-umbrello/umbrello/umbrello/signalwidget.h #645322:645323
@@ -84,9 +84,8 @@
     /**
      * Show a properties dialog for a SignalWidget.
      *
-     * @return  True if we modified the signal.
      */
-    bool showProperties();
+    virtual void  showProperties();
 
 
     /**
--- branches/work/isi-umbrello/umbrello/umbrello/umlwidget.cpp #645322:645323
@@ -626,7 +626,7 @@
     }
 }
 
-bool UMLWidget::showProperties() {
+void UMLWidget::showProperties() {
     // will already be selected so make sure docWindow updates the doc
     // back it the widget
     DocWindow *docwindow = UMLApp::app()->getDocWindow();
--- branches/work/isi-umbrello/umbrello/umbrello/umlwidget.h #645322:645323
@@ -447,7 +447,7 @@
      *
      * @return  True if the widget was modified.
      */
-    bool showProperties();
+    virtual void showProperties();
 
     /**
      * Returns true if the Activate method has been called for this instance




More information about the umbrello-devel mailing list