[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri May 28 19:06:13 CEST 2004
CVS commit by staikos:
- add log scale support back
- respond to key press, not release, for actions
M +62 -42 kst2dplot.cpp 1.40
M +2 -0 kst2dplot.h 1.18
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.39:1.40
@@ -2226,37 +2226,4 @@ void Kst2DPlot::setCursorForMode(QWidget
void Kst2DPlot::keyReleaseEvent(QWidget *view, QKeyEvent *e) {
- bool handled = true;
- switch (e->key()) {
- case Key_A:
- setYScaleMode(AC);
- pushScale();
- static_cast<KstViewWidget*>(view)->paint();
- break;
- case Key_M:
- setXScaleMode(AUTO);
- setYScaleMode(AUTO);
- pushScale();
- static_cast<KstViewWidget*>(view)->paint();
- break;
- case Key_R:
- if (popScale()) {
- static_cast<KstViewWidget*>(view)->paint();
- }
- break;
- case Key_S:
- setXScaleMode(NOSPIKE);
- setYScaleMode(NOSPIKE);
- pushScale();
- static_cast<KstViewWidget*>(view)->paint();
- break;
- default:
- handled = false;
- }
-
- if (handled) {
- e->accept();
- return;
- }
-
if (_mouse.zooming() || _mouse.mode == INACTIVE) {
if (_mouse.mode != INACTIVE) {
@@ -2304,5 +2271,66 @@ void Kst2DPlot::keyReleaseEvent(QWidget
+void Kst2DPlot::cancelZoom(QWidget *view) {
+ if (_mouse.rectBigEnough()) {
+ QPainter p;
+ p.begin(view);
+ p.setRasterOp(Qt::NotROP);
+ p.drawWinFocusRect(_mouse.mouseRect());
+ p.end();
+ }
+
+ _mouse.mode = INACTIVE;
+}
+
+
void Kst2DPlot::keyPressEvent(QWidget *view, QKeyEvent *e) {
+ bool handled = true;
+ switch (e->key()) {
+ case Key_A:
+ setYScaleMode(AC);
+ pushScale();
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ break;
+ case Key_G: // X Log
+ setLog(!isXLog(), isYLog());
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ break;
+ case Key_L: // Y Log
+ setLog(isXLog(), !isYLog());
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ break;
+ case Key_M:
+ setXScaleMode(AUTO);
+ setYScaleMode(AUTO);
+ pushScale();
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ break;
+ case Key_R:
+ if (popScale()) {
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ }
+ break;
+ case Key_S:
+ setXScaleMode(NOSPIKE);
+ setYScaleMode(NOSPIKE);
+ pushScale();
+ cancelZoom(view);
+ static_cast<KstViewWidget*>(view)->paint();
+ break;
+ default:
+ handled = false;
+ break;
+ }
+
+ if (handled) {
+ e->accept();
+ return;
+ }
+
ButtonState s = e->stateAfter();
if (_mouse.zooming()) {
@@ -2318,13 +2346,5 @@ void Kst2DPlot::keyPressEvent(QWidget *v
if (e->key() == Qt::Key_Escape) {
- if (_mouse.rectBigEnough()) {
- QPainter p;
- p.begin(view);
- p.setRasterOp(Qt::NotROP);
- p.drawWinFocusRect(_mouse.mouseRect());
- p.end();
- }
-
- _mouse.mode = INACTIVE;
+ cancelZoom(view);
} else {
QPoint newp = _mouse.lastLocation;
--- kdeextragear-2/kst/kst/kst2dplot.h #1.17:1.18
@@ -152,4 +152,6 @@ public:
virtual void keyReleaseEvent(QWidget *view, QKeyEvent *e);
+ void cancelZoom(QWidget *view);
+
public slots:
virtual void edit();
More information about the Kst
mailing list