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

Pierre Pettera ppmakusu at gmail.com
Fri Feb 16 03:09:46 UTC 2007


SVN commit 634026 by pettera:

Undo / Redo commit:

- Bug correction on Rename
- Fixing problems with ChangeFillcolor & ChangeLineColor
- Undo properties activate
- Fixing problems with change text on floatingText

 M  +3 -3      associationwidget.cpp  
 M  +1 -1      cmd_id.h  
 M  +2 -2      cmds/cmd_handle_rename.cpp  
 M  +2 -2      cmds/generic/cmd_rename_umlobject.cpp  
 M  +5 -17     cmds/widget/cmd_changeFillColor.cpp  
 M  +2 -7      cmds/widget/cmd_changeFillColor.h  
 M  +11 -13    cmds/widget/cmd_changeLineColor.cpp  
 M  +4 -7      cmds/widget/cmd_changeLineColor.h  
 M  +6 -0      cmds/widget/cmd_set_txt.cpp  
 M  +3 -3      dialogs/classpropdlg.cpp  
 M  +11 -2     floatingtextwidget.cpp  
 M  +5 -0      floatingtextwidget.h  
 M  +1 -2      umlobject.cpp  
 M  +6 -1      umlview.cpp  
 M  +20 -6     umlwidget.cpp  
 M  +11 -0     umlwidget.h  


--- branches/work/isi-umbrello/umbrello/umbrello/associationwidget.cpp #634025:634026
@@ -330,7 +330,7 @@
         if (m_role[B].m_pWidget)
             m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());
     } else {
-        m_pName->setTextcmd(strName);
+        m_pName->setText(strName);
         if (strName.isEmpty()) {
             m_pName->hide();
             m_pName = NULL;
@@ -2530,11 +2530,11 @@
     case ListPopupMenu::mt_Line_Color:
     case ListPopupMenu::mt_Line_Color_Selection:
         {
-            QColor newColour;
+       /*     QColor newColour;
             if( KColorDialog::getColor(newColour) ) {
                 m_pView->selectionSetLineColor(newColour);
                 m_umldoc->setModified(true);
-            }
+            }*/
         }
         break;
 
--- branches/work/isi-umbrello/umbrello/umbrello/cmd_id.h #634025:634026
@@ -21,4 +21,4 @@
 
 };
 
-#endif // __CMD_ID__
\ No newline at end of file
+#endif // __CMD_ID__
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_handle_rename.cpp #634025:634026
@@ -45,12 +45,12 @@
 	
 	void cmdHandleRename::redo()
 	{
-		//ftw->changeName(newstring);
+		ftw->changeName(newstring);
 	}
 	
 	void cmdHandleRename::undo()
 	{	
-		//ftw->changeName(oldstring);
+		ftw->changeName(oldstring);
 	}
 
 }
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/generic/cmd_rename_umlobject.cpp #634025:634026
@@ -31,12 +31,12 @@
 	
 	void cmdRenameUMLObject::redo()
 	{
-		m_obj->setName(m_name);
+		m_obj->setNamecmd(m_name);
 	}
 	
 	void cmdRenameUMLObject::undo()
 	{
-		m_obj->setName(m_oldname);
+		m_obj->setNamecmd(m_oldname);
 	}
 
 }
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_changeFillColor.cpp #634025:634026
@@ -1,4 +1,3 @@
-
 /***************************************************************************
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -34,19 +33,10 @@
 
 namespace Uml
 {
-	cmdChangeFillColor::cmdChangeFillColor(	/* obj1: m_pDoc   */	UMLDoc *doc
-											/* obj2: m_pView  */	, UMLView *view
-											/* obj3: newColor */	, QColor col):already(false)
+	cmdChangeFillColor::cmdChangeFillColor(UMLWidget *w, QColor col):UMLw(w),color(col)
 	{
-		UMLWidget * widget = view->getFirstMultiSelectedWidget();
-		pDoc=doc;
-		pView=view;
-		//oldColor=pView->getFillColour();
-		color = col;
-		oldColor= widget -> getFillColor() ;
-		//widget -> setFillColour(color);
-		//pView -> selectionSetFillColor( col );
-		pDoc -> setModified(true);
+		setText(i18n("Change Fill Color"));
+		oldColor= w -> getFillColor() ;
 	}
 
 	cmdChangeFillColor::~cmdChangeFillColor()
