[Kst] extragear/graphics/kst/src/libkstapp
George Staikos
staikos at kde.org
Tue Aug 1 13:53:56 CEST 2006
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);
More information about the Kst
mailing list