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

Gaël de Chalendar kleag at free.fr
Fri Jun 23 14:54:57 UTC 2006


SVN commit 554219 by kleag:

First version of documentation generators

 M  +21 -0     configure.in.in  
 M  +6 -3      umbrello/Makefile.am  
 A             umbrello/common.ent  
 A             umbrello/docgenerators (directory)  
 A             umbrello/docgenerators/Makefile.am  
 A             umbrello/docgenerators/docbookgenerator.cpp   [License: GPL (v2+)]
 A             umbrello/docgenerators/docbookgenerator.h   [License: GPL (v2+) GENERATED FILE]
 A             umbrello/docgenerators/main.cpp   [License: GPL (v2+)]
 M  +5 -0      umbrello/umbrelloui.rc  
 M  +11 -0     umbrello/uml.cpp  
 M  +10 -1     umbrello/uml.h  
 M  +2 -0      umbrello/umllistview.cpp  
 M  +9 -1      umbrello/umlview.cpp  
 M  +7 -1      umbrello/umlview.h  
 A             umbrello/xmi2docbook.xsl  


--- branches/KDE/3.5/kdesdk/umbrello/configure.in.in #554218:554219
@@ -40,3 +40,24 @@
 dnl int setenv(const char *name, const char *value, int overwrite);
 dnl #endif
 dnl ])
+
+AC_LANG_SAVE
+AC_LANG_C
+
+AC_CHECK_HEADER(libxml2/libxml/xmlmemory.h,
+  [have_libxml2=yes],
+  [have_libxml2=no])
+
+if test "$have_libxml2" = "no"; then
+  DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
+fi
+
+AC_CHECK_HEADER(libxslt/xslt.h,
+  [have_libxslt=yes],
+  [have_libxslt=no])
+
+if test "$have_libxslt" = "no"; then
+  DO_NOT_COMPILE="$DO_NOT_COMPILE umbrello"
+fi
+
+AC_LANG_RESTORE
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #554218:554219
@@ -120,16 +120,19 @@
 worktoolbar.cpp
 
 #umbrello_LDADD   = ./refactoring/librefactoring.la ./classparser/libclassparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la $(AUTOLAYOUT_LIBS) $(LIB_KDEPRINT) $(LIB_KIO)
-umbrello_LDADD   = ./refactoring/librefactoring.la ./classparser/libclassparser.la ./clipboard/libclipboard.la ./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la $(LIB_KDEPRINT) $(LIB_KIO)
+umbrello_LDADD = -lxml2 -lxslt ./docgenerators/libdocgenerators.la \
+	./refactoring/librefactoring.la ./classparser/libclassparser.la ./clipboard/libclipboard.la \
+	./dialogs/libdialogs.la ./codegenerators/libcodegenerator.la $(LIB_KDEPRINT) $(LIB_KIO)
 
 ## See section "dnl Not GPL compatible" in ../configure.in.in
 # SUBDIRS = $(AUTOLAYOUT_DIR) classparser dialogs clipboard pics codegenerators headings refactoring
-SUBDIRS = classparser dialogs clipboard pics codegenerators headings refactoring
+SUBDIRS = classparser dialogs clipboard pics codegenerators headings \
+	refactoring docgenerators
 
 KDE_ICON=AUTO
 
 appdir=$(kde_datadir)/umbrello
-app_DATA = tips umbrelloui.rc
+app_DATA = tips umbrelloui.rc xmi2docbook.xsl common.ent
 
 xdg_apps_DATA = umbrello.desktop
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umbrelloui.rc #554218:554219
@@ -1,6 +1,11 @@
 <!DOCTYPE kpartgui>
 <kpartgui name="umbrello" version="11">
 <MenuBar>
+  <Menu name="file"><text>&File</text>
+    <Menu name="file_export"><text>&Export</text>
+      <Action name="file_export_docbook"/>
+    </Menu>
+  </Menu>
   <Menu name="edit"><text>&Edit</text>
     <Action name="delete_selected"/>
   </Menu>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #554218:554219
@@ -77,6 +77,8 @@
 
 #include "cmdlineexportallviewsevent.h"
 
