View Issue Details

IDProjectCategoryView StatusLast Update
0016849ScribusUser Interfacepublic2024-12-05 19:58
Reporterdigirew Assigned Tonitramr  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.5.7 
Target Version1.7.0Fixed in Version1.7.0.svn 
Summary0016849: Properties for First line, right and left indents
DescriptionI have the ability under the styles to set a numeric value for First line, right and left indents.


It would be great if I had those same entry fields/values appear someplace in my text properties panels. Right now when im in text edit mode, I can move the 3 triangles on the ruler to manually adjust the first line, right and left indents, however I have no way to verify what values im setting it to. I need to be able to see that value and enter a number on the fly.

im currently using 1.5.6 (no option to select that version when submitting this ticket).
TagsNo tags attached.
PatchYes

Activities

digirew

2022-10-14 18:12

reporter  

digirew

2022-10-14 18:13

reporter   ~0049786

I attached a screen shot of the options available when creating a "style". However, im looking for something similar in the text properties when adjusting these manually.

nitramr

2024-11-27 19:54

developer   ~0051672

I add the editing options in columns section. Additionally, I moved the tabulators button back to this section, because it is more related to these options than alignments.

I hope the patch works, because the propertywidget_alignment.cpp was modified by optical margin patch too.
files.zip (2,687 bytes)
indents.png (18,451 bytes)   
indents.png (18,451 bytes)   
indents_2024-11-27_01.patch (17,215 bytes)   
Index: scribus/ui/propertiespalette_text.cpp
===================================================================
--- scribus/ui/propertiespalette_text.cpp	(Revision 26452)
+++ scribus/ui/propertiespalette_text.cpp	(Arbeitskopie)
@@ -56,13 +56,13 @@
 	scText->restorePreferences();
 
 	alignmentWidgets = new PropertyWidget_Alignment(this);
-	scAlignment = new SectionContainer(tr("Alignment && Tabs"), "SectionTPAlignment", true, true);
+	scAlignment = new SectionContainer(tr("Alignment"), "SectionTPAlignment", true, true);
 	scAlignment->setCanSaveState(true);
 	scAlignment->setWidget(alignmentWidgets);
 	scAlignment->restorePreferences();
 
 	distanceWidgets = new PropertyWidget_Distance(this);
-	scDistance = new SectionContainer(tr("Columns && Margins"), "SectionTPColumnsMargins", true, false);
+	scDistance = new SectionContainer(tr("Columns && Indents"), "SectionTPColumnsMargins", true, false);
 	scDistance->setCanSaveState(true);
 	scDistance->setWidget(distanceWidgets);
 	scDistance->restorePreferences();
@@ -391,6 +391,7 @@
 	textWidgets->updateStyle(newCurrent);
 	styleWidgets->updateStyle(newCurrent);
 	alignmentWidgets->updateStyle(newCurrent);
+	distanceWidgets->updateStyle(newCurrent);
 }
 
 void PropertiesPalette_Text::updateTextStyles()
@@ -422,8 +423,8 @@
 void PropertiesPalette_Text::languageChange()
 {
 	scAdvanced->setText(tr("Typography"));
-	scAlignment->setText(tr("Alignment && Tabs"));
-	scDistance->setText(tr("Columns && Margins"));
+	scAlignment->setText(tr("Alignment"));
+	scDistance->setText(tr("Columns && Indents"));
 	scFontFeatures->setText(tr("OpenType Features"));
 	scHyphenation->setText(tr("Hyphenation && Language"));
 	scOrphans->setText(tr("Orphans && Widows"));
Index: scribus/ui/propertywidget_alignment.cpp
===================================================================
--- scribus/ui/propertywidget_alignment.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.cpp	(Arbeitskopie)
@@ -147,10 +147,8 @@
 
 void PropertyWidget_Alignment::connectSignals()
 {
-	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
 	connect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	connect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	connect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	connect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	connect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	connect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -158,10 +156,8 @@
 
 void PropertyWidget_Alignment::disconnectSignals()
 {
-	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
 	disconnect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	disconnect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	disconnect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	disconnect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	disconnect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	disconnect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -187,7 +183,6 @@
 		textVerticalAlignment->setEnabled(!m_item->isPathText());
 		flopWidget->setEnabled(!m_item->isPathText());
 		opticalMarginsWidget->setEnabled(!m_item->isPathText());
-		tabsButton->setEnabled(!m_item->isPathText());
 	}
 	setEnabled(enabled);
 }
@@ -286,37 +283,6 @@
 	m_haveItem = tmp;
 }
 
-void PropertyWidget_Alignment::handleTabs()
-{
-	if (!m_doc || !m_item)
-		return;
-
-	PageItem_TextFrame *tItem = m_item->asTextFrame();
-	if (tItem == nullptr)
-		return;
-	const ParagraphStyle& style(m_doc->appMode == modeEdit ? tItem->currentStyle() : tItem->itemText.defaultStyle());
-	TabManager *dia = new TabManager(this, m_doc->unitIndex(), style.tabValues(), tItem->columnWidth());
-	if (dia->exec())
-	{
-		if (m_doc->appMode != modeEdit)
-		{
-			ParagraphStyle newStyle(m_item->itemText.defaultStyle());
-			newStyle.setTabValues(dia->tabList());
-			Selection tempSelection(this, false);
-			tempSelection.addItem(m_item, true);
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
-		}
-		else
-		{
-			ParagraphStyle newStyle;
-			newStyle.setTabValues(dia->tabList());
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-		}
-		m_item->update();
-	}
-	delete dia;
-}
-
 void PropertyWidget_Alignment::handleAlignment(int a)
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
Index: scribus/ui/propertywidget_alignment.h
===================================================================
--- scribus/ui/propertywidget_alignment.h	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.h	(Arbeitskopie)
@@ -53,17 +53,14 @@
 	void toggleLabelVisibility(bool v);
 
 	void showFirstLinePolicy(FirstLineOffsetPolicy f);
	void showOpticalMargins(int e);
 	void showAlignment(int e);
 	void showDirection(int e);
 
 private slots:
 
-	void handleTabs();
 	void handleFirstLinePolicy(int);
 	void handleOpticalMargins();
-//	void resetOpticalMargins();
-
 	void handleAlignment(int a);
 	void handleVAlignment(int a);
 	void handleDirection(int d);
Index: scribus/ui/propertywidget_distance.cpp
===================================================================
--- scribus/ui/propertywidget_distance.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_distance.cpp	(Arbeitskopie)
@@ -28,23 +28,27 @@
 	layout()->setAlignment(Qt::AlignTop);
 
 	columnGap->setValues(0, 300, 2, 0);
