[Kst] extragear/graphics/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Sun Oct 23 00:39:29 CEST 2005
SVN commit 473210 by netterfield:
More work on rotated plot labels
M +21 -7 kst2dplot.cpp
M +3 -6 kstplotdialog_i.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #473209:473210
@@ -5710,16 +5710,17 @@
p.restore();
} else if (_xTickLabel->rotation() > 0) {
p.save();
- p.translate(d2i(xTickPos), yTickPos);
+ p.translate(d2i(xTickPos-_xTickLabel->lineSpacing()*(0.25 + 0.25*sin(_xTickLabel->rotation()*M_PI/180.0))), yTickPos);
_xTickLabel->paint(p);
p.restore();
- // FIXME XTickLabel->draw(p, d2i(xTickPos + (0.5 * XTickLabel->rotatedWidth(p))), d2i(y_px - ybot_bdr_px + 0.4*XTickLabel->rotatedHeight(p)));
} else if (_xTickLabel->rotation() < 0) {
p.save();
- p.translate(d2i(xTickPos) - _xTickLabel->size().width(), yTickPos);
+ p.translate(d2i(xTickPos - _xTickLabel->size().width()*cos(_xTickLabel->rotation()*M_PI/180.0)+
+ _xTickLabel->lineSpacing()*(0.25 + 0.5*sin(_xTickLabel->rotation()*M_PI/180.0)))
+ , yTickPos);
_xTickLabel->paint(p);
+ printf("%g %g\n", double(_xTickLabel->rotation()), double(_xTickLabel->size().width()));
p.restore();
- // FIXME XTickLabel->draw(p, d2i(xTickPos - (0.5 * XTickLabel->rotatedWidth(p))), d2i(y_px - ybot_bdr_px + 0.4 * XTickLabel->rotatedHeight(p)));
}
}
}
@@ -5769,9 +5770,22 @@
}
_yTickLabel->setText(tpy.labels[i - tpy.iLo]);
p.save();
- p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos) - _yTickLabel->size().height() / 2);
- _yTickLabel->paint(p);
- p.restore();
+
+ if (_yTickLabel->rotation() == 0) {
+ p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos) - _yTickLabel->size().height() / 2);
+ _yTickLabel->paint(p);
+ p.restore();
+ } else if (_yTickLabel->rotation() < 0) {
+ p.translate(xTickPos - _yTickLabel->size().width()*cos(_yTickLabel->rotation()*M_PI/180.0) + _yTickLabel->size().height()*sin(_yTickLabel->rotation()*M_PI/180.0),
+ d2i(yTickPos));
+ _yTickLabel->paint(p);
+ p.restore();
+ } else if (_yTickLabel->rotation() > 0) {
+ p.translate(xTickPos - _yTickLabel->size().width()*cos(_yTickLabel->rotation()*M_PI/180.0) - _yTickLabel->size().height()*sin(_yTickLabel->rotation()*M_PI/180.0),
+ d2i(yTickPos));
+ _yTickLabel->paint(p);
+ p.restore();
+ }
}
}
--- trunk/extragear/graphics/kst/kst/kstplotdialog_i.cpp #473209:473210
@@ -419,13 +419,10 @@
setMajorSpacing(_xMajorTickSpacing, plot->xMajorTicks());
setMajorSpacing(_yMajorTickSpacing, plot->yMajorTicks());
-// FIXME
-#if 0
- NumberFontSize->setValue(plot->XTickLabel->size());
- _spinBoxXAngle->setValue((int)plot->XTickLabel->rotation());
- _spinBoxYAngle->setValue((int)plot->YTickLabel->rotation());
+ NumberFontSize->setValue(plot->xTickLabel()->fontSize());
+ _spinBoxXAngle->setValue((int)plot->xTickLabel()->rotation());
+ _spinBoxYAngle->setValue((int)plot->yTickLabel()->rotation());
-#endif
XAxisText->setText(plot->xLabel()->text());
XLabelFontSize->setValue(plot->xLabel()->fontSize());
More information about the Kst
mailing list