View Issue Details

IDProjectCategoryView StatusLast Update
0010338ScribusStylespublic2016-04-11 19:12
Reportercezaryece Assigned Tofschmid  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0010338: [new feature] patch for applying char styles to Drop Cap and on-demand control in PP
Description- adding ability to set character style for Drop Cap char in definition of paragraph style
- adding control of Drop Cap parameters (on/off, offset, # lines, char style) to Properties Palette for fast set DC for selected paragraph(s) without setting it in paragraph style definition
Steps To ReproduceCheck reports for relation:
0000460, 0000204, 0008673, 0007587, 0006822, 0006529, 0006338, 0001337, 0000461
Tagsdropcap, oif
Patch

Relationships

related to 0000460 acknowledged Drop caps with more than one character 
related to 0000204 acknowledged Drop Cap only for the first paragraph 
related to 0008673 new feature request: add option in paragraph styles to apply a particular character style to the first line of text 
related to 0006822 new Drop caps - part 2. 
related to 0006338 acknowledged More options for "drop caps" 
related to 0001337 confirmed Drop caps only drop first char of a paragraph beginning with a quote 
related to 0000461 acknowledged drop-cap position for hanging, jutting, etc 

Activities

cezaryece

2011-10-23 21:18

updater  

dropCapStyles.patch (29,889 bytes)   
Index: Scribus/scribus/fileloader.cpp
===================================================================
--- Scribus/scribus/fileloader.cpp	(wersja 16905)
+++ Scribus/scribus/fileloader.cpp	(kopia robocza)
@@ -407,6 +407,7 @@
 		vg.charStyle().setFont((*currDoc->AllFonts)[tmpf]);
 		vg.charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg.attribute("FONTSIZE"), 12.0) * 10.0));
 		vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt()));
+		vg.setDcCharStyleName(pg.attribute("DROPCHSTYLE", ""));
 		vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt());
 		vg.setDropCapOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0));
 		vg.charStyle().setFeatures(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()).featureList());
Index: Scribus/scribus/pageitem_textframe.cpp
===================================================================
--- Scribus/scribus/pageitem_textframe.cpp	(wersja 16924)
+++ Scribus/scribus/pageitem_textframe.cpp	(kopia robocza)
@@ -1325,7 +1325,7 @@
 			if (current.itemsInLine == 0)
 				opticalMargins = style.opticalMargins();
 			
-			const CharStyle& charStyle =  (hl->ch != SpecialChars::PARSEP? itemText.charStyle(a) : itemText.paragraphStyle(a).charStyle());
+			CharStyle charStyle = (hl->ch != SpecialChars::PARSEP? itemText.charStyle(a) : style.charStyle());
 			chstr = ExpandToken(a);
 			double hlcsize10 = charStyle.fontSize() / 10.0;
 			double scaleV = charStyle.scaleV() / 1000.0;
@@ -1350,6 +1350,31 @@
 						DropCmode = false;
 				}
 			}