-	columns->setDecimals(0);
-	columns->setSuffix("");
+	columns->setDecimals(0);
+	columns->setSuffix("");
 
-	MarginStruct distances;
-	distances.resetToZero();
+	MarginStruct distances;
+	distances.resetToZero();
 
-	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
-	distanceWidget->toggleLabelVisibility(false);
+	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
+	distanceWidget->toggleLabelVisibility(false);
 
-	iconSetChange();
+	firstLineIndentSpin->setValues(-3000, 4000, 3, 0);
+	leftIndentSpin->setValues(0, 4000, 3, 0);
+	rightIndentSpin->setValues(0, 4000, 3, 0);
+
+	iconSetChange();
 	languageChange();
 
-	columnGapCombo->setCurrentIndex(0);
+	columnGapCombo->setCurrentIndex(0);
 
-	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange()));
-	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
+	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
 }
 
 void PropertyWidget_Distance::setMainWindow(ScribusMainWindow* mw)
@@ -85,6 +89,16 @@
 	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
 }
 
+void PropertyWidget_Distance::updateStyle(const ParagraphStyle &newCurrent)
+{
+	if (!m_item)
+		return;
+
+	firstLineIndentSpin->setValue(newCurrent.firstIndent() * m_unitRatio);
+	leftIndentSpin->setValue(newCurrent.leftMargin() * m_unitRatio);
+	rightIndentSpin->setValue(newCurrent.rightMargin() * m_unitRatio);
+}
+
 void PropertyWidget_Distance::setCurrentItem(PageItem *item)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -130,20 +144,22 @@
 		columnGap->setValue(textItem->columnWidth() * m_unitRatio);
 	}
 
-	MarginStruct distances;
-	distances.set(
-		textItem->textToFrameDistTop(),
-		textItem->textToFrameDistLeft(),
-		textItem->textToFrameDistBottom(),
-		textItem->textToFrameDistRight()
-	);
-	distanceWidget->setPageHeight(m_item->height());
-	distanceWidget->setPageWidth(m_item->width());
-	distanceWidget->setNewValues(distances);
-
-	columnGapLabel->setVisible(columns->value() != 1);
-	columnGapSizeLabel->setVisible(columns->value() != 1);
-
+	MarginStruct distances;
+	distances.set(
+		textItem->textToFrameDistTop(),
+		textItem->textToFrameDistLeft(),
+		textItem->textToFrameDistBottom(),
+		textItem->textToFrameDistRight()
+	);
+	distanceWidget->setPageHeight(m_item->height());
+	distanceWidget->setPageWidth(m_item->width());
+	distanceWidget->setNewValues(distances);
+
+	columnGapLabel->setVisible(columns->value() != 1);
+	columnGapSizeLabel->setVisible(columns->value() != 1);
+
+	updateStyle(parStyle);
+
 	connectSignals();
 }
 
@@ -151,8 +167,12 @@
 {
 	connect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()), Qt::UniqueConnection);
 	connect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()), Qt::UniqueConnection);
-	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
-	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
+	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
+	connect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
 }
 
 void PropertyWidget_Distance::disconnectSignals()
@@ -159,8 +179,12 @@
 {
 	disconnect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()));
 	disconnect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
-	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
-	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
+	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
+	disconnect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
 }
 
 void PropertyWidget_Distance::configureWidgets()
@@ -173,6 +197,10 @@
 			textItem = m_item->asTable()->activeCell().textFrame();
 
 		enabled  = (textItem != nullptr);
+
+		if (m_item->isPathText())
+			enabled = true;
+
 		enabled &= (m_doc->m_Selection->count() == 1);
 
 		if (textItem)
@@ -179,9 +207,11 @@
 		{
 			int numCols = textItem->m_columns;
 			
-			columnGapLabel->setVisible(numCols != 1);
-			columnGapSizeLabel->setVisible(numCols != 1);
+			columnGapLabel->setVisible(numCols != 1);
+			columnGapSizeLabel->setVisible(numCols != 1);
 		}
+
+		tabsButton->setEnabled(!m_item->isPathText());
 	}
 	setEnabled(enabled);
 }
@@ -209,13 +239,16 @@
 	// Nothing to do in this widget
 }
 
-void PropertyWidget_Distance::iconSetChange()
-{
-	IconManager &im = IconManager::instance();
-
-	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
-}
-
+void PropertyWidget_Distance::iconSetChange()
+{
+	IconManager &im = IconManager::instance();
+
+	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
+	firstLineIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-firstline"));
+	leftIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-left"));
+	rightIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-right"));
+}
+
 void PropertyWidget_Distance::showColumns(int r, double g)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -372,6 +405,37 @@
 	m_doc->regionsChanged()->update(QRect());
 }
 
