r16765 by fschmid - Applied patch from Bug 10158: Typing text to a text frame feels very sluggish

scribus-commit scribus-commit at lists.scribus.net
Fri Aug 5 17:37:31 UTC 2011


Author: fschmid
Date: Fri Aug  5 17:37:30 2011
New Revision: 16765

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16765
Log:
Applied patch from Bug 10158: Typing text to a text frame feels very sluggish

Modified:
    trunk/Scribus/scribus/ui/fontcombo.cpp
    trunk/Scribus/scribus/ui/fontcombo.h

Modified: trunk/Scribus/scribus/ui/fontcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16765&path=/trunk/Scribus/scribus/ui/fontcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/fontcombo.cpp Fri Aug  5 17:37:30 2011
@@ -106,7 +106,6 @@
 	otfFont = loadIcon("font_otf16.png");
 	psFont = loadIcon("font_type1_16.png");
 	substFont = loadIcon("font_subst16.png");
-	currDoc = 0;
 	fontComboLayout = new QGridLayout(this);
 	fontComboLayout->setMargin(0);
 	fontComboLayout->setSpacing(0);
@@ -124,6 +123,7 @@
 	fontComboLayout->addWidget(fontFamily,0,col);
 	fontStyle = new ScComboBox(this);
 	fontComboLayout->addWidget(fontStyle,1,col);
+	isForAnnotation = true;  // this is merely to ensure that the list is rebuilt
 	RebuildList(0);
 	connect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	connect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
@@ -192,10 +192,13 @@
 
 void FontComboH::setCurrentFont(QString f)
 {
+	QString family = prefsManager->appPrefs.fontPrefs.AvailFonts[f].family();
+	QString style = prefsManager->appPrefs.fontPrefs.AvailFonts[f].style();
+	// If we already have the correct font+style, nothing to do
+	if ((fontFamily->currentText() == family) && (fontStyle->currentText() == style))
+		return;
 	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
-	QString family = prefsManager->appPrefs.fontPrefs.AvailFonts[f].family();
-	QString style = prefsManager->appPrefs.fontPrefs.AvailFonts[f].style();
 	setCurrentComboItem(fontFamily, family);
 	fontStyle->clear();
 	QStringList slist = prefsManager->appPrefs.fontPrefs.AvailFonts.fontMap[family];
@@ -225,7 +228,12 @@
 
 void FontComboH::RebuildList(ScribusDoc *currentDoc, bool forAnnotation, bool forSubstitute)
 {
+	// if we already have the proper fonts loaded, we need to do nothing
+	if ((currDoc == currentDoc) && (forAnnotation == isForAnnotation) && (isForSubstitute == forSubstitute))
+		return;
 	currDoc = currentDoc;
+	isForAnnotation = forAnnotation;
+	isForSubstitute = forSubstitute;
 	disconnect(fontFamily, SIGNAL(activated(int)), this, SLOT(familySelected(int)));
 	disconnect(fontStyle, SIGNAL(activated(int)), this, SLOT(styleSelected(int)));
 	fontFamily->clear();

Modified: trunk/Scribus/scribus/ui/fontcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16765&path=/trunk/Scribus/scribus/ui/fontcombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/fontcombo.h (original)
+++ trunk/Scribus/scribus/ui/fontcombo.h Fri Aug  5 17:37:30 2011
@@ -89,6 +89,7 @@
 	QLabel *fontStyleLabel;
 	PrefsManager* prefsManager;
 	ScribusDoc *currDoc;
+	bool isForAnnotation, isForSubstitute;
 	QPixmap ttfFont;
 	QPixmap otfFont;
 	QPixmap psFont;




More information about the scribus-commit mailing list