+			if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP)
+			{
+				if (style.hasDropCap())
+				{
+					if (style.dcCharStyleName() == tr("No Style") || style.dcCharStyleName().isEmpty())
+					{
+						const QString& curParent(style.hasParent() ? style.parent() : style.name());
+						CharStyle newStyle;
+						newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
+						charStyle.setStyle(newStyle);
+					}
+					else if (charStyle.name() != style.dcCharStyleName())
+						charStyle.setStyle(m_Doc->charStyle(style.dcCharStyleName()));
+					itemText.setCharStyle(a, chstr.length(),charStyle);
+				}
+				else if (style.dcCharStyleName() != tr("No Style") && !style.dcCharStyleName().isEmpty())
+				//hasDropCap is cleared but is set dcCharStyleName = clear drop cap char style
+				{
+					const QString& curParent(style.hasParent() ? style.parent() : style.name());
+					CharStyle newStyle;
+					newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
+					charStyle.setStyle(newStyle);
+					itemText.setCharStyle(a, chstr.length(),charStyle);
+				}
+			}
 
 			{  // local block for 'fl'
 				StyleFlag fl = hl->effects();
Index: Scribus/scribus/ui/propertywidget_dropcap.cpp
===================================================================
--- Scribus/scribus/ui/propertywidget_dropcap.cpp	(wersja 0)
+++ Scribus/scribus/ui/propertywidget_dropcap.cpp	(wersja 0)
@@ -0,0 +1,150 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+
+#include "propertywidget_dropcap.h"
+#include "scribus.h"
+#include "units.h"
+#include "util.h"
+
+PropertyWidget_DropCap::PropertyWidget_DropCap(QWidget *parent) : QFrame(parent)
+{
+    setupUi(this);
+	setFrameStyle(QFrame::Box | QFrame::Plain);
+	setLineWidth(1);
+	layout()->setAlignment( Qt::AlignTop );
+
+	languageChange();
+
+	if (!m_doc) return;
+	dropCapCharStyleCombo->updateFormatList();
+}
+
+void PropertyWidget_DropCap::setDoc(ScribusDoc *doc)
+{
+	m_doc = doc;
+	dropCapCharStyleCombo->setDoc(doc);
+
+	if (!m_doc)
+		return;
+
+	m_unitRatio   = m_doc->unitRatio();
+	m_unitIndex   = m_doc->unitIndex();
+	dropCapOffset->setSuffix(unitGetSuffixFromIndex(0));
+}
+
+void PropertyWidget_DropCap::unitChange()
+{
+	if (!m_doc)
+		return;
+
+	m_unitRatio = m_doc->unitRatio();
+	m_unitIndex = m_doc->unitIndex();
+
+	dropCapOffset->blockSignals(true);
+	dropCapOffset->setNewUnit( m_unitIndex );
+	dropCapOffset->blockSignals(false);
+}
+
+void PropertyWidget_DropCap::updateCharStyles()
+{
+	dropCapCharStyleCombo->updateFormatList();
+}
+
+void PropertyWidget_DropCap::displayCharStyle(const QString& name)
+{
+	bool blocked = dropCapCharStyleCombo->blockSignals(true);
+	dropCapCharStyleCombo->setFormat(name);
+	dropCapCharStyleCombo->blockSignals(blocked);
+}
+
+void PropertyWidget_DropCap::enableDropCap(bool enable)
+{
+	dropCapLines->setEnabled(enable);
+	dropCapOffset->setEnabled(enable);
+	dropCapCharStyleCombo->setEnabled(enable);
+}
+
+void PropertyWidget_DropCap::updateStyle(const ParagraphStyle& newCurrent)
+{
+	disconnectSignals ();
+	dropCapBox->setChecked(newCurrent.hasDropCap());
+	dropCapLines->setValue(newCurrent.dropCapLines());
+	dropCapOffset->setValue(newCurrent.dropCapOffset() * m_unitRatio);
+	displayCharStyle(newCurrent.dcCharStyleName());
+	connectSignals ();
+}
+
+void PropertyWidget_DropCap::connectSignals()
+{
+	connect(dropCapBox, SIGNAL(stateChanged(int)), this, SLOT(handleDropCapUse()));
+	connect(dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(handleDropCapLines()));
+	connect(dropCapOffset, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapOffset()));
+	connect(dropCapCharStyleCombo, SIGNAL(activated(int)), this, SLOT(handleDropCapCharStyle()));
+}
+
+void PropertyWidget_DropCap::disconnectSignals()
+{
+	disconnect(dropCapBox, SIGNAL(stateChanged(int)), this, SLOT(handleDropCapUse()));
+	disconnect(dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(handleDropCapLines()));
+	disconnect(dropCapOffset, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapOffset()));
+	disconnect(dropCapCharStyleCombo, SIGNAL(activated(int)), this, SLOT(handleDropCapCharStyle()));
+}
+
+void PropertyWidget_DropCap::handleDropCapUse()
+{
+	if (!m_doc) return;
+	ParagraphStyle newStyle;
+	newStyle.setHasDropCap(dropCapBox->isChecked());
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+	enableDropCap(dropCapBox->isChecked());
+}
+
+void PropertyWidget_DropCap::handleDropCapLines()
+{
+	if (!m_doc) return;
+	ParagraphStyle newStyle;
+	newStyle.setDropCapLines(dropCapLines->value());
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_DropCap::handleDropCapOffset()
+{
+	if (!m_doc) return;
+	ParagraphStyle newStyle;
+	newStyle.setDropCapOffset(dropCapOffset->value());
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_DropCap::handleDropCapCharStyle()
+{
+	if (!m_doc) return;
+	ParagraphStyle newStyle;
+	QString name = dropCapCharStyleCombo->currentText();
+	if (!name.isEmpty())
+		newStyle.setDcCharStyleName(name);
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_DropCap::changeEvent(QEvent *e)
+{
+	if (e->type() == QEvent::LanguageChange)
+	{
+		languageChange();
+		return;
+	}
+	QWidget::changeEvent(e);
+}
+
+void PropertyWidget_DropCap::languageChange()
+{
+	dropCapBox->setText(tr("Use Drop Caps"));
+	dropCapLinesLabel->setText(tr("Drop Caps lines"));
+	dropCapOffsetLabel->setText(tr("Drop Caps offset"));
+	dropCapCharStyleLabel->setText(tr("Drop Cap use character style..."));
+	dropCapCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style"));
+}
+
Index: Scribus/scribus/ui/propertywidget_dropcap.h
===================================================================
--- Scribus/scribus/ui/propertywidget_dropcap.h	(wersja 0)
+++ Scribus/scribus/ui/propertywidget_dropcap.h	(wersja 0)
@@ -0,0 +1,42 @@
+#ifndef PROPERTYWIDGET_DropCap_H
+#define PROPERTYWIDGET_DropCap_H
+
+#include "ui_propertywidget_dropcapbase.h"
+
+#include "propertywidgetbase.h"
+
+class ParagraphStyle;
+
+class PropertyWidget_DropCap : public QFrame, private Ui::PropertyWidget_DropCapBase, public PropertyWidgetBase
+{
+    Q_OBJECT
+
+public:
+	PropertyWidget_DropCap(QWidget *parent = 0);
+	~PropertyWidget_DropCap() {}
+
+	void updateStyle(const ParagraphStyle& newCurrent);
+	void updateCharStyles();
+	void setDoc(ScribusDoc *doc);
+	void displayCharStyle(const QString& name);
+
+protected:
+	double m_unitRatio;
+	int    m_unitIndex;
+	void changeEvent(QEvent *e);
+
+public slots:
+	void languageChange();
+	void unitChange();
+	void handleDropCapUse();
+	void handleDropCapLines();
+	void handleDropCapOffset();
+	void handleDropCapCharStyle();
+
+private:
+	void connectSignals();
+	void disconnectSignals();
+	void enableDropCap(bool);
+};
+
+#endif // PROPERTYWIDGET_DropCap_H
Index: Scribus/scribus/ui/smpstylewidget.h
===================================================================
--- Scribus/scribus/ui/smpstylewidget.h	(wersja 16924)
+++ Scribus/scribus/ui/smpstylewidget.h	(kopia robocza)
@@ -37,7 +37,7 @@
 
 	void showLineSpacing(QList<ParagraphStyle*> &pstyles);
 	void showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex);
-	void showDropCap(QList<ParagraphStyle*> &pstyles, int unitIndex);
+	void showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex);
 	void showAlignment(QList<ParagraphStyle*> &pstyles);
 	void showOpticalMargin(QList<ParagraphStyle*> &pstyles);
 	void showMinSpace(QList<ParagraphStyle*> &pstyles);
Index: Scribus/scribus/ui/propertiespalette_text.cpp
===================================================================
--- Scribus/scribus/ui/propertiespalette_text.cpp	(wersja 16924)
+++ Scribus/scribus/ui/propertiespalette_text.cpp	(kopia robocza)
@@ -19,6 +19,7 @@
 #include "propertiespalette_utils.h"
 #include "propertywidget_advanced.h"
 #include "propertywidget_distance.h"
+#include "propertywidget_dropcap.h"
 #include "propertywidget_flop.h"
 #include "propertywidget_optmargins.h"
 #include "propertywidget_orphans.h"
@@ -75,6 +76,9 @@
 	orphanBox = new PropertyWidget_Orphans(textTree);
 	orphanItem = textTree->addWidget( tr("Orphans and Widows"), orphanBox);
 
+	dropcapsBox = new PropertyWidget_DropCap(textTree);
+	dropcapsItem = textTree->addWidget( tr("Drop Cap"), dropcapsBox);
+
 	distanceWidgets = new PropertyWidget_Distance(textTree);
     distanceItem = textTree->addWidget( tr("Columns & Text Distances"), distanceWidgets);
 
@@ -171,6 +175,7 @@
 	flopBox->setDoc(m_doc);
 	optMargins->setDoc(m_doc);
 	orphanBox->setDoc(m_doc);
+	dropcapsBox->setDoc(m_doc);
 	pathTextWidgets->setDoc(m_doc);
 
 	fonts->RebuildList(m_doc);
@@ -203,6 +208,7 @@
 	flopBox->setDoc(0);
 	optMargins->setDoc(0);
 	orphanBox->setDoc(0);
+	dropcapsBox->setDoc(0);
 
 	m_haveItem = false;
 
@@ -280,7 +286,10 @@
 	/*if (updateFlags & reqColorsUpdate)
 		updateColorList();*/
 	if (updateFlags & reqCharStylesUpdate)
+	{
 		charStyleCombo->updateFormatList();
+		dropcapsBox->updateCharStyles();
+	}
 	if (updateFlags & reqParaStylesUpdate)
 		paraStyleCombo->updateFormatList();
 	if (updateFlags & reqDefFontListUpdate)
@@ -291,6 +300,7 @@
 	{
 		paraStyleCombo->setDoc(m_haveDoc ? m_doc : 0);
 		charStyleCombo->setDoc(m_haveDoc ? m_doc : 0);
+		dropcapsBox->setDoc(m_haveDoc ? m_doc : 0);
 	}
 }
 