+void PropertyWidget_Distance::handleIndents()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+
+	PageItem_TextFrame *tItem = m_item->asTextFrame();
+	if (tItem == nullptr)
+		return;
+
+	if (m_doc->appMode != modeEdit)
+	{
+		ParagraphStyle newStyle(m_item->itemText.defaultStyle());
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		Selection tempSelection(this, false);
+		tempSelection.addItem(m_item, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
+	else
+	{
+		ParagraphStyle newStyle;
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	}
+	m_item->update();
+}
+
 void PropertyWidget_Distance::changeEvent(QEvent *e)
 {
 	if (e->type() == QEvent::LanguageChange)
@@ -386,18 +450,28 @@
 {
 	retranslateUi(this);
 
-	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
-	int oldColGapLabel = columnGapCombo->currentIndex();
-	columnGapCombo->clear();
-	columnGapCombo->addItem( tr("Gap:"));
-	columnGapCombo->addItem( tr("Width:"));
-	columnGapCombo->setCurrentIndex(oldColGapLabel);
+	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
+	int oldColGapLabel = columnGapCombo->currentIndex();
+	columnGapCombo->clear();
+	columnGapCombo->addItem( tr("Gap:"));
+	columnGapCombo->addItem( tr("Width:"));
+	columnGapCombo->setCurrentIndex(oldColGapLabel);
 
 	QString ptSuffix = tr(" pt");
 	QString suffix = (m_doc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix;
 
 	columnGap->setSuffix(suffix);
-
+	firstLineIndentSpin->setSuffix(suffix);
+	leftIndentSpin->setSuffix(suffix);
+	rightIndentSpin->setSuffix(suffix);
+
+	firstLineIndentSpin->setToolTip(tr("Indentation for first line of the paragraph"));
+	leftIndentSpin->setToolTip(tr("Indentation from the left for the whole paragraph"));
+	rightIndentSpin->setToolTip(tr("Indentation from the right for the whole paragraph"));
+	firstLineIndentLabel->setToolTip(firstLineIndentSpin->toolTip());
+	leftIndentLabel->setToolTip(leftIndentSpin->toolTip());
+	rightIndentLabel->setToolTip(rightIndentSpin->toolTip());
+	tabsButton->setToolTip(tr("Edit tab settings of text frame..."));
 }
 
 void PropertyWidget_Distance::unitChange()
@@ -406,13 +480,19 @@
 		return;
 
 	QSignalBlocker columnGapBlocker(columnGap);
-	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker numberFirstLineIndentBlocker(firstLineIndentSpin);
+	QSignalBlocker numberLeftIndentBlocker(leftIndentSpin);
+	QSignalBlocker numberRightIndentBlocker(rightIndentSpin);
 
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 
 	columnGap->setNewUnit(m_unitIndex);
-	distanceWidget->setNewUnit(m_unitIndex);
+	distanceWidget->setNewUnit(m_unitIndex);
+	firstLineIndentSpin->setNewUnit(m_unitIndex);
+	leftIndentSpin->setNewUnit(m_unitIndex);
+	rightIndentSpin->setNewUnit(m_unitIndex);
 }
 
 void PropertyWidget_Distance::localeChange()
@@ -419,12 +499,18 @@
 {
 	const QLocale& l(LocaleManager::instance().userPreferredLocale());
 	columnGap->setLocale(l);
-	distanceWidget->setLocale(l);
+	distanceWidget->setLocale(l);
+	firstLineIndentSpin->setLocale(l);
+	leftIndentSpin->setLocale(l);
+	rightIndentSpin->setLocale(l);
 }
-
-void PropertyWidget_Distance::toggleLabelVisibility(bool v)
-{
-	columnGapSizeLabel->setLabelVisibility(v);
-	columnGapLabel->setLabelVisibility(v);
-	columnsLabel->setLabelVisibility(v);
-}
+
+void PropertyWidget_Distance::toggleLabelVisibility(bool v)
+{
+	columnGapSizeLabel->setLabelVisibility(v);
+	columnGapLabel->setLabelVisibility(v);
+	columnsLabel->setLabelVisibility(v);
+	firstLineIndentLabel->setLabelVisibility(v);
+	leftIndentLabel->setLabelVisibility(v);
+	rightIndentLabel->setLabelVisibility(v);
+}
Index: scribus/ui/propertywidget_distance.h
===================================================================
--- scribus/ui/propertywidget_distance.h	(Revision 26452)
+++ scribus/ui/propertywidget_distance.h	(Arbeitskopie)
@@ -42,15 +42,17 @@
 	void setMainWindow(ScribusMainWindow *mw);
 	void setDoc(ScribusDoc *d);
 
+	void updateStyle(const ParagraphStyle &newCurrent);
+
 	void handleAppModeChanged(int oldMode, int mode);
 	void handleSelectionChanged();
 	void handleUpdateRequest(int);
 
-	void iconSetChange();
+	void iconSetChange();
 	void languageChange();
 	void unitChange();
 	void localeChange();
-	void toggleLabelVisibility(bool v);
+	void toggleLabelVisibility(bool v);
 
 	void showColumns(int r, double g);
 
@@ -60,6 +62,7 @@
 	void handleGapSwitch();
 	void handleTabs();
 	void handleTextDistances();
+	void handleIndents();
 };
 
 #endif
indents_2024-11-27_01.patch (17,215 bytes)   

nitramr

2024-11-27 20:13

developer   ~0051673

First patch has an issue with "text on path".
indents_2024-11-27_2.patch (16,624 bytes)   
Index: scribus/ui/propertiespalette_text.cpp
===================================================================
--- scribus/ui/propertiespalette_text.cpp	(Revision 26452)
+++ scribus/ui/propertiespalette_text.cpp	(Arbeitskopie)
@@ -56,13 +56,13 @@
 	scText->restorePreferences();
 
 	alignmentWidgets = new PropertyWidget_Alignment(this);
-	scAlignment = new SectionContainer(tr("Alignment && Tabs"), "SectionTPAlignment", true, true);
+	scAlignment = new SectionContainer(tr("Alignment"), "SectionTPAlignment", true, true);
 	scAlignment->setCanSaveState(true);
 	scAlignment->setWidget(alignmentWidgets);
 	scAlignment->restorePreferences();
 
 	distanceWidgets = new PropertyWidget_Distance(this);
-	scDistance = new SectionContainer(tr("Columns && Margins"), "SectionTPColumnsMargins", true, false);
+	scDistance = new SectionContainer(tr("Columns && Indents"), "SectionTPColumnsMargins", true, false);
 	scDistance->setCanSaveState(true);
 	scDistance->setWidget(distanceWidgets);
 	scDistance->restorePreferences();
@@ -391,6 +391,7 @@
 	textWidgets->updateStyle(newCurrent);
 	styleWidgets->updateStyle(newCurrent);
 	alignmentWidgets->updateStyle(newCurrent);
+	distanceWidgets->updateStyle(newCurrent);
 }
 
 void PropertiesPalette_Text::updateTextStyles()
@@ -422,8 +423,8 @@
 void PropertiesPalette_Text::languageChange()
 {
 	scAdvanced->setText(tr("Typography"));
-	scAlignment->setText(tr("Alignment && Tabs"));
-	scDistance->setText(tr("Columns && Margins"));
+	scAlignment->setText(tr("Alignment"));
+	scDistance->setText(tr("Columns && Indents"));
 	scFontFeatures->setText(tr("OpenType Features"));
 	scHyphenation->setText(tr("Hyphenation && Language"));
 	scOrphans->setText(tr("Orphans && Widows"));
Index: scribus/ui/propertywidget_alignment.cpp
===================================================================
--- scribus/ui/propertywidget_alignment.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.cpp	(Arbeitskopie)
@@ -147,10 +147,8 @@
 
 void PropertyWidget_Alignment::connectSignals()
 {
-	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
 	connect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	connect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	connect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	connect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	connect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	connect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -158,10 +156,8 @@
 
 void PropertyWidget_Alignment::disconnectSignals()
 {
-	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
 	disconnect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	disconnect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	disconnect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	disconnect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	disconnect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	disconnect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -187,7 +183,6 @@
 		textVerticalAlignment->setEnabled(!m_item->isPathText());
 		flopWidget->setEnabled(!m_item->isPathText());
 		opticalMarginsWidget->setEnabled(!m_item->isPathText());
-		tabsButton->setEnabled(!m_item->isPathText());
 	}
 	setEnabled(enabled);
 }
@@ -286,37 +283,6 @@
 	m_haveItem = tmp;
 }
 
