r24062 by jghali - Fix issue in scripter's setParagraphStyle() and setCharacterStyle() when trying to apply style to frame with no item selected

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 8 22:50:48 UTC 2020


Author: jghali
Date: Thu Oct  8 22:50:47 2020
New Revision: 24062

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24062
Log:
Fix issue in scripter's setParagraphStyle() and setCharacterStyle() when trying to apply style to frame with no item selected

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24062&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	Thu Oct  8 22:50:47 2020
@@ -709,6 +709,11 @@
 	// For multiple selections or if current item has no text selected, we apply style in normal mode
 	if (currentDoc->m_Selection->isMultipleSelection() || (item->itemText.selectionLength() <= 0))
 	{
+		if (currentDoc->m_Selection->count() <= 1)
+		{
+			currentView->deselectItems(true);
+			currentView->selectItem(item, false);
+		}
 		int mode = currentDoc->appMode;
 		currentDoc->appMode = modeNormal;
 		currentDoc->itemSelection_SetNamedParagraphStyle(paraStyleName);
@@ -780,6 +785,11 @@
 	// For multiple selections or if current item has no text selected, we apply style in normal mode
 	if (currentDoc->m_Selection->isMultipleSelection() || (item->itemText.selectionLength() <= 0))
 	{
+		if (currentDoc->m_Selection->count() <= 1)
+		{
+			currentView->deselectItems(true);
+			currentView->selectItem(item, false);
+		}
 		int mode = currentDoc->appMode;
 		currentDoc->appMode = modeNormal;
 		currentDoc->itemSelection_SetNamedCharStyle(charStyleName);

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24062&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp	Thu Oct  8 22:50:47 2020
@@ -709,6 +709,11 @@
 	// For multiple selections or if current item has no text selected, we apply style in normal mode
 	if (currentDoc->m_Selection->isMultipleSelection() || (item->itemText.selectionLength() <= 0))
 	{
+		if (currentDoc->m_Selection->count() <= 1)
+		{
+			currentView->deselectItems(true);
+			currentView->selectItem(item, false);
+		}
 		int mode = currentDoc->appMode;
 		currentDoc->appMode = modeNormal;
 		currentDoc->itemSelection_SetNamedParagraphStyle(paraStyleName);
@@ -780,6 +785,11 @@
 	// For multiple selections or if current item has no text selected, we apply style in normal mode
 	if (currentDoc->m_Selection->isMultipleSelection() || (item->itemText.selectionLength() <= 0))
 	{
+		if (currentDoc->m_Selection->count() <= 1)
+		{
+			currentView->deselectItems(true);
+			currentView->selectItem(item, false);
+		}
 		int mode = currentDoc->appMode;
 		currentDoc->appMode = modeNormal;
 		currentDoc->itemSelection_SetNamedCharStyle(charStyleName);




More information about the scribus-commit mailing list