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

Ralf Habacker ralf.habacker at gmail.com
Sun Mar 18 20:01:26 UTC 2012


SVN commit 1286233 by habacker:

Refactored calls belonging to UMLScene related methods.

CCBUG: 290952

 M  +13 -13    clipboard/umlclipboard.cpp  
 M  +13 -13    dialogs/diagramprintpage.cpp  
 M  +4 -4      uml.cpp  
 M  +2 -2      umllistview.cpp  
 M  +1 -1      widgets/widget_utils.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/clipboard/umlclipboard.cpp #1286232:1286233
@@ -537,7 +537,7 @@
         return false;
     }
 
-    if( diagramType != UMLApp::app()->currentView()->type() ) {
+    if( diagramType != UMLApp::app()->currentView()->umlScene()->type() ) {
         if( !checkPasteWidgets(widgets) ) {
             while ( !assocs.isEmpty() ) {
                 delete assocs.takeFirst();
@@ -562,24 +562,24 @@
     //now add any widget we are want to paste
     bool objectAlreadyExists = false;
     UMLView *currentView = UMLApp::app()->currentView();
-    currentView->beginPartialWidgetPaste();
+    currentView->umlScene()->beginPartialWidgetPaste();
 
     foreach ( UMLWidget* widget, widgets ) {
 
         Uml::IDType oldId = widget->id();
         Uml::IDType newId = idchanges->findNewID(oldId);
         // how should findWidget find ::None id, which is returned for the first entry ?
-        if (currentView->findWidget(newId)) {
+        if (currentView->umlScene()->findWidget(newId)) {
             uError() << "widget (oldID=" << ID2STR(oldId) << ", newID="
                 << ID2STR(newId) << ") already exists in target view.";
             widgets.removeAll(widget);
             delete widget;
             objectAlreadyExists = true;
         } else {
-            if (currentView->type() == Uml::DiagramType::Activity || currentView->type() == Uml::DiagramType::State)
+            if (currentView->umlScene()->type() == Uml::DiagramType::Activity || currentView->type() == Uml::DiagramType::State)
                 widget->setID(doc->assignNewID(widget->id()));
-            if (! currentView->addWidget(widget, true)) {
-                currentView->endPartialWidgetPaste();
+            if (! currentView->umlScene()->addWidget(widget, true)) {
+                currentView->umlScene()->endPartialWidgetPaste();
                 return false;
             }
         }
@@ -587,21 +587,21 @@
 
     //now paste the associations
     foreach ( AssociationWidget* assoc, assocs ) {
-        if (!currentView->addAssociation(assoc, true)) {
-            currentView->endPartialWidgetPaste();
+        if (!currentView->umlScene()->addAssociation(assoc, true)) {
+            currentView->umlScene()->endPartialWidgetPaste();
             return false;
         }
     }
 
-    currentView->clearSelected();
-    currentView->selectWidgets(widgets);
+    currentView->umlScene()->clearSelected();
+    currentView->umlScene()->selectWidgets(widgets);
     foreach ( AssociationWidget* assoc, assocs ) {
-        currentView->selectWidgetsOfAssoc(assoc);
+        currentView->umlScene()->selectWidgetsOfAssoc(assoc);
     }
 
     //Activate all the pasted associations and widgets
-    currentView->activate();
-    currentView->endPartialWidgetPaste();
+    currentView->umlScene()->activate();
+    currentView->umlScene()->endPartialWidgetPaste();
 
     /*
     UMLListView *listView = UMLApp::app()->listView();
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/diagramprintpage.cpp #1286232:1286233
@@ -17,7 +17,7 @@
 #include "model_utils.h"
 #include "uml.h"
 #include "umldoc.h"
-#include "umlview.h"
+#include "umlscene.h"
 #include "umlviewlist.h"
 
 // kde includes
@@ -81,10 +81,10 @@
     select->addWidget(m_pSelectLW);
     m_pSelectLW->setEnabled(false);
     m_pSelectLW->setSelectionMode(QAbstractItemView::MultiSelection);
-    m_pSelectLW->addItem(UMLApp::app()->currentView()->name());
+    m_pSelectLW->addItem(UMLApp::app()->currentView()->umlScene()->name());
     m_pSelectLW->setCurrentRow(0);
     m_nIdList.clear();
-    m_nIdList.append(UMLApp::app()->currentView()->getID());
+    m_nIdList.append(UMLApp::app()->currentView()->umlScene()->getID());
 
     m_ViewType = Uml::DiagramType(Uml::DiagramType::Class);
     connect(m_pAllRB, SIGNAL(clicked()), this, SLOT(slotClicked()));
@@ -195,9 +195,9 @@
         m_pTypeCB->setEnabled(false);
         m_pSelectLW->setEnabled(false);
         m_pSelectLW->clear();
-        m_pSelectLW->addItem(UMLApp::app()->currentView()->name());
+        m_pSelectLW->addItem(UMLApp::app()->currentView()->umlScene()->name());
         m_pSelectLW->setCurrentRow(0);
-        m_nIdList.append(UMLApp::app()->currentView()->getID());
+        m_nIdList.append(UMLApp::app()->currentView()->umlScene()->getID());
     }
 
     if (m_pAllRB->isChecked()) {
@@ -205,8 +205,8 @@
         m_pSelectLW->setEnabled(false);
         m_pSelectLW->clear();
         foreach ( UMLView * view , list ) {
-            m_pSelectLW->addItem(view->name());
-            m_nIdList.append(view->getID());
+            m_pSelectLW->addItem(view->umlScene()->name());
+            m_nIdList.append(view->umlScene()->getID());
         }
         m_pSelectLW->selectAll();
     }
@@ -216,8 +216,8 @@
         m_pSelectLW->setEnabled(true);
         m_pSelectLW->clear();
         foreach ( UMLView * view , list) {
-            m_pSelectLW->addItem(view->name());
-            m_nIdList.append(view->getID());
+            m_pSelectLW->addItem(view->umlScene()->name());
+            m_nIdList.append(view->umlScene()->getID());
         }
     }
 
@@ -227,8 +227,8 @@
         m_pSelectLW->clear();
         foreach ( UMLView * view , list) {
             if(view->type() == m_ViewType) {
-                m_pSelectLW->addItem(view->name());
-                m_nIdList.append(view->getID());
+                m_pSelectLW->addItem(view->umlScene()->name());
+                m_nIdList.append(view->umlScene()->getID());
             }
         }
         m_pSelectLW->selectAll();
@@ -253,8 +253,8 @@
     m_nIdList.clear();
     foreach (UMLView * view , list) {
         if (view->type() == m_ViewType) {
-            m_pSelectLW->addItem(view->name());
-            m_nIdList.append(view->getID());
+            m_pSelectLW->addItem(view->umlScene()->name());
+            m_nIdList.append(view->umlScene()->getID());
         }
     }
     m_pSelectLW->selectAll();
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #1286232:1286233
@@ -553,12 +553,12 @@
 void UMLApp::slotZoomFit()
 {
     currentView()->setZoom(100);  // bring it first to the original values
-    DEBUG(DBG_SRC) << "canvas width=" << currentView()->getCanvasWidth()
-                   << ", height=" << currentView()->getCanvasHeight();
+    DEBUG(DBG_SRC) << "canvas width=" << currentView()->umlScene()->getCanvasWidth()
+                   << ", height=" << currentView()->umlScene()->getCanvasHeight();
     DEBUG(DBG_SRC) << "visible width=" << currentView()->visibleWidth()
                    << ", height=" << currentView()->visibleHeight();
-    int scaleW = ceil(100.0 * currentView()->visibleWidth() / currentView()->getCanvasWidth());
-    int scaleH = ceil(100.0 * currentView()->visibleHeight() / currentView()->getCanvasHeight());
+    int scaleW = ceil(100.0 * currentView()->visibleWidth() / currentView()->umlScene()->getCanvasWidth());
+    int scaleH = ceil(100.0 * currentView()->visibleHeight() / currentView()->umlScene()->getCanvasHeight());
     DEBUG(DBG_SRC) << "scale width: " << scaleW << ", height: " << scaleH;
     int scale = 100;
     if (scaleW < scaleH) {
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #1286232:1286233
@@ -1612,7 +1612,7 @@
     }
     UMLView *currentView = UMLApp::app()->currentView();
     if (currentView)
-        currentView->updateContainment(o);
+        currentView->umlScene()->updateContainment(o);
 }
 
 /**
@@ -1777,7 +1777,7 @@
             }
             UMLView *currentView = UMLApp::app()->currentView();
             if (currentView)
-                currentView->updateContainment(o);
+                currentView->umlScene()->updateContainment(o);
         }
         break;
     case UMLListViewItem::lvt_Attribute:
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widget_utils.cpp #1286232:1286233
@@ -57,7 +57,7 @@
     rect = new UMLSceneRectItem(p.x() - SIZE / 2,
                                  p.y() - SIZE / 2,
                                  SIZE, SIZE);
-    rect->setCanvas(currentView->canvas());
+    rect->setCanvas(currentView->umlScene()->canvas());
     rect->setBrush( QBrush(Qt::blue) );
     rect->setPen( QPen(Qt::blue) );
     rect->setVisible(true);




More information about the umbrello-devel mailing list