Bug 122293 - drag 'n drop a class when the zoom is not 1:1 don't put the class under mouse cursor
Summary: drag 'n drop a class when the zoom is not 1:1 don't put the class under mouse...
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 112237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-19 17:22 UTC by Yan Morin
Modified: 2006-03-22 07:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yan Morin 2006-02-19 17:22:31 UTC
Version:           1.5.2 (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources

How to reproduce:
1. Select a zoom level that is not 1:1 (ex: 50%)
2. Drag'n'drop a class inside the class diagram area
3. Release the mouse button

Expected Behaviour:
The top-left corner should be in the same position as the cursor like or like in 1:1 zoom.
Comment 1 Yan Morin 2006-02-19 18:03:59 UTC
umlview.cpp

Maybe in: 
444 void UMLView::slotObjectCreated(UMLObject* o)
with m_Pos.x() or y.

Or in:
666 void UMLView::contentsDropEvent(QDropEvent *e) {
...
700     m_Pos = e->pos();
Comment 2 Yan Morin 2006-02-19 18:30:31 UTC
Index: umlview.cpp
===================================================================
--- umlview.cpp (revision 511314)
+++ umlview.cpp (working copy)
@@ -697,7 +697,7 @@
         return;
     }
     m_bCreateObject = true;
-    m_Pos = e->pos();
+    m_Pos = (e->pos() * 100 ) / m_nZoom;

     slotObjectCreated(o);

Comment 3 Oliver Kellogg 2006-02-26 23:41:48 UTC
SVN commit 513929 by okellogg:

Apply attachment
http://www.geeksoc.org/~jr/umbrello/uml-devel/att-9255/umbrello-isDatatype.patch
>From http://www.geeksoc.org/~jr/umbrello/uml-devel/9259.html

C++ isDatatype patch for typedef unsigned int/uint case
and fix for putting class under mouse cursor when diagram zoom is not 1:1 
Many thanks to Yan Morin <yansanmo.site_AT_gmail.com>
BUG:122293


 M  +1 -0      THANKS  
 M  +8 -1      umbrello/classparser/cpptree2uml.cpp  
 M  +7 -0      umbrello/import_utils.cpp  
 M  +5 -0      umbrello/import_utils.h  
 M  +1 -1      umbrello/umlview.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/THANKS #513928:513929
@@ -47,6 +47,7 @@
 martin <mv123q3 @hotmail.com>
 Rene Meyer <Rene.Meyer @sturmit.de>
 Laurent Montel <montel @kde.org>
+Yan Morin <yansanmo.site @gmail.com>
 Tom Morris <tfmorris @gmail.com>
 Lutz Mueller <lutz.mueller @gmx.de>
 Heiko Nardmann <heiko.nardmann @onlinehome.de>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classparser/cpptree2uml.cpp #513928:513929
@@ -144,7 +144,14 @@
 //#endif
             /* @todo Trace typedefs back to their root type for deciding
                      whether to build a Datatype (for pointers.)  */
-            if (type.contains('*')) {
+            /* check out if the ID type is a Datatype 
+               ex: typedef unsigned int uint; 
+               where unsigned int is a known datatype
+               I'm not sure if setIsReference() should be run
+             */
+            bool isDatatype = Import_Utils::isDatatype(typeId, m_currentNamespace[m_nsCnt]);
+
+            if (type.contains('*') || isDatatype) {
                 UMLObject *inner =
                 Import_Utils::createUMLObject( Uml::ot_Class, typeId,
                                              m_currentNamespace[m_nsCnt] );
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/import_utils.cpp #513928:513929
@@ -349,5 +349,12 @@
         incPathList.append(path);
 }
 
+
+bool isDatatype(QString name, UMLPackage *parentPkg) {
+    UMLDoc *umldoc = UMLApp::app()->getDocument();
+    UMLObject * o = umldoc->findUMLObject(name, Uml::ot_Datatype, parentPkg);
+    return (o!=NULL);
+}
+
 }  // end namespace Import_Utils
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/import_utils.h #513928:513929
@@ -134,6 +134,11 @@
      */
     bool newUMLObjectWasCreated();
 
+    /**
+     * Returns true if a type is an actual Datatype
+     */
+    bool isDatatype(QString name, UMLPackage *parentPkg = NULL);
+
 } // end namespace Import_Utils
 
 #endif
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.cpp #513928:513929
@@ -697,7 +697,7 @@
         return;
     }
     m_bCreateObject = true;
-    m_Pos = e->pos();
+    m_Pos = (e->pos() * 100 ) / m_nZoom;
 
     slotObjectCreated(o);
 
Comment 4 Oliver Kellogg 2006-03-22 07:50:23 UTC
*** Bug 112237 has been marked as a duplicate of this bug. ***