@@ -370,6 +380,7 @@
 		flopItem->setHidden(true);
 		distanceItem->setHidden(true);
 		orphanItem->setHidden(true);
+		dropcapsItem->setHidden(true);
 		pathTextItem->setHidden(false);
 		pathTextWidgets->pathTextType->setCurrentIndex(m_item->textPathType);
 		pathTextWidgets->flippedPathText->setChecked(m_item->textPathFlipped);
@@ -382,6 +393,7 @@
 		flopItem->setHidden(false);
 		distanceItem->setHidden(false);
 		orphanItem->setHidden(false);
+		dropcapsItem->setHidden(false);
 		pathTextItem->setHidden(true);
 	}
 	else
@@ -389,6 +401,7 @@
 		flopItem->setHidden(false);
 		distanceItem->setHidden(false);
 		orphanItem->setHidden(false);
+		dropcapsItem->setHidden(false);
 		pathTextItem->setHidden(true);
 	}
 
@@ -424,6 +437,7 @@
 	flopBox->unitChange();
 	optMargins->unitChange();
 	pathTextWidgets->unitChange();
+	dropcapsBox->unitChange();
 
 	m_haveItem = tmp;
 }
@@ -575,6 +589,7 @@
 	advancedWidgets->updateStyle(newCurrent);
 	colorWidgets->updateStyle(newCurrent);
 	orphanBox->updateStyle (newCurrent);
+	dropcapsBox->updateStyle(newCurrent);
 
 	displayFontFace(charStyle.font().scName());
 	displayFontSize(charStyle.fontSize());
@@ -594,6 +609,7 @@
 void PropertiesPalette_Text::updateCharStyles()
 {
 	charStyleCombo->updateFormatList();
+	dropcapsBox->updateCharStyles();
 }
 
 void PropertiesPalette_Text::updateParagraphStyles()
@@ -605,6 +621,7 @@
 {
 	paraStyleCombo->updateFormatList();
 	charStyleCombo->updateFormatList();
+	dropcapsBox->updateCharStyles();
 }
 
 void PropertiesPalette_Text::displayAlignment(int e)
Index: Scribus/scribus/ui/smpstylewidget.cpp
===================================================================
--- Scribus/scribus/ui/smpstylewidget.cpp	(wersja 16924)
+++ Scribus/scribus/ui/smpstylewidget.cpp	(kopia robocza)
@@ -93,6 +93,7 @@
 	//dropCapsBox->setToolTip(      tr("Enable or disable drop cap"));
 	dropCapLines_->setToolTip(    tr("Drop Cap Lines"));
 	dropCapOffset_->setToolTip(   tr("Drop Cap Offset"));
+	dropCapCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style"));
 	alignement_->setToolTip(      tr("Alignment"));
 	tabList_->first_->setToolTip( tr("First Line Indent"));
 	tabList_->left_->setToolTip(  tr("Left Indent"));
