Version: (using KDE KDE 3.5.6) Installed from: Compiled From Sources Compiler: gcc (GCC) 4.1.2 OS: Linux In the kst Settings dialog, it would be nice if there were a tab for default legend settings (ie. the font and box properties from the Edit Legend dialog box). Every time I create a legend I need to muck around in the edit legend dialog because I don't like the "factory defaults".
Another alternative would be to make the settings sticky.
SVN commit 661237 by arwalker: BUG:144049 make legend settings sticky M +1 -0 Makefile.am M +3 -0 kst.cpp A kstlegenddefaults.cpp [License: GPL (v2+)] A kstlegenddefaults.h [License: GPL (v2+)] M +54 -33 kstviewlegend.cpp M +0 -1 kstviewlegend.h --- branches/work/kst/1.5/kst/src/libkstapp/Makefile.am #661236:661237 @@ -7,6 +7,7 @@ kstdatacollection-gui.cpp \ dialoglauncher-gui.cpp \ labelrenderer.cpp \ + kstlegenddefaults.cpp \ kstnumbersequence.cpp \ kstuinames.cpp \ editviewobjectdialog.ui \ --- branches/work/kst/1.5/kst/src/libkstapp/kst.cpp #661236:661237 @@ -69,6 +69,7 @@ #include "ksthsdialog_i.h" #include "kstiface_impl.h" #include "kstimagedialog_i.h" +#include "kstlegenddefaults.h" #include "kstlogwidget.h" #include "kstmatrixdialog_i.h" #include "kstmatrixdefaults.h" @@ -1100,6 +1101,7 @@ config->setGroup("General Options"); _recent->saveEntries(config, "Recent Files"); + KST::legendDefaults.writeConfig(config); KST::vectorDefaults.writeConfig(config); KST::matrixDefaults.writeConfig(config); KST::objectDefaults.writeConfig(config); @@ -1111,6 +1113,7 @@ config->setGroup("General Options"); _recent->loadEntries(config, "Recent Files"); + KST::legendDefaults.readConfig(config); KST::vectorDefaults.readConfig(config); KST::matrixDefaults.readConfig(config); KST::objectDefaults.readConfig(config); --- branches/work/kst/1.5/kst/src/libkstapp/kstviewlegend.cpp #661236:661237 @@ -23,6 +23,7 @@ #include "kst2dplot.h" #include "kstdatacollection.h" #include "kstdataobjectcollection.h" +#include "kstlegenddefaults.h" #include "kst.h" #include "kstsettings.h" #include "ksttimers.h" @@ -57,23 +58,26 @@ KstViewLegend::KstViewLegend() : KstBorderedViewObject("Legend") { + _fontName = KST::legendDefaults.font(); + _vertical = KST::legendDefaults.vertical(); + _legendMargin = KST::legendDefaults.margin(); + _trackContents = KST::legendDefaults.trackContents(); + + _fontSize = -1; + setFontSize(KST::legendDefaults.fontSize()); + setForegroundColor(KST::legendDefaults.fontColor()); + setBorderColor(KST::legendDefaults.foregroundColor()); + setBackgroundColor(KST::legendDefaults.backgroundColor()); + setBorderWidth(KST::legendDefaults.border()); + setTransparent(KST::legendDefaults.transparent()); + _fallThroughTransparency = false; _container = false; _rotation = 0; - _vertical = true; - _fontName = KstApp::inst()->defaultFont(); _isResizable = false; - setForegroundColor(KstSettings::globalSettings()->foregroundColor); - setBorderColor(KstSettings::globalSettings()->foregroundColor); - setBackgroundColor(KstSettings::globalSettings()->backgroundColor); - setBorderWidth(2); - _legendMargin = 5; - _fontSize = -1; - setFontSize(0); _layoutActions &= ~(MoveTo | Copy | CopyTo); _standardActions |= Delete | Edit; _parsedTitle = 0L; - _trackContents = true; reparseTitle(); computeTextSize(); setDirty(false); @@ -83,22 +87,28 @@ KstViewLegend::KstViewLegend(const QDomElement& e) : KstBorderedViewObject(e) { - // some defaults and invariants + _fontName = KST::legendDefaults.font(); + _vertical = KST::legendDefaults.vertical(); + _legendMargin = KST::legendDefaults.margin(); + _trackContents = KST::legendDefaults.trackContents(); + + _fontSize = -1; + setFontSize(KST::legendDefaults.fontSize()); + setForegroundColor(KST::legendDefaults.fontColor()); + setBorderColor(KST::legendDefaults.foregroundColor()); + setBackgroundColor(KST::legendDefaults.backgroundColor()); + setBorderWidth(KST::legendDefaults.border()); + setTransparent(KST::legendDefaults.transparent()); + _fallThroughTransparency = false; - _container = false; _type = "Legend"; _rotation = 0.0; - _fontName = KstApp::inst()->defaultFont(); - _vertical = true; + _container = false; _isResizable = false; - _fontSize = -1; - setFontSize(0); _layoutActions &= ~(MoveTo | Copy | CopyTo); _standardActions |= Delete | Edit; - _legendMargin = 5; _parsedTitle = 0L; - _trackContents = true; - + QStringList ctaglist; // read the properties @@ -601,30 +611,30 @@ } KstBaseCurveList allCurves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList); - + if (isNew) { - widget->_fontSize->setValue(0); - widget->_fontColor->setColor(KstSettings::globalSettings()->foregroundColor); - widget->_font->setCurrentFont(KstApp::inst()->defaultFont()); - widget->_margin->setValue(5); - widget->_boxColors->setForeground(KstSettings::globalSettings()->foregroundColor); - widget->_boxColors->setBackground(KstSettings::globalSettings()->backgroundColor); - widget->_vertical->setChecked(true); - widget->_transparent->setChecked(false); - widget->_border->setValue(2); + widget->_fontSize->setValue(KST::legendDefaults.fontSize()); + widget->_fontColor->setColor(KST::legendDefaults.fontColor()); + widget->_font->setCurrentFont(KST::legendDefaults.font()); + widget->_boxColors->setForeground(KST::legendDefaults.foregroundColor()); + widget->_boxColors->setBackground(KST::legendDefaults.backgroundColor()); + widget->_vertical->setChecked(KST::legendDefaults.vertical()); + widget->_transparent->setChecked(KST::legendDefaults.transparent()); + widget->_margin->setValue(KST::legendDefaults.margin()); + widget->_border->setValue(KST::legendDefaults.border()); + widget->TrackContents->setChecked(KST::legendDefaults.trackContents()); + widget->_title->setText(""); - widget->TrackContents->setChecked(true); - + for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) { (*it)->readLock(); widget->AvailableCurveList->insertItem((*it)->tagName()); (*it)->unlock(); } - } else { // fill legend properties into widget widget->TrackContents->setChecked(trackContents()); widget->_title->setText(title()); - widget->_fontSize->setValue(int(fontSize())); + widget->_fontSize->setValue(fontSize()); widget->_fontColor->setColor(foregroundColor()); widget->_font->setCurrentFont(fontName()); widget->_transparent->setChecked(transparent()); @@ -695,6 +705,17 @@ legendExtra->setTrackContents(widget->TrackContents->isChecked()); } + KST::legendDefaults.setFontSize(widget->_fontSize->value()); + KST::legendDefaults.setFont(widget->_font->currentFont()); + KST::legendDefaults.setTransparent(widget->_transparent->isChecked()); + KST::legendDefaults.setBorder(widget->_border->value()); + KST::legendDefaults.setFontColor(widget->_fontColor->color()); + KST::legendDefaults.setForegroundColor(widget->_boxColors->foreground()); + KST::legendDefaults.setBackgroundColor(widget->_boxColors->background()); + KST::legendDefaults.setMargin(widget->_margin->value()); + KST::legendDefaults.setVertical(widget->_vertical->isChecked()); + KST::legendDefaults.setTrackContents(widget->TrackContents->isChecked()); + setDirty(); return true; } --- branches/work/kst/1.5/kst/src/libkstapp/kstviewlegend.h #661236:661237 @@ -117,7 +117,6 @@ double _rotation; QString _fontName; -// KstScalarList _scalarsUsed; KstScalarMap _scalarsUsed; KstStringMap _stringsUsed; KstVectorMap _vectorsUsed;