[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Jan 7 22:38:54 CET 2004


CVS commit by staikos: 

Legend labels shouldn't interpret vector names


  M +11 -3     kstlabel.cpp   1.27
  M +4 -0      kstlabel.h   1.19
  M +48 -50    kstlegend.cpp   1.3
  M +1 -1      kstplot.cpp   1.30


--- kdeextragear-2/kst/kst/kstlabel.cpp  #1.26:1.27
@@ -31,6 +31,7 @@
 
 KstLabel::KstLabel() {
-  Text = "";
+  Text = QString::null;
   Rotation = 0.0;
+  _interpret = true;
   _x = 0.0;
   _y = 0.0;
@@ -55,4 +56,5 @@ KstLabel::KstLabel(const QString &in_tex
   Text = in_text;
   Rotation = in_rotation;
+  _interpret = true;
   _x = in_X;
   _y = in_Y;
@@ -280,5 +282,6 @@ void KstLabel::draw(QPainter &p, int px,
   for (i = 0; i < uiLength; i++) {    
     C = processedText[i];
-    if( C == '^' || C == '_' || C == '{' || C == '}' || C == '\\' ) {
+    if( _interpret &&
+        (C == '^' || C == '_' || C == '{' || C == '}' || C == '\\') ) {
       if( !strOut.isEmpty() ) {
         p.setFont( TextFont );
@@ -398,5 +401,5 @@ void KstLabel::draw(QPainter &p, int px,
     // do we need to terminate a superscript or subscript?
     //
-    if (i_fp > 0 && fP[i_fp].locked == false && bTerminate ) {
+    if (_interpret && i_fp > 0 && fP[i_fp].locked == false && bTerminate ) {
       if( !strOut.isEmpty( ) ) {
         p.setFont( TextFont );
@@ -539,4 +542,7 @@ void KstLabel::draw(QPainter &p, int px,
 void KstLabel::save(QTextStream &ts) {
   ts << "    <text>" << QStyleSheet::escape(Text) << "</text>" << endl;
+  if (_interpret) {
+    ts << "    <interpret/>" << endl;
+  }
   ts << "    <justify>" << Justify << "</justify>" << endl;
   ts << "    <rotation>" << Rotation << "</rotation>" << endl;
@@ -568,4 +574,6 @@ void KstLabel::read(QDomElement &e) {
       } else if  (e.tagName() == "rotation") {
         Rotation = e.text().toFloat();
+      } else if  (e.tagName() == "interpret") {
+        _interpret = true;
       } else if  (e.tagName() == "xpos") {
         _x = e.text().toFloat();

--- kdeextragear-2/kst/kst/kstlabel.h  #1.18:1.19
@@ -59,4 +59,7 @@ public:
   void draw(QPainter &p, int px, int py, bool bJustify=true, bool doDraw=true);
 
+  /** Interpret special characters, default = true */
+  void setInterpreted(bool interpreted) { _interpret = interpreted; }
+
   void setSize(int size);
   void setFontName(const QString &fontName);
@@ -81,4 +84,5 @@ private:
   int fontSize(QPainter &p);
 
+  bool _interpret;
   float Rotation;
   QString Text;

--- kdeextragear-2/kst/kst/kstlegend.cpp  #1.2:1.3
@@ -158,6 +158,4 @@ void KstLegend::draw(KstBaseCurveList* p
   if(ShowLegend) {
     pLabels = new KstLabel[pCurves->count()];
-    if( pLabels != 0L )
-    {
       penOld = p.pen();
       p.setFont(TextFont);
@@ -169,4 +167,5 @@ void KstLegend::draw(KstBaseCurveList* p
         iLabel = 0;
         for(KstBaseCurveList::iterator it = pCurves->begin(); it != pCurves->end(); it++) {
+        pLabels[iLabel].setInterpreted(false);
           pLabels[iLabel].setFontName(TextFont.family());
           pLabels[iLabel].setSize(Size);
@@ -224,5 +223,4 @@ void KstLegend::draw(KstBaseCurveList* p
         p.setPen(penOld);
       }
-    }
     delete[] pLabels;
   }

--- kdeextragear-2/kst/kst/kstplot.cpp  #1.29:1.30
@@ -765,5 +765,5 @@ double KstPlot::getXBorder(QPainter &p) 
              YTick, Yorg, p);
 
-  return (xleft_bdr_px);
+  return xleft_bdr_px;
 }
 





More information about the Kst mailing list