@@ -293,6 +294,12 @@
 	lineSpacing_->setEnabled(pstyle->lineSpacingMode() == ParagraphStyle::FixedLineSpacing);
 	dropCapLines_->setEnabled(pstyle->hasDropCap());
 	dropCapOffset_->setEnabled(pstyle->hasDropCap());
+	dropCapCharStyleCombo->setEnabled(pstyle->hasDropCap());
+	dropCapCharStyleCombo->clear();
+	dropCapCharStyleCombo->addItem(tr("No Style"));
+	for (int i =0; i < cstyles.count(); i++)
+		dropCapCharStyleCombo->addItem(cstyles.at(i).name());
+	setCurrentComboItem(dropCapCharStyleCombo, pstyle->dcCharStyleName().isEmpty() ? tr("No Style") : pstyle->dcCharStyleName());
 
 	QFont f(font());
 	f.setBold(true);
@@ -311,7 +318,6 @@
 				parentCombo->addItem(pstyles[i].name());
 		}
 	}
-
 	if (pstyle->isDefaultStyle() || !hasParent_)
 		parentCombo->setCurrentIndex(0);
 	else
@@ -339,7 +345,7 @@
 	{
 		showLineSpacing(pstyles);
 		showSpaceAB(pstyles, unitIndex);
-		showDropCap(pstyles, unitIndex);
+		showDropCap(pstyles, cstyles, unitIndex);
 		showAlignment(pstyles);
 		showOpticalMargin(pstyles);
 		showMinSpace(pstyles);
@@ -433,7 +439,7 @@
 		spaceBelow_->setValue(tmpA);
 }
 
-void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, int unitIndex)
+void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex)
 {
 	double unitRatio = unitGetRatioFromIndex(unitIndex);
 	parentDropCapButton->hide();
@@ -483,10 +489,16 @@
 	else
 		dropCapOffset_->setValue(dco * unitRatio);
 
+	dropCapCharStyleCombo->clear();
+	dropCapCharStyleCombo->addItem(tr("No Style"));
+	for (int i=0; i < cstyles.count(); i++)
+		dropCapCharStyleCombo->addItem(cstyles.at(i).name());
+
 	connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
 	dropCapsBox->setEnabled(true);
 	dropCapLines_->setEnabled(true);
 	dropCapOffset_->setEnabled(true);
+	dropCapCharStyleCombo->setEnabled(true);
 }
 
 void SMPStyleWidget::showAlignment(QList<ParagraphStyle*> &pstyles)
@@ -820,12 +832,14 @@
 		dropCapsBox->setEnabled(true);
 		dropCapLines_->setEnabled(true);
 		dropCapOffset_->setEnabled(true);
+		dropCapCharStyleCombo->setEnabled(true);
 	}
 	else
 	{
 		dropCapsBox->setEnabled(true);
 		dropCapLines_->setEnabled(false);
 		dropCapOffset_->setEnabled(false);
+		dropCapCharStyleCombo->setEnabled(false);
 	}
 	if (hasParent_)
 		parentDropCapButton->show();
Index: Scribus/scribus/ui/smtextstyles.h
===================================================================
--- Scribus/scribus/ui/smtextstyles.h	(wersja 16924)
+++ Scribus/scribus/ui/smtextstyles.h	(kopia robocza)
@@ -75,6 +75,7 @@
 	void slotDropCap(bool isOn);
 	void slotDropCapLines(int lines);
 	void slotDropCapOffset();
+	void slotDropCapCharStyle(const QString &name);
 	void slotSpaceAbove();
 	void slotSpaceBelow();
 	void slotAlignment();
Index: Scribus/scribus/ui/propertiespalette_text.h
===================================================================
--- Scribus/scribus/ui/propertiespalette_text.h	(wersja 16924)
+++ Scribus/scribus/ui/propertiespalette_text.h	(kopia robocza)
@@ -25,6 +25,7 @@
 class PageItem;
 class PropertyWidget_Advanced;
 class PropertyWidget_Distance;
+class PropertyWidget_DropCap;
 class PropertyWidget_Flop;
 class PropertyWidget_OptMargins;
 class PropertyWidget_Orphans;
@@ -154,7 +155,10 @@
 
 	PropertyWidget_Orphans* orphanBox;
 	QTreeWidgetItem* orphanItem;
