[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/kolourpaint/tools/selection
From:       Clarence Dang <dang () kde ! org>
Date:       2006-11-26 7:26:26
Message-ID: 1164525986.664517.10233.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 607890 by dang:

Restore accidental drag detection for text box creation:
* Use "accidentalDragAdjustedPoint" (formerly called "thisPoint") instead of "currentPoint()".

Broken by:

r606478 | dang | 2006-11-21 02:08:22 +1100 (Tue, 21 Nov 2006) | 2 lines
Changed paths:
   M /trunk/KDE/kdegraphics/kolourpaint/tools/selection/kptooltext.cpp
   M /trunk/KDE/kdegraphics/kolourpaint/tools/selection/kptooltext.h

Split some code out of kpToolText::createMoreSelectionAndUpdateStatusBar() into shouldCreate()




 M  +9 -5      kptooltext.cpp  
 M  +2 -1      kptooltext.h  


--- trunk/KDE/kdegraphics/kolourpaint/tools/selection/kptooltext.cpp #607889:607890
@@ -275,10 +275,11 @@
 }
 
 // private
-bool kpToolText::shouldCreate (const kpTextStyle &textStyle,
+bool kpToolText::shouldCreate (const QPoint &accidentalDragAdjustedPoint,
+        const kpTextStyle &textStyle,
         int *minimumWidthOut, int *minimumHeightOut)
 {
-    if (m_dragHasBegun || currentPoint () != startPoint ())
+    if (m_dragHasBegun || accidentalDragAdjustedPoint != startPoint ())
     {
     #if DEBUG_KP_TOOL_TEXT && 1
         kDebug () << "\tdrag creating text box" << endl;
@@ -313,7 +314,7 @@
     // Calculate suggested width.
     *minimumWidthOut = calcClickCreateDimension (
         startPoint ().x (),
-            currentPoint ().x (),
+            accidentalDragAdjustedPoint.x (),
         kpSelection::preferredMinimumWidthForTextStyle (textStyle),
             kpSelection::minimumWidthForTextStyle (textStyle),
         document ()->width ());
@@ -321,7 +322,7 @@
     // Calculate suggested height.
     *minimumHeightOut = calcClickCreateDimension (
         startPoint ().y (),
-            currentPoint ().y (),
+            accidentalDragAdjustedPoint.y (),
         kpSelection::preferredMinimumHeightForTextStyle (textStyle),
             kpSelection::minimumHeightForTextStyle (textStyle),
         document ()->height ());
@@ -347,8 +348,11 @@
 
     // (will set both variables)
     int minimumWidth = 0, minimumHeight = 0;
-    if (!shouldCreate (textStyle, &minimumWidth, &minimumHeight))
+    if (!shouldCreate (accidentalDragAdjustedPoint, textStyle,
+            &minimumWidth, &minimumHeight))
+    {
         return;
+    }
 
 
     // Make sure the dragged out rectangle is of the minimum width we just
--- trunk/KDE/kdegraphics/kolourpaint/tools/selection/kptooltext.h #607889:607890
@@ -127,7 +127,8 @@
     int calcClickCreateDimension (int mouseStart, int mouseEnd,
         int preferredMin, int smallestMin,
         int docSize);
-    bool shouldCreate (const kpTextStyle &textStyle,
+    bool shouldCreate (const QPoint &accidentalDragAdjustedPoint,
+        const kpTextStyle &textStyle,
         int *minimumWidthOut, int *minimumHeightOut);
 protected:
     virtual void createMoreSelectionAndUpdateStatusBar (
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic