[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Thu Mar 1 19:23:05 CET 2007


SVN commit 638366 by treat:

* kMin/kMax -> qMin/qMax


 M  +1 -1      emailthread.cpp  
 M  +7 -7      kst2dplot.cpp  
 M  +3 -3      kstborderedviewobject.cpp  
 M  +2 -2      kstdatacollection-gui.cpp  
 M  +1 -1      ksteventmonitorentry.cpp  
 M  +16 -16    kstgfxmousehandlerutils.cpp  
 M  +8 -8      ksttoplevelview.cpp  
 M  +1 -1      kstviewbox.cpp  
 M  +1 -1      kstviewellipse.cpp  
 M  +2 -2      kstviewlabel.cpp  
 M  +3 -3      kstviewlegend.cpp  
 M  +4 -4      kstviewline.cpp  
 M  +2 -2      kstviewobject.cpp  
 M  +1 -1      kstviewpicture.cpp  
 M  +8 -8      labelrenderer.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/emailthread.cpp #638365:638366
@@ -174,7 +174,7 @@
 {
   Q_UNUSED(job)
 
-  int chunkSize = kMin(_bodyLength - _bodyOffset, uint(0x8000));
+  int chunkSize = qMin(_bodyLength - _bodyOffset, uint(0x8000));
 
   if (chunkSize > 0) {
     array.duplicate(_strBody.data() + _bodyOffset, chunkSize);
--- branches/work/kst/portto4/kst/src/libkstapp/kst2dplot.cpp #638365:638366
@@ -1932,8 +1932,8 @@
     tick_label->setText(strTmp);
     QSize lsize = tick_label->size();
 
-    tp.maxWidth = kMax(tp.maxWidth, double(lsize.width()));
-    tp.maxHeight = kMax(tp.maxHeight, double(lsize.height()));
+    tp.maxWidth = qMax(tp.maxWidth, double(lsize.width()));
+    tp.maxHeight = qMax(tp.maxHeight, double(lsize.height()));
     if (strTmp == strTmpOld) {
       bDuplicate = true;
     } else {
@@ -1969,8 +1969,8 @@
 
       // update the max height and width of opposite labels
       QSize lsize = tick_label->size();
-      tp.oppMaxWidth = kMax(tp.oppMaxWidth, double(lsize.width()));
-      tp.oppMaxHeight = kMax(tp.oppMaxHeight, double(lsize.height()));
+      tp.oppMaxWidth = qMax(tp.oppMaxWidth, double(lsize.width()));
+      tp.oppMaxHeight = qMax(tp.oppMaxHeight, double(lsize.height()));
     }
   }
 
@@ -1999,8 +1999,8 @@
       tp.labels.append(strTmp);
       tick_label->setText(strTmp);
       QSize lsize = tick_label->size();
-      tp.maxWidth = kMax(tp.maxWidth, double(lsize.width()));
-      tp.maxHeight = kMax(tp.maxHeight, double(lsize.height()));
+      tp.maxWidth = qMax(tp.maxWidth, double(lsize.width()));
+      tp.maxHeight = qMax(tp.maxHeight, double(lsize.height()));
     }
   }
 }