-	
+
+	PropertyWidget_DropCap* dropcapsBox;
+	QTreeWidgetItem* dropcapsItem;
+
 	PropertyWidget_PathText* pathTextWidgets;
 	QTreeWidgetItem* pathTextItem;
 
Index: Scribus/scribus/ui/propertywidget_dropcapbase.ui
===================================================================
--- Scribus/scribus/ui/propertywidget_dropcapbase.ui	(wersja 0)
+++ Scribus/scribus/ui/propertywidget_dropcapbase.ui	(wersja 0)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PropertyWidget_DropCapBase</class>
+ <widget class="QFrame" name="PropertyWidget_DropCapBase">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>211</width>
+    <height>142</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
+   <item row="1" column="0">
+    <widget class="QLabel" name="dropCapLinesLabel">
+     <property name="toolTip">
+      <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string>
+     </property>
+     <property name="text">
+      <string>Height</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QSpinBox" name="dropCapLines">
+     <property name="suffix">
+      <string> lines</string>
+     </property>
+     <property name="maximum">
+      <number>10</number>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="dropCapOffsetLabel">
+     <property name="text">
+      <string>Offset</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0">
+    <widget class="QCheckBox" name="dropCapBox">
+     <property name="text">
+      <string>use Drop Caps</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="2">
+    <widget class="QLabel" name="dropCapCharStyleLabel">
+     <property name="text">
+      <string>Use Character Style</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0" colspan="2">
+    <widget class="CharStyleComboBox" name="dropCapCharStyleCombo"/>
+   </item>
+   <item row="2" column="1">
+    <widget class="ScrSpinBox" name="dropCapOffset">
+     <property name="minimum">
+      <double>-99.989999999999995</double>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ScrSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header>ui/scrspinbox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>CharStyleComboBox</class>
+   <extends>QComboBox</extends>
+   <header>ui/spalette.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Index: Scribus/scribus/ui/smpstylewidget.ui
===================================================================
--- Scribus/scribus/ui/smpstylewidget.ui	(wersja 16924)
+++ Scribus/scribus/ui/smpstylewidget.ui	(kopia robocza)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>714</width>
-    <height>580</height>
+    <height>599</height>
    </rect>
   </property>
   <layout class="QVBoxLayout">
@@ -257,58 +257,59 @@
               <item>
                <layout class="QHBoxLayout">
                 <item>
-                 <layout class="QVBoxLayout">
-                  <item>
-                   <layout class="QHBoxLayout">
-                    <item>
-                     <widget class="QLabel" name="label">
-                      <property name="text">
-                       <string>&amp;Lines:</string>
-                      </property>
-                      <property name="buddy">
-                       <cstring>dropCapLines_</cstring>
-                      </property>
-                     </widget>
-                    </item>
-                    <item>
-                     <widget class="SMSpinBox" name="dropCapLines_">
-                      <property name="minimum">
-                       <number>2</number>
-                      </property>
-                      <property name="maximum">
-                       <number>20</number>
-                      </property>
-                     </widget>
-                    </item>
-                   </layout>
-                  </item>
-                  <item>
-                   <layout class="QHBoxLayout">
-                    <item>
-                     <widget class="QLabel" name="label_2">
-                      <property name="text">
-                       <string>Distance from Text:</string>
-                      </property>
-                      <property name="buddy">
-                       <cstring>dropCapOffset_</cstring>
-                      </property>
-                     </widget>
-                    </item>
-                    <item>
-                     <widget class="SMScrSpinBox" name="dropCapOffset_">
-                      <property name="minimum">
-                       <number>-3000</number>
-                      </property>
-                      <property name="maximum">
-                       <number>3000</number>
-                      </property>
-                     </widget>
-                    </item>
-                   </layout>
-                  </item>
-                 </layout>
+                 <widget class="QLabel" name="label">
+                  <property name="text">
+                   <string>&amp;Lines:</string>
+                  </property>
+                  <property name="buddy">
+                   <cstring>dropCapLines_</cstring>
+                  </property>
+                 </widget>
                 </item>
                 <item>