-void PropertyWidget_Alignment::handleTabs()
-{
-	if (!m_doc || !m_item)
-		return;
-
-	PageItem_TextFrame *tItem = m_item->asTextFrame();
-	if (tItem == nullptr)
-		return;
-	const ParagraphStyle& style(m_doc->appMode == modeEdit ? tItem->currentStyle() : tItem->itemText.defaultStyle());
-	TabManager *dia = new TabManager(this, m_doc->unitIndex(), style.tabValues(), tItem->columnWidth());
-	if (dia->exec())
-	{
-		if (m_doc->appMode != modeEdit)
-		{
-			ParagraphStyle newStyle(m_item->itemText.defaultStyle());
-			newStyle.setTabValues(dia->tabList());
-			Selection tempSelection(this, false);
-			tempSelection.addItem(m_item, true);
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
-		}
-		else
-		{
-			ParagraphStyle newStyle;
-			newStyle.setTabValues(dia->tabList());
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-		}
-		m_item->update();
-	}
-	delete dia;
-}
-
 void PropertyWidget_Alignment::handleAlignment(int a)
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
Index: scribus/ui/propertywidget_alignment.h
===================================================================
--- scribus/ui/propertywidget_alignment.h	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.h	(Arbeitskopie)
@@ -53,17 +53,14 @@
 	void toggleLabelVisibility(bool v);
 
 	void showFirstLinePolicy(FirstLineOffsetPolicy f);
	void showOpticalMargins(int e);
 	void showAlignment(int e);
 	void showDirection(int e);
 
 private slots:
 
-	void handleTabs();
 	void handleFirstLinePolicy(int);
 	void handleOpticalMargins();
-//	void resetOpticalMargins();
-
 	void handleAlignment(int a);
 	void handleVAlignment(int a);
 	void handleDirection(int d);
Index: scribus/ui/propertywidget_distance.cpp
===================================================================
--- scribus/ui/propertywidget_distance.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_distance.cpp	(Arbeitskopie)
@@ -28,23 +28,27 @@
 	layout()->setAlignment(Qt::AlignTop);
 
 	columnGap->setValues(0, 300, 2, 0);
-	columns->setDecimals(0);
-	columns->setSuffix("");
+	columns->setDecimals(0);
+	columns->setSuffix("");
 
-	MarginStruct distances;
-	distances.resetToZero();
+	MarginStruct distances;
+	distances.resetToZero();
 
-	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
-	distanceWidget->toggleLabelVisibility(false);
+	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
+	distanceWidget->toggleLabelVisibility(false);
 
-	iconSetChange();
+	firstLineIndentSpin->setValues(-3000, 4000, 3, 0);
+	leftIndentSpin->setValues(0, 4000, 3, 0);
+	rightIndentSpin->setValues(0, 4000, 3, 0);
+
+	iconSetChange();
 	languageChange();
 
-	columnGapCombo->setCurrentIndex(0);
+	columnGapCombo->setCurrentIndex(0);
 
-	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange()));
-	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
+	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
 }
 
 void PropertyWidget_Distance::setMainWindow(ScribusMainWindow* mw)
@@ -85,6 +89,16 @@
 	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
 }
 
+void PropertyWidget_Distance::updateStyle(const ParagraphStyle &newCurrent)
+{
+	if (!m_item)
+		return;
+
+	firstLineIndentSpin->setValue(newCurrent.firstIndent() * m_unitRatio);
+	leftIndentSpin->setValue(newCurrent.leftMargin() * m_unitRatio);
+	rightIndentSpin->setValue(newCurrent.rightMargin() * m_unitRatio);
+}
+
 void PropertyWidget_Distance::setCurrentItem(PageItem *item)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -130,20 +144,22 @@
 		columnGap->setValue(textItem->columnWidth() * m_unitRatio);
 	}
 
-	MarginStruct distances;
-	distances.set(
-		textItem->textToFrameDistTop(),
-		textItem->textToFrameDistLeft(),
-		textItem->textToFrameDistBottom(),
-		textItem->textToFrameDistRight()
-	);
-	distanceWidget->setPageHeight(m_item->height());
-	distanceWidget->setPageWidth(m_item->width());
-	distanceWidget->setNewValues(distances);
-
-	columnGapLabel->setVisible(columns->value() != 1);
-	columnGapSizeLabel->setVisible(columns->value() != 1);
-
+	MarginStruct distances;
+	distances.set(
+		textItem->textToFrameDistTop(),
+		textItem->textToFrameDistLeft(),
+		textItem->textToFrameDistBottom(),
+		textItem->textToFrameDistRight()
+	);
+	distanceWidget->setPageHeight(m_item->height());
+	distanceWidget->setPageWidth(m_item->width());
+	distanceWidget->setNewValues(distances);
+
+	columnGapLabel->setVisible(columns->value() != 1);
+	columnGapSizeLabel->setVisible(columns->value() != 1);
+
+	updateStyle(parStyle);
+
 	connectSignals();
 }
 
@@ -151,8 +167,12 @@
 {
 	connect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()), Qt::UniqueConnection);
 	connect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()), Qt::UniqueConnection);
-	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
-	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
+	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
+	connect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
 }
 
 void PropertyWidget_Distance::disconnectSignals()
@@ -159,8 +179,12 @@
 {
 	disconnect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()));
 	disconnect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
-	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
-	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
+	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
+	disconnect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
 }
 
 void PropertyWidget_Distance::configureWidgets()
@@ -209,13 +233,16 @@
 	// Nothing to do in this widget
 }
 
-void PropertyWidget_Distance::iconSetChange()
-{
-	IconManager &im = IconManager::instance();
-
-	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
-}
-
+void PropertyWidget_Distance::iconSetChange()
+{
+	IconManager &im = IconManager::instance();
+
+	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
+	firstLineIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-firstline"));
+	leftIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-left"));
+	rightIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-right"));
+}
+
 void PropertyWidget_Distance::showColumns(int r, double g)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -372,6 +399,37 @@
 	m_doc->regionsChanged()->update(QRect());
 }
 
