Version: 1.3.0_devel (using KDE 3.4.0, compiled sources) Compiler: gcc version 3.4.3 OS: SunOS (sun4u) release 5.8 The nifty black & white printing tool (in fact, option in the print dialog) has apparently not been updated along with the rest at some point, and it has a few problems that should be fixed: 1) the dialog's layout is broken 2) in the legends, curve preview is not consistent with the real curves (at least curve width and symbol size are not correct, but maybe other properties are out of sync as well) 3) when curve width is selected as a property to cycle through, and max width=3 all curves start out with a width of 3. It would be better to cycle in the reverse order (from the most usual properties to the least usual: e.g. from width=1 to width=max, or no point to the strangest shape of point, etc...)
1) Nicolas, could you provide more information as there is nothing I can see that is obviously wrong. 2) Is not a problem with the black & white printing tool but with printing in general. 3) Should probably be a seperate bug report. Either way I would agree.
I have just had a look again, and the dialog looks good. So 1) is not an issue, I don't know why it was broken at some point. Probably a local problem... Regarding 2), it should really be fixed so tell me whether I need to write another report or not. 3) looks like a small change, I'm not sure a separate report is worth it but I am ready to do it if it helps.
For 3: This is the behaviour I see currently. i.e. all curves start out with width=1 and increase from there. If this is not what you see please enter a new bug report with more details (some screen captures would be ideal).
For 2: the problem is that the view legend draws the line and symbol with a width of lineWidth * KstPainter::lineWidthAdjustmentFactor(). The former is set by the user while the latter is determined by the size of the painter. The same calculation is made for drawing the actual curve, but here the KstPainter is for the plor rather than the legend. When plotting KstPainter::lineWidthAdjustmentFactor() returns the same value for the legend and plot. However, when printing the two values are very different (being larger for the plot). The result is line widths that do not match between the plot and legend. The solution is not obvious as a legend does not have to reside in the plot that contains the curve, and the same curve can reside in more than one plot.
There are probably two possible solutions: 1) do not apply a correction factor for line widths in printing. Probably not acceptable as the line widths will be too narrow. 2) base the correction factor for line widths in printing on the size of the window, not the plot or legend.
Regarding point 3) (cycling not starting with the default values in the B&W printing tool) I confirm that: - cycling only through point styles, a curve alone in its plot gets a point symbol (I'd expect the first point type to be "none") - cycling through curve widths only, with a max width = 3 (or 1 !), I get thick curves even with only 1 plot containing only 1 curve ! As far as the printing problem is concerned, I have no clue how to solve it but it sure isn't nice :-(
SVN commit 539829 by arwalker: CCBUG:125888 Remove special casing for line widths when switching to monochrome before printing as this is handled in the paint code. M +1 -1 kst.cpp M +2 -2 kst2dplot.cpp M +1 -1 kst2dplot.h --- trunk/extragear/graphics/kst/src/libkstapp/kst.cpp #539828:539829 @@ -1533,7 +1533,7 @@ if (enhanceReadability) { Kst2DPlotList plotList = tlv->findChildrenType<Kst2DPlot>(false); for (Kst2DPlotList::Iterator it = plotList.begin(); it != plotList.end(); ++it ) { - (*it)->changeToMonochrome(pointStyleOrder, lineStyleOrder, lineWidthOrder, maxLineWidth, pointDensity, true); + (*it)->changeToMonochrome(pointStyleOrder, lineStyleOrder, lineWidthOrder, maxLineWidth, pointDensity); } } } --- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #539828:539829 @@ -6389,7 +6389,7 @@ void Kst2DPlot::changeToMonochrome(int pointStylePriority, int lineStylePriority, int lineWidthPriority, - int maxLineWidth, int pointDensity, bool forPrint) { + int maxLineWidth, int pointDensity) { // change plot background to white, foreground to black, // and set all curves to black, and cycle line styles and point styles pushPlotColors(); @@ -6439,7 +6439,7 @@ (*i)->pushLineStyle(lineStyleSeq.current()); } if (lineWidthPriority > -1) { - (*i)->pushLineWidth(forPrint ? 5*lineWidthSeq.current() : lineWidthSeq.current()); + (*i)->pushLineWidth(5*lineWidthSeq.current()); } (*i)->writeUnlock(); seqVect[0]->next(); --- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.h #539828:539829 @@ -342,7 +342,7 @@ // corresponding curve property is not cycled or altered. The remaining priorities must // be in the range [0, X-1] with no duplicates, where X = number of priorities != -1 void changeToMonochrome(int pointStylePriority, int lineStylePriority, int lineWidthPriority, - int maxLineWidth, int pointDensity, bool forPrint); + int maxLineWidth, int pointDensity); // undo changes made by changeToMonochrome // PRE: pointStylePriority, lineStylePriority, lineWidthPriority must have same values as when // passed to changeToMonochrome (otherwise behaviour is not as expected)
For the point symbols the first symbol is not a "null" symbol because we don't have such a thing. Symbols are either on or off and if they are on then a symbol is selected. I don't see any pressing need to change this, but if you feel it is important please enter a new bug report as this bug repotr should now focus solely on part 2) of the original problem.
Created attachment 16033 [details] Proposed patch Proposed fix for the curve width and symbol size being wrong in the legend. Nicolas, if you have the time could you try this out and let me know if it fixes your problem. Thanks.
OK, I have made some experiments and I will attach some results. In short, things are better with the patch, but there is still room for improvement. Moreover, I am disturbed by differences between the behaviors of the B&W printing tool and the "differentiate between curves" tool. Attached are 2 .ps files, one generated by printing in monochrome, with line width an point style properties selected for cycling (in that order) and max width = 3. The second file (print_std.ps) has been generated by first setting all curves to black, then using the differentiate tool with the same option. As you will notice, the results are significantly different. It would be much better if both tools were somehow merged, one being a one-shot call (from the tools menu), the other one change/print/revert. By the way, I prefer the result of the "differentiate" tool... The third file I have attached is the "real" output, as exported to a graphics file. It's quite close to the corresponding .ps, but there are subtle differences. Finally, I must admit that I have not investigated cases with more than one plot. From one of your previous comments, it may have an influence but I don't have enough time to try it out right now :-( Thanks for your efforts, I think we really need to make printing perfect again to give kst that high-profile shine it deserves. And it's getting close...
Created attachment 16045 [details] File printed with the B&W printing options
Created attachment 16046 [details] File printed the standard way with prior manipulation using the same options as in the B&W tool
Created attachment 16047 [details] What I actually have on the screen
SVN commit 540265 by arwalker: BUG:125888 Honour the selected maximum line width. Nicolas, I believe this fixes your problem. If not please enter a new bug report as this one is beginning to sprawl into multiple unrelated topics. M +1 -1 kstcurvedifferentiate_i.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kstcurvedifferentiate_i.cpp #540264:540265 @@ -282,7 +282,7 @@ maxSequences++; } if (_lineWidthOrder > -1) { - _lineWidthSeq.setRange(1, KSTLINEWIDTH_MAX); + _lineWidthSeq.setRange(1, _maxLineWidth); _seqVect.insert(_lineWidthOrder, &_lineWidthSeq); maxSequences++; }
SVN commit 540266 by arwalker: CCBUG:125888 Print curve legends at proper width M +2 -7 libkstapp/kst2dplot.cpp M +1 -2 libkstapp/kstviewlegend.cpp M +6 -11 libkstmath/kstcurvepointsymbol.cpp M +5 -3 libkstmath/kstvcurve.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #540265:540266 @@ -2286,7 +2286,7 @@ void Kst2DPlot::paintSelf(KstPainter& p, const QRegion& bounds) { if (p.type() == KstPainter::P_EXPORT || p.type() == KstPainter::P_PRINT) { p.save(); - p.setViewport(geometry()); + p.translate(geometry().left(), geometry().top()); draw(p); p.restore(); KstPlotBase::paintSelf(p, bounds); @@ -2376,10 +2376,7 @@ benchTime.start(); #endif - p.setWindow(0, 0, int(p.viewport().width()), - int(p.viewport().height())); - - QRect winRect = p.window(); + QRect winRect = geometry(); int x_px = winRect.width(); int y_px = winRect.height(); @@ -2565,8 +2562,6 @@ p.fillRect(RelWinRegion, QBrush(foregroundColor(), Qt::DiagCrossPattern)); p.drawRect(RelWinRegion); } - - p.setWindow(old_window); } --- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #540265:540266 @@ -355,8 +355,7 @@ adjustSizeForText(_parent->geometry()); KstBorderedViewObject::paintSelf(p, bounds); const QRect cr(contentsRectForDevice(p)); - p.setViewport(cr); - p.setWindow(0, 0, cr.width(), cr.height()); + p.translate(cr.left(), cr.top()); if (!_transparent) { p.fillRect(0, 0, cr.width(), cr.height(), _backgroundColor); } --- trunk/extragear/graphics/kst/src/libkstmath/kstcurvepointsymbol.cpp #540265:540266 @@ -23,25 +23,20 @@ namespace KstCurvePointSymbol { void draw(int Type, QPainter *p, int x, int y, int lineSize, int size) { + Q_UNUSED(size) + int s; if (Type < 0 || Type > KSTPOINT_MAXTYPE) { Type = 0; } - if (size == -1) { - QRect r = p->window(); - s = (r.width() + r.height())/400; + if (lineSize == 0 || lineSize == 1) { + s = 3; } else { - s = size/200; + s = ( 3 * lineSize ) / 2; } - - if (s < 1) { - s = 1; - } - - s += lineSize; - + switch (Type) { case 0: p->drawLine(x-s, y-s, x+s, y+s); --- trunk/extragear/graphics/kst/src/libkstmath/kstvcurve.cpp #540265:540266 @@ -1666,17 +1666,19 @@ void KstVCurve::paintLegendSymbol(KstPainter *p, const QRect& bound) { + int width = lineWidth() * p->lineWidthAdjustmentFactor(); + p->save(); if (hasLines()) { // draw a line from left to right centered vertically - p->setPen(QPen(color(), lineWidth() * p->lineWidthAdjustmentFactor(), KstLineStyle[lineStyle()])); + p->setPen(QPen(color(), width, KstLineStyle[lineStyle()])); p->drawLine(bound.left(), bound.top() + bound.height()/2, bound.right(), bound.top() + bound.height()/2); } if (hasPoints()) { // draw a point in the middle - p->setPen(QPen(color(), lineWidth() * p->lineWidthAdjustmentFactor())); - KstCurvePointSymbol::draw(pointType, p, bound.left() + bound.width()/2, bound.top() + bound.height()/2, lineWidth(), 600); + p->setPen(QPen(color(), width)); + KstCurvePointSymbol::draw(pointType, p, bound.left() + bound.width()/2, bound.top() + bound.height()/2, width, 600); } p->restore(); }