[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri Sep 12 00:17:37 CEST 2003


CVS commit by staikos: 

Shift and Ctrl should not override label mode


  M +19 -15    kstmouse.cpp   1.8


--- kdeextragear-2/kst/kst/kstmouse.cpp  #1.7:1.8
@@ -59,5 +59,7 @@ KstMouse::KstMouse(KstView *view) {
 
   /* build VResizeCursor */
-  for (i=0; i<32; i++) resize_bits[i] = 0;
+  for (i = 0; i < 32; i++) {
+    resize_bits[i] = 0;
+  }
   resize_bits[16] = 0x7f;
   resize_bits[17] = 0xff;
@@ -136,5 +138,5 @@ void KstMouse::unsetZoom() {
 
 QRect KstMouse::getMouseRect() {
-  int x1,x2,y1,y2,t;
+  int x1, x2, y1, y2;
 
   x1 = PressLocation.x();
@@ -146,5 +148,5 @@ QRect KstMouse::getMouseRect() {
     x2++;
   } else if (x1 > x2) {
-    t = x1; x1 = x2; x2 = t;
+    int t = x1; x1 = x2; x2 = t;
   }
 
@@ -152,5 +154,5 @@ QRect KstMouse::getMouseRect() {
     y2++;
   } else if (y1 > y2) {
-    t = y1; y1 = y2; y2 = t;
+    int t = y1; y1 = y2; y2 = t;
   }
 
@@ -169,5 +171,10 @@ void KstMouse::DrawBox(QPainter &p) {
 void KstMouse::mousePressedInPlot(const QMouseEvent *e,
                                   const QRect &plot_rect) {
-  if (e->state() & Qt::ShiftButton) {
+  int mzr = _view->ParentApp->getMouseZoomRadio();
+
+  if (mzr == LABEL_TOOL) {
+    setMode(LABEL_TOOL);
+    setPressLocation(e->pos());
+  } else if (e->state() & Qt::ShiftButton) {
     setMode(Y_ZOOMBOX);
     setPressLocation(QPoint(plot_rect.left()+1, e->y()));
@@ -176,5 +183,5 @@ void KstMouse::mousePressedInPlot(const 
     setPressLocation(QPoint(e->x(), plot_rect.top()+1));
   } else {
-    switch (_view->ParentApp->getMouseZoomRadio()) {
+    switch (mzr) {
         case Y_ZOOMBOX:
           setMode(Y_ZOOMBOX);
@@ -185,8 +192,4 @@ void KstMouse::mousePressedInPlot(const 
           setPressLocation(QPoint(e->x(), plot_rect.top()+1));
           break;
-        case LABEL_TOOL:
-          setMode(LABEL_TOOL);
-          setPressLocation(e->pos());
-          break;
         default:
           setMode(XY_ZOOMBOX);
@@ -209,6 +212,9 @@ void KstMouse::setCursor(bool in_plot, c
 
 void KstMouse::setCursor(bool in_plot, Qt::ButtonState state) {
+  int mzr = _view->ParentApp->getMouseZoomRadio();
   if (in_plot) {
-    if (getMode() == X_ZOOMBOX) {
+    if (mzr == LABEL_TOOL) {
+      _view->setCursor(*IBeamCursor);
+    } else if (getMode() == X_ZOOMBOX) {
       _view->setCursor(*HResizeCursor);
     } else if (getMode() == Y_ZOOMBOX) {
@@ -218,10 +224,8 @@ void KstMouse::setCursor(bool in_plot, Q
     } else if (state & Qt::ControlButton) {
       _view->setCursor(*HResizeCursor);
-    } else if (_view->ParentApp->getMouseZoomRadio() == X_ZOOMBOX) {
+    } else if (mzr == X_ZOOMBOX) {
       _view->setCursor(*HResizeCursor);
-    } else if (_view->ParentApp->getMouseZoomRadio() == Y_ZOOMBOX) {
+    } else if (mzr == Y_ZOOMBOX) {
       _view->setCursor(*VResizeCursor);
-    } else if (_view->ParentApp->getMouseZoomRadio() == LABEL_TOOL) {
-      _view->setCursor(*IBeamCursor);
     } else {
       _view->setCursor(*CrossCursor);




More information about the Kst mailing list