+void PropertyWidget_Distance::handleIndents()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+
+	PageItem_TextFrame *tItem = m_item->asTextFrame();
+	if (tItem == nullptr)
+		return;
+
+	if (m_doc->appMode != modeEdit)
+	{
+		ParagraphStyle newStyle(m_item->itemText.defaultStyle());
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		Selection tempSelection(this, false);
+		tempSelection.addItem(m_item, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
+	else
+	{
+		ParagraphStyle newStyle;
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	}
+	m_item->update();
+}
+
 void PropertyWidget_Distance::changeEvent(QEvent *e)
 {
 	if (e->type() == QEvent::LanguageChange)
@@ -386,18 +444,28 @@
 {
 	retranslateUi(this);
 
-	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
-	int oldColGapLabel = columnGapCombo->currentIndex();
-	columnGapCombo->clear();
-	columnGapCombo->addItem( tr("Gap:"));
-	columnGapCombo->addItem( tr("Width:"));
-	columnGapCombo->setCurrentIndex(oldColGapLabel);
+	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
+	int oldColGapLabel = columnGapCombo->currentIndex();
+	columnGapCombo->clear();
+	columnGapCombo->addItem( tr("Gap:"));
+	columnGapCombo->addItem( tr("Width:"));
+	columnGapCombo->setCurrentIndex(oldColGapLabel);
 
 	QString ptSuffix = tr(" pt");
 	QString suffix = (m_doc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix;
 
 	columnGap->setSuffix(suffix);
-
+	firstLineIndentSpin->setSuffix(suffix);
+	leftIndentSpin->setSuffix(suffix);
+	rightIndentSpin->setSuffix(suffix);
+
+	firstLineIndentSpin->setToolTip(tr("Indentation for first line of the paragraph"));
+	leftIndentSpin->setToolTip(tr("Indentation from the left for the whole paragraph"));
+	rightIndentSpin->setToolTip(tr("Indentation from the right for the whole paragraph"));
+	firstLineIndentLabel->setToolTip(firstLineIndentSpin->toolTip());
+	leftIndentLabel->setToolTip(leftIndentSpin->toolTip());
+	rightIndentLabel->setToolTip(rightIndentSpin->toolTip());
+	tabsButton->setToolTip(tr("Edit tab settings of text frame..."));
 }
 
 void PropertyWidget_Distance::unitChange()
@@ -406,13 +474,19 @@
 		return;
 
 	QSignalBlocker columnGapBlocker(columnGap);
-	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker numberFirstLineIndentBlocker(firstLineIndentSpin);
+	QSignalBlocker numberLeftIndentBlocker(leftIndentSpin);
+	QSignalBlocker numberRightIndentBlocker(rightIndentSpin);
 
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 
 	columnGap->setNewUnit(m_unitIndex);
-	distanceWidget->setNewUnit(m_unitIndex);
+	distanceWidget->setNewUnit(m_unitIndex);
+	firstLineIndentSpin->setNewUnit(m_unitIndex);
+	leftIndentSpin->setNewUnit(m_unitIndex);
+	rightIndentSpin->setNewUnit(m_unitIndex);
 }
 
 void PropertyWidget_Distance::localeChange()
@@ -419,12 +493,18 @@
 {
 	const QLocale& l(LocaleManager::instance().userPreferredLocale());
 	columnGap->setLocale(l);
-	distanceWidget->setLocale(l);
+	distanceWidget->setLocale(l);
+	firstLineIndentSpin->setLocale(l);
+	leftIndentSpin->setLocale(l);
+	rightIndentSpin->setLocale(l);
 }
-
-void PropertyWidget_Distance::toggleLabelVisibility(bool v)
-{
-	columnGapSizeLabel->setLabelVisibility(v);
-	columnGapLabel->setLabelVisibility(v);
-	columnsLabel->setLabelVisibility(v);
-}
+
+void PropertyWidget_Distance::toggleLabelVisibility(bool v)
+{
+	columnGapSizeLabel->setLabelVisibility(v);
+	columnGapLabel->setLabelVisibility(v);
+	columnsLabel->setLabelVisibility(v);
+	firstLineIndentLabel->setLabelVisibility(v);
+	leftIndentLabel->setLabelVisibility(v);
+	rightIndentLabel->setLabelVisibility(v);
+}
Index: scribus/ui/propertywidget_distance.h
===================================================================
--- scribus/ui/propertywidget_distance.h	(Revision 26452)
+++ scribus/ui/propertywidget_distance.h	(Arbeitskopie)
@@ -42,15 +42,17 @@
 	void setMainWindow(ScribusMainWindow *mw);
 	void setDoc(ScribusDoc *d);
 
+	void updateStyle(const ParagraphStyle &newCurrent);
+
 	void handleAppModeChanged(int oldMode, int mode);
 	void handleSelectionChanged();
 	void handleUpdateRequest(int);
 
-	void iconSetChange();
+	void iconSetChange();
 	void languageChange();
 	void unitChange();
 	void localeChange();
-	void toggleLabelVisibility(bool v);
+	void toggleLabelVisibility(bool v);
 
 	void showColumns(int r, double g);
 
@@ -60,6 +62,7 @@
 	void handleGapSwitch();
 	void handleTabs();
 	void handleTextDistances();
+	void handleIndents();
 };
 
 #endif
indents_2024-11-27_2.patch (16,624 bytes)   

ale

2024-11-28 08:40

manager   ~0051674

Good!

Sometimes, I wonder why all programs offer the editing of the margins from the ruler: it's so uncomfortable to get exact values!

Another feedback (that I don't think needs a new patch: if there is an agreement on this, the person merging this can quick make the change):

some time ago I got criticized for using the term "Tabulator"...
I think that they're just called "Tabs", like the tooltip on the "Tabulators..." button says.

nitramr

2024-11-28 09:16

developer   ~0051675

You're right, it seems that "tabs" are used more often than" tabulators". At least if you trust this website. https://www.linguee.com/german-english/translation/tabulator.html

nitramr

2024-11-29 16:23

developer   ~0051691

Just an update. I add "space above" and "space after" input too. "Tabulators" button has been renamed to "Tabs".

I kept the pt unit for the two new input fields, like in style manager.
files-2.zip (2,797 bytes)
indents-2.png (19,180 bytes)   
indents-2.png (19,180 bytes)   
indents_2024-11-29_1.patch (17,906 bytes)   
Index: scribus/ui/propertiespalette_text.cpp
===================================================================
--- scribus/ui/propertiespalette_text.cpp	(Revision 26452)
+++ scribus/ui/propertiespalette_text.cpp	(Arbeitskopie)
@@ -56,13 +56,13 @@
 	scText->restorePreferences();
 
 	alignmentWidgets = new PropertyWidget_Alignment(this);
-	scAlignment = new SectionContainer(tr("Alignment && Tabs"), "SectionTPAlignment", true, true);
+	scAlignment = new SectionContainer(tr("Alignment"), "SectionTPAlignment", true, true);
 	scAlignment->setCanSaveState(true);
 	scAlignment->setWidget(alignmentWidgets);
 	scAlignment->restorePreferences();
 
 	distanceWidgets = new PropertyWidget_Distance(this);
-	scDistance = new SectionContainer(tr("Columns && Margins"), "SectionTPColumnsMargins", true, false);
+	scDistance = new SectionContainer(tr("Columns && Indents"), "SectionTPColumnsMargins", true, false);
 	scDistance->setCanSaveState(true);
 	scDistance->setWidget(distanceWidgets);
 	scDistance->restorePreferences();
@@ -391,6 +391,7 @@
 	textWidgets->updateStyle(newCurrent);
 	styleWidgets->updateStyle(newCurrent);
 	alignmentWidgets->updateStyle(newCurrent);
+	distanceWidgets->updateStyle(newCurrent);
 }
 
 void PropertiesPalette_Text::updateTextStyles()
@@ -422,8 +423,8 @@
 void PropertiesPalette_Text::languageChange()
 {
 	scAdvanced->setText(tr("Typography"));
-	scAlignment->setText(tr("Alignment && Tabs"));
-	scDistance->setText(tr("Columns && Margins"));
+	scAlignment->setText(tr("Alignment"));
+	scDistance->setText(tr("Columns && Indents"));
 	scFontFeatures->setText(tr("OpenType Features"));
 	scHyphenation->setText(tr("Hyphenation && Language"));
 	scOrphans->setText(tr("Orphans && Widows"));
Index: scribus/ui/propertywidget_alignment.cpp
===================================================================
--- scribus/ui/propertywidget_alignment.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.cpp	(Arbeitskopie)
@@ -147,10 +147,8 @@
 
 void PropertyWidget_Alignment::connectSignals()
 {
-	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
 	connect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	connect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	connect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	connect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	connect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	connect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -158,10 +156,8 @@
 
 void PropertyWidget_Alignment::disconnectSignals()
 {
-	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
 	disconnect(flopWidget->flopGroup, SIGNAL(idClicked(int)), this, SLOT(handleFirstLinePolicy(int)));
 	disconnect(opticalMarginsWidget, SIGNAL(opticalMarginChanged()), this, SLOT(handleOpticalMargins()) );
-//	disconnect(opticalMarginsWidget->resetButton, SIGNAL(clicked()), this, SLOT(resetOpticalMargins()) );
 	disconnect(textAlignment , SIGNAL(State(int))   , this, SLOT(handleAlignment(int)));
 	disconnect(textVerticalAlignment, SIGNAL(State(int)), this, SLOT(handleVAlignment(int)));
 	disconnect(textDirection , SIGNAL(State(int))   , this, SLOT(handleDirection(int)));
@@ -187,7 +183,6 @@
 		textVerticalAlignment->setEnabled(!m_item->isPathText());
 		flopWidget->setEnabled(!m_item->isPathText());
 		opticalMarginsWidget->setEnabled(!m_item->isPathText());
-		tabsButton->setEnabled(!m_item->isPathText());
 	}
 	setEnabled(enabled);
 }
@@ -286,37 +283,6 @@
 	m_haveItem = tmp;
 }
 
-void PropertyWidget_Alignment::handleTabs()
-{
-	if (!m_doc || !m_item)
-		return;
-
-	PageItem_TextFrame *tItem = m_item->asTextFrame();
-	if (tItem == nullptr)
-		return;
-	const ParagraphStyle& style(m_doc->appMode == modeEdit ? tItem->currentStyle() : tItem->itemText.defaultStyle());
-	TabManager *dia = new TabManager(this, m_doc->unitIndex(), style.tabValues(), tItem->columnWidth());
-	if (dia->exec())
-	{
-		if (m_doc->appMode != modeEdit)
-		{
-			ParagraphStyle newStyle(m_item->itemText.defaultStyle());
-			newStyle.setTabValues(dia->tabList());
-			Selection tempSelection(this, false);
-			tempSelection.addItem(m_item, true);
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
-		}
-		else
-		{
-			ParagraphStyle newStyle;
-			newStyle.setTabValues(dia->tabList());
-			m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-		}
-		m_item->update();
-	}
-	delete dia;
-}
-
 void PropertyWidget_Alignment::handleAlignment(int a)
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
Index: scribus/ui/propertywidget_alignment.h
===================================================================
--- scribus/ui/propertywidget_alignment.h	(Revision 26452)
+++ scribus/ui/propertywidget_alignment.h	(Arbeitskopie)
@@ -53,17 +53,14 @@
 	void toggleLabelVisibility(bool v);
 
 	void showFirstLinePolicy(FirstLineOffsetPolicy f);
	void showOpticalMargins(int e);
 	void showAlignment(int e);
 	void showDirection(int e);
 
 private slots:
 
-	void handleTabs();
 	void handleFirstLinePolicy(int);
 	void handleOpticalMargins();
-//	void resetOpticalMargins();
-
 	void handleAlignment(int a);
 	void handleVAlignment(int a);
 	void handleDirection(int d);
Index: scribus/ui/propertywidget_distance.cpp
===================================================================
--- scribus/ui/propertywidget_distance.cpp	(Revision 26452)
+++ scribus/ui/propertywidget_distance.cpp	(Arbeitskopie)
@@ -28,23 +28,32 @@
 	layout()->setAlignment(Qt::AlignTop);
 
 	columnGap->setValues(0, 300, 2, 0);
-	columns->setDecimals(0);
-	columns->setSuffix("");
+	columns->setDecimals(0);
+	columns->setSuffix("");
 
-	MarginStruct distances;
-	distances.resetToZero();
+	MarginStruct distances;
+	distances.resetToZero();
 
-	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
-	distanceWidget->toggleLabelVisibility(false);
+	distanceWidget->setup(distances, 0, m_unitIndex, NewMarginWidget::DistanceWidgetFlags);
+	distanceWidget->toggleLabelVisibility(false);
 
-	iconSetChange();
+	firstLineIndentSpin->setValues(-3000, 4000, 3, 0);
+	leftIndentSpin->setValues(0, 4000, 3, 0);
+	rightIndentSpin->setValues(0, 4000, 3, 0);
+
+	gapBeforeSpin->setValues(0, 300, 2, 0);
+	gapBeforeSpin->setSuffix(unitGetSuffixFromIndex(0));
+	gapAfterSpin->setValues(0, 300, 2, 0);
+	gapAfterSpin->setSuffix(unitGetSuffixFromIndex(0));
+
+	iconSetChange();
 	languageChange();
 
-	columnGapCombo->setCurrentIndex(0);
+	columnGapCombo->setCurrentIndex(0);
 
-	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
+	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 	connect(ScQApp, SIGNAL(localeChanged()), this, SLOT(localeChange()));
-	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
+	connect(ScQApp, SIGNAL(labelVisibilityChanged(bool)), this, SLOT(toggleLabelVisibility(bool)));
 }
 
 void PropertyWidget_Distance::setMainWindow(ScribusMainWindow* mw)