+                 <widget class="SMSpinBox" name="dropCapLines_">
+                  <property name="minimum">
+                   <number>2</number>
+                  </property>
+                  <property name="maximum">
+                   <number>20</number>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <spacer name="horizontalSpacer_2">
+                  <property name="orientation">
+                   <enum>Qt::Horizontal</enum>
+                  </property>
+                  <property name="sizeHint" stdset="0">
+                   <size>
+                    <width>40</width>
+                    <height>20</height>
+                   </size>
+                  </property>
+                 </spacer>
+                </item>
+                <item>
+                 <widget class="QLabel" name="label_2">
+                  <property name="text">
+                   <string>Distance from Text:</string>
+                  </property>
+                  <property name="buddy">
+                   <cstring>dropCapOffset_</cstring>
+                  </property>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="SMScrSpinBox" name="dropCapOffset_">
+                  <property name="minimum">
+                   <number>-3000</number>
+                  </property>
+                  <property name="maximum">
+                   <number>3000</number>
+                  </property>
+                 </widget>
+                </item>
+                <item>
                  <spacer>
                   <property name="orientation">
                    <enum>Qt::Horizontal</enum>
@@ -324,6 +325,16 @@
                </layout>
               </item>
               <item>
+               <widget class="QLabel" name="dropCapCharStyleComboLabel">
+                <property name="text">
+                 <string>Character Style for Drop Cap:</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="SMScComboBox" name="dropCapCharStyleCombo"/>
+              </item>
+              <item>
                <widget class="QToolButton" name="parentDropCapButton">
                 <property name="enabled">
                  <bool>true</bool>
Index: Scribus/scribus/ui/smtextstyles.cpp
===================================================================
--- Scribus/scribus/ui/smtextstyles.cpp	(wersja 16924)
+++ Scribus/scribus/ui/smtextstyles.cpp	(kopia robocza)
@@ -515,6 +515,7 @@
 	connect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
 	connect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
 	connect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset()));
+	connect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&)));
 
 	connect(pwidget_->keepLinesStart, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesStart()));
 	connect(pwidget_->keepLinesEnd, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesEnd()));
@@ -592,6 +593,7 @@
 	disconnect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
 	disconnect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
 	disconnect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset()));
+	disconnect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&)));
 
 	disconnect(pwidget_->parentCombo, SIGNAL(activated(const QString&)),
 			this, SLOT(slotParentChanged(const QString&)));
@@ -911,6 +913,23 @@
 	}
 }
 
