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

Thibault Normand thibault.normand at gmail.com
Wed Dec 13 16:27:38 UTC 2006


SVN commit 613253 by tnormand:

+ cmd_create_activitydiag
+ cmd_create_collaborationdiag
+ cmd_create_componentdiag
+ cmd_create_deploydiag
+ cmd_create_entityrelationdiag
+ cmd_create_seqdiag
+ cmd_create_statediag
+ cmd_create_usecasediag

# Setup the CMakeLists.txt to compile the new cmds
# Moving cmd_create_class in a folder representing the object affected by the action
# [umldoc|umllistview] createDiagram, in order to return the newly created view.

 M  +3 -0      ChangeLog  
 M  +17 -0     umbrello/CMakeLists.txt  
 A             umbrello/cmds/classdiag (directory)  
 AM            umbrello/cmds/classdiag/cmd_create_class.cpp   [License: no copyright]
 AM            umbrello/cmds/classdiag/cmd_create_class.h  
 AM            umbrello/cmds/cmd_create_activitydiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_activitydiag.h   [License: no copyright]
 M  +27 -19    umbrello/cmds/cmd_create_classdiag.cpp  
 M  +9 -4      umbrello/cmds/cmd_create_classdiag.h  
 AM            umbrello/cmds/cmd_create_collaborationdiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_collaborationdiag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_componentdiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_componentdiag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_deploydiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_deploydiag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_entityrelationdiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_entityrelationdiag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_seqdiag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_seqdiag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_statediag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_statediag.h   [License: no copyright]
 AM            umbrello/cmds/cmd_create_usecasediag.cpp   [License: no copyright]
 AM            umbrello/cmds/cmd_create_usecasediag.h   [License: no copyright]
 M  +4 -3      umbrello/umldoc.cpp  
 M  +2 -1      umbrello/umldoc.h  
 M  +5 -3      umbrello/umllistview.cpp  
 M  +1 -1      umbrello/umllistview.h  


--- branches/work/isi-umbrello/umbrello/ChangeLog #613252:613253
@@ -9,7 +9,10 @@
   http://www.geeksoc.org/~jr/umbrello/uml-devel/9862.html
 * Note widget is now always drawn on TOP of all widgets
   http://www.geeksoc.org/~jr/umbrello/uml-devel/9863.html
+* Optimized printer margins
+  http://www.geeksoc.org/~jr/umbrello/uml-devel/9895.html
 * Bugs/wishes from http://bugs.kde.org:
+* Umbrello saves too much copies at xmi (135606)
 * Artifacts of a component diagram are wrongly placed in Deployment View folder (137564)
 * Incorrect export to SQL (138139)
 
--- branches/work/isi-umbrello/umbrello/umbrello/CMakeLists.txt #613252:613253
@@ -6,6 +6,7 @@
 add_subdirectory( docgenerators ) 
 add_subdirectory( headings ) 
 add_subdirectory( refactoring ) 
+add_subdirectory( cmds )
 
 macro(CREATE_VERSION _in_FILE _out_FILE)
     FILE(READ ${_in_FILE} _contents)
@@ -156,6 +157,21 @@
 	clipboard/umlclipboard.cpp 
 	clipboard/idchangelog.cpp
 	)
+
+set(libcmds_SRCS
+	cmds/cmd_create_activitydiag.cpp
+	cmds/cmd_create_classdiag.cpp
+	cmds/cmd_create_collaborationdiag.cpp
+	cmds/cmd_create_componentdiag.cpp
+	cmds/cmd_create_deploydiag.cpp
+	cmds/cmd_create_entityrelationdiag.cpp
+	cmds/cmd_create_seqdiag.cpp
+	cmds/cmd_create_statediag.cpp
+	cmds/cmd_create_usecasediag.cpp
+
+	cmds/classdiag/cmd_create_class.cpp
+)
+
 ########### next target ###############
 
 set(umbrello_SRCS 
@@ -167,6 +183,7 @@
     ${libcodeimport_SRCS}
     ${libcodegenerator_SRCS}
     ${libdocgenerator_SRCS}
+    ${libcmds_SRCS}
 	activitywidget.cpp 
    actor.cpp 
    actorwidget.cpp 
** branches/work/isi-umbrello/umbrello/umbrello/cmds/classdiag/cmd_create_class.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/classdiag/cmd_create_class.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_activitydiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_activitydiag.h #property svn:executable
   + *
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_classdiag.cpp #613252:613253
@@ -1,28 +1,36 @@
 #include "cmd_create_classdiag.h"
 
-cmdCreateClassDiag::cmdCreateClassDiag(UMLDoc* doc, const QString& name):m_pUMLDoc(doc),m_pUMLView(NULL),m_Name(name)
-{
-	setText(i18n("Create class diagram"));
-}
+#include "uml.h"
 
-cmdCreateClassDiag::~cmdCreateClassDiag()
-{
-	if(m_pUMLView)
-		delete m_pUMLView;
-}
+#include <klocale.h>
 
-cmdCreateClassDiag::redo()
+namespace Uml
 {
-	UMLFolder* temp = m_pUMLDoc->getRootFolder(Uml::mt_Logical);
-	m_pUMLView = m_pUMLDoc->createDiagram(temp, Uml::dt_Class);
-}
 
-cmdCreateClassDiag::undo()
-{
-	if(m_pUMLView)
+	cmdCreateClassDiag::cmdCreateClassDiag(UMLDoc* doc, const QString& name):m_pUMLDoc(doc),m_pUMLView(NULL),m_Name(name)
 	{
-		m_pUMLDoc->removeDiagram(m_pUMLView->getID());
-		delete m_pUMLView;
+		setText(i18n("Create class diagram"));
 	}
+	
+	cmdCreateClassDiag::~cmdCreateClassDiag()
+	{
+		if(m_pUMLView)
+			delete m_pUMLView;
+	}
+	
+	void cmdCreateClassDiag::redo()
+	{
+		UMLFolder* temp = m_pUMLDoc->getRootFolder(Uml::mt_Logical);
+		m_pUMLView = m_pUMLDoc->createDiagram(temp, Uml::dt_Class);
+	}
+	
+	void cmdCreateClassDiag::undo()
+	{
+		if(m_pUMLView)
+		{
+			m_pUMLDoc->removeDiagram(m_pUMLView->getID());
+			delete m_pUMLView;
+		}
+	}
+
 }
-
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_classdiag.h #613252:613253
@@ -3,20 +3,25 @@
 
 #include <QUndoCommand>
 
-namespace umbrello.cmds
+#include "umldoc.h"
+#include "umlview.h"
+
+namespace Uml
 {
 	class cmdCreateClassDiag : public QUndoCommand
 	{
 		public:
 			cmdCreateClassDiag(UMLDoc* doc, const QString& name);
-			~CmdCreateClassDiag();
+			~cmdCreateClassDiag();
 
 			void redo();
 			void undo();
+
 		private:
-			QString		m_Name;
 			UMLDoc*		m_pUMLDoc;
 			UMLView*	m_pUMLView;
+			QString		m_Name;
 	};
 };
-#endif
\ No newline at end of file
+
+#endif
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_collaborationdiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_collaborationdiag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_componentdiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_componentdiag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_deploydiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_deploydiag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_entityrelationdiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_entityrelationdiag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_seqdiag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_seqdiag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_statediag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_statediag.h #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_usecasediag.cpp #property svn:executable
   + *
** branches/work/isi-umbrello/umbrello/umbrello/cmds/cmd_create_usecasediag.h #property svn:executable
   + *
--- branches/work/isi-umbrello/umbrello/umbrello/umldoc.cpp #613252:613253
@@ -973,7 +973,7 @@
     m_bLoading = state;
 }
 
