[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri May 28 10:12:47 CEST 2004
CVS commit by staikos:
finally track down most of the mouse zoom handling issues. very tricky, and
I think this event handling code from KstView should be completely rethought.
I started refactoring some of it but it clearly isn't working too well.
M +42 -10 kst2dplot.cpp 1.36
M +0 -2 kstviewwidget.cpp 1.32
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.35:1.36
@@ -2199,5 +2199,9 @@ void Kst2DPlot::setCursorForMode(QWidget
break;
default:
+ if (GetPlotRegion().contains(view->mapFromGlobal(QCursor::pos()))) {
+ view->setCursor(QCursor(Qt::CrossCursor));
+ } else {
view->setCursor(QCursor(Qt::ArrowCursor));
+ }
break;
}
@@ -2207,9 +2211,20 @@ void Kst2DPlot::setCursorForMode(QWidget
void Kst2DPlot::keyReleaseEvent(QWidget *view, QKeyEvent *e) {
if (_mouse.zooming() || _mouse.mode == INACTIVE) {
- // FIXME: wrong
if (_mouse.mode != INACTIVE) {
- KstMouseModeType newType = XY_ZOOMBOX;
- zoomRectUpdate(view, newType, _mouse.lastLocation.x(), _mouse.lastLocation.y());
- _mouse.mode = newType;
+ KstMouseModeType newType = XY_ZOOMBOX; // FIXME: wrong
+ QPoint newp = _mouse.lastLocation;
+
+ QPainter p;
+ p.begin(view);
+ p.setRasterOp(Qt::NotROP);
+ if (_mouse.rectBigEnough()) {
+ p.drawWinFocusRect(_mouse.mouseRect());
+ }
+
+ _mouse.zoomUpdate(newType, newp);
+ if (_mouse.rectBigEnough()) {
+ p.drawWinFocusRect(_mouse.mouseRect());
+ }
+ p.end();
}
setCursorForMode(view);
@@ -2232,13 +2247,30 @@ void Kst2DPlot::keyPressEvent(QWidget *v
newType = XY_ZOOMBOX;
}
- zoomRectUpdate(view, newType, _mouse.lastLocation.x(), _mouse.lastLocation.y());
- _mouse.mode = newType;
if (e->key() == Qt::Key_Escape) {
- zoomRectUpdate(view, INACTIVE, _mouse.lastLocation.x(), _mouse.lastLocation.y());
+ if (_mouse.rectBigEnough()) {
+ QPainter p;
+ p.begin(view);
+ p.setRasterOp(Qt::NotROP);
+ p.drawWinFocusRect(_mouse.mouseRect());
+ p.end();
+ }
+
_mouse.mode = INACTIVE;
} else {
- e->ignore();
- return;
+ QPoint newp = _mouse.lastLocation;
+
+ QPainter p;
+ p.begin(view);
+ p.setRasterOp(Qt::NotROP);
+ if (_mouse.rectBigEnough()) {
+ p.drawWinFocusRect(_mouse.mouseRect());
+ }
+
+ _mouse.zoomUpdate(newType, newp);
+ if (_mouse.rectBigEnough()) {
+ p.drawWinFocusRect(_mouse.mouseRect());
+ }
+ p.end();
}
setCursorForMode(view);
--- kdeextragear-2/kst/kst/kstviewwidget.cpp #1.31:1.32
@@ -330,5 +330,4 @@ void KstViewWidget::keyPressEvent(QKeyEv
void KstViewWidget::keyReleaseEvent(QKeyEvent *e) {
if (_view->viewMode() == KstTopLevelView::DisplayMode) {
-kdDebug() << "Key release " << endl;
KstViewObjectPtr vo;
// Note: should mouse grabbers get keyboard input?
@@ -339,5 +338,4 @@ kdDebug() << "Key release " << endl;
}
if (vo) {
-kdDebug() << "SENDING IT" << endl;
vo->keyReleaseEvent(this, e);
}
More information about the Kst
mailing list