+void SMParagraphStyle::slotDropCapCharStyle(const QString& name)
+{
+	if (pwidget_->dropCapCharStyleCombo->useParentValue())
+		for (int i = 0; i < selection_.count(); ++i)
+			selection_[i]->resetDcCharStyleName();
+	else
+		for (int i = 0; i < selection_.count(); ++i)
+			selection_[i]->setDcCharStyleName(name);
+
+	if (!selectionIsDirty_)
+	{
+		selectionIsDirty_ = true;
+		emit selectionDirty();
+	}
+}
+
+
 void SMParagraphStyle::handleKeepLinesStart()
 {
 	if (pwidget_->keepLinesStart->useParentValue())
Index: Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
===================================================================
--- Scribus/scribus/styles/paragraphstyle.attrdefs.cxx	(wersja 16905)
+++ Scribus/scribus/styles/paragraphstyle.attrdefs.cxx	(kopia robocza)
@@ -39,4 +39,5 @@
 ATTRDEF(int, keepLinesEnd, KeepLinesEnd, 0)
 ATTRDEF(bool, keepWithNext, KeepWithNext, false)
 ATTRDEF(bool, keepTogether, KeepTogether, false)
+ATTRDEF(QString, dcCharStyleName, DcCharStyleName,"")
 
Index: Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(wersja 16924)
+++ Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(kopia robocza)
@@ -608,6 +608,8 @@
 		docu.writeAttribute("NACH", style.gapAfter());
 	if ( ! style.isInhHasDropCap())
 		docu.writeAttribute("DROP", static_cast<int>(style.hasDropCap()));
+	if ( ! style.isInhDcCharStyleName())
+		docu.writeAttribute("DROPCHSTYLE", style.dcCharStyleName());
 	if ( ! style.isInhDropCapLines())
 		docu.writeAttribute("DROPLIN", style.dropCapLines());
 	if ( ! style.isInhDropCapOffset())
Index: Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(wersja 16924)
+++ Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(kopia robocza)
@@ -2086,6 +2086,10 @@
 	if (attrs.hasAttribute(DROP))
 		newStyle.setHasDropCap(static_cast<bool>(attrs.valueAsInt(DROP)));
 
+	static const QString DROPCHSTYLE("DROPCHSTYLE");
+	if (attrs.hasAttribute(DROPCHSTYLE))
+		newStyle.setDcCharStyleName(attrs.valueAsString(DROPCHSTYLE));
+
 	static const QString DROPLIN("DROPLIN");
 	if (attrs.hasAttribute(DROPLIN))
 		newStyle.setDropCapLines(attrs.valueAsInt(DROPLIN));
Index: Scribus/scribus/CMakeLists.txt
===================================================================
--- Scribus/scribus/CMakeLists.txt	(wersja 16905)
+++ Scribus/scribus/CMakeLists.txt	(kopia robocza)
@@ -133,6 +133,7 @@
   ui/propertiespalette_xyzbase.ui
   ui/propertywidget_advancedbase.ui
   ui/propertywidget_distancebase.ui
+  ui/propertywidget_dropcapbase.ui
   ui/propertywidget_flopbase.ui
   ui/propertywidget_optmarginsbase.ui
   ui/propertywidget_orphansbase.ui
@@ -379,6 +380,7 @@
   ui/propertiespalette_xyz.h
   ui/propertywidget_advanced.h
   ui/propertywidget_distance.h
+  ui/propertywidget_dropcap.h
   ui/propertywidget_flop.h
   ui/propertywidget_optmargins.h
   ui/propertywidget_orphans.h
@@ -799,6 +801,7 @@
   ui/propertiespalette_xyz.cpp
   ui/propertywidget_advanced.cpp
   ui/propertywidget_distance.cpp
+  ui/propertywidget_dropcap.cpp
   ui/propertywidget_flop.cpp
   ui/propertywidget_optmargins.cpp
   ui/propertywidget_orphans.cpp
 
dropCapStyles.patch (29,889 bytes)   

cezaryece

2011-10-24 05:27

updater   ~0027091

No... forget my list of related reports, sorry...

jghali

2011-11-19 23:14

administrator  

10338_dropcap_test1.sla (19,122 bytes)

jghali

2011-11-19 23:15

administrator  

10338_dropcap_test1.jpg (216,078 bytes)   
10338_dropcap_test1.jpg (216,078 bytes)   

jghali

2011-11-19 23:18

administrator   ~0027236

I started testing the patch. It seems there is a problem vs vertical alignment once drop cap are activated. Test doc and screenshot attached.

jghali

2011-11-20 00:00

administrator   ~0027237

Nevermind, i managed to found the problem and fix it. I've committed the fix to 1.5.0svn.

Issue History

Date Modified Username Field Change
2011-10-23 21:18 cezaryece New Issue
2011-10-23 21:18 cezaryece File Added: dropCapStyles.patch
2011-10-24 05:27 cezaryece Note Added: 0027091
2011-10-25 06:11 cezaryece Tag Attached: oif
2011-10-25 06:11 cezaryece Tag Attached: oif 2011
2011-10-25 06:11 cezaryece Tag Attached: oif2011
2011-11-19 23:14 jghali File Added: 10338_dropcap_test1.sla
2011-11-19 23:15 jghali File Added: 10338_dropcap_test1.jpg
2011-11-19 23:18 jghali Note Added: 0027236
2011-11-20 00:00 jghali Note Added: 0027237
2011-11-20 19:58 fschmid Status new => resolved
2011-11-20 19:58 fschmid Fixed in Version => 1.5.0svn
2011-11-20 19:58 fschmid Resolution open => fixed
2011-11-20 19:58 fschmid Assigned To => fschmid
2011-12-30 16:36 cbradney Status resolved => closed
2014-10-08 22:59 Kunda Tag Detached: oif 2011
2014-10-11 18:35 Kunda Tag Detached: oif2011
2016-04-11 19:11 Kunda Tag Attached: dropcap
2016-04-11 19:11 Kunda Relationship added related to 0000460
2016-04-11 19:11 Kunda Relationship added related to 0000204
2016-04-11 19:12 Kunda Relationship added related to 0008673
2016-04-11 19:12 Kunda Relationship added related to 0006822
2016-04-11 19:12 Kunda Relationship added related to 0006338
2016-04-11 19:12 Kunda Relationship added related to 0001337
2016-04-11 19:12 Kunda Relationship added related to 0000461