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

Ralf Habacker ralf.habacker at gmail.com
Thu Aug 23 04:09:35 UTC 2012


SVN commit 1312462 by habacker:

Use UMLScene related types to reduce differences to soc branch.

 M  +3 -3      controller/umlwidgetcontroller.cpp  
 M  +1 -1      controller/umlwidgetcontroller.h  
 M  +1 -1      toolbarstatearrow.h  
 M  +1 -1      toolbarstateassociation.cpp  
 M  +1 -1      toolbarstatemessages.cpp  
 M  +17 -15    umlscene.cpp  
 M  +4 -4      umlscene.h  
 M  +1 -1      widgets/activitywidget.cpp  
 M  +1 -1      widgets/activitywidget.h  
 M  +1 -1      widgets/forkjoinwidget.cpp  
 M  +1 -1      widgets/forkjoinwidget.h  
 M  +3 -3      widgets/messagewidget.cpp  
 M  +1 -1      widgets/messagewidget.h  
 M  +7 -7      widgets/umlwidget.cpp  
 M  +4 -4      widgets/umlwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/controller/umlwidgetcontroller.cpp #1312461:1312462
@@ -202,8 +202,8 @@
     }
 
     UMLScenePoint position = getPosition(me);
-    int diffX = position.x() - m_widget->x();
-    int diffY = position.y() - m_widget->y();
+    UMLSceneValue diffX = position.x() - m_widget->x();
+    UMLSceneValue diffY = position.y() - m_widget->y();
 
     if ((me->modifiers() & Qt::ShiftModifier) && (me->modifiers() & Qt::ControlModifier)) {
         //Move in Y axis
@@ -490,7 +490,7 @@
  * @param diffX The difference between current X position and new X position.
  * @param diffY The difference between current Y position and new Y position.
  */
-void UMLWidgetController::constrainMovementForAllWidgets(int &diffX, int &diffY)
+void UMLWidgetController::constrainMovementForAllWidgets(UMLSceneValue &diffX, UMLSceneValue &diffY)
 {
     Q_UNUSED(diffX); Q_UNUSED(diffY);
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/controller/umlwidgetcontroller.h #1312461:1312462
@@ -98,7 +98,7 @@
 
     virtual QCursor getResizeCursor();
 
-    virtual void constrainMovementForAllWidgets(int &diffX, int &diffY);
+    virtual void constrainMovementForAllWidgets(UMLSceneValue &diffX, UMLSceneValue &diffY);
 
     virtual void doMouseDoubleClick(UMLSceneMouseEvent *me);
 
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatearrow.h #1312461:1312462
@@ -61,7 +61,7 @@
     /**
      * The start position of the selection rectangle.
      */
-    QPoint m_startPosition;
+    UMLScenePoint m_startPosition;
 
 };
 
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstateassociation.cpp #1312461:1312462
@@ -80,7 +80,7 @@
     ToolBarStatePool::mouseMove(ome);
 
     if (m_associationLine) {
-        QPoint sp = m_associationLine->startPoint();
+        UMLScenePoint sp = m_associationLine->startPoint();
         m_associationLine->setPoints(sp.x(), sp.y(), m_pMouseEvent->x(), m_pMouseEvent->y());
     }
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatemessages.cpp #1312461:1312462
@@ -79,7 +79,7 @@
     ToolBarStatePool::mouseMove(ome);
 
     if (m_messageLine) {
-        QPoint sp = m_messageLine->startPoint();
+        UMLScenePoint sp = m_messageLine->startPoint();
         m_messageLine->setPoints(sp.x(), sp.y(), m_pMouseEvent->x(), m_pMouseEvent->y());
     }
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.cpp #1312461:1312462
@@ -623,7 +623,7 @@
     pPainter.setViewport(left, top, width, height);
 
     // get Diagram
-    getDiagram(QRect(rect.x(), rect.y(), windowWidth, diagramHeight), pPainter);
+    getDiagram(UMLSceneRect (rect.x(), rect.y(), windowWidth, diagramHeight), pPainter);
 
     if (isFooter) {
         //draw foot note
@@ -1387,7 +1387,7 @@
  * @param dX The distance to move horizontally.
  * @param dY The distance to move vertically.
  */
-void UMLScene::moveSelectedBy(int dX, int dY)
+void UMLScene::moveSelectedBy(UMLSceneValue dX, UMLSceneValue dY)
 {
     // DEBUG(DBG_SRC) << "********** m_selectedList count=" << m_selectedList.count();
     foreach(UMLWidget *w, selectedWidgets()) {
@@ -2980,15 +2980,15 @@
  *            updated if the Y coordinate of the upper right corner
  *            of ft is larger than the qy value passed in.
  */
-void UMLScene::findMaxBoundingRectangle(const FloatingTextWidget* ft, int& px, int& py, int& qx, int& qy)
+void UMLScene::findMaxBoundingRectangle(const FloatingTextWidget* ft, UMLSceneValue& px, UMLSceneValue& py, UMLSceneValue& qx, UMLSceneValue& qy)
 {
     if (ft == NULL || !ft->isVisible())
         return;
 
-    int x = ft->x();
-    int y = ft->y();
-    int x1 = x + ft->width() - 1;
-    int y1 = y + ft->height() - 1;
+    UMLSceneValue x = ft->x();
+    UMLSceneValue y = ft->y();
+    UMLSceneValue x1 = x + ft->width() - 1;
+    UMLSceneValue y1 = y + ft->height() - 1;
 
     if (px == -1 || x < px)
         px = x;
@@ -3015,14 +3015,14 @@
     getDiagram(rect, diagram);
 
     //now get the selection cut
-    int px = -1, py = -1, qx = -1, qy = -1;
+    UMLSceneValue px = -1, py = -1, qx = -1, qy = -1;
 
     //first get the smallest rect holding the widgets
     foreach(UMLWidget* temp, m_selectedList) {
-        int x = temp->x();
-        int y = temp->y();
-        int x1 = x + temp->width() - 1;
-        int y1 = y + temp->height() - 1;
+        UMLSceneValue x = temp->x();
+        UMLSceneValue y = temp->y();
+        UMLSceneValue x1 = x + temp->width() - 1;
+        UMLSceneValue y1 = y + temp->height() - 1;
         if (px == -1 || x < px) {
             px = x;
         }
@@ -3730,14 +3730,15 @@
 {
     m_nSnapX = x;
     m_nSnapY = y;
-    Q3Canvas::setAllChanged();
+    setAllChanged();
 }
 
 /**
  * Returns the input coordinate with possible grid-snap applied.
  */
-int UMLScene::snappedX(int x)
+UMLSceneValue UMLScene::snappedX(UMLSceneValue _x)
 {
+    int x = (int)_x;
     if (snapToGrid()) {
         int gridX = snapX();
         int modX = x % gridX;
@@ -3751,8 +3752,9 @@
 /**
  * Returns the input coordinate with possible grid-snap applied.
  */
-int UMLScene::snappedY(int y)
+UMLSceneValue UMLScene::snappedY(UMLSceneValue _y)
 {
+    int y = (int)_y;
     if (snapToGrid()) {
         int gridY = snapY();
         int modY = y % gridY;
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.h #1312461:1312462
@@ -196,7 +196,7 @@
     const QColor& gridDotColor() const;
     void setGridDotColor(const QColor& color);
 
-    void setSize(int width, int height);
+    void setSize(UMLSceneValue width, UMLSceneValue height);
 
     bool snapToGrid() const;
     void setSnapToGrid(bool bSnap);
@@ -208,8 +208,8 @@
     int snapY() const;
     void setSnapSpacing(int x, int y);
 
-    int snappedX(int x);
-    int snappedY(int y);
+    UMLSceneValue snappedX(UMLSceneValue x);
+    UMLSceneValue snappedY(UMLSceneValue y);
 
     bool isSnapGridVisible() const;
     void setSnapGridVisible(bool bShow);
@@ -444,7 +444,7 @@
     void updateComponentSizes();
 
     void findMaxBoundingRectangle(const FloatingTextWidget* ft,
-                                  int& px, int& py, int& qx, int& qy);
+                                  UMLSceneValue& px, UMLSceneValue& py, UMLSceneValue& qx, UMLSceneValue& qy);
     void forceUpdateWidgetFontMetrics(QPainter *painter);
 
     virtual void drawBackground(QPainter & painter, const QRect & clip);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.cpp #1312461:1312462
@@ -327,7 +327,7 @@
 /**
  * Overrides Method from UMLWidget.
  */
-void ActivityWidget::constrain(int& width, int& height)
+void ActivityWidget::constrain(UMLSceneValue& width, UMLSceneValue& height)
 {
     if (m_activityType == Normal || m_activityType == Invok || m_activityType == Param) {
         UMLWidget::constrain(width, height);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/activitywidget.h #1312461:1312462
@@ -70,7 +70,7 @@
     virtual bool loadFromXMI( QDomElement & qElement );
     virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
 
-    void constrain(int& width, int& height);
+    void constrain(UMLSceneValue& width, UMLSceneValue& height);
 
 public Q_SLOTS:
     virtual void slotMenuSelection(QAction* action);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/forkjoinwidget.cpp #1312461:1312462
@@ -153,7 +153,7 @@
 /**
  * Reimplement method from UMLWidget.
  */
-void ForkJoinWidget::constrain(int& width, int& height)
+void ForkJoinWidget::constrain(UMLSceneValue& width, UMLSceneValue& height)
 {
     if (m_orientation == Qt::Vertical) {
         if (width < 4)
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/forkjoinwidget.h #1312461:1312462
@@ -46,7 +46,7 @@
 
     void drawSelected(QPainter * p, int offsetX, int offsetY);
 
-    void constrain(int& width, int& height);
+    void constrain(UMLSceneValue& width, UMLSceneValue& height);
 
 private:
     Qt::Orientation m_orientation;   ///< whether to draw the plate horizontally or vertically
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/messagewidget.cpp #1312461:1312462
@@ -532,13 +532,13 @@
  * @param textHeight   height of the text
  * @param tr           Uml::TextRole of the text
  */
-void MessageWidget::constrainTextPos(int &textX, int &textY, int textWidth, int textHeight,
+void MessageWidget::constrainTextPos(UMLSceneValue &textX, UMLSceneValue &textY, UMLSceneValue textWidth, UMLSceneValue textHeight,
                                      Uml::TextRole tr)
 {
     textX = constrainX(textX, textWidth, tr);
     // Constrain Y.
-    const int minTextY = getMinY();
-    const int maxTextY = getMaxY() - textHeight - 5;
+    const UMLSceneValue minTextY = getMinY();
+    const UMLSceneValue maxTextY = getMaxY() - textHeight - 5;
     if (textY < minTextY)
         textY = minTextY;
     else if (textY > maxTextY)
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/messagewidget.h #1312461:1312462
@@ -72,7 +72,7 @@
     virtual UMLClassifier* seqNumAndOp(QString& seqNum, QString& op);
     virtual void setSeqNumAndOp(const QString &seqNum, const QString &op);
 
-    virtual void constrainTextPos(int &textX, int &textY, int textWidth, int textHeight,
+    virtual void constrainTextPos(UMLSceneValue &textX, UMLSceneValue &textY, UMLSceneValue textWidth, UMLSceneValue textHeight,
                                   Uml::TextRole tr);
 
     //---------- End LinkWidget Interface methods implemementation.
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.cpp #1312461:1312462
@@ -293,7 +293,7 @@
  * @param width  input value, may be modified by the constraint
  * @param height input value, may be modified by the constraint
  */
-void UMLWidget::constrain(int& width, int& height)
+void UMLWidget::constrain(UMLSceneValue& width, UMLSceneValue& height)
 {
     UMLSceneSize minSize = minimumSize();
     if (width < minSize.width())
@@ -1259,7 +1259,7 @@
  * If m_scene->snapComponentSizeToGrid() is true, then
  * set the next larger size that snaps to the grid.
  */
-void UMLWidget::setSize(int width, int height)
+void UMLWidget::setSize(UMLSceneValue width, UMLSceneValue height)
 {
     // snap to the next larger size that is a multiple of the grid
     if (!m_ignoreSnapComponentSizeToGrid
@@ -1284,9 +1284,9 @@
 {
     if (m_doc->loading())
         return;
-    QSize size = calculateSize();
-    int clipWidth = size.width();
-    int clipHeight = size.height();
+    UMLSceneSize size = calculateSize();
+    UMLSceneValue clipWidth = size.width();
+    UMLSceneValue clipHeight = size.height();
     constrain(clipWidth, clipHeight);
     setSize(clipWidth, clipHeight);
     adjustAssocs(x(), y());    // adjust assoc lines
@@ -1298,8 +1298,8 @@
  */
 void UMLWidget::clipSize()
 {
-    int clipWidth = width();
-    int clipHeight = height();
+    UMLSceneValue clipWidth = width();
+    UMLSceneValue clipHeight = height();
     constrain(clipWidth, clipHeight);
     setSize(clipWidth, clipHeight);
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.h #1312461:1312462
@@ -97,7 +97,7 @@
 
     virtual bool activate(IDChangeLog* ChangeLog = 0);
 
-    virtual int onWidget(const QPoint & p);
+    virtual UMLSceneValue onWidget(const UMLScenePoint & p);
 
     /**
      * Draws the UMLWidget on the given paint device
@@ -142,11 +142,11 @@
     /**
      * Returns the width of the widget.
      */
-    int width() const {
-        return UMLSceneRectItem::width();
+    UMLSceneValue width() const {
+        return UMLSceneRectItem::rect().width();
     }
 
-    void setSize(int width,int height);
+    void setSize(UMLSceneValue width,UMLSceneValue height);
 
     bool getIgnoreSnapToGrid() const;
     void setIgnoreSnapToGrid(bool to);




More information about the umbrello-devel mailing list