[Kst] extragear/graphics/kst/src/libkstapp (silent)
George Staikos
staikos at kde.org
Mon Sep 18 19:41:43 CEST 2006
SVN commit 586103 by staikos:
nothing functional:
removing trailing whitespace again
fix typos
improve legibility
SVN_SILENT
M +62 -72 kst2dplot.cpp
--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #586102:586103
@@ -144,7 +144,7 @@
_lineWidthMarkers = 0;
_colorMarkers = QColor("black");
_defaultMarkerColor = true;
-
+
commonConstructor(in_tag, xscale_in, yscale_in, xmin_in, ymin_in,
xmax_in, ymax_in);
}
@@ -205,7 +205,7 @@
_lineWidthMarkers = 0;
_colorMarkers = QColor("black");
_defaultMarkerColor = true;
-
+
// must stay here for plot loading correctness
_pos_x = 0.0;
_pos_y = 0.0;
@@ -477,7 +477,7 @@
KMdiIterator<KMdiChildView*> *iter;
bool duplicate = true;
int last = 0;
-
+
// check for unique plot name
while (duplicate) {
duplicate = false;
@@ -493,7 +493,7 @@
plotName = i18n("%1-copy%2").arg(plot.tagName()).arg(last);
}
++last;
-
+
duplicate = true;
break;
}
@@ -502,7 +502,7 @@
}
app->deleteIterator(iter);
}
-
+
commonConstructor(plotName,
plot._xScaleMode,
plot._yScaleMode,
@@ -682,7 +682,7 @@
_yTickLabel = 0L;
delete _fullTickLabel;
_fullTickLabel = 0L;
-
+
_curveToMarkers = 0L;
_vectorToMarkers = 0L;
}
@@ -707,7 +707,7 @@
bool Kst2DPlot::checkLRange(double &min_in, double &max_in, bool bIsLog, double logBase) {
bool rc = true;
-
+
if (bIsLog) {
if (isnan(pow(logBase, min_in)) || isnan(pow(logBase, max_in)) ||
isinf(pow(logBase, min_in)) || isinf(pow(logBase, max_in))) {
@@ -895,7 +895,7 @@
}
return true;
}
-
+
return false;
}
@@ -2799,7 +2799,7 @@
ts << indent << "<xlogbase>" << _xLogBase << "</xlogbase>" << endl;
ts << indent << "<ylogbase>" << _yLogBase << "</ylogbase>" << endl;
-
+
for (KstBaseCurveList::Iterator j = Curves.begin(); j != Curves.end(); ++j) {
(*j)->readLock();
ts << indent << "<curvetag>" << QStyleSheet::escape((*j)->tagName()) << "</curvetag>" << endl;
@@ -2834,11 +2834,11 @@
ts << indent << "<curvetomarkersrisingdetect>" << _curveToMarkersRisingDetect << "</curvetomarkersrisingdetect>" <<endl;
ts << indent << "<curvetomarkersfallingdetect>" << _curveToMarkersFallingDetect << "</curvetomarkersfallingdetect>" <<endl;
}
-
+
if (hasVectorToMarkers()) {
ts << indent << "<vectortomarkersname>" << _vectorToMarkers->tagName() << "</vectortomarkersname>" <<endl;
}
-
+
// save grid line settings
ts << indent << "<xmajorgrid>" << _xMajorGrid << "</xmajorgrid>" << endl;
ts << indent << "<ymajorgrid>" << _yMajorGrid << "</ymajorgrid>" << endl;
@@ -3042,36 +3042,28 @@
}
-void Kst2DPlot::setTicks(double& tick, double& org,
- double max, double min, bool is_log, double logBase, bool isX,
- int base) {
- double St = 0.0;
+void Kst2DPlot::setTicks(double& tick, double& org, double max, double min, bool is_log, double logBase, bool isX, int base) {
double Exp;
int auto_tick;
int majorDensity = isX ? _xMajorTicks : _yMajorTicks;
- double *ticks;
- int *autominor;
- int nt;
static double b10_ticks[] = {1.0, 2.0, 5.0, 10.0};
- static int b10_autominor[]= { 5, 4, 5, 5};
+ static int b10_autominor[]= { 5, 4, 5, 5};
static int n_b10_ticks = sizeof(b10_ticks) / sizeof(double);
static double b24_ticks[] = {1.0, 2.0, 4.0, 6.0, 12.0, 24.0};
- static int b24_autominor[]= { 5, 4, 4, 6, 6, 6};
+ static int b24_autominor[]= { 5, 4, 4, 6, 6, 6};
static int n_b24_ticks = sizeof(b24_ticks) / sizeof(double);
- static double b60_ticks[] =
- {1.0, 2.0, 5.0, 10.0, 15.0, 20.0, 30.0, 60.0};
- static int b60_autominor[] =
- { 5, 4, 5, 5, 3, 4, 6, 6};
+ static double b60_ticks[] = {1.0, 2.0, 5.0, 10.0, 15.0, 20.0, 30.0, 60.0};
+ static int b60_autominor[] = { 5, 4, 5, 5, 3, 4, 6, 6};
static int n_b60_ticks = sizeof(b60_ticks) / sizeof(double);
- ticks = b10_ticks;
- nt = n_b10_ticks;
- autominor = b10_autominor;
+ double *ticks = b10_ticks;
+ int nt = n_b10_ticks;
+ int *autominor = b10_autominor;
// check for hysteresis of y-axis tick spacing...
- St = (max - min) / (double)majorDensity;
+ double St = (max - min) / (double)majorDensity;
if (!isX && is_log == _isLogLast && _stLast != 0.0 &&
St/_stLast < TICK_HYSTERESIS_FACTOR &&
St/_stLast > 1.0/TICK_HYSTERESIS_FACTOR) {
@@ -3081,8 +3073,8 @@
} else if (is_log) {
if (max - min <= (double)majorDensity && ((_xLogBase == 10.0 && max - min > 1.5) ||
(_xLogBase == 2.0 && max - min > 1.0))) {
- // show in logarithmic mode with major ticks nicely labelled and the specified
- // number of minor ticks between each major label...
+ // show in logarithmic mode with major ticks nicely labelled and the
+ // specified number of minor ticks between each major label
if (logBase == 2.0) {
auto_tick = 10;
} else if (logBase == 10.0) {
@@ -3092,7 +3084,7 @@
}
tick = 1.0;
} else if (max - min >= (double)majorDensity) {
- // show in logarithmic mode with major ticks nicely labelled and no minor ticks...
+ // show in logarithmic mode with major ticks nicely labelled and no minor ticks
auto_tick = 0;
tick = floor((max - min) / (double)majorDensity);
if (tick == 1.0) {
@@ -3105,31 +3097,29 @@
}
}
} else {
- // show in "linear" mode with major ticks linearly spaced and no minor ticks...
+ // show in "linear" mode with major ticks linearly spaced and no minor ticks
auto_tick = 0;
Exp = pow(logBase, floor(log10(St)/log10(logBase)));
tick = ticks[0] * Exp;
- for (int i=1; i<nt; i++) {
+ for (int i = 1; i < nt; i++) {
if (fabs((ticks[i] * Exp) - St) < fabs(tick - St)) {
tick = ticks[i] * Exp;
}
}
- }
+ }
} else {
- // determine tick interval...
+ // determine tick interval
Exp = 0.0;
if (base == 60) {
- if ((b60_ticks[0]*0.7 < St) &&
- (b60_ticks[n_b60_ticks-1] > St*0.7)) {
+ if (b60_ticks[0]*0.7 < St && b60_ticks[n_b60_ticks-1] > St*0.7) {
Exp = 1.0;
ticks = b60_ticks;
autominor = b60_autominor;
nt = n_b60_ticks;
}
} else if (base == 24) {
- if ((b24_ticks[0]*0.7 < St) &&
- (b24_ticks[n_b24_ticks-1] > St*0.7)) {
+ if (b24_ticks[0]*0.7 < St && b24_ticks[n_b24_ticks-1] > St*0.7) {
Exp = 1.0;
ticks = b24_ticks;
autominor = b24_autominor;
@@ -3143,7 +3133,7 @@
tick = ticks[0] * Exp;
auto_tick = autominor[0];
- for (int i=1; i<nt; i++) {
+ for (int i = 1; i < nt; i++) {
if (fabs((ticks[i] * Exp) - St) < fabs(tick - St)) {
tick = ticks[i] * Exp;
auto_tick = autominor[i];
@@ -3157,7 +3147,7 @@
_yMinorTicks = (_reqYMinorTicks < 0) ? auto_tick : _reqYMinorTicks;
}
- // determine location of the origin...
+ // determine location of the origin
if (min > 0.0) {
org = ceil(min / tick) * tick;
} else if (max < 0.0) {
@@ -3167,7 +3157,7 @@
}
if (!isX) {
- _stLast = St;
+ _stLast = St;
_tickYLast = tick;
_autoTickYLast = auto_tick;
_isLogLast = is_log;
@@ -3296,7 +3286,7 @@
pushScale();
if (isTied() && _menuView) {
KstApp::inst()->tiedZoom(true, x0, x1, false, 0.0, 0.0, _menuView, tagName());
- }
+ }
setDirty();
if (_menuView) {
_menuView->paint();
@@ -3307,20 +3297,20 @@
bool Kst2DPlot::tiedZoomPrev(QWidget *view) {
bool updated = false;
-
+
if (popScale()) {
cancelZoom(view);
setDirty();
updated = true;
}
-
+
return updated;
}
bool Kst2DPlot::tiedZoomMode(ZoomType zoom, bool flag, double center, KstScaleModeType mode, KstScaleModeType modeExtra) {
bool updated = true;
-
+
switch (zoom) {
case ZOOM_MOVE_HORIZONTAL:
if(!moveSelfHorizontal(flag)) {
@@ -3333,12 +3323,12 @@
}
break;
case ZOOM_CENTER:
- moveSelfToCenter(center);
+ moveSelfToCenter(center);
break;
case ZOOM_VERTICAL:
if(!zoomSelfVertical(flag)) {
updated = false;
- }
+ }
break;
case ZOOM_HORIZONTAL:
if(!zoomSelfHorizontal(flag)) {
@@ -3346,7 +3336,7 @@
}
break;
case ZOOM_X_MODE:
- setXScaleMode(mode);
+ setXScaleMode(mode);
break;
case ZOOM_Y_MODE:
setYScaleMode(mode);
@@ -3410,14 +3400,14 @@
KstViewObject* Kst2DPlot::copyObjectQuietly(KstViewObject& parent, const QString& name) const {
- QString plotName;
-
+ QString plotName;
+
if (name.isEmpty()) {
plotName = i18n("%1-copy").arg(tagName());
} else {
plotName = name;
}
-
+
Kst2DPlot *plot = new Kst2DPlot(*this, plotName);
parent.appendChild(plot, true);
@@ -3817,7 +3807,7 @@
i_near_x = (*i)->getIndexNearXY(xpos, dx_per_pix, ypos);
(*i)->point(i_near_x, near_x, near_y);
distance = fabs(ypos - near_y);
-
+
if (distance < best_distance || !rc) {
newypos = near_y;
newxpos = near_x;
@@ -4013,7 +4003,7 @@
QPen newPen(Qt::black, 1, Qt::DotLine);
p.setPen(newPen);
p.setRasterOp(Qt::NotROP);
-
+
if (pr.contains(oldPos)) {
if (_mouse.lastGuidelineType == X_ZOOMBOX) {
p.drawLine(oldPos.x(), pr.top(), oldPos.x(), pr.bottom());
@@ -4021,21 +4011,21 @@
p.drawLine(pr.left(), oldPos.y(), pr.right(), oldPos.y());
}
}
-
+
_mouse.lastGuideline = QPoint(-1, -1);
if (pr.contains(newPos)) {
if (gzType == X_ZOOMBOX) {
p.drawLine(newPos.x(), pr.top(), newPos.x(), pr.bottom());
_mouse.lastGuidelineType = gzType;
- _mouse.lastGuideline = newPos;
+ _mouse.lastGuideline = newPos;
} else if (gzType == Y_ZOOMBOX) {
p.drawLine(pr.left(), newPos.y(), pr.right(), newPos.y());
_mouse.lastGuidelineType = gzType;
- _mouse.lastGuideline = newPos;
+ _mouse.lastGuideline = newPos;
}
}
-
+
p.end();
}
@@ -4239,7 +4229,7 @@
bool doUpdate = false;
_zoomPaused = false;
KstViewWidget* kstView = static_cast<KstViewWidget*>(view);
-
+
kstView->viewObject()->releaseMouse(this);
_mouse.tracker = e->pos();
@@ -4516,7 +4506,7 @@
} else if (e->key() == Key_Control) {
updateXYGuideline(view, _mouse.lastGuideline, QPoint(-1, -1), GetPlotRegion(), X_ZOOMBOX);
}
-
+
setCursorForMode(view, newType, c);
e->accept();
}
@@ -5103,7 +5093,7 @@
KstViewWidget *view = static_cast<KstViewWidget*>(vw);
bool handled = true;
bool paint = true;
-
+
ButtonState s = e->stateAfter();
QPoint cursorPos = _mouse.tracker;
switch (e->key()) {
@@ -5543,7 +5533,7 @@
void Kst2DPlot::updateMarkersFromCurve() {
if (hasCurveToMarkers()) {
_curveToMarkers->readLock();
-
+
int count = _curveToMarkers->sampleCount();
if (count > 0) {
@@ -5602,7 +5592,7 @@
void Kst2DPlot::updateMarkersFromVector() {
if (hasVectorToMarkers()) {
_vectorToMarkers->readLock();
-
+
int count = _vectorToMarkers->length();
for (int i = 0; i < count; ++i) {
@@ -5623,7 +5613,7 @@
double m_X, double b_X, double x_max, double x_min,
double y_px, double ytop_bdr_px, double ybot_bdr_px) {
int width = lineWidthMarkers() * p.lineWidthAdjustmentFactor();
-
+
if (defaultColorMarker()) {
p.setPen(QPen(foregroundColor(), width, KstLineStyle[lineStyleMarkers()]));
} else {
@@ -5710,7 +5700,7 @@
// draw x-ticks
if (_xLog) {
double XPos;
-
+
i = (int)floor((double)_xMajorTicks*(xleft_bdr_px - 1.0 - x_orig_px)/xtick_px);
for (;xtick_px * i + x_orig_px < x_px - xright_bdr_px + 1; i++) {
// draw major ticks
@@ -5783,7 +5773,7 @@
// draw y ticks
if (_yLog) {
double YPos;
-
+
i = (int)floor( (double)_yMajorTicks * ( ytop_bdr_px - 1.0 - y_orig_px ) / ytick_px );
for (; ytick_px * i + y_orig_px < y_px - ybot_bdr_px + 1; i++) {
// draw major ticks
@@ -5993,7 +5983,7 @@
if (!_suppressTop) {
int xpos;
-
+
p.save();
switch (KST_JUSTIFY_H(_topLabel->justification())) {
case KST_JUSTIFY_H_LEFT:
@@ -6004,10 +5994,10 @@
break;
case KST_JUSTIFY_H_CENTER:
xpos = d2i( ( x_px + xleft_bdr_px - xright_bdr_px ) / 2.0 ) - ( _topLabel->size().width() / 2 );
- break;
+ break;
default:
xpos = d2i(xleft_bdr_px);
- break;
+ break;
}
p.translate(xpos, d2i(0.08 * _topLabel->size().height()));
_topLabel->paint(p);
@@ -6049,8 +6039,8 @@
double X2, Y2;
int i, j;
- int minor_width = p.lineWidthAdjustmentFactor() * minorPenWidth();
- int major_width = p.lineWidthAdjustmentFactor() * majorPenWidth();
+ int minor_width = p.lineWidthAdjustmentFactor() * minorPenWidth();
+ int major_width = p.lineWidthAdjustmentFactor() * majorPenWidth();
// draw X grid lines
if (_xLog) {
@@ -6862,7 +6852,7 @@
double Kst2DPlot::verticalSizeFactor() {
- // roughtly, geometry/dataRect. But use an estimate rather
+ // roughly, geometry/dataRect. But use an estimate rather
// than calculating it, so that we get stable results.
// this is used by cleanup to do a better job with
// sizing plots with supressed borders.
More information about the Kst
mailing list