[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Fri Aug 19 00:27:15 CEST 2005


SVN commit 450728 by rchern:

Fix handling of double click in temp. layout mode again

 M  +6 -0      kstgfxarrowmousehandler.cpp  
 M  +6 -0      kstgfxellipsemousehandler.cpp  
 M  +6 -0      kstgfxlinemousehandler.cpp  
 M  +2 -0      kstgfxmousehandler.cpp  
 M  +1 -0      kstgfxmousehandler.h  
 M  +7 -0      kstgfxpicturemousehandler.cpp  
 M  +6 -0      kstgfxrectanglemousehandler.cpp  
 M  +6 -0      kstgfxtextmousehandler.cpp  
 M  +0 -7      kstviewwidget.cpp  
 M  +0 -1      kstviewwidget.h  


--- trunk/extragear/graphics/kst/kst/kstgfxarrowmousehandler.cpp #450727:450728
@@ -69,6 +69,12 @@
   Q_UNUSED(shift)
   Q_UNUSED(pos)
       
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
+      
   // make a new _drawingArrow using defaults
   if (!_cancelled) {
     KstViewArrowPtr arrow = new KstViewArrow();
--- trunk/extragear/graphics/kst/kst/kstgfxellipsemousehandler.cpp #450727:450728
@@ -95,6 +95,12 @@
   Q_UNUSED(shift)
   Q_UNUSED(pos)
       
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
+      
   if (!_cancelled) {
     KstViewEllipsePtr ellipse = new KstViewEllipse();
     copyDefaults(KstViewObjectPtr(ellipse));
--- trunk/extragear/graphics/kst/kst/kstgfxlinemousehandler.cpp #450727:450728
@@ -70,6 +70,12 @@
   Q_UNUSED(pos)
   Q_UNUSED(shift)
   
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
+      
   if (!_cancelled) {
     // make a new arrow
     KstViewArrowPtr arrow = new KstViewArrow();
--- trunk/extragear/graphics/kst/kst/kstgfxmousehandler.cpp #450727:450728
@@ -26,6 +26,7 @@
   _top = top;
   _mouseOrigin = QPoint(-1,-1);
   _mouseMoved = false;
+  _mouseDown = false;
 }  
 
 
@@ -39,6 +40,7 @@
   _mouseOrigin = pos;  
   _mouseMoved = false;
   _cancelled = false;
+  _mouseDown = true;
 }
 
 
--- trunk/extragear/graphics/kst/kst/kstgfxmousehandler.h #450727:450728
@@ -50,6 +50,7 @@
     bool _mouseMoved;
     QRect _prevBand;
     bool _cancelled;
+    bool _mouseDown;
 };
 
 #endif
--- trunk/extragear/graphics/kst/kst/kstgfxpicturemousehandler.cpp #450727:450728
@@ -64,6 +64,13 @@
 void KstGfxPictureMouseHandler::releasePress(const QPoint& pos, bool shift) {
   Q_UNUSED(shift)
   Q_UNUSED(pos)
+      
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
+      
   // once released, create a picture and popup the edit dialog
   if (!_cancelled) {
     KstViewPicturePtr pic = new KstViewPicture();
--- trunk/extragear/graphics/kst/kst/kstgfxrectanglemousehandler.cpp #450727:450728
@@ -69,6 +69,12 @@
   Q_UNUSED(pos)
   Q_UNUSED(shift)
       
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
+      
   if (!_cancelled) {
     // make a new rectangle
     KstViewBoxPtr box = new KstViewBox();
--- trunk/extragear/graphics/kst/kst/kstgfxtextmousehandler.cpp #450727:450728
@@ -68,6 +68,12 @@
 void KstGfxTextMouseHandler::releasePress(const QPoint& pos, bool shift) {
   Q_UNUSED(shift)
   Q_UNUSED(pos)
+      
+  if (!_mouseDown) {
+    // if mouse was never down, pretend it wasn't released
+    return;
+  }
+  _mouseDown = false;
   
   // once released, create a new text object and popup the edit dialog
   if (!_cancelled) {
--- trunk/extragear/graphics/kst/kst/kstviewwidget.cpp #450727:450728
@@ -38,7 +38,6 @@
   setMinimumSize(40, 25);
   _vo_datamode = 0L;
   _lastViewMode = KstTopLevelView::LayoutMode;
-  _doubleClicking = false;
 }
 
 
@@ -229,7 +228,6 @@
 
 void KstViewWidget::mouseDoubleClickEvent(QMouseEvent *e) {
   //kdDebug() << "DoubleClick event. button=" << e->button() << " state=" << e->state() << endl;
-  _doubleClicking = true;
   if (_view->viewMode() == KstTopLevelView::DisplayMode) {
     KstViewObjectPtr vo;
     if (_view->mouseGrabbed()) {
@@ -276,11 +274,6 @@
 
 
 void KstViewWidget::mouseReleaseEvent(QMouseEvent *e) {
-  if (_doubleClicking) {
-    e->accept();
-    _doubleClicking = false;
-    return;  
-  }
   //kdDebug() << "Release event. button=" << e->button() << " state=" << e->state() << endl;
   if (_view->viewMode() == KstTopLevelView::DisplayMode) {
     KstViewObjectPtr vo;
--- trunk/extragear/graphics/kst/kst/kstviewwidget.h #450727:450728
@@ -73,7 +73,6 @@
     KPopupMenu *_menu;
     QDragObject *_drag;
     KstPaintType _nextUpdate;
-    bool _doubleClicking : 1;
 };
 
 #endif


More information about the Kst mailing list