@@ -85,6 +94,18 @@
 	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
 }
 
+void PropertyWidget_Distance::updateStyle(const ParagraphStyle &newCurrent)
+{
+	if (!m_item)
+		return;
+
+	firstLineIndentSpin->setValue(newCurrent.firstIndent() * m_unitRatio);
+	leftIndentSpin->setValue(newCurrent.leftMargin() * m_unitRatio);
+	rightIndentSpin->setValue(newCurrent.rightMargin() * m_unitRatio);
+	gapBeforeSpin->setValue(newCurrent.gapBefore());
+	gapAfterSpin->setValue(newCurrent.gapAfter());
+}
+
 void PropertyWidget_Distance::setCurrentItem(PageItem *item)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -130,20 +151,22 @@
 		columnGap->setValue(textItem->columnWidth() * m_unitRatio);
 	}
 
-	MarginStruct distances;
-	distances.set(
-		textItem->textToFrameDistTop(),
-		textItem->textToFrameDistLeft(),
-		textItem->textToFrameDistBottom(),
-		textItem->textToFrameDistRight()
-	);
-	distanceWidget->setPageHeight(m_item->height());
-	distanceWidget->setPageWidth(m_item->width());
-	distanceWidget->setNewValues(distances);
-
-	columnGapLabel->setVisible(columns->value() != 1);
-	columnGapSizeLabel->setVisible(columns->value() != 1);
-
+	MarginStruct distances;
+	distances.set(
+		textItem->textToFrameDistTop(),
+		textItem->textToFrameDistLeft(),
+		textItem->textToFrameDistBottom(),
+		textItem->textToFrameDistRight()
+	);
+	distanceWidget->setPageHeight(m_item->height());
+	distanceWidget->setPageWidth(m_item->width());
+	distanceWidget->setNewValues(distances);
+
+	columnGapLabel->setVisible(columns->value() != 1);
+	columnGapSizeLabel->setVisible(columns->value() != 1);
+
+	updateStyle(parStyle);
+
 	connectSignals();
 }
 