@@ -55,14 +45,12 @@
 	}
 	void cmdChangeFillColor::redo()
 	{
-			pView -> selectionSetFillColor( color );
-        	pDoc -> setModified(true);
+		UMLw -> setFillColourcmd( color );
 	}
 	
 	void cmdChangeFillColor::undo()
 	{	
 		
-		pView -> selectionSetFillColor( oldColor );
-        pDoc -> setModified(true);
+		UMLw -> setFillColourcmd( oldColor );
 	}
 }
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_changeFillColor.h #634025:634026
@@ -25,8 +25,7 @@
 	{
 		
 		
-		UMLDoc *pDoc;
-		UMLView *pView;
+		UMLWidget *UMLw;
 				
 		/* ancienne couleur */
 		QColor oldColor;
@@ -34,12 +33,8 @@
 		/* nouvelle couleur */
 		QColor color;
 				
-		bool		already;
-				
 		public:
-			cmdChangeFillColor(/* obj1: m_pDoc   */UMLDoc *doc
-							/* obj2: m_pView  */, UMLView *view
-							/* obj3: newColor */, QColor col);
+			cmdChangeFillColor(UMLWidget *w, QColor col);
 			~cmdChangeFillColor();
 			void redo();
 			void undo();
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_changeLineColor.cpp #634025:634026
@@ -35,34 +35,32 @@
 namespace Uml
 {
 
-	cmdChangeLineColor::cmdChangeLineColor(/* obj1: m_pDoc   */UMLDoc *doc
-							/* obj2: m_pView  */				, UMLView *view
-							/* obj3: newColor */				, QColor col)
+	/*cmdChangeLineColor::cmdChangeLineColor(UMLView *view, QColor col)
 	{
+		setText(i18n("Change Line Color"));
 		UMLWidget * widget = view->getFirstMultiSelectedWidget();
-		pDoc=doc;
 		pView=view;
 		color = col;
 		oldColor=widget -> getLineColor() ;
-		//view -> selectionSetLineColor( col );
-     //   doc -> setModified(true);
-	}
+	}*/
 
+cmdChangeLineColor::cmdChangeLineColor(UMLWidget *w, QColor col):UMLw(w),color(col)
+{	
+	setText(i18n("Change Line Color"));
+	oldColor= w -> getLineColor() ;
+
+}
 	cmdChangeLineColor::~cmdChangeLineColor()
 	{
 	}
 	void cmdChangeLineColor::redo()
 	{
 
-			pView -> selectionSetLineColor( color );
-        	pDoc -> setModified(true);
-
+		UMLw -> setLineColorcmd( color );
 	}
 	
 	void cmdChangeLineColor::undo()
 	{	
-		pView -> selectionSetLineColor( oldColor );
-        pDoc -> setModified(true);
-
+		UMLw -> setLineColorcmd( oldColor );
 	}
 }
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_changeLineColor.h #634025:634026
@@ -22,25 +22,22 @@
 	class cmdChangeLineColor : public QUndoCommand
 	{
 	public:
-		cmdChangeLineColor(/* obj1: m_pDoc   */UMLDoc *doc
-							/* obj2: m_pView  */, UMLView *view
-							/* obj3: newColor */, QColor col);
+		//cmdChangeLineColor(UMLView *view, QColor col);
+		cmdChangeLineColor(UMLWidget *w, QColor col);
 		~cmdChangeLineColor();
 		void redo();
 		void undo();
 	
 			private:
 				
-				UMLDoc *pDoc;
-				UMLView *pView;
+				UMLWidget *UMLw;
+				//MLView *pView;
 				
 				/* ancienne couleur */
 				QColor oldColor;
 				
 				/* nouvelle couleur */
 				QColor color;
-				
-				bool		already;
 	};
 };
 #endif /*CMD_CHANGELINECOLOR_H_*/
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_set_txt.cpp #634025:634026
@@ -34,7 +34,9 @@
 
 	cmdSetTxt::cmdSetTxt(FloatingTextWidget* _ftw, QString txt):ftw(_ftw),newstring(txt)
 	{	
+
 		oldstring = _ftw->getText();
+kDebug() << "la valeur de l'oldstring est: "<< oldstring << ", la valeur de la newstring est: "<< newstring <<endl;
 	}
 	
 	cmdSetTxt::~cmdSetTxt()
