r17273 by fschmid - Made the enhanced CharSelect Palette insert glyphs with the correct font into textframes.

scribus-commit scribus-commit at lists.scribus.net
Sat Feb 4 10:00:00 UTC 2012


Author: fschmid
Date: Sat Feb  4 09:59:59 2012
New Revision: 17273

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17273
Log:
Made the enhanced CharSelect Palette insert glyphs with the correct font into textframes.

Modified:
    trunk/Scribus/scribus/chartableview.cpp
    trunk/Scribus/scribus/ui/charselect.cpp
    trunk/Scribus/scribus/ui/charselectenhanced.cpp
    trunk/Scribus/scribus/ui/charselectenhanced.h

Modified: trunk/Scribus/scribus/chartableview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17273&path=/trunk/Scribus/scribus/chartableview.cpp
==============================================================================
--- trunk/Scribus/scribus/chartableview.cpp (original)
+++ trunk/Scribus/scribus/chartableview.cpp Sat Feb  4 09:59:59 2012
@@ -77,7 +77,7 @@
 	int index = currenCharactersIndex();
 	int currentChar = -1;
 
-	if (index < model()->characters().count())
+	if ((index < model()->characters().count()) && (model()->characters().count() > 0))
 		currentChar = model()->characters()[index];
 
 	if (e->button() == Qt::RightButton && currentChar > -1)

Modified: trunk/Scribus/scribus/ui/charselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17273&path=/trunk/Scribus/scribus/ui/charselect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.cpp (original)
+++ trunk/Scribus/scribus/ui/charselect.cpp Sat Feb  4 09:59:59 2012
@@ -116,6 +116,9 @@
 		m_Item->asTextFrame()->invalidateLayout();
 	//CB: Avox please make text->insertchar(char) so none of this happens in gui code, and item can tell doc its changed so the view and mainwindow slotdocch are not necessary
 	QChar ch;
+	QString fontName = m_doc->currentStyle.charStyle().font().scName();
+	if (m_enhanced)
+		fontName = m_enhanced->getUsedFont();
 	for (int a=0; a<chToIns.length(); ++a)
 	{
 		ch = chToIns.at(a);
@@ -123,7 +126,11 @@
 			ch = QChar(13);
 		if (ch == QChar(9))
 			ch = QChar(32);
+		int pot = m_Item->itemText.cursorPosition();
 		m_Item->itemText.insertChars(ch, true);
+		CharStyle nstyle = m_Item->itemText.charStyle(pot);
+		nstyle.setFont((*m_doc->AllFonts)[fontName]);
+		m_Item->itemText.applyCharStyle(pot, 1, nstyle);
 	}
 	m_doc->view()->DrawNew();
 	m_doc->changed();

Modified: trunk/Scribus/scribus/ui/charselectenhanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17273&path=/trunk/Scribus/scribus/ui/charselectenhanced.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselectenhanced.cpp (original)
+++ trunk/Scribus/scribus/ui/charselectenhanced.cpp Sat Feb  4 09:59:59 2012
@@ -64,6 +64,11 @@
 		newFont(fontSelector->currentIndex());
 	}
 //     tDebug("CharSelectEnhanced setDoc end");
+}
+
+QString CharSelectEnhanced::getUsedFont()
+{
+	return m_fontInUse;
 }
 
 void CharSelectEnhanced::scanFont()

Modified: trunk/Scribus/scribus/ui/charselectenhanced.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17273&path=/trunk/Scribus/scribus/ui/charselectenhanced.h
==============================================================================
--- trunk/Scribus/scribus/ui/charselectenhanced.h (original)
+++ trunk/Scribus/scribus/ui/charselectenhanced.h Sat Feb  4 09:59:59 2012
@@ -26,6 +26,7 @@
 	~CharSelectEnhanced();
 
 	void setDoc(ScribusDoc* doc);
+	QString getUsedFont();
 
 signals:
 	/*! \brief A signall emitted when press the "Insert" button.




More information about the scribus-commit mailing list