[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Sun Jun 20 03:17:38 CEST 2004
CVS commit by arwalker:
Correctly read in demo.kst
M +12 -12 kst2dplot.cpp 1.102
M +4 -4 kst2dplot.h 1.38
M +10 -6 kstdoc.cpp 1.89
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.101:1.102
@@ -87,8 +87,8 @@ Kst2DPlot::Kst2DPlot(const QString& in_t
double xmin_in, double ymin_in,
double xmax_in, double ymax_in) : KstPlotBase("Kst2DPlot") {
- _pos_x = 0;
- _pos_y = 0;
- _width = 0;
- _height = 0;
+ _pos_x = 0.0;
+ _pos_y = 0.0;
+ _width = 0.0;
+ _height = 0.0;
commonConstructor(in_tag, yscale_in, xscale_in, xmin_in, ymin_in,
@@ -109,8 +109,8 @@ Kst2DPlot::Kst2DPlot(QDomElement& e) : K
bool x_log = false, y_log = false;
- _pos_x = 0;
- _pos_y = 0;
- _width = 0;
- _height = 0;
+ _pos_x = 0.0;
+ _pos_y = 0.0;
+ _width = 0.0;
+ _height = 0.0;
/* parse the DOM tree */
@@ -120,11 +120,11 @@ Kst2DPlot::Kst2DPlot(QDomElement& e) : K
if (!el.isNull()) { // the node was really an element.
if (el.tagName() == "width") {
- _width = el.text().toInt();
+ _width = el.text().toDouble();
} else if (el.tagName() == "height") {
- _height = el.text().toInt();
+ _height = el.text().toDouble();
} else if (el.tagName() == "pos_x") {
- _pos_x = el.text().toInt();
+ _pos_x = el.text().toDouble();
} else if (el.tagName() == "pos_y") {
- _pos_x = el.text().toInt();
+ _pos_y = el.text().toDouble();
} else if (el.tagName() == "xscalemode") {
xscale_in = (KstScaleModeType) el.text().toInt();
--- kdeextragear-2/kst/kst/kst2dplot.h #1.37:1.38
@@ -136,8 +136,8 @@ public:
KstLegend *Legend;
- int _width;
- int _height;
- int _pos_x;
- int _pos_y;
+ double _width;
+ double _height;
+ double _pos_x;
+ double _pos_y;
/** Arbitrary Labels */
--- kdeextragear-2/kst/kst/kstdoc.cpp #1.88:1.89
@@ -319,11 +319,15 @@ bool KstDoc::openDocument(const KURL& ur
plot = *it;
- if (plot->_width != 0 && plot->_height != 0 ) {
+ if (plot->_width > 0.0 && plot->_height > 0.0 ) {
pWindow->view()->appendChild(plot.data(), true);
-
+ if (plot->_width > 1.0 && plot->_height > 1.0) {
plot->resizeFromAspect( (double)plot->_pos_x / (double)plot->_width,
(double)plot->_pos_y / (double)plot->_height,
1.0 / (double)plot->_width,
1.0 / (double)plot->_height );
+ } else {
+ plot->resizeFromAspect( plot->_pos_x, plot->_pos_y,
+ plot->_width, plot->_height );
+ }
}
}
More information about the Kst
mailing list