Bug 111241 - Ability to have guide lines always drawn when in 'x mouse zoom' or 'y mouse zoom'
Summary: Ability to have guide lines always drawn when in 'x mouse zoom' or 'y mouse z...
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-21 20:21 UTC by Matthew Truch
Modified: 2006-08-01 20:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2005-08-21 20:21:57 UTC
Version:           1.2.0_devel (using KDE KDE 3.4.0)
OS:                Linux

It would be convienient to have (as a configurable option, in Configure Kst) the guide lines that are drawn when you are in the process of a zoom in x mouse zoom or y mouse zoom to be drawn all the time when you are in one of those zoom modes, not just during an active zoom process.  

Motivation: I believe that most kst users use xy mouse zoom mode as the standard (default) operating mode, and only enter x or y zoom modes temporarily and through the shift of ctrl shortcuts.  Currently, in x or y zoom modes, as soon as you start a zoom a horizontal or vertical dotted line appears on the plot to indicate one of the new boundaries, and another one appears and follows the mouse to help the user better position the second boundary.  If the dotted line that follows the mouse always appears (and follows the mouse) when in x or y zoom mode, the user will be able to easily (and more accuratly) place both boundary points exactly where they want to, not just the second.

Desired behavior:  When in xy mouse mode, nothing changes from the current behavior.  When the user enters x mouse zoom (for example) the vertical dotted line that follows the mouse instantly appears.  The user can then accuratly place the first boundary point, click, and then set the second as in the current behavior.  As soon as the user returns to xy mouse zoom, the dotted line that follows the mouse disappears.
Comment 1 George Staikos 2005-10-11 04:32:23 UTC
Implemented in trunk, but still a bit buggy.  If you find any ways to cause artifacts, please report with a mechanism to reproduce it.
Comment 2 Matthew Truch 2006-06-16 20:10:26 UTC
I'm going to reopen this bug as one tiny part was not implimented.  Currently, the 'guidelines' are displayed when you enter X or Y zoom mode with the mouse menu (by clicking on the toolbar as appropriate), and when you use the function keys (F3 and F4), but *not* when you are in XY zoom mode and quickly enter X or Y zoom mode with the shift and ctrl keys.  It would be best if the guidelines were also displayed for the first step of zooming when shift or ctrl is pressed.  
Comment 3 Netterfield 2006-06-17 04:48:52 UTC
I agree: the guide lines should always be shown if you are in the mode, even if you are in it using a modifier key.
Comment 4 George Staikos 2006-08-01 13:54:02 UTC
SVN commit 568496 by staikos:

draw the guidelines when using the modifier keys too
FEATURE: 111241


 M  +37 -5     kst2dplot.cpp  
 M  +1 -0      kst2dplot.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #568495:568496
@@ -2392,10 +2392,13 @@
     }
 
     KstMouseModeType gzType = globalZoomType();
-    if (view && (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX)) {
-      if (GetPlotRegion().contains(_mouse.tracker)) {
+    if (view && GetPlotRegion().contains(_mouse.tracker)) {
+      if (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX) {
         updateXYGuideline(view, QPoint(-1, -1), view->mapFromGlobal(QCursor::pos()), GetPlotRegion(), gzType);
         _mouse.lastGuideline = view->mapFromGlobal(QCursor::pos());
+      } else if (gzType == XY_ZOOMBOX) {
+        updateXYGuideline(view, QPoint(-1, -1), view->mapFromGlobal(QCursor::pos()), GetPlotRegion(), gzType);
+        _mouse.lastGuideline = view->mapFromGlobal(QCursor::pos());
       }
     }
   }
@@ -3990,20 +3993,29 @@
   p.setRasterOp(Qt::NotROP);
   if (gzType == X_ZOOMBOX) {
     if (pr.contains(oldPos)) {
-      p.drawLine(oldPos.x(), pr.top(), oldPos.x(), pr.bottom());
+      if (_mouse.lastGuidelineType == X_ZOOMBOX) {
+        p.drawLine(oldPos.x(), pr.top(), oldPos.x(), pr.bottom());
+      } else if (_mouse.lastGuidelineType == Y_ZOOMBOX) {
+        p.drawLine(pr.left(), oldPos.y(), pr.right(), oldPos.y());
+      }
     }
     if (pr.contains(newPos)) {
       p.drawLine(newPos.x(), pr.top(), newPos.x(), pr.bottom());
     }
   } else {
     if (pr.contains(oldPos)) {
-      p.drawLine(pr.left(), oldPos.y(), pr.right(), oldPos.y());
+      if (_mouse.lastGuidelineType == X_ZOOMBOX) {
+        p.drawLine(oldPos.x(), pr.top(), oldPos.x(), pr.bottom());
+      } else if (_mouse.lastGuidelineType == Y_ZOOMBOX) {
+        p.drawLine(pr.left(), oldPos.y(), pr.right(), oldPos.y());
+      }
     }
     if (pr.contains(newPos)) {
       p.drawLine(pr.left(), newPos.y(), pr.right(), newPos.y());
     }
   }
   p.end();
+  _mouse.lastGuidelineType = gzType;
 }
 
 
@@ -4023,13 +4035,32 @@
   KstMouseModeType gzType = globalZoomType();
   // Draw a helper guide in X or Y zoom modes
   if (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX) {
-    if (e->state() == 0) {
+    ButtonState s = e->stateAfter();
+    if (s == 0) {
       updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, gzType);
       _mouse.lastGuideline = _mouse.tracker;
+    } else if (s & Qt::ShiftButton) {
+      updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, Y_ZOOMBOX);
+      _mouse.lastGuideline = _mouse.tracker;
+    } else if (s & Qt::ControlButton) {
+      updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, X_ZOOMBOX);
+      _mouse.lastGuideline = _mouse.tracker;
     } else {
       updateXYGuideline(view, _mouse.lastGuideline, QPoint(-1, -1), pr, gzType);
       _mouse.lastGuideline = QPoint(-1, -1);
     }
+  } else if (gzType == XY_ZOOMBOX) {
+      ButtonState s = e->stateAfter();
+    if (s & Qt::ShiftButton) {
+      updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, Y_ZOOMBOX);
+      _mouse.lastGuideline = _mouse.tracker;
+    } else if (s & Qt::ControlButton) {
+      updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, X_ZOOMBOX);
+      _mouse.lastGuideline = _mouse.tracker;
+    } else {
+      updateXYGuideline(view, _mouse.lastGuideline, QPoint(-1, -1), pr, gzType);
+      _mouse.lastGuideline = QPoint(-1, -1);
+    }
   }
 
   // Note: we have one report of a system where this clip region is invalid
@@ -4320,6 +4351,7 @@
   lastLocation = QPoint(-1, -1);
   tracker = QPoint(-1, -1);
   lastGuideline = QPoint(-1, -1);
+  lastGuidelineType = XY_ZOOMBOX;
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.h #568495:568496
@@ -73,6 +73,7 @@
   QPoint lastLocation, pressLocation;  // for zooming primarily
   QPoint tracker; // for tracking the mouse location
   QPoint lastGuideline; // for tracking the last guideline location
+  KstMouseModeType lastGuidelineType;
   QRect plotGeometry;
   bool zooming() const;
   void zoomStart(KstMouseModeType t, const QPoint& location);
Comment 5 Andrew Walker 2006-08-01 19:11:01 UTC
In XY zoom mode a horizontal guideline is left on a plot after any of the following:

XY zoom using only the mouse
Vertical zoom using the modifier key
Horizontal zoom using the modifier key
Comment 6 George Staikos 2006-08-01 20:31:14 UTC
File a new bug