r24131 by jghali - Improve performance of spell checker when parsing text frames by introducing a specific word iterator class

scribus-commit scribus-commit at lists.scribus.net
Fri Oct 30 20:06:13 UTC 2020


Author: jghali
Date: Fri Oct 30 20:06:13 2020
New Revision: 24131

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24131
Log:
Improve performance of spell checker when parsing text frames by introducing a specific word iterator class

Added:
    trunk/Scribus/scribus/text/scworditerator.cpp
    trunk/Scribus/scribus/text/scworditerator.h
Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
    trunk/Scribus/scribus/text/CMakeLists.txt
    trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
    trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
    trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
    trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
    trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
    trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp	Fri Oct 30 20:06:13 2020
@@ -14,6 +14,7 @@
 #include "scribusdoc.h"
 #include "scribusview.h"
 #include "selection.h"
+#include "text/scworditerator.h"
 #include "text/specialchars.h"
 #include "ui/storyeditor.h"
 #include "util.h"
@@ -112,12 +113,15 @@
 
 bool HunspellPluginImpl::parseTextFrame(StoryText *iText)
 {
+	ScWordIterator wordIt(*iText);
+
 	int len = iText->length();
-	int currPos = iText->firstWord(), wordStart;
+	int currPos = wordIt.firstWord();
+	int wordStart;
 	while (currPos < len)
 	{
 		wordStart = currPos;
-		int wordEnd = iText->endOfWord(wordStart);
+		int wordEnd = wordIt.endOfWord(wordStart);
 		QString word = iText->text(wordStart, wordEnd - wordStart);
 		// remove any Ignorable Code Point
 		QString tmp = word;
@@ -180,7 +184,7 @@
 			wf.lang = wordLang;
 			wordsToCorrect.append(wf);
 		}
-		currPos = iText->nextWord(wordStart);
+		currPos = wordIt.nextWord(wordStart);
 	}
 	return true;
 }

Modified: trunk/Scribus/scribus/text/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/scribus/text/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/text/CMakeLists.txt	(original)
+++ trunk/Scribus/scribus/text/CMakeLists.txt	Fri Oct 30 20:06:13 2020
@@ -23,6 +23,7 @@
 	screenpainter.cpp
 	scrptrun.cpp
 	sctext_shared.cpp
+	scworditerator.cpp
 	shapedtext.cpp
 	shapedtextcache.cpp
 	shapedtextfeed.cpp

Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj	(original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj	Fri Oct 30 20:06:13 2020
@@ -434,6 +434,7 @@
     <ClInclude Include="..\..\..\scribus\text\itextsource.h" />
     <ClInclude Include="..\..\..\scribus\text\screenpainter.h" />
     <ClInclude Include="..\..\..\scribus\text\scrptrun.h" />
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtext.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextcache.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextfeed.h" />
@@ -910,6 +911,7 @@
     <ClCompile Include="..\..\..\scribus\text\index.cpp" />
     <ClCompile Include="..\..\..\scribus\text\screenpainter.cpp" />
     <ClCompile Include="..\..\..\scribus\text\scrptrun.cpp" />
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtext.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextcache.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextfeed.cpp" />

Modified: trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters	(original)
+++ trunk/Scribus/win32/msvc2015/scribus-main/Scribus.vcxproj.filters	Fri Oct 30 20:06:13 2020
@@ -827,6 +827,9 @@
     <ClInclude Include="..\..\..\scribus\printpreviewcreatorfactory.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\scribus\desaxe\digester.cpp">
@@ -2555,6 +2558,9 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\..\scribus\ui\printlanguagecombo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>

Modified: trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj	(original)
+++ trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj	Fri Oct 30 20:06:13 2020
@@ -434,6 +434,7 @@
     <ClInclude Include="..\..\..\scribus\text\itextsource.h" />
     <ClInclude Include="..\..\..\scribus\text\screenpainter.h" />
     <ClInclude Include="..\..\..\scribus\text\scrptrun.h" />
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtext.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextcache.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextfeed.h" />
@@ -910,6 +911,7 @@
     <ClCompile Include="..\..\..\scribus\text\index.cpp" />
     <ClCompile Include="..\..\..\scribus\text\screenpainter.cpp" />
     <ClCompile Include="..\..\..\scribus\text\scrptrun.cpp" />
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtext.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextcache.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextfeed.cpp" />

Modified: trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters	(original)
+++ trunk/Scribus/win32/msvc2017/scribus-main/Scribus.vcxproj.filters	Fri Oct 30 20:06:13 2020
@@ -827,6 +827,9 @@
     <ClInclude Include="..\..\..\scribus\printpreviewcreatorfactory.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\scribus\desaxe\digester.cpp">
@@ -2555,6 +2558,9 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\..\scribus\ui\printlanguagecombo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>

Modified: trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj
==============================================================================
--- trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj	(original)
+++ trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj	Fri Oct 30 20:06:13 2020
@@ -435,6 +435,7 @@
     <ClInclude Include="..\..\..\scribus\text\itextsource.h" />
     <ClInclude Include="..\..\..\scribus\text\screenpainter.h" />
     <ClInclude Include="..\..\..\scribus\text\scrptrun.h" />
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtext.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextcache.h" />
     <ClInclude Include="..\..\..\scribus\text\shapedtextfeed.h" />
@@ -911,6 +912,7 @@
     <ClCompile Include="..\..\..\scribus\text\index.cpp" />
     <ClCompile Include="..\..\..\scribus\text\screenpainter.cpp" />
     <ClCompile Include="..\..\..\scribus\text\scrptrun.cpp" />
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtext.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextcache.cpp" />
     <ClCompile Include="..\..\..\scribus\text\shapedtextfeed.cpp" />

Modified: trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24131&path=/trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters
==============================================================================
--- trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters	(original)
+++ trunk/Scribus/win32/msvc2019/scribus-main/Scribus.vcxproj.filters	Fri Oct 30 20:06:13 2020
@@ -827,6 +827,9 @@
     <ClInclude Include="..\..\..\scribus\printpreviewcreatorfactory.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\scribus\text\scworditerator.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\scribus\desaxe\digester.cpp">
@@ -2555,6 +2558,9 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\..\..\scribus\ui\printlanguagecombo.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\scribus\text\scworditerator.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>




More information about the scribus-commit mailing list