@@ -151,8 +174,15 @@
 {
 	connect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()), Qt::UniqueConnection);
 	connect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()), Qt::UniqueConnection);
-	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
-	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()), Qt::UniqueConnection);
+	connect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()), Qt::UniqueConnection);
+	connect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()), Qt::UniqueConnection);
+	connect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(gapAfterSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+	connect(gapBeforeSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()), Qt::UniqueConnection);
+
 }
 
 void PropertyWidget_Distance::disconnectSignals()
@@ -159,8 +189,14 @@
 {
 	disconnect(columns       , SIGNAL(valueChanged(double))   , this, SLOT(handleColumns()));
 	disconnect(columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
-	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
-	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(columnGapCombo, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
+	disconnect(distanceWidget, SIGNAL(valuesChanged(MarginStruct)), this, SLOT(handleTextDistances()));
+	disconnect(tabsButton    , SIGNAL(clicked())           , this, SLOT(handleTabs()));
+	disconnect(firstLineIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(rightIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(leftIndentSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(gapAfterSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
+	disconnect(gapBeforeSpin, SIGNAL(valueChanged(double)), this, SLOT(handleIndents()));
 }
 
 void PropertyWidget_Distance::configureWidgets()
@@ -209,13 +245,18 @@
 	// Nothing to do in this widget
 }
 
-void PropertyWidget_Distance::iconSetChange()
-{
-	IconManager &im = IconManager::instance();
-
-	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
-}
-
+void PropertyWidget_Distance::iconSetChange()
+{
+	IconManager &im = IconManager::instance();
+
+	columnsLabel->setPixmap(im.loadPixmap("paragraph-columns"));
+	firstLineIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-firstline"));
+	leftIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-left"));
+	rightIndentLabel->setPixmap(im.loadPixmap("paragraph-indent-right"));
+	gapBeforeLabel->setPixmap(im.loadPixmap("paragraph-space-above") );
+	gapAfterLabel->setPixmap(im.loadPixmap("paragraph-space-below") );
+}
+
 void PropertyWidget_Distance::showColumns(int r, double g)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -372,6 +413,41 @@
 	m_doc->regionsChanged()->update(QRect());
 }
 
+void PropertyWidget_Distance::handleIndents()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+
+	PageItem_TextFrame *tItem = m_item->asTextFrame();
+	if (tItem == nullptr)
+		return;
+
+	if (m_doc->appMode != modeEdit)
+	{
+		ParagraphStyle newStyle(m_item->itemText.defaultStyle());
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		newStyle.setGapBefore(gapBeforeSpin->value());
+		newStyle.setGapAfter(gapAfterSpin->value());
+		Selection tempSelection(this, false);
+		tempSelection.addItem(m_item, true);
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection);
+	}
+	else
+	{
+		ParagraphStyle newStyle;
+		newStyle.setFirstIndent(firstLineIndentSpin->value() / m_unitRatio);
+		newStyle.setLeftMargin(leftIndentSpin->value() / m_unitRatio);
+		newStyle.setRightMargin(rightIndentSpin->value() / m_unitRatio);
+		newStyle.setGapBefore(gapBeforeSpin->value());
+		newStyle.setGapAfter(gapAfterSpin->value());
+		m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	}
+	m_item->update();
+}
+
 void PropertyWidget_Distance::changeEvent(QEvent *e)
 {
 	if (e->type() == QEvent::LanguageChange)
@@ -386,18 +462,30 @@
 {
 	retranslateUi(this);
 
-	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
-	int oldColGapLabel = columnGapCombo->currentIndex();
-	columnGapCombo->clear();
-	columnGapCombo->addItem( tr("Gap:"));
-	columnGapCombo->addItem( tr("Width:"));
-	columnGapCombo->setCurrentIndex(oldColGapLabel);
+	QSignalBlocker columnGapLabelBlocker(columnGapCombo);
+	int oldColGapLabel = columnGapCombo->currentIndex();
+	columnGapCombo->clear();
+	columnGapCombo->addItem( tr("Gap:"));
+	columnGapCombo->addItem( tr("Width:"));
+	columnGapCombo->setCurrentIndex(oldColGapLabel);
 
 	QString ptSuffix = tr(" pt");
 	QString suffix = (m_doc) ? unitGetSuffixFromIndex(m_doc->unitIndex()) : ptSuffix;
 
 	columnGap->setSuffix(suffix);
-
+	firstLineIndentSpin->setSuffix(suffix);
+	leftIndentSpin->setSuffix(suffix);
+	rightIndentSpin->setSuffix(suffix);
+
+	firstLineIndentSpin->setToolTip(tr("Indentation for first line of the paragraph"));
+	leftIndentSpin->setToolTip(tr("Indentation from the left for the whole paragraph"));
+	rightIndentSpin->setToolTip(tr("Indentation from the right for the whole paragraph"));
+	firstLineIndentLabel->setToolTip(firstLineIndentSpin->toolTip());
+	leftIndentLabel->setToolTip(leftIndentSpin->toolTip());
+	rightIndentLabel->setToolTip(rightIndentSpin->toolTip());
+	tabsButton->setToolTip(tr("Edit tab settings of text frame..."));
+	gapBeforeLabel->setToolTip(tr("Space above a paragraph"));
+	gapAfterLabel->setToolTip(tr("Space below a paragraph"));
 }
 
 void PropertyWidget_Distance::unitChange()
@@ -406,13 +494,19 @@
 		return;
 
 	QSignalBlocker columnGapBlocker(columnGap);
-	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker distancesBlocker(distanceWidget);
+	QSignalBlocker numberFirstLineIndentBlocker(firstLineIndentSpin);
+	QSignalBlocker numberLeftIndentBlocker(leftIndentSpin);
+	QSignalBlocker numberRightIndentBlocker(rightIndentSpin);
 
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 
 	columnGap->setNewUnit(m_unitIndex);
-	distanceWidget->setNewUnit(m_unitIndex);
+	distanceWidget->setNewUnit(m_unitIndex);
+	firstLineIndentSpin->setNewUnit(m_unitIndex);
+	leftIndentSpin->setNewUnit(m_unitIndex);
+	rightIndentSpin->setNewUnit(m_unitIndex);
 }
 
 void PropertyWidget_Distance::localeChange()
@@ -419,12 +513,22 @@
 {
 	const QLocale& l(LocaleManager::instance().userPreferredLocale());
 	columnGap->setLocale(l);
-	distanceWidget->setLocale(l);
+	distanceWidget->setLocale(l);
+	firstLineIndentSpin->setLocale(l);
+	leftIndentSpin->setLocale(l);
+	rightIndentSpin->setLocale(l);
+	gapAfterSpin->setLocale(l);
+	gapBeforeSpin->setLocale(l);
 }
-
-void PropertyWidget_Distance::toggleLabelVisibility(bool v)
-{
-	columnGapSizeLabel->setLabelVisibility(v);
-	columnGapLabel->setLabelVisibility(v);
-	columnsLabel->setLabelVisibility(v);
-}
+
+void PropertyWidget_Distance::toggleLabelVisibility(bool v)
+{
+	columnGapSizeLabel->setLabelVisibility(v);
+	columnGapLabel->setLabelVisibility(v);
+	columnsLabel->setLabelVisibility(v);
+	firstLineIndentLabel->setLabelVisibility(v);
+	leftIndentLabel->setLabelVisibility(v);
+	rightIndentLabel->setLabelVisibility(v);
+	gapBeforeLabel->setLabelVisibility(v);
+	gapAfterLabel->setLabelVisibility(v);
+}
Index: scribus/ui/propertywidget_distance.h
===================================================================
--- scribus/ui/propertywidget_distance.h	(Revision 26452)
+++ scribus/ui/propertywidget_distance.h	(Arbeitskopie)
@@ -42,15 +42,17 @@
 	void setMainWindow(ScribusMainWindow *mw);
 	void setDoc(ScribusDoc *d);
 
+	void updateStyle(const ParagraphStyle &newCurrent);
+
 	void handleAppModeChanged(int oldMode, int mode);
 	void handleSelectionChanged();
 	void handleUpdateRequest(int);
 
-	void iconSetChange();
+	void iconSetChange();
 	void languageChange();
 	void unitChange();
 	void localeChange();
-	void toggleLabelVisibility(bool v);
+	void toggleLabelVisibility(bool v);
 
 	void showColumns(int r, double g);
 
@@ -60,6 +62,7 @@
 	void handleGapSwitch();
 	void handleTabs();
 	void handleTextDistances();
+	void handleIndents();
 };
 
 #endif
indents_2024-11-29_1.patch (17,906 bytes)   

PeterBenedek

2024-11-29 18:31

developer   ~0051693

Very nice work. Thank you martin.

Issue History

Date Modified Username Field Change
2022-10-14 18:12 digirew New Issue
2022-10-14 18:12 digirew File Added: Screen Shot 2022-10-14 at 2.11.08 PM.png
2022-10-14 18:13 digirew Note Added: 0049786
2024-11-27 19:51 nitramr Assigned To => nitramr
2024-11-27 19:51 nitramr Status new => confirmed
2024-11-27 19:51 nitramr Category Usability => User Interface
2024-11-27 19:51 nitramr Fixed in Version => 1.7.0.svn
2024-11-27 19:51 nitramr Target Version => 1.7.0
2024-11-27 19:51 nitramr Patch No => Yes
2024-11-27 19:54 nitramr Note Added: 0051672
2024-11-27 19:54 nitramr File Added: files.zip
2024-11-27 19:54 nitramr File Added: indents.png
2024-11-27 19:54 nitramr File Added: indents_2024-11-27_01.patch
2024-11-27 20:13 nitramr Note Added: 0051673
2024-11-27 20:13 nitramr File Added: indents_2024-11-27_2.patch
2024-11-28 08:40 ale Note Added: 0051674
2024-11-28 09:16 nitramr Note Added: 0051675
2024-11-29 16:23 nitramr Note Added: 0051691
2024-11-29 16:23 nitramr File Added: files-2.zip
2024-11-29 16:23 nitramr File Added: indents-2.png
2024-11-29 16:23 nitramr File Added: indents_2024-11-29_1.patch
2024-11-29 18:31 PeterBenedek Note Added: 0051693
2024-12-05 19:58 cbradney Status confirmed => resolved
2024-12-05 19:58 cbradney Resolution open => fixed