[Uml-devel] kdesdk/umbrello/umbrello

Klas Kalass klas.kalass at gmx.de
Wed Mar 19 06:05:08 UTC 2003


CVS commit by kalass: 

not all umlwidgets should snap size and position to grid, 
for messages it does not make sense to do so and results in bad rendering
results.

disabled snap feature for messages


  M +2 -0      messagewidget.cpp   1.5
  M +7 -3      umlwidget.cpp   1.21
  M +6 -0      umlwidget.h   1.6


--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.4:1.5
@@ -51,4 +51,6 @@ MessageWidget::MessageWidget(UMLView * v
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 void MessageWidget::init() {
+        m_bIgnoreSnapToGrid = true;
+        m_bIgnoreSnapComponentSizeToGrid = true;
         m_pWA = m_pWB = m_pFText = 0;
         m_nY = 0;

--- kdesdk/umbrello/umbrello/umlwidget.cpp  #1.20:1.21
@@ -255,4 +255,6 @@ void UMLWidget::init() {
         m_bShiftPressed = false;
         m_bActivated = false;
+        m_bIgnoreSnapToGrid = false;
+        m_bIgnoreSnapComponentSizeToGrid = false;
         m_nPressOffsetX = m_nPressOffsetY = 0;
         m_pMenu = 0;
@@ -636,5 +638,5 @@ void UMLWidget::setView(UMLView * v) {
 void UMLWidget::setX( int x ) {
         m_pData -> setX( x );
-        if( m_pView -> getSnapToGrid() ) {
+        if( !m_bIgnoreSnapToGrid && m_pView -> getSnapToGrid() ) {
                 int gridX = m_pView -> getSnapX();
 
@@ -649,5 +651,5 @@ void UMLWidget::setX( int x ) {
 void UMLWidget::setY( int y ) {
         m_pData -> setY( y );
-        if( m_pView -> getSnapToGrid() ) {
+        if( !m_bIgnoreSnapToGrid && m_pView -> getSnapToGrid() ) {
                 int gridY = m_pView -> getSnapY();
                 int modY = m_pData -> getY() % gridY;
@@ -695,5 +697,7 @@ bool UMLWidget::widgetHasUMLObject(Uml::
 void UMLWidget::setSize(int width,int height) {
         // snap to the next larger size that is a multiple of the grid
-        if (m_pView -> getSnapComponentSizeToGrid() ) {
+        if (!m_bIgnoreSnapComponentSizeToGrid 
+            && m_pView -> getSnapComponentSizeToGrid() )
+        {
                 // integer divisions
                 int numX = width / m_pView->getSnapX();

--- kdesdk/umbrello/umbrello/umlwidget.h  #1.5:1.6
@@ -524,4 +524,10 @@ protected:
         QString m_Name;
 
+        /**
+         * Change Widget Behaviour
+         */
+        bool m_bIgnoreSnapToGrid;
+        bool m_bIgnoreSnapComponentSizeToGrid;
+
 public slots:
 






More information about the umbrello-devel mailing list