-void UMLDoc::createDiagram(UMLFolder *folder, Diagram_Type type, bool askForName /*= true */) {
+UMLView* UMLDoc::createDiagram(UMLFolder *folder, Diagram_Type type, bool askForName /*= true */) {
     bool ok = true;
     QString name,
     dname = uniqViewName(type);
@@ -1000,7 +1000,7 @@
             setModified(true, false);
             UMLApp::app()->enablePrint(true);
             changeCurrentView( temp->getID() );
-            break;
+            return temp;
         } else {
             KMessageBox::error(0, i18n("A diagram is already using that name."), i18n("Not a Unique Name"));
         }
@@ -2124,7 +2124,7 @@
 }
 
 void UMLDoc::addToUndoStack() {
-    Settings::OptionState optionState = Settings::getOptionState();
+/*    Settings::OptionState optionState = Settings::getOptionState();
     if (!m_bLoading && optionState.generalState.undo) {
         QBuffer* buffer = new QBuffer();
         buffer->open(QIODevice::WriteOnly);
@@ -2138,6 +2138,7 @@
             UMLApp::app()->enableUndo(true);
         }
     }
+*/
 }
 
 void UMLDoc::clearUndoStack() {
--- branches/work/isi-umbrello/umbrello/umbrello/umldoc.h #613252:613253
@@ -267,8 +267,9 @@
      * @param type              The type of diagram to create.
      * @param askForName        If true shows a dialog box asking for name,
      *                  else uses a default name.
+     * @return Pointer to the UMLView of the new diagram.
      */
-    void createDiagram(UMLFolder *folder, Uml::Diagram_Type type, bool askForName = true);
+    UMLView* createDiagram(UMLFolder *folder, Uml::Diagram_Type type, bool askForName = true);
 
     /**
      * Removes an @ref UMLObject from the current file.  If this object
--- branches/work/isi-umbrello/umbrello/umbrello/umllistview.cpp #613252:613253
@@ -2140,12 +2140,12 @@
     return true;
 }
 
-void UMLListView::createDiagram( UMLListViewItem * item, Uml::Diagram_Type type ) {
+UMLView* UMLListView::createDiagram( UMLListViewItem * item, Uml::Diagram_Type type ) {
     QString name = item -> text( 0 );
     UMLView * view = m_doc -> findView( type, name );
     if( view ) {
         delete item;
-        return;
+        return view;
     }
     UMLListViewItem *parentItem = static_cast<UMLListViewItem*>(item->parent());
     UMLFolder *parentFolder = dynamic_cast<UMLFolder*>(parentItem->getUMLObject());
@@ -2153,7 +2153,7 @@
         kError() << "UMLListView::createDiagram(" << name
             << "): parent UMLObject is not a UMLFolder" << endl;
         delete item;
-        return;
+        return NULL;
     }
     view = new UMLView(parentFolder);
     view->setName( name );
@@ -2165,6 +2165,8 @@
     item -> setText( name );
     view->activate();
     m_doc -> changeCurrentView( view -> getID() );
+
+    return view;
 }
 
 QString UMLListView::getUniqueDiagramName(Uml::Diagram_Type type) {
--- branches/work/isi-umbrello/umbrello/umbrello/umllistview.h #613252:613253
@@ -228,7 +228,7 @@
     /**
      * Creates a diagram out of the given list view item.
      */
-    void createDiagram( UMLListViewItem * item, Uml::Diagram_Type type );
+    UMLView* createDiagram( UMLListViewItem * item, Uml::Diagram_Type type );
 
     /**
      * Returns a unique name for a diagram.




More information about the umbrello-devel mailing list