@@ -4405,7 +4405,7 @@
 
 
 QRect KstMouse::mouseRect() const {
-  QRect rc = QRect(kMin(pressLocation.x(), lastLocation.x()), kMin(pressLocation.y(), lastLocation.y()), QABS(pressLocation.x() - lastLocation.x()), QABS(pressLocation.y() - lastLocation.y()));
+  QRect rc = QRect(qMin(pressLocation.x(), lastLocation.x()), qMin(pressLocation.y(), lastLocation.y()), QABS(pressLocation.x() - lastLocation.x()), QABS(pressLocation.y() - lastLocation.y()));
   switch (mode) {
     case X_ZOOMBOX:
       rc.setTop(plotGeometry.top());
--- branches/work/kst/portto4/kst/src/libkstapp/kstborderedviewobject.cpp #638365:638366
@@ -123,7 +123,7 @@
 
 
 void KstBorderedViewObject::setBorderWidth(int w) {
-  int mw = kMax(0, w);
+  int mw = qMax(0, w);
   if (_borderWidth != mw) {
     _borderWidth = mw;
     setDirty();
@@ -137,7 +137,7 @@
 
 
 void KstBorderedViewObject::setMargin(int w) {
-  int mm = kMax(0, w);
+  int mm = qMax(0, w);
   if (_margin != mm) {
     _margin = mm;
     setDirty();
@@ -151,7 +151,7 @@
 
 
 void KstBorderedViewObject::setPadding(int p) {
-  int mp = kMax(0, p);
+  int mp = qMax(0, p);
   if (_padding != mp) {
     _padding = mp;
     setDirty();
--- branches/work/kst/portto4/kst/src/libkstapp/kstdatacollection-gui.cpp #638365:638366
@@ -123,7 +123,7 @@
   register int modval;
   QString saving = i18n("Saving vector %1").arg(v->tagName());
 
-  modval = kMax(vSize/100, 100);
+  modval = qMax(vSize/100, 100);
 
   QString ltxt = "; " + v->tagName() + '\n';
   f->writeBlock(ltxt.ascii(), ltxt.length());
@@ -174,7 +174,7 @@
   }
 
   QString saving = i18n("Saving vectors...");
-  register int modval = kMax(maxlen/100, 100);
+  register int modval = qMax(maxlen/100, 100);
   app->slotUpdateProgress(maxlen, 0, QString::null);
 
   bool first = true;
--- branches/work/kst/portto4/kst/src/libkstapp/ksteventmonitorentry.cpp #638365:638366
@@ -200,7 +200,7 @@
   int ns = 1;
 
   for (KstVectorMap::ConstIterator i = _vectorsUsed.begin(); i != _vectorsUsed.end(); ++i) {
-    ns = kMax(ns, i.data()->length());
+    ns = qMax(ns, i.data()->length());
   }
 
   double *rawValuesX = 0L;
--- branches/work/kst/portto4/kst/src/libkstapp/kstgfxmousehandlerutils.cpp #638365:638366
@@ -31,24 +31,24 @@
   
   if (fromPoint.y() == toPoint.y()) {
     npos.setY(fromPoint.y());
-    npos.setX(kMax(npos.x(), bounds.left()));
-    npos.setX(kMin(npos.x(), bounds.right()));
+    npos.setX(qMax(npos.x(), bounds.left()));
+    npos.setX(qMin(npos.x(), bounds.right()));
   } else if (fromPoint.x() == toPoint.x()) {
     npos.setX(fromPoint.x());
-    npos.setY(kMax(npos.y(), bounds.top()));
-    npos.setY(kMin(npos.y(), bounds.bottom()));
+    npos.setY(qMax(npos.y(), bounds.top()));
+    npos.setY(qMin(npos.y(), bounds.bottom()));
   } else {
     double newxpos, newypos;
     double slope = double(toPoint.y() - fromPoint.y()) / double(toPoint.x() - fromPoint.x());
 
     newxpos = (double(pos.y()) + slope*double(fromPoint.x()) + double(pos.x())/slope -double(fromPoint.y())) / (slope + 1.0/slope); //we want the tip of our new line to be as close as possible to the original line (while still maintaining aspect). 
 
-    newxpos = kMin(newxpos, double(bounds.right())); //ensure that our x is inside the bounds.
-    newxpos = kMax(newxpos, double(bounds.left())); // ""
+    newxpos = qMin(newxpos, double(bounds.right())); //ensure that our x is inside the bounds.
+    newxpos = qMax(newxpos, double(bounds.left())); // ""
     newypos = slope*(newxpos - double(fromPoint.x())) + double(fromPoint.y()); //consistency w/ x.
 
-    newypos = kMin(newypos, double(bounds.bottom())); //ensure that our y is inside the bounds.
-    newypos = kMax(newypos, double(bounds.top())); // ""*/
+    newypos = qMin(newypos, double(bounds.bottom())); //ensure that our y is inside the bounds.
+    newypos = qMax(newypos, double(bounds.top())); // ""*/
     newxpos = double(fromPoint.x()) + (newypos - double(fromPoint.y()))/slope; // x will still be inside the bounds because we have just moved newypos closer to fromPoint.y(), which will send newxpos closer to fromPoint.x(), ie. in the direction further 'into' the bounds.
 
     npos.setX(int(newxpos));
@@ -85,11 +85,11 @@
   newHalfHeight = abs((pos - anchorPoint).y());
 
   if (maintainAspect) {
-    newHalfWidth = kMin(newHalfWidth,anchorPoint.x() - bounds.left());
-    newHalfWidth = kMin(newHalfWidth,bounds.right() - anchorPoint.x());
+    newHalfWidth = qMin(newHalfWidth,anchorPoint.x() - bounds.left());
+    newHalfWidth = qMin(newHalfWidth,bounds.right() - anchorPoint.x());
 
-    newHalfHeight = kMin(newHalfHeight,anchorPoint.y() - bounds.top());
-    newHalfHeight = kMin(newHalfHeight,bounds.bottom() - anchorPoint.y());
+    newHalfHeight = qMin(newHalfHeight,anchorPoint.y() - bounds.top());
+    newHalfHeight = qMin(newHalfHeight,bounds.bottom() - anchorPoint.y());
 
     QSize newSize(originalRect.size());
     newSize.scale(2*newHalfWidth,2*newHalfHeight,QSize::ScaleMin);
@@ -115,8 +115,8 @@
       if (maintainAspect) {
         double newHalfHeight = originalSize.height() * (abs(newWidth) + 1) / originalSize.width() / 2.0; //defined with the QRect convention (height = bot - top + 1)
 
-        newHalfHeight = kMin(double(movePoint.y() - bounds.top()) + 1, newHalfHeight); // ensure we are still within the bounds.
-        newHalfHeight = kMin(double(bounds.bottom() - movePoint.y()) + 1, newHalfHeight);
+        newHalfHeight = qMin(double(movePoint.y() - bounds.top()) + 1, newHalfHeight); // ensure we are still within the bounds.
+        newHalfHeight = qMin(double(bounds.bottom() - movePoint.y()) + 1, newHalfHeight);
 
         if (newWidth == 0) { // anything better to be done?
           newWidth = 1;
@@ -138,8 +138,8 @@
       if (maintainAspect) {
         double newHalfWidth = originalSize.width() * (abs(newHeight) + 1) / originalSize.height() / 2.0;
 
-        newHalfWidth = kMin(double(movePoint.x() - bounds.left() + 1), newHalfWidth);
-        newHalfWidth = kMin(double(bounds.right() - movePoint.x() + 1), newHalfWidth);
+        newHalfWidth = qMin(double(movePoint.x() - bounds.left() + 1), newHalfWidth);
+        newHalfWidth = qMin(double(bounds.right() - movePoint.x() + 1), newHalfWidth);
 
         if (newHeight == 0) {
           newHeight = 1;
--- branches/work/kst/portto4/kst/src/libkstapp/ksttoplevelview.cpp #638365:638366
@@ -409,10 +409,10 @@
 
   anchor_pt = move_pt = originalSize.center();
 
-  npos.setX(kMax(npos.x(), bounds.left()));
-  npos.setX(kMin(npos.x(), bounds.right()));
-  npos.setY(kMin(npos.y(), bounds.bottom()));
-  npos.setY(kMax(npos.y(), bounds.top()));
+  npos.setX(qMax(npos.x(), bounds.left()));
+  npos.setX(qMin(npos.x(), bounds.right()));
+  npos.setY(qMin(npos.y(), bounds.bottom()));
+  npos.setY(qMax(npos.y(), bounds.top()));
 
   if ((direction & UP) != 0) {
     move_pt.setY(originalSize.top());
@@ -442,10 +442,10 @@
 QRect KstTopLevelView::newSizeCentered(const QRect& oldSize, const QRect& bounds, const QPoint& pos, bool maintainAspect) {
   QPoint npos = pos;
 
-  npos.setX(kMax(npos.x(), bounds.left()));
-  npos.setX(kMin(npos.x(), bounds.right()));
-  npos.setY(kMin(npos.y(), bounds.bottom()));
-  npos.setY(kMax(npos.y(), bounds.top()));
+  npos.setX(qMax(npos.x(), bounds.left()));
+  npos.setX(qMin(npos.x(), bounds.right()));
+  npos.setY(qMin(npos.y(), bounds.bottom()));
+  npos.setY(qMax(npos.y(), bounds.top()));
 
   return KstGfxMouseHandlerUtils::resizeRectFromCornerCentered(oldSize, npos, bounds, maintainAspect);
 }
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewbox.cpp #638365:638366
@@ -227,7 +227,7 @@
 
 
 void KstViewBox::setBorderWidth(int w) {
-  int mw = kMax(0, w);
+  int mw = qMax(0, w);
   if (_borderWidth != mw) {
     _borderWidth = mw;
     setDirty();
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewellipse.cpp #638365:638366
@@ -131,7 +131,7 @@
 
 void KstViewEllipse::setBorderWidth(int width) {
   if (_borderWidth != width) {
-    _borderWidth = kMax(0, width);
+    _borderWidth = qMax(0, width);
     setDirty();
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewlabel.cpp #638365:638366
@@ -499,7 +499,7 @@
     computeTextSize(_parsed);
   }
  
-  QSize sz(kMax(1, _textWidth), kMax(1, _textHeight));
+  QSize sz(qMax(1, _textWidth), qMax(1, _textHeight));
 
   if (int(_rotation) != 0 && int(_rotation) != 180) {
     Q3PointArray pts(4);
@@ -771,7 +771,7 @@
 }
 
 void KstViewLabel::setLabelMargin(int margin) {
-  int mm = kMax(0, margin);
+  int mm = qMax(0, margin);
   if (mm != _labelMargin) {
     _labelMargin = mm;
     setDirty();
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewlegend.cpp #638365:638366
@@ -474,13 +474,13 @@
 
   int width, height;
   if (_vertical) {
-    width = kMax(_textWidth + 9*_ascent/2, _titleWidth);
+    width = qMax(_textWidth + 9*_ascent/2, _titleWidth);
     height = _textHeight;
     if (_titleHeight > 0) {
       height += _titleHeight;
     }
   } else {
-    height = kMax(_textHeight, _titleHeight);
+    height = qMax(_textHeight, _titleHeight);
 
     if (_titleWidth > 0) {
       width = _titleWidth + _textWidth + 9*_ascent*_curves.count()/2;
@@ -732,7 +732,7 @@
 
 
 void KstViewLegend::setLegendMargin(int margin) {
-  int mm = kMax(0, margin);
+  int mm = qMax(0, margin);
   if (_legendMargin != mm) {
     _legendMargin = mm;
     setDirty();
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewline.cpp #638365:638366
@@ -285,21 +285,21 @@
     if (_from.y() < _to.y()) {
       _orientation = DownRight;  
       KstViewObject::move(_from);
-      KstViewObject::resize(QSize(kMax(_width, _to.x() - _from.x() + 1), kMax(_width, _to.y() - _from.y() + 1)));
+      KstViewObject::resize(QSize(qMax(_width, _to.x() - _from.x() + 1), qMax(_width, _to.y() - _from.y() + 1)));
     } else {
       _orientation = UpRight;  
       KstViewObject::move(QPoint(_from.x(), _to.y()));
-      KstViewObject::resize(QSize(kMax(_width, _to.x() - _from.x() + 1), kMax(_width, _from.y() - _to.y() + 1)));
+      KstViewObject::resize(QSize(qMax(_width, _to.x() - _from.x() + 1), qMax(_width, _from.y() - _to.y() + 1)));
     }
   } else {
     if (_from.y() < _to.y()) {
       _orientation = DownLeft;  
       KstViewObject::move(QPoint(_to.x(), _from.y()));
-      KstViewObject::resize(QSize(kMax(_width, _from.x() - _to.x() + 1), kMax(_width, _to.y() - _from.y() + 1)));
+      KstViewObject::resize(QSize(qMax(_width, _from.x() - _to.x() + 1), qMax(_width, _to.y() - _from.y() + 1)));
     } else {
       _orientation = UpLeft;  
       KstViewObject::move(_to);
-      KstViewObject::resize(QSize(kMax(_width, _from.x() - _to.x() + 1), kMax(_width, _from.y() - _to.y() + 1)));
+      KstViewObject::resize(QSize(qMax(_width, _from.x() - _to.x() + 1), qMax(_width, _from.y() - _to.y() + 1)));
     }
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewobject.cpp #638365:638366
@@ -738,13 +738,13 @@
 
   if (!_onGrid) {
     _onGrid = true;
-    _columns = kMax(1, cols);
+    _columns = qMax(1, cols);
   } else {
     if (cols > 0) {
       _columns = cols;
       assert(_columns > 0);
     } else if (cols <= 0){
-      _columns = kMax(1, int(sqrt(cnt)));
+      _columns = qMax(1, int(sqrt(cnt)));
     }
   }
 
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewpicture.cpp #638365:638366
@@ -264,7 +264,7 @@
 
 
 void KstViewPicture::setRefreshTimer(int seconds) {
-  _refresh = kMax(0, seconds);
+  _refresh = qMax(0, seconds);
   if (_refresh) {
     if (!_timer) {
       _timer = new QTimer(this);
--- branches/work/kst/portto4/kst/src/libkstapp/labelrenderer.cpp #638365:638366
@@ -131,13 +131,13 @@
                     if (rc.p) {
                       rc.p->drawText(rc.x, rc.y, txt);
                     } else {
-                      rc.ascent = kMax(rc.ascent, -rc.y + rc.fontAscent());
+                      rc.ascent = qMax(rc.ascent, -rc.y + rc.fontAscent());
                       if (-rc.y - rc.fontDescent() < 0) {
-                        rc.descent = kMax(rc.descent, rc.fontDescent() + rc.y);
+                        rc.descent = qMax(rc.descent, rc.fontDescent() + rc.y);
                       }
                     }
                     rc.x   += rc.fontWidth(txt);
-                    rc.xMax = kMax(rc.xMax, rc.x);
+                    rc.xMax = qMax(rc.xMax, rc.x);
 
                     rc.x    = oldX;
                     rc.y   += rc.fontAscent() + rc.fontDescent() + 1;
@@ -208,9 +208,9 @@
 
     if (!rc.p) {
       // No need to compute ascent and descent when really painting
-      rc.ascent = kMax(rc.ascent, -rc.y + rc.fontAscent());
+      rc.ascent = qMax(rc.ascent, -rc.y + rc.fontAscent());
       if (-rc.y - rc.fontDescent() < 0) {
-        rc.descent = kMax(rc.descent, rc.fontDescent() + rc.y);
+        rc.descent = qMax(rc.descent, rc.fontDescent() + rc.y);
       }
     }
 
@@ -223,17 +223,17 @@
     if (fi->up) {
       int xPrev = rc.x;
       renderLabel(rc, fi->up);
-      xNext = kMax(xNext, rc.x);
+      xNext = qMax(xNext, rc.x);
       rc.x = xPrev;
     }
 
     if (fi->down) {
       renderLabel(rc, fi->down);
-      xNext = kMax(xNext, rc.x);
+      xNext = qMax(xNext, rc.x);
     }
 
     rc.x = xNext;
-    rc.xMax = kMax(rc.xMax, rc.x);
+    rc.xMax = qMax(rc.xMax, rc.x);
 
     fi = fi->next;
   }


More information about the Kst mailing list