r18008 by craig - Complete TODO: Move most code from Scribus::SetNewFont to new ScribusDoc::itemSetFont

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 29 21:44:59 UTC 2012


Author: craig
Date: Sat Dec 29 21:44:59 2012
New Revision: 18008

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18008
Log:
Complete TODO: Move most code from Scribus::SetNewFont to new ScribusDoc::itemSetFont

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18008&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Dec 29 21:44:59 2012
@@ -7285,33 +7285,7 @@
 void ScribusMainWindow::SetNewFont(const QString& nf)
 {
 	setMainWindowActive();
-	QString nf2(nf);
-	if (!doc->UsedFonts.contains(nf))
-	{
-		if (doc->AddFont(nf)) //, prefsManager->appPrefs.fontPrefs.AvailFonts[nf]->Font))
-		{
-		}
-		else
-		{//CB FIXME: to doc?
-			if (doc->m_Selection->count() != 0)
-			{
-				PageItem *currItem = doc->m_Selection->itemAt(0);
-				nf2 = currItem->currentCharStyle().font().scName();
-			}
-		}
-	}
-	PageItem *i2 = doc->m_Selection->itemAt(0);
-	if (doc->appMode == modeEditTable)
-		i2 = doc->m_Selection->itemAt(0)->asTable()->activeCell().textFrame();
-	if (i2 != NULL)
-	{
-		Selection tempSelection(this, false);
-		tempSelection.addItem(i2, true);
-		doc->itemSelection_SetFont(nf2, &tempSelection);
-	}
-//	doc->currentStyle.charStyle().setFont((*doc->AllFonts)[nf2]);
-	view->DrawNew();
-// 	slotDocCh();
+	doc->itemSetFont(nf);
 }
 
 void ScribusMainWindow::setItemFSize(int id)

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18008&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Dec 29 21:44:59 2012
@@ -8854,6 +8854,32 @@
 	itemSelection_ApplyParagraphStyle(newStyle, customSelection);
 }
 
+void ScribusDoc::itemSetFont(const QString &newFont)
+{
+	QString nf2(newFont);
+	if (!UsedFonts.contains(newFont))
+	{
+		if (!AddFont(newFont))
+		{
+			if (m_Selection->count() != 0)
+			{
+				PageItem *currItem = m_Selection->itemAt(0);
+				nf2 = currItem->currentCharStyle().font().scName();
+			}
+		}
+	}
+	PageItem *i2 = m_Selection->itemAt(0);
+	if (appMode == modeEditTable)
+		i2 = m_Selection->itemAt(0)->asTable()->activeCell().textFrame();
+	if (i2 != NULL)
+	{
+		Selection tempSelection(this, false);
+		tempSelection.addItem(i2, true);
+		itemSelection_SetFont(nf2, &tempSelection);
+	}
+	m_View->DrawNew();
+}
+
 void ScribusDoc::itemSelection_SetFontSize(int size, Selection* customSelection)
 {
 	//if (true || ((appMode == modeEdit) || (appMode == modeEditTable)))

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18008&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Dec 29 21:44:59 2012
@@ -1054,6 +1054,7 @@
 	void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0);
 	//void ChLocalXY(double x, double y);
 	//void ChLocalSc(double x, double y);
+	void itemSetFont(const QString& newFont);
 	void itemSelection_SetFont(QString fon, Selection* customSelection=0);
 	void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0);
 	void itemSelection_SetFillShade(int sha, Selection* customSelection=0);




More information about the scribus-commit mailing list