[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu Dec 1 01:08:44 CET 2005


SVN commit 484485 by netterfield:

activate justification in viewlabeldialog.



 M  +35 -7     kstviewlabel.cpp  
 M  +2 -2      viewlabelwidget.ui  
 M  +2 -2      viewlabelwidget.ui.h  


--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #484484:484485
@@ -31,6 +31,8 @@
 #include <kglobal.h>
 #include <klocale.h>
 #include <kpopupmenu.h>
+#include <knuminput.h>
+#include <kcombobox.h>
 
 #include <qapplication.h>
 #include <qbitmap.h>
@@ -38,6 +40,8 @@
 #include <qptrstack.h>
 #include <qtextedit.h>
 #include <qregexp.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
 
 #include <stdlib.h>
 
@@ -577,14 +581,28 @@
   if (!w) {
     return false;
   }
-  // replace \n & \t with tabs and newlines for the text edit box
-  QString tmpstr = _txt;
-  QRegExp cr("\\\\n");
-  QRegExp tab("\\\\t");
-  tmpstr.replace(cr,"\n");
-  tmpstr.replace(tab,"\t");
-  widget->_text->setText(tmpstr);
   
+  if (text().isEmpty()) { // probably a new label: set widget to defaults
+  } else { 
+    // replace \n & \t with tabs and newlines for the text edit box
+    QString tmpstr = text();
+    QRegExp cr("\\\\n");
+    QRegExp tab("\\\\t");
+    tmpstr.replace(cr,"\n");
+    tmpstr.replace(tab,"\t");
+    widget->_text->setText(tmpstr);
+
+    widget->_precision->setValue(int(dataPrecision()));
+    widget->_rotation->setValue(double(rotation()));
+    widget->_fontSize->setValue(int(fontSize()));
+    widget->_horizontal->setCurrentItem(horizJustifyWrap());
+    widget->_vertical->setCurrentItem(vertJustifyWrap());
+
+    widget->_transparent->setChecked(transparent());
+    widget->_autoResize->setChecked(autoResize());
+    widget->_border->setValue(borderWidth());
+
+  }
   return true;
 }
 
@@ -601,6 +619,16 @@
   _txt.replace(cr, "\\n");
   _txt.replace(tab, "\\t");
 
+  setDataPrecision(widget->_precision->value());
+  setRotation(widget->_rotation->value());
+  setFontSize(widget->_fontSize->value());
+  setHorizJustifyWrap(widget->_horizontal->currentItem());
+  setVertJustifyWrap(widget->_vertical->currentItem());
+
+  setTransparent(widget->_transparent->isChecked());
+  setAutoResize(widget->_autoResize->isChecked());
+  setBorderWidth(widget->_border->value());
+  
   reparse(); // calls setDirty()
   return true;
 }
--- trunk/extragear/graphics/kst/kst/viewlabelwidget.ui #484484:484485
@@ -8,7 +8,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>525</width>
+            <width>623</width>
             <height>396</height>
         </rect>
     </property>
@@ -295,7 +295,7 @@
                         </spacer>
                         <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
                             <property name="name">
-                                <cstring>_resize</cstring>
+                                <cstring>_autoResize</cstring>
                             </property>
                             <property name="text">
                                 <string>Auto Resize for Text</string>
--- trunk/extragear/graphics/kst/kst/viewlabelwidget.ui.h #484484:484485
@@ -16,11 +16,11 @@
     connect(_scalars, SIGNAL(selectionChanged(const QString &)),
 	    this, SLOT(insertScalarInText(const QString &)));
     _horizontal->insertItem(i18n("Left"));
+    _horizontal->insertItem(i18n("Right"));
     _horizontal->insertItem(i18n("Center"));
-    _horizontal->insertItem(i18n("Right"));
     _vertical->insertItem(i18n("Top"));
+    _vertical->insertItem(i18n("Bottom"));
     _vertical->insertItem(i18n("Center"));
-    _vertical->insertItem(i18n("Bottom"));
 
 }
 


More information about the Kst mailing list