tabs-expanded.diff (5,636 bytes)
diff --git a/scribus/ui/propertiespalette_text.cpp b/scribus/ui/propertiespalette_text.cpp
index 3e67a647d..b46b2d486 100644
--- a/scribus/ui/propertiespalette_text.cpp
+++ b/scribus/ui/propertiespalette_text.cpp
@@ -23,6 +23,9 @@ for which a new license (GPL+exception) is in place.
#include "pageitem.h"
#include "pageitem_table.h"
#include "pageitem_textframe.h"
+#include "prefscontext.h"
+#include "prefsfile.h"
+#include "prefsmanager.h"
#include "propertiespalette_utils.h"
#include "propertywidget_advanced.h"
#include "propertywidget_distance.h"
@@ -105,6 +108,8 @@ PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(paren
pathTextWidgets = new PropertyWidget_PathText(textTree);
pathTextItem = textTree->addItem(pathTextWidgets, tr("Path Text Properties"));
+ readPreferences();
+
languageChange();
connect(lineSpacing , SIGNAL(valueChanged(double)), this, SLOT(handleLineSpacing()));
@@ -125,6 +130,70 @@ PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(paren
m_haveItem = false;
setEnabled(false);
+ connect(textTree, &ScTreeWidget::currentChanged2, this, &PropertiesPalette_Text::writePreferencesExpandStatus);
+}
+
+void PropertiesPalette_Text::readPreferences()
+{
+ palettePrefs = PrefsManager::instance()->prefsFile->getContext("TextPalette");
+
+ textTree->setItemExpanded(colorWidgetsItem,
+ palettePrefs->getBool("colorsExpanded", false));
+
+ textTree->setItemExpanded(flopItem,
+ palettePrefs->getBool("firstLineExpanded", false));
+
+ textTree->setItemExpanded(orphanItem,
+ palettePrefs->getBool("orphansExpanded", false));
+
+ textTree->setItemExpanded(parEffectItem,
+ palettePrefs->getBool("paragraphEffectsExpanded", false));
+
+ textTree->setItemExpanded(distanceItem,
+ palettePrefs->getBool("columnsExpanded", false));
+
+ textTree->setItemExpanded(optMarginsItem,
+ palettePrefs->getBool("opticalMarginsExpanded", false));
+
+ textTree->setItemExpanded(hyphenationWidgetItem,
+ palettePrefs->getBool("hyphenationExpanded", false));
+
+ textTree->setItemExpanded(advancedWidgetsItem,
+ palettePrefs->getBool("advancedExpanded", false));
+
+ textTree->setItemExpanded(fontfeaturesWidgetItem,
+ palettePrefs->getBool("fontFeaturesExpanded", false));
+
+ textTree->setItemExpanded(pathTextItem,
+ palettePrefs->getBool("pathTextExpanded", false));
+}
+
+void PropertiesPalette_Text::writePreferencesExpandStatus(int item)
+{
+ palettePrefs = PrefsManager::instance()->prefsFile->getContext("TextPalette");
+
+ bool expanded{textTree->isItemExpanded(item)};
+
+ if (item == colorWidgetsItem)
+ palettePrefs->set("colorsExpanded", expanded);
+ else if (item == flopItem)
+ palettePrefs->set("firstLineExpanded", expanded);
+ else if (item == orphanItem)
+ palettePrefs->set("orphansExpanded", expanded);
+ else if (item == parEffectItem)
+ palettePrefs->set("paragraphEffectsExpanded", expanded);
+ else if (item == distanceItem)
+ palettePrefs->set("columnsExpanded", expanded);
+ else if (item == optMarginsItem)
+ palettePrefs->set("opticalMarginsExpanded", expanded);
+ else if (item == hyphenationWidgetItem)
+ palettePrefs->set("hyphenationExpanded", expanded);
+ else if (item == advancedWidgetsItem)
+ palettePrefs->set("advancedExpanded", expanded);
+ else if (item == fontfeaturesWidgetItem)
+ palettePrefs->set("fontFeaturesExpanded", expanded);
+ else if (item == pathTextItem)
+ palettePrefs->set("pathTextExpanded", expanded);
}
void PropertiesPalette_Text::setMainWindow(ScribusMainWindow* mw)
diff --git a/scribus/ui/propertiespalette_text.h b/scribus/ui/propertiespalette_text.h
index 7d78d60f9..3d623fda6 100644
--- a/scribus/ui/propertiespalette_text.h
+++ b/scribus/ui/propertiespalette_text.h
@@ -16,6 +16,7 @@ for which a new license (GPL+exception) is in place.
#include "scguardedptr.h"
#include "sctextstruct.h"
+class PrefsContext;
class PageItem;
class PropertyWidget_Advanced;
class PropertyWidget_Distance;
@@ -62,6 +63,8 @@ protected:
private:
PageItem* currentItemFromSelection();
+ void readPreferences();
+ PrefsContext* palettePrefs;
public slots:
void setMainWindow(ScribusMainWindow *mw);
@@ -114,6 +117,8 @@ private slots:
void doClearCStyle();
void doClearPStyle();
+ void writePreferencesExpandStatus(int item);
+
protected:
PropertyWidget_Advanced* advancedWidgets;
PropertyWidget_Distance* distanceWidgets;
diff --git a/scribus/ui/sctreewidget.cpp b/scribus/ui/sctreewidget.cpp
index 175df5ae0..bce8a207a 100644
--- a/scribus/ui/sctreewidget.cpp
+++ b/scribus/ui/sctreewidget.cpp
@@ -168,6 +168,20 @@ QWidget* ScTreeWidget::widget(int index)
return itemWidget(child, 0);
}
+void ScTreeWidget::setItemExpanded(int index, bool expanded)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return;
+ topLevelItem(index)->setExpanded(expanded);
+}
+
+bool ScTreeWidget::isItemExpanded(int index)
+{
+ if ((index < 0) || (index >= topLevelItemCount()))
+ return false;
+ topLevelItem(index)->isExpanded();
+}
+
void ScTreeWidget::setItemEnabled(int index, bool enable)
{
if ((index < 0) || (index >= topLevelItemCount()))
diff --git a/scribus/ui/sctreewidget.h b/scribus/ui/sctreewidget.h
index 823673a6a..3dd8f64a0 100644
--- a/scribus/ui/sctreewidget.h
+++ b/scribus/ui/sctreewidget.h
@@ -55,6 +55,8 @@ public:
void setToolBoxMode(bool enable);
int addItem(QWidget* widget, const QString& title);
QWidget* widget(int index);
+ void setItemExpanded(int index, bool enable);
+ bool isItemExpanded(int index);
void setItemEnabled(int index, bool enable);
bool isItemEnabled(int index);
void setCurrentIndex(int index);