@@ -44,12 +46,16 @@
 	
 	void cmdSetTxt::redo()
 	{
+
 		ftw->setTextcmd(newstring);
+kDebug() << "string apres redo " << ftw->getText()<< ", la valeur de l'oldstring est: "<< oldstring << ", la valeur de la newstring est: "<< newstring <<endl;
 	}
 	
 	void cmdSetTxt::undo()
 	{	
+		ftw->setName("balbalbalbalbla");
 		ftw->setTextcmd(oldstring);
+kDebug() << "string apres undo: " << ftw->getText()<< "la valeur de l'oldstring est: "<< oldstring << "la valeur de la newstring est: "<< newstring <<endl;
 	}
 
 }
--- branches/work/isi-umbrello/umbrello/umbrello/dialogs/classpropdlg.cpp #634025:634026
@@ -209,7 +209,7 @@
         m_pColorPage->updateUMLWidget();
     }
     if (m_pWidget) {
-        m_pWidget->setFont( m_pChooser->font() );
+     //   m_pWidget->setFont( m_pChooser->font() );
     }
 }
 
@@ -332,8 +332,8 @@
     pageItem->setHeader( i18n("Font Settings") );
     pageItem->setIcon( KIcon(DesktopIcon("fonts") ));
     addPage( pageItem);
-    m_pChooser = new KFontChooser( (QWidget*)page, false, QStringList(), false);
-    m_pChooser -> setFont( m_pWidget -> getFont() );
+//    m_pChooser = new KFontChooser( (QWidget*)page, false, QStringList(), false);
+   // m_pChooser -> setFont( m_pWidget -> getFont() );
 }
 
 
--- branches/work/isi-umbrello/umbrello/umbrello/floatingtextwidget.cpp #634025:634026
@@ -184,6 +184,13 @@
                                             m_pView, &v);
     if (!ok || newText == getText())
         return;
