[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Fri Aug 13 00:19:11 CEST 2004
CVS commit by arwalker:
Ensure the plot regions remain correct after printing or exporting.
Fixes 87080.
M +13 -17 kst2dplot.cpp 1.223
M +2 -5 kst2dplot.h 1.90
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.222:1.223
@@ -1383,6 +1383,4 @@ void Kst2DPlot::paint(KstPaintType type,
}
- setPixRect();
-
_oldXAlignment = KST::alignment.x(size());
_oldSize = sizeNew;
@@ -1484,17 +1482,13 @@ void Kst2DPlot::draw(QPainter &p, KstPai
if (x_px - xright_bdr_px - xleft_bdr_px >= 10 &&
y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10) {
-
- RelPlotRegion.setRect(d2i(xleft_bdr_px),
+ QRect RelPlotRegion(d2i(xleft_bdr_px),
d2i(ytop_bdr_px),
d2i(x_px - xright_bdr_px - xleft_bdr_px + 1.0),
d2i(y_px - ybot_bdr_px - ytop_bdr_px + 1.0));
-
- RelWinRegion.setRect(0, 0, (int)x_px, (int)y_px);
-
- RelPlotAndAxisRegion.setRect(
- d2i(YLabel->lineSpacing(p) + 1),
+ QRect RelPlotAndAxisRegion(d2i(YLabel->lineSpacing(p) + 1),
d2i(ytop_bdr_px),
d2i(x_px - YLabel->lineSpacing(p) - xright_bdr_px),
d2i(y_px - XLabel->lineSpacing(p) - ytop_bdr_px));
+ QRect RelWinRegion(0, 0, (int)x_px, (int)y_px);
Lx = (double)xleft_bdr_px + 1;
@@ -1507,4 +1501,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
b_Y = Hy - m_Y * y_min;
if (type != P_PRINT && type != P_EXPORT) {
+ setPixRect(RelPlotRegion, RelWinRegion, RelPlotAndAxisRegion);
_m_X = m_X;
_m_Y = m_Y;
@@ -1519,5 +1514,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
p.setPen(QPen(_foregroundColor, penWidth));
- plotAxes(p, x_max, y_max, x_min, y_min,
+ plotAxes(p, RelPlotRegion, x_max, y_max, x_min, y_min,
XTick, Xorg, xleft_bdr_px, xright_bdr_px, x_orig_px, xtick_px, xtick_len_px, x_px,
YTick, Yorg, ytop_bdr_px, ybot_bdr_px, y_orig_px, ytick_px, ytick_len_px, y_px);
@@ -1585,5 +1580,5 @@ QRect Kst2DPlot::GetTieBoxRegion() const
}
-void Kst2DPlot::setPixRect() {
+void Kst2DPlot::setPixRect(const QRect& RelPlotRegion, const QRect& RelWinRegion, const QRect& RelPlotAndAxisRegion) {
PlotRegion = RelPlotRegion;
PlotRegion.moveBy(geometry().x(), geometry().y());
@@ -4346,5 +4341,6 @@ void Kst2DPlot::plotMarkers(QPainter& p,
-void Kst2DPlot::plotAxes(QPainter& p, double x_max, double y_max, double x_min, double y_min,
+void Kst2DPlot::plotAxes(QPainter& p, QRect& plotRegion,
+ double x_max, double y_max, double x_min, double y_min,
double XTick, double Xorg, double xleft_bdr_px, double xright_bdr_px,
double x_orig_px, double xtick_px, double xtick_len_px, int x_px,
@@ -4362,5 +4358,5 @@ void Kst2DPlot::plotAxes(QPainter& p, do
/* Draw Axis */
- p.drawRect(RelPlotRegion);
+ p.drawRect(plotRegion);
if (_xLog) {
--- kdeextragear-2/kst/kst/kst2dplot.h #1.89:1.90
@@ -160,5 +160,5 @@ public:
/* kstview tells kstplot where to offset the plot to */
- void setPixRect();
+ void setPixRect(const QRect& RelPlotRegion, const QRect& RelWinRegion, const QRect& RelPlotAndAxisRegion);
virtual void resize(const QSize&);
@@ -320,9 +320,6 @@ private:
Stored here to be Used to determine mouse mode */
QRect PlotRegion;
- QRect RelPlotRegion;
QRect WinRegion;
- QRect RelWinRegion;
QRect PlotAndAxisRegion;
- QRect RelPlotAndAxisRegion;
void updateScale();
@@ -351,5 +348,5 @@ private:
/** helper functions for draw(...) **/
void plotLabels(QPainter& p, int x_px, int y_px, double xleft_bdr_px, double ytop_bdr_px);
- void plotAxes(QPainter& p, double x_max, double y_max, double x_min, double y_min,
+ void plotAxes(QPainter& p, QRect& plotRegion, double x_max, double y_max, double x_min, double y_min,
double XTick, double Xorg, double xleft_bdr_px, double xright_bdr_px, double x_orig_px, double xtick_px, double xtick_len_px, int x_px,
double YTick, double Yorg, double ytop_bdr_px, double ybot_bdr_px, double y_orig_px, double ytick_px, double ytick_len_px, int y_px);
More information about the Kst
mailing list