[Uml-devel] branches/KDE/3.5/kdesdk/umbrello

Jonathan Riddell jr at jriddell.org
Tue Aug 2 13:43:00 UTC 2005


SVN commit 442493 by jriddell:

Add an alpha version of automatic diagram layout

>From Dimitri Ognibene <ognibened @yahoo.it>

http://bugs.kde.org/show_bug.cgi?id=67059

CCMAIL:ognibened at yahoo.it


 M  +1 -0      ChangeLog  
 M  +7 -0      configure.in.in  
 M  +3 -3      umbrello/Makefile.am  
 A             umbrello/autolayout (directory)  
 A             umbrello/autolayout/Makefile.am  
 AM            umbrello/autolayout/_graph.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayout.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayoutdlg.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayoutdlg.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayouter.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayouter.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayouteradapter.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/autolayouteradapter.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/baseinclude.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/canvas.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/diagram.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/diagram_interface.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/dotautolayouter.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/dotautolayouter.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphvizautolayouter.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphvizautolayouter.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphvizgraph.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphvizgraph.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphviznode.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/graphviznode.h   [License: GPL (v2+)]
 A             umbrello/autolayout/newautolayoutdialog.ui  
 AM            umbrello/autolayout/node.h   [License: GPL (v2+)]
 AM            umbrello/autolayout/simplecanvas.cpp   [License: GPL (v2+)]
 AM            umbrello/autolayout/simplecanvas.h   [License: GPL (v2+)]
 M  +51 -0     umbrello/uml.cpp  
 M  +6 -0      umbrello/uml.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #442492:442493
@@ -5,6 +5,7 @@
 * Code generator for Tcl
 * Externalization of folders (i.e. submodel files)
 * Change interface into class and vice versa (if abstract and no attributes)
+* Automatic Diagram Layout (67059, not yet closed)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
 57588 67719 72016 79433 87252 88117 97162 105564 108223 109591 109636
--- branches/KDE/3.5/kdesdk/umbrello/configure.in.in #442492:442493
@@ -7,6 +7,13 @@
 if test "$kde_have_flex" = "no"; then
   DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
 fi
+AC_CHECK_HEADER(graphviz/dot.h,
+  [kde_have_graphviz=yes],
+  [kde_have_graphviz=no])
+
+if test "$kde_have_graphviz" = "no"; then
+  DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
+fi
 AC_LANG_RESTORE
 
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #442492:442493
@@ -99,9 +99,9 @@
 widget_utils.cpp \
 worktoolbar.cpp
 
-umbrello_LDADD   = ./refactoring/librefactoring.la ./classparser/libclassparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la  $(LIB_KDEPRINT) $(LIB_KIO)
+umbrello_LDADD   = ./refactoring/librefactoring.la ./classparser/libclassparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la ./autolayout/libautolayout.la  $(LIB_KDEPRINT) $(LIB_KIO) 
 
-SUBDIRS = classparser dialogs clipboard pics codegenerators headings diagram refactoring plugins
+SUBDIRS = classparser dialogs clipboard pics codegenerators headings diagram refactoring plugins autolayout
 
 KDE_ICON=AUTO
 
@@ -113,7 +113,7 @@
 mimedir = $(kde_mimedir)/application
 mime_DATA = x-umbrello.desktop
 
-INCLUDES= -Idialogs -Irefactoring $(all_includes)
+INCLUDES= -Idialogs -Irefactoring $(all_includes) -I/usr/include/graphviz/
 
 METASOURCES = AUTO
 
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/_graph.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayout.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayoutdlg.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayoutdlg.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayouter.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayouter.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayouteradapter.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/autolayouteradapter.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/baseinclude.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/canvas.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/diagram.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/diagram_interface.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/dotautolayouter.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/dotautolayouter.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphvizautolayouter.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphvizautolayouter.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphvizgraph.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphvizgraph.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphviznode.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/graphviznode.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/node.h #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/simplecanvas.cpp #property changes
Name: svn:eol-style
   + native