+#include "docgenerators/docbookgenerator.h"
+
 UMLApp::UMLApp(QWidget* , const char* name):KDockMainWindow(0, name) {
     s_instance = this;
     m_pDocWindow = 0;
@@ -179,6 +181,9 @@
 #endif
     selectAll = KStdAction::selectAll(this,  SLOT( slotSelectAll() ), actionCollection());
 
+    fileExportDocbook = new KAction(i18n("&Export model to docbook"),0,this,SLOT(slotFileExportDocbook()),
+                              actionCollection(),"file_export_docbook");
+    
     classWizard = new KAction(i18n("&New Class Wizard..."),0,this,SLOT(slotClassWizard()),
                               actionCollection(),"class_wizard");
     new KAction(i18n("&Add Default Datatypes for Active Language"), 0, this,
@@ -202,6 +207,7 @@
     fileClose->setToolTip(i18n("Closes the document"));
     filePrint ->setToolTip(i18n("Prints out the document"));
     fileQuit->setToolTip(i18n("Quits the application"));
+    fileExportDocbook->setToolTip(i18n("Exports the model to the docbook format"));
     editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
     editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
     editPaste->setToolTip(i18n("Pastes the contents of the clipboard"));
@@ -804,6 +810,11 @@
     slotStatusMsg(i18n("Ready."));
 }
 
+void UMLApp::slotFileExportDocbook()
+{
+  DocbookGenerator().generateDocbookForProject();
+}
+    
 void UMLApp::slotEditUndo() {
     m_doc->loadUndoData();
     slotStatusMsg(i18n("Ready."));
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.h #554218:554219
@@ -487,8 +487,16 @@
      * aborts.
      */
     void slotFileQuit();
-
+    
     /**
+     * Exports the current model to docbook in a subdir of the 
+     * current model directory named from the model name.
+     * @todo Let the user chose the destination directory and 
+     * name.
+     */
+    void slotFileExportDocbook();
+    
+    /**
      * Put the marked text/object into the clipboard and remove
      * it from the document.
      */
@@ -896,6 +904,7 @@
     KAction* fileOpen;
     KRecentFilesAction* fileOpenRecent;
     KAction* fileSave;
+    KAction* fileExportDocbook;
 
     KAction* fileSaveAs;
     KAction* fileClose;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umllistview.cpp #554218:554219
@@ -173,6 +173,7 @@
     }
 
     Uml::ListView_Type type;
+    // if item is null (0), then do not chose lvt_Unknown type
     type = item ? item->getType() : Uml::lvt_Unknown;
     if (me->button() == Qt::LeftButton) {
         switch( type ) {
@@ -196,6 +197,7 @@
             UMLApp::app() -> getDocWindow() -> showDocumentation( item -> getUMLObject(), false );
             break;
 
+        case Uml::lvt_Unknown:  // used for EnumLiteral, do not try to show item documentation
         default:
             UMLApp::app() -> getDocWindow() -> updateDocumentation( true );
             break;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.cpp #554218:554219
@@ -112,7 +112,8 @@
 
 
 // constructor
-UMLView::UMLView() : QCanvasView(UMLApp::app()->getMainViewWidget(), "AnUMLView") {
+UMLView::UMLView() : QCanvasView(UMLApp::app()->getMainViewWidget(), "AnUMLView"),
+  m_pChildDisplayedDoc(false) {
     init();
     m_pDoc = UMLApp::app()->getDocument();
 }
@@ -1266,6 +1267,10 @@
 void UMLView::contentsMousePressEvent(QMouseEvent* ome)
 {
     m_pToolBarState->mousePress(ome);
+    if (!m_pChildDisplayedDoc) {
+      UMLApp::app() -> getDocWindow() -> showDocumentation( this, true );
+    }
+    m_pChildDisplayedDoc = false;
 }
 
 void UMLView::makeSelected (UMLWidget * uw) {
@@ -2099,14 +2104,17 @@
 
 void UMLView::showDocumentation( UMLObject * object, bool overwrite ) {
     UMLApp::app() -> getDocWindow() -> showDocumentation( object, overwrite );
+    m_pChildDisplayedDoc = true;
 }
 
 void UMLView::showDocumentation( UMLWidget * widget, bool overwrite ) {
     UMLApp::app() -> getDocWindow() -> showDocumentation( widget, overwrite );
+    m_pChildDisplayedDoc = true;
 }
 
 void UMLView::showDocumentation( AssociationWidget * widget, bool overwrite ) {
     UMLApp::app() -> getDocWindow() -> showDocumentation( widget, overwrite );
+    m_pChildDisplayedDoc = true;
 }
 
 void UMLView::updateDocumentation( bool clear ) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.h #554218:554219
@@ -1200,7 +1200,13 @@
     WorkToolBar::ToolBar_Buttons getCurrentCursor() const;
 
 private:
-
+    /**
+     * set to true when a child has used the showDocumentation method,
+     * thus when one click on a child widget.
+     * Reseted to false when one click in an empty zone of the view
+     */
+    bool m_pChildDisplayedDoc;
+    
     ToolBarStateFactory* m_pToolBarStateFactory;
     ToolBarState* m_pToolBarState;
 




More information about the umbrello-devel mailing list