r16998 by fschmid - Fixed Bug 10338: "[new feature] patch for applying char styles to Drop Cap and on-demand control in PP"

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 20 19:57:27 UTC 2011


Author: fschmid
Date: Sun Nov 20 19:57:27 2011
New Revision: 16998

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16998
Log:
Fixed Bug 10338: "[new feature] patch for applying char styles to Drop Cap and on-demand control in PP"

Added:
    trunk/Scribus/scribus/ui/propertywidget_dropcap.cpp
    trunk/Scribus/scribus/ui/propertywidget_dropcap.h
    trunk/Scribus/scribus/ui/propertywidget_dropcapbase.ui
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/fileloader.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
    trunk/Scribus/scribus/ui/propertiespalette_text.cpp
    trunk/Scribus/scribus/ui/propertiespalette_text.h
    trunk/Scribus/scribus/ui/smpstylewidget.cpp
    trunk/Scribus/scribus/ui/smpstylewidget.h
    trunk/Scribus/scribus/ui/smpstylewidget.ui
    trunk/Scribus/scribus/ui/smtextstyles.cpp
    trunk/Scribus/scribus/ui/smtextstyles.h

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Sun Nov 20 19:57:27 2011
@@ -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
@@ -381,6 +382,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
@@ -803,6 +805,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

Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Sun Nov 20 19:57:27 2011
@@ -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());

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Nov 20 19:57:27 2011
@@ -1348,7 +1348,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;
@@ -1371,6 +1371,31 @@
 					}
 					else
 						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);
 				}
 			}
 

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sun Nov 20 19:57:27 2011
@@ -2380,6 +2380,10 @@
 	static const QString DROP("DROP");
 	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))

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Sun Nov 20 19:57:27 2011
@@ -614,6 +614,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())

Modified: trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx
==============================================================================
--- trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx (original)
+++ trunk/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx Sun Nov 20 19:57:27 2011
@@ -39,4 +39,5 @@
 ATTRDEF(int, keepLinesEnd, KeepLinesEnd, 0)
 ATTRDEF(bool, keepWithNext, KeepWithNext, false)
 ATTRDEF(bool, keepTogether, KeepTogether, false)
+ATTRDEF(QString, dcCharStyleName, DcCharStyleName,"")
 

Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Sun Nov 20 19:57:27 2011
@@ -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,11 +609,14 @@
 void PropertiesPalette_Text::updateCharStyles()
 {
 	charStyleCombo->updateFormatList();
+	dropcapsBox->updateCharStyles();
 }
 
 void PropertiesPalette_Text::updateParagraphStyles()
 {
 	paraStyleCombo->updateFormatList();
+	charStyleCombo->updateFormatList();
+	dropcapsBox->updateCharStyles();
 }
 
 void PropertiesPalette_Text::updateTextStyles()

Modified: trunk/Scribus/scribus/ui/propertiespalette_text.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/propertiespalette_text.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.h Sun Nov 20 19:57:27 2011
@@ -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;
 

Modified: trunk/Scribus/scribus/ui/smpstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/smpstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.cpp Sun Nov 20 19:57:27 2011
@@ -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();
@@ -482,11 +488,17 @@
 		dropCapOffset_->clear();
 	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();

Modified: trunk/Scribus/scribus/ui/smpstylewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/smpstylewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.h (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.h Sun Nov 20 19:57:27 2011
@@ -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);

Modified: trunk/Scribus/scribus/ui/smpstylewidget.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/smpstylewidget.ui
==============================================================================
--- trunk/Scribus/scribus/ui/smpstylewidget.ui (original)
+++ trunk/Scribus/scribus/ui/smpstylewidget.ui Sun Nov 20 19:57:27 2011
@@ -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,56 +257,57 @@
               <item>
                <layout class="QHBoxLayout">
                 <item>
-                 <layout class="QVBoxLayout">
-                  <item>
-                   <layout class="QHBoxLayout">
-                    <item>
-                     <widget class="QLabel" name="label">
-                      <property name="text">
-                       <string>&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>&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>
@@ -322,6 +323,16 @@
                  </spacer>
                 </item>
                </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">

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp Sun Nov 20 19:57:27 2011
@@ -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())

Modified: trunk/Scribus/scribus/ui/smtextstyles.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16998&path=/trunk/Scribus/scribus/ui/smtextstyles.h
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.h (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.h Sun Nov 20 19:57:27 2011
@@ -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();




More information about the scribus-commit mailing list