+
+    UMLApp::app()->executeCommand(new cmdHandleRename(this,newText));
+}
+
+void FloatingTextWidget::changeName(QString newText)
+{
+
     if (m_pLink && !isTextValid(newText)) {
         AssociationWidget *assoc = dynamic_cast<AssociationWidget*>(m_pLink);
         if (assoc) {
@@ -228,13 +235,15 @@
     setVisible( true );
     updateComponentSize();
     update();
+
 }
 
-void FloatingTextWidget::setText(const QString &t) {
+
+void FloatingTextWidget::setTextcmd(const QString &t) {
       UMLApp::app()->executeCommand(new cmdSetTxt(this,t));
 }
 
-void FloatingTextWidget::setTextcmd(const QString &t) {
+void FloatingTextWidget::setText(const QString &t) {
     if (m_Role == Uml::tr_Seq_Message || m_Role == Uml::tr_Seq_Message_Self) {
         QString seqNum, op;
         m_pLink->getSeqNumAndOp(seqNum, op);
--- branches/work/isi-umbrello/umbrello/umbrello/floatingtextwidget.h #634025:634026
@@ -224,6 +224,11 @@
     void handleRename();
 
     /**
+     * Change Name
+     */
+    void changeName(QString newText);
+
+    /**
      * Shows an operation dialog box.
      */
     void showOpDlg();
--- branches/work/isi-umbrello/umbrello/umbrello/umlobject.cpp #634025:634026
@@ -102,8 +102,7 @@
 }
 
 void UMLObject::setName(const QString &strName) {
-    m_Name = strName;
-    emit modified();
+	UMLApp::app()->executeCommand(new Uml::cmdRenameUMLObject(this,strName));
 }
 
 void UMLObject::setNamecmd(const QString &strName) {
--- branches/work/isi-umbrello/umbrello/umbrello/umlview.cpp #634025:634026
@@ -303,7 +303,7 @@
             QColor textColor(50, 50, 50);
             pPainter.setPen(textColor);
             pPainter.drawLine(0, height + 2, width, height + 2);
-            pPainter.drawText(0, height + 4, width, fontHeight, Qt::AlignLeft, string);
+            pPainter.drawTex t(0, height + 4, width, fontHeight, Qt::AlignLeft, string);
 
             if(pageX+1 < numPagesX || pageY+1 < numPagesY) {
                 pPrinter -> newPage();
@@ -993,6 +993,7 @@
 
 void UMLView::selectionSetLineColor( const QColor &color )
 {
+    UMLApp::app()->BeginMacro("Change Line Color");
     UMLWidget * temp = 0;
     for (temp = m_SelectedList.first(); temp; temp = m_SelectedList.next()) {
         temp->setLineColor(color);
@@ -1003,6 +1004,7 @@
         aw->setLineColor(color);
         aw->setUsesDiagramLineColour(false);
     }
+    UMLApp::app()->EndMacro();
 }
 
 void UMLView::selectionSetLineWidth( uint width )
@@ -1019,8 +1021,10 @@
     }
 }
 
+
 void UMLView::selectionSetFillColor( const QColor &color )
 {
+    UMLApp::app()->BeginMacro("Change Fill Color");
     UMLWidget * temp = 0;
     for(temp=(UMLWidget *) m_SelectedList.first();
             temp;
@@ -1028,6 +1032,7 @@
         temp -> setFillColour( color );
         temp -> setUsesDiagramFillColour(false);
     }
+    UMLApp::app()->EndMacro();
 }
 
 void UMLView::selectionToggleShow(int sel)
--- branches/work/isi-umbrello/umbrello/umbrello/umlwidget.cpp #634025:634026
@@ -288,9 +288,13 @@
                 wt == wt_Component || wt == wt_Artifact ||
                 wt == wt_Node || wt == wt_Enum || wt == wt_Entity ||
                 (wt == wt_Class && m_pView -> getType() == dt_Class)) {
-            showProperties();
+ 		UMLApp::app()->BeginMacro("Change Properties");
+           	 showProperties();
+		UMLApp::app()->EndMacro();
         } else if (wt == wt_Object) {
-            m_pObject->showProperties();
+ 		UMLApp::app()->BeginMacro("Change Properties");
+            	m_pObject->showProperties();
+		UMLApp::app()->EndMacro();
         } else {
             kWarning() << "making properties dialog for unknown widget type" << endl;
         }
@@ -302,8 +306,9 @@
         widget = m_pView->getFirstMultiSelectedWidget();
         if (widget) { newColour = widget->getLineColor(); }
         if( KColorDialog::getColor(newColour) ) {
-				UMLApp::app()->executeCommand(new cmdChangeLineColor(m_pDoc,m_pView,newColour));
-            
+            m_pView -> selectionSetLineColor( newColour );
+            m_pDoc -> setModified(true);
+
         }
         break;
 
@@ -312,7 +317,8 @@
         widget = m_pView->getFirstMultiSelectedWidget();
         if (widget) { newColour = widget->getFillColour(); }
         if ( KColorDialog::getColor(newColour) ) {
-				UMLApp::app()->executeCommand(new cmdChangeFillColor(m_pDoc,m_pView,newColour));
+            m_pView -> selectionSetFillColor( newColour );
+            m_pDoc -> setModified(true);
         }
         break;
 
@@ -445,11 +451,15 @@
     update();
 }
 
-void UMLWidget::setLineColor(const QColor &colour) {
+void UMLWidget::setLineColorcmd(const QColor &colour) {
     WidgetBase::setLineColor(colour);
     update();
 }
 
+void UMLWidget::setLineColor(const QColor &colour) {
+	UMLApp::app()->executeCommand(new cmdChangeLineColor(this,colour));
+}
+
 QColor UMLWidget::getLineColor() {
 	return  m_LineColour;
 }
@@ -460,6 +470,10 @@
 }
 
 void UMLWidget::setFillColour(const QColor &colour) {
+	UMLApp::app()->executeCommand(new cmdChangeFillColor(this,colour));
+}
+
+void UMLWidget::setFillColourcmd(const QColor &colour) {
     m_FillColour = colour;
     m_bUsesDiagramFillColour = false;
     update();
--- branches/work/isi-umbrello/umbrello/umbrello/umlwidget.h #634025:634026
@@ -131,6 +131,10 @@
     void setLineColor(const QColor &colour);
 
     /**
+     * Overrides the method from WidgetBase.
+     */
+    void setLineColorcmd(const QColor &colour);
+    /**
      * get line color attribute.
      */
 	QColor getLineColor() ;
@@ -148,6 +152,13 @@
     void setFillColour(const QColor &colour);
 
     /**
+     * Sets the background fill colour
+     *
+     * @param colour the new fill colour
+     */
+    void setFillColourcmd(const QColor &colour);
+
+    /**
      * get fill color attribute.
      */
 	QColor getFillColor();




More information about the umbrello-devel mailing list