** branches/KDE/3.5/kdesdk/umbrello/umbrello/autolayout/simplecanvas.h #property changes
Name: svn:eol-style
   + native
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #442492:442493
@@ -59,6 +59,7 @@
 #include "umllistview.h"
 #include "umlviewlist.h"
 #include "worktoolbar.h"
+#include "autolayout/autolayoutdlg.h"//dimitri
 
 #include "clipboard/umlclipboard.h"
 #include "dialogs/classwizard.h"
@@ -215,6 +216,8 @@
     classDiagram = new KAction( i18n( "&Class Diagram..." ), SmallIconSet("umbrello_diagram_class"), 0,
                                 this, SLOT( slotClassDiagram() ), actionCollection(), "new_class_diagram" );
 
+    autolayout = new KAction(i18n("&Autolayout..."),0,0,this,SLOT(slotAutolayout()),
+                                              actionCollection(),"autolayout");
     sequenceDiagram= new KAction( i18n( "&Sequence Diagram..." ), SmallIconSet("umbrello_diagram_sequence"), 0,
                                   this, SLOT( slotSequenceDiagram() ), actionCollection(), "new_sequence_diagram" );
 
@@ -1682,6 +1685,54 @@
     //m_tabWidget->moveTab( m_tabWidget->currentPageIndex(), m_tabWidget->currentPageIndex() + 1 );
 }
 
+void UMLApp::slotAutolayout(){
+ QDialog* d = new AutolayoutDlg(getCurrentView());
+ d->show();
+
+/*if ( getCurrentView()->getType()== Uml::dt_Class){
+using namespace Autolayout;
+       int max_x = getCurrentView()->getCanvasWidth();
+       int max_y = getCurrentView()->getCanvasHeight();
+        
+	
+       Diagram d= Diagram(max_x,max_y);
+       UMLWidgetList list = getCurrentView()->getWidgetList();
+ UMLWidget* widget;
+       for ( widget = list.first(); widget; widget= list.next() ){
+        if (widget->getBaseType() == Uml::wt_Class){
+
+         
+         d.addNode(widget->getID().c_str(),widget->getWidth(),
+         widget->getHeight());
+        }
+}
+        AssociationWidgetList as_list=getCurrentView()->getAssociationList();
+        AssociationWidget* assoc;
+        AssociationWidgetListIt it(as_list);
+        while ( (assoc = it.current()) != 0 ) {
+          ++it;
+          d.addEdge(assoc->getWidgetID(Uml::A).c_str(),
+           assoc->getWidgetID(Uml::B).c_str());
+        }
+         d.autolayout();
+        for ( widget = list.first(); widget; widget= list.next() )
+        if (widget->getBaseType() == Uml::wt_Class){
+		Node n =d.getNode(widget->getID().c_str());
+               //printf("old values widgets %s x,y:%d,%d\n",widget->getID().c_str(),widget->getX(),widget->getY());
+                int x_old=widget->getX();
+                int x_calc=n.getX();
+                int x_calc2=30 +n.getX()-widget->getWidth()/2;
+               widget->setX(30 +n.getX()-widget->getWidth()/2);
+                int x=widget->getX();
+               widget->setY(max_y/2-(n.getY()+(widget->getHeight()/2)));
+               widget->updateWidget();
+
+        }
+//         d.save();
+       
+*/
+}
+
 KTabWidget* UMLApp::tabWidget() {
     return m_tabWidget;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.h #442492:442493
@@ -497,6 +497,11 @@
      */
     void slotViewStatusBar();
     // #endif
+    
+    /**
+     * Autolayouts the current class diagram
+     */
+    void slotAutolayout();
 
     /**
      * Changes the statusbar contents for the standard label
@@ -882,6 +887,7 @@
     KAction* classWizard;
     KAction* deleteSelectedWidget;
     KAction* deleteDiagram;
+    KAction* autolayout;
 
     KAction* changeTabLeft;
     KAction* changeTabRight;




More information about the umbrello-devel mailing list