r17485 by craig - Update hunspell plugin, plugin manager to allow SE to see plugins, scplugin to have SE plugin attributes

scribus-commit scribus-commit at lists.scribus.net
Mon Apr 30 21:42:55 UTC 2012


Author: craig
Date: Mon Apr 30 21:42:55 2012
New Revision: 17485

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17485
Log:
Update hunspell plugin, plugin manager to allow SE to see plugins, scplugin to have SE plugin attributes

Modified:
    branches/Version14x/Scribus/CMakeLists.txt
    branches/Version14x/Scribus/resources/dicts/CMakeLists.txt
    branches/Version14x/Scribus/scribus/pluginmanager.cpp
    branches/Version14x/Scribus/scribus/pluginmanager.h
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
    branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
    branches/Version14x/Scribus/scribus/scplugin.cpp
    branches/Version14x/Scribus/scribus/scplugin.h
    branches/Version14x/Scribus/scribus/scraction.cpp
    branches/Version14x/Scribus/scribus/scraction.h
    branches/Version14x/Scribus/scribus/storyeditor.cpp
    branches/Version14x/Scribus/scribus/storyeditor.h

Modified: branches/Version14x/Scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/CMakeLists.txt
==============================================================================
--- branches/Version14x/Scribus/CMakeLists.txt (original)
+++ branches/Version14x/Scribus/CMakeLists.txt Mon Apr 30 21:42:55 2012
@@ -78,8 +78,8 @@
 #where VERSION_SUFFIX is of the form "", "svn" or "Nsvn" (N being the minor patch level)
 SET (VERSION_MAJOR "1")
 SET (VERSION_MINOR "4")
-SET (VERSION_PATCH "1")
-SET (VERSION_SUFFIX "")
+SET (VERSION_PATCH "2")
+SET (VERSION_SUFFIX "svn")
 SET (VERSION ${VERSION_MAJOR})
 IF (VERSION_MINOR GREATER -1)
   SET (VERSION ${VERSION}.${VERSION_MINOR})
@@ -406,8 +406,8 @@
   SET( ENV{LD_PREBIND} 1 )
   SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
   IF (WANT_DEBUG)
-    SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
-    SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+	SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+	SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
   ENDIF (WANT_DEBUG)
   IF (WANT_RELEASEWITHDEBUG)
     SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
@@ -687,6 +687,19 @@
 ENDIF (WITH_ASPELL)
 #>>ASPELL for Speelling support
 
+#<<HUNSPELL for Speelling support
+OPTION(WANT_HUNSPELL "Enable support for spell checking with hunspell" OFF)
+IF (WANT_HUNSPELL)
+  FIND_PACKAGE(HUNSPELL)
+  IF (HUNSPELL_FOUND)
+    MESSAGE("Hunspell Found OK")
+    SET(HAVE_HUNSPELL 1)
+  ELSE (HUNSPELL_FOUND)
+    MESSAGE("HunSpell or its developer libraries NOT found - Disabling support for spell checking")
+  ENDIF (HUNSPELL_FOUND)
+ENDIF (WANT_HUNSPELL)
+#>>HUNSPELL for Speelling support
+
 
 #<<PoDoFo for AI PDF import
 OPTION(WITH_PODOFO "Enable support for PDF embedded in AI" ON)
@@ -863,11 +876,12 @@
   SET(CPACK_TOPLEVEL_TAG "")
   SET(CPACK_SOURCE_IGNORE_FILES
     CMakeCache.txt
-    scribus-1.4.1.tar.gz
-    scribus-1.4.1.tar.Z
-    scribus-1.4.1.tar.xz
-    scribus-1.4.1.gz
-    scribus-1.4.1.tar.bz2
+	scribus-1.4.2.tar.gz
+	scribus-1.4.2.tar.Z
+	scribus-1.4.2.tar.xz
+	scribus-1.4.2.gz
+	scribus-1.4.2.tar.bz2
+	scribus-1.4.2.tar.7z
     "~$"
     "\\\\.cvsignore$"
     "\\\\.o$"

Modified: branches/Version14x/Scribus/resources/dicts/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/resources/dicts/CMakeLists.txt
==============================================================================
--- branches/Version14x/Scribus/resources/dicts/CMakeLists.txt (original)
+++ branches/Version14x/Scribus/resources/dicts/CMakeLists.txt Mon Apr 30 21:42:55 2012
@@ -4,5 +4,9 @@
 )
 
 #Install our hyphenation dict files, selected from *.dic in this directory
-FILE( GLOB SCRIBUS_DICT_FILES *.dic *.txt )
-INSTALL(FILES ${SCRIBUS_DICT_FILES} DESTINATION ${SHAREDIR}dicts)
+FILE( GLOB SCRIBUS_HYPH_DICT_FILES *.dic README*.txt )
+INSTALL(FILES ${SCRIBUS_HYPH_DICT_FILES} DESTINATION ${SHAREDIR}dicts)
+
+#Install our spelling dict files, selected from * in this directory
+FILE( GLOB SCRIBUS_SPELL_DICT_FILES spelling/*.dic spelling/*.txt spelling/*.aff )
+INSTALL(FILES ${SCRIBUS_SPELL_DICT_FILES} DESTINATION ${SHAREDIR}dicts/spelling)

Modified: branches/Version14x/Scribus/scribus/pluginmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/pluginmanager.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pluginmanager.cpp (original)
+++ branches/Version14x/Scribus/scribus/pluginmanager.cpp Mon Apr 30 21:42:55 2012
@@ -25,6 +25,7 @@
 #include "prefsfile.h"
 #include "scpaths.h"
 #include "commonstrings.h"
+#include "storyeditor.h"
 
 #ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
@@ -354,6 +355,65 @@
 	return true;
 }
 
+bool PluginManager::setupPluginActions(StoryEditor *sew)
+{
+	Q_CHECK_PTR(sew);
+	ScActionPlugin* plugin = 0;
+
+	//sew->seMenuMgr->addMenuSeparator("Extras");
+	for (PluginMap::Iterator it = pluginMap.begin(); it != pluginMap.end(); ++it)
+	{
+		if (it.value().plugin->inherits("ScActionPlugin"))
+		{
+			//Add in ScrAction based plugin linkage
+			//Insert DLL Action into Dictionary with values from plugin interface
+			plugin = dynamic_cast<ScActionPlugin*>(it.value().plugin);
+			assert(plugin);
+			ScActionPlugin::ActionInfo ai(plugin->actionInfo());
+			if (ai.enabledForStoryEditor)
+			{
+				ScrAction* action = new ScrAction(ScrAction::ActionDLLSE, ai.icon1, ai.icon2, ai.text, ai.keySequence, sew);
+				Q_CHECK_PTR(action);
+				sew->seActions.insert(ai.name, action);
+
+				// then enable and connect up the action
+				sew->seActions[ai.name]->setEnabled(ai.enabledForStoryEditor);
+
+				// Connect action's activated signal with the plugin's run method
+				it.value().enabled = connect( sew->seActions[ai.name], SIGNAL(triggeredData(QWidget*, ScribusDoc*)),
+							plugin, SLOT(run(QWidget*, ScribusDoc*)) );
+				//Get the menu manager to add the DLL's menu item to the right menu, after the chosen existing item
+				if ( ai.menuAfterName.isEmpty() )
+				{
+					if (!ai.seMenu.isEmpty())
+					{
+						if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty()))
+						{
+							if (!sew->seMenuMgr->menuExists(ai.seMenu))
+								sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
+						}
+						sew->seMenuMgr->addMenuItem(sew->seActions[ai.name], ai.seMenu);
+					}
+				}
+				else
+				{
+					QString actionName(ai.seMenu.toLower()+ai.menuAfterName);
+					ScrAction* afterAction=0;
+					if (sew->seActions.contains(actionName))
+						afterAction=sew->seActions[actionName];
+					if ((!ai.subMenuName.isEmpty()) && (!ai.parentMenu.isEmpty()))
+					{
+						if (!sew->seMenuMgr->menuExists(ai.seMenu))
+							sew->seMenuMgr->createMenu(ai.seMenu, ai.subMenuName, ai.parentMenu);
+					}
+					sew->seMenuMgr->addMenuItemAfter(sew->seActions[ai.name], ai.seMenu, afterAction);
+				}
+			}
+		}
+	}
+	return true;
+}
+
 void PluginManager::enableOnlyStartupPluginActions(ScribusMainWindow* mw)
 {
 	Q_CHECK_PTR(mw);

Modified: branches/Version14x/Scribus/scribus/pluginmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/pluginmanager.h
==============================================================================
--- branches/Version14x/Scribus/scribus/pluginmanager.h (original)
+++ branches/Version14x/Scribus/scribus/pluginmanager.h Mon Apr 30 21:42:55 2012
@@ -21,6 +21,7 @@
 class ScActionPlugin;
 class ScPersistentPlugin;
 class PrefsContext;
+class StoryEditor;
 
 /**
  * \brief PluginManager handles plugin loading, unloading, and running.
@@ -63,6 +64,11 @@
 	 */
 	bool setupPluginActions(ScribusMainWindow*);
 
+	/*! \brief Called at after initPlugs to hook the loaded plugin into the GUI.
+	 * Run in SE startup
+	 */
+	bool setupPluginActions(StoryEditor*);
+
 	/*! \brief Called when the last doc is closed
 	 */
 	void enableOnlyStartupPluginActions(ScribusMainWindow*);

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp Mon Apr 30 21:42:55 2012
@@ -11,7 +11,7 @@
 #include "hunspelldialog.h"
 
 
-HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, PageItem *frameToCheck)
+HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, StoryText *iText)
 {
 	setupUi( this );
 	setModal( true );
@@ -23,7 +23,7 @@
 
 	m_doc=doc;
 	m_docChanged=false;
-	fTC=frameToCheck;
+	m_Itext=iText;
 }
 
 void HunspellDialog::set(QStringList *dictEntries, Hunspell **hspellers, QList<WordsFound> *wfList)
@@ -66,7 +66,7 @@
 	suggestionsListWidget->setCurrentRow(0);
 
 	int sentencePos=0;
-	QString sentence(fTC->itemText.sentence(currWF.start, sentencePos));
+	QString sentence(m_Itext->sentence(currWF.start, sentencePos));
 	sentence.insert(currWF.end-sentencePos+currWF.changeOffset,"</b></font>");
 	sentence.insert(currWF.start-sentencePos+currWF.changeOffset,"<font color=red><b>");
 	sentenceTextEdit->setText(sentence);
@@ -89,7 +89,6 @@
 	if(m_wfList->at(wfListIndex).ignore || m_wfList->at(wfListIndex).changed)
 		goToNextWord();
 	replaceWord(wfListIndex);
-	m_docChanged=true;
 	goToNextWord();
 }
 
@@ -102,7 +101,6 @@
 	for(int i=0;i<m_wfList->count();++i)
 		if(m_wfList->at(i).w==wordToChange)
 			replaceWord(i);
-	m_docChanged=true;
 	goToNextWord();
 }
 
@@ -110,7 +108,7 @@
 {
 	//qDebug()<<"Replacing word"<<i<m_wfList->at(i).w<<m_wfList->at(i).start;
 	QString newText(suggestionsListWidget->currentItem()->text());
-	int lengthDiff=fTC->itemText.replaceWord(m_wfList->at(i).start+m_wfList->at(i).changeOffset, newText);
+	int lengthDiff=m_Itext->replaceWord(m_wfList->at(i).start+m_wfList->at(i).changeOffset, newText);
 	if (lengthDiff!=0)
 	{
 		for (int k=i; k<m_wfList->count();++k)

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h Mon Apr 30 21:42:55 2012
@@ -11,7 +11,7 @@
 #include "pluginapi.h"
 #include "hunspellpluginstructs.h"
 #include "scribusdoc.h"
-#include "pageitem.h"
+#include "text/storytext.h"
 
 #include "ui_hunspelldialogbase.h"
 
@@ -20,7 +20,7 @@
 	Q_OBJECT
 
 	public:
-		HunspellDialog(QWidget* parent, ScribusDoc *doc, PageItem* frameToCheck);
+		HunspellDialog(QWidget* parent, ScribusDoc *doc, StoryText* iText);
 		~HunspellDialog() {};
 		void set(QStringList* dictEntries, Hunspell **hspellers, QList<WordsFound>* wfList);
 		bool docChanged() {return m_docChanged;}
@@ -34,7 +34,7 @@
 
 	private:
 		ScribusDoc* m_doc;
-		PageItem* fTC;
+		StoryText* m_Itext;
 		QStringList* m_dictEntries;
 		Hunspell **m_hspellers;
 		QList<WordsFound>* m_wfList;

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp Mon Apr 30 21:42:55 2012
@@ -7,6 +7,7 @@
 #include "hunspellplugin.h"
 #include "hunspellpluginimpl.h"
 #include "scribuscore.h"
+#include "storyeditor.h"
 
 // See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods
 // do. That documentatation is not duplicated here.
@@ -29,9 +30,11 @@
 	// Action name
 	m_actionInfo.name = "HunspellPlugin";
 	// Action text for menu, including &accel
-	m_actionInfo.text = tr("Hunspell &Plugin");
+	m_actionInfo.text = tr("Check Spelling...");
 	// Menu
 	m_actionInfo.menu = "Item";
+	// Story Editor Menu
+	m_actionInfo.seMenu = "Edit";
 	// If needed, what item to add the menu item after
 	//m_actionInfo.menuAfterName = "ColorWheel"
 	// If needed, the keyboard shortcut for the plugin
@@ -39,6 +42,7 @@
 	// Should the menu item be enabled when the app starts
 	// (even without a document open) ?
 	m_actionInfo.enabledOnStartup = false;
+	m_actionInfo.enabledForStoryEditor = true;
 	m_actionInfo.notSuitableFor.append(PageItem::Line);
 	m_actionInfo.notSuitableFor.append(PageItem::Polygon);
 	m_actionInfo.notSuitableFor.append(PageItem::ImageFrame);
@@ -74,6 +78,17 @@
 	return result;
 }
 
+bool HunspellPlugin::run(QWidget *parent, ScribusDoc *doc, QString target)
+{
+	HunspellPluginImpl *hunspellPluginImpl = new HunspellPluginImpl();
+	Q_CHECK_PTR(hunspellPluginImpl);
+	if (parent)
+		hunspellPluginImpl->setRunningForSE(true, dynamic_cast<StoryEditor*>(parent));
+	bool result = hunspellPluginImpl->run(target, doc);
+	delete hunspellPluginImpl;
+	return result;
+}
+
 // Low level plugin API
 int hunspellplugin_getPluginAPIVersion()
 {

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.h (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellplugin.h Mon Apr 30 21:42:55 2012
@@ -24,6 +24,7 @@
 		virtual ~HunspellPlugin();
 		//! \brief main method to run the plug
 		virtual bool run(ScribusDoc* doc, QString target = QString::null);
+		virtual bool run(QWidget* p, ScribusDoc* doc, QString target = QString::null);
 		virtual const QString fullTrName() const;
 		virtual const AboutData* getAboutData() const;
 		virtual void deleteAboutData(const AboutData* about) const;
@@ -31,6 +32,8 @@
 		virtual void addToMainWindowMenu(ScribusMainWindow *) {};
 
 		// Special features (none)
+
+		QWidget *m_parent;
 };
 
 extern "C" PLUGIN_API int hunspellplugin_getPluginAPIVersion();

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp Mon Apr 30 21:42:55 2012
@@ -12,6 +12,7 @@
 #include "scpaths.h"
 #include "scribusdoc.h"
 #include "scribus.h"
+#include "storyeditor.h"
 #include "text/specialchars.h"
 #include "util.h"
 
@@ -31,6 +32,8 @@
 {
 	hspellers=NULL;
 	numDicts=0;
+	m_runningForSE=false;
+	m_SE=NULL;
 }
 
 HunspellPluginImpl::~HunspellPluginImpl()
@@ -55,7 +58,17 @@
 	qDebug()<<"Hunspell Init Ok:"<<initOk;
 	if (!initOk)
 		return false;
-	bool spellCheckOk=checkWithHunspell();
+	bool spellCheckOk=false;
+	if (m_runningForSE)
+	{
+		//qDebug()<<"Running for StoryEditor";
+		spellCheckOk=checkWithHunspellSE();
+	}
+	else
+	{
+		//qDebug()<<"Running for ScribusMainWindow";
+		spellCheckOk=checkWithHunspell();
+	}
 	if (!spellCheckOk)
 		return false;
 	return true;
@@ -126,19 +139,26 @@
 	for( int i = 0; i < m_doc->m_Selection->count(); ++i )
 	{
 		frameToCheck = m_doc->m_Selection->itemAt(i);
-		parseTextFrame(frameToCheck);
-		openGUIForTextFrame(frameToCheck);
+		StoryText *iText=&frameToCheck->itemText;
+		parseTextFrame(iText);
+		openGUIForTextFrame(iText);
 		m_doc->view()->DrawNew();
 	}
 	return true;
 }
 
-bool HunspellPluginImpl::parseTextFrame(PageItem *frameToCheck)
-{
-	StoryText *iText=&frameToCheck->itemText;
+bool HunspellPluginImpl::checkWithHunspellSE()
+{
+	StoryText *iText=&(m_SE->Editor->StyledText);
+	parseTextFrame(iText);
+	openGUIForStoryEditor(iText);
+	m_SE->Editor->updateAll();
+	return true;
+}
+
+bool HunspellPluginImpl::parseTextFrame(StoryText *iText)
+{
 	int len=iText->length();
-	QString text=iText->text(0,len);
-//	qDebug()<<text;
 	int wordCount=0,wordNo=0,errorCount=0;
 	int currPos=0;
 	while (currPos<len)
@@ -185,9 +205,9 @@
 	return true;
 }
 
-bool HunspellPluginImpl::openGUIForTextFrame(PageItem *frameToCheck)
-{
-	HunspellDialog hsDialog(m_doc->scMW(), m_doc, frameToCheck);
+bool HunspellPluginImpl::openGUIForTextFrame(StoryText *iText)
+{
+	HunspellDialog hsDialog(m_doc->scMW(), m_doc, iText);
 	hsDialog.set(&dictEntries, hspellers, &wordsToCorrect);
 	hsDialog.exec();
 	if (hsDialog.docChanged())
@@ -195,3 +215,19 @@
 	return true;
 }
 
+bool HunspellPluginImpl::openGUIForStoryEditor(StoryText *iText)
+{
+	m_SE->setSpellActive(true);
+	HunspellDialog hsDialog(m_SE, m_doc, iText);
+	hsDialog.set(&dictEntries, hspellers, &wordsToCorrect);
+	hsDialog.exec();
+	m_SE->setSpellActive(false);
+	return true;
+}
+
+void HunspellPluginImpl::setRunningForSE(bool rfSE, StoryEditor *sE)
+{
+	m_runningForSE=rfSE;
+	m_SE=sE;
+}
+

Modified: branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h (original)
+++ branches/Version14x/Scribus/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h Mon Apr 30 21:42:55 2012
@@ -17,6 +17,8 @@
 class QString;
 class ScribusDoc;
 class PageItem;
+class StoryText;
+class StoryEditor;
 
 
 
@@ -30,8 +32,11 @@
 		bool findDictionaries();
 		bool initHunspell();
 		bool checkWithHunspell();
-		bool parseTextFrame(PageItem *frameToCheck);
-		bool openGUIForTextFrame(PageItem *frameToCheck);
+		bool checkWithHunspellSE();
+		bool parseTextFrame(StoryText *);
+		bool openGUIForTextFrame(StoryText *iText);
+		bool openGUIForStoryEditor(StoryText *iText);
+		void setRunningForSE(bool rfSE, StoryEditor *sE);
 		QList<WordsFound> wordsToCorrect;
 
 	protected:
@@ -42,6 +47,8 @@
 		QStringList dictEntries;
 		QStringList affEntries;
 		ScribusDoc* m_doc;
+		bool m_runningForSE;
+		StoryEditor* m_SE;
 };
 
 #endif

Modified: branches/Version14x/Scribus/scribus/scplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/scplugin.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scplugin.cpp (original)
+++ branches/Version14x/Scribus/scribus/scplugin.cpp Mon Apr 30 21:42:55 2012
@@ -100,6 +100,10 @@
 	m_actionInfo.firstObjectType.clear();
 	m_actionInfo.secondObjectType.clear();
 	m_actionInfo.enabledOnStartup = false;
+	m_actionInfo.enabledForStoryEditor = false;
+	m_actionInfo.seMenu = "";
+	m_actionInfo.seParentMenu = "";
+	m_actionInfo.seKeySequence = "";
 }
 
 ScActionPlugin::~ScActionPlugin()

Modified: branches/Version14x/Scribus/scribus/scplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/scplugin.h
==============================================================================
--- branches/Version14x/Scribus/scribus/scplugin.h (original)
+++ branches/Version14x/Scribus/scribus/scplugin.h Mon Apr 30 21:42:55 2012
@@ -278,6 +278,10 @@
 											// -1 indicates that any kind of object is possible. Otherwise the selection must contain the 2 Object Types
 											// for the Plugin Action to be enabled
 			bool enabledOnStartup;
+			bool enabledForStoryEditor;
+			QString seMenu;
+			QString seParentMenu;
+			QString seKeySequence;
 		};
 
 		// Return an ActionInfo instance to the caller
@@ -495,7 +499,7 @@
 //
 // The API version is currently simply incremented with each incompatible
 // change. Future versions may introduce a minor/major scheme if necessary.
-#define PLUGIN_API_VERSION 0x00000009
+#define PLUGIN_API_VERSION 0x00000010
 
 
 #endif

Modified: branches/Version14x/Scribus/scribus/scraction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/scraction.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scraction.cpp (original)
+++ branches/Version14x/Scribus/scribus/scraction.cpp Mon Apr 30 21:42:55 2012
@@ -187,6 +187,8 @@
 		emit triggeredData(layerID);
 	if (_actionType==ScrAction::ActionDLL)
 		emit triggeredData(((ScribusMainWindow*)parent())->doc);
+	if (_actionType==ScrAction::ActionDLLSE)
+		emit triggeredData(dynamic_cast<QWidget*>(parent()), ((ScribusMainWindow*)parent())->doc);
 }
 
 void ScrAction::toggledToToggledData(bool ison)

Modified: branches/Version14x/Scribus/scribus/scraction.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/scraction.h
==============================================================================
--- branches/Version14x/Scribus/scribus/scraction.h (original)
+++ branches/Version14x/Scribus/scribus/scraction.h Mon Apr 30 21:42:55 2012
@@ -35,7 +35,7 @@
 	Q_OBJECT
 
 public:
-	typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL, RecentPaste } ActionType;
+	typedef enum {Normal, DataInt, DataDouble, DataQString, RecentFile, DLL, Window, RecentScript, UnicodeChar, Layer, ActionDLL, RecentPaste, ActionDLLSE } ActionType;
 	
 	/*!
 		\author Craig Bradney
@@ -177,6 +177,7 @@
 	void triggeredData(double);
 	void triggeredData(QString);
 	void triggeredData(ScribusDoc*);
+	void triggeredData(QWidget*, ScribusDoc*);
 	void toggledData(bool, int);
 	void toggledData(bool, double);
 	void toggledData(bool, QString);

Modified: branches/Version14x/Scribus/scribus/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/storyeditor.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/storyeditor.cpp (original)
+++ branches/Version14x/Scribus/scribus/storyeditor.cpp Mon Apr 30 21:42:55 2012
@@ -1547,6 +1547,7 @@
 	charSelect(NULL),
 	charSelectUsed(false)
 {
+	m_spellActive=false;
 	prefsManager=PrefsManager::instance();
 #ifdef Q_WS_MAC
 	noIcon = loadIcon("noicon.xpm");
@@ -1811,6 +1812,9 @@
 	seMenuMgr->addMenuToMenuBar("Edit");
 	seMenuMgr->addMenuToMenuBar("Insert");
 	seMenuMgr->addMenuToMenuBar("Settings");
+
+	ScCore->pluginManager->setupPluginActions(this);
+	ScCore->pluginManager->languageChange();
 }
 
 void StoryEditor::buildGUI()
@@ -2105,6 +2109,11 @@
 		seActions["editPaste"]->setEnabled(true);
 }
 
+void StoryEditor::setSpellActive(bool ssa)
+{
+	m_spellActive=ssa;
+}
+
 /** 10/12/2004 - pv - #1203: wrong selection on double click
 Catch the double click signal - cut the wrong selection (with
 whitespaces on the tail) - select only one word - return
@@ -2180,45 +2189,48 @@
 
 bool StoryEditor::eventFilter( QObject* ob, QEvent* ev )
 {
-	if ( ev->type() == QEvent::WindowDeactivate )
-	{
-		if ((currItem!=NULL) && (!blockUpdate))
-			updateTextFrame();
-		activFromApp = false;
-//		Editor->getCursorPosition(&CurrPara, &CurrChar);
-	}
-	if ( ev->type() == QEvent::WindowActivate )
-	{
-		if ((!activFromApp) && (!textChanged) && (!blockUpdate))
-		{
-			activFromApp = true;
-			if (currItem!=NULL)
+	if (!m_spellActive)
+	{
+		if ( ev->type() == QEvent::WindowDeactivate )
+		{
+			if ((currItem!=NULL) && (!blockUpdate))
+				updateTextFrame();
+			activFromApp = false;
+			//		Editor->getCursorPosition(&CurrPara, &CurrChar);
+		}
+		if ( ev->type() == QEvent::WindowActivate )
+		{
+			if ((!activFromApp) && (!textChanged) && (!blockUpdate))
 			{
-				//set to false otherwise some dialog properties wont be set correctly
-				if (currItem->itemText.length() == 0)
-					firstSet = false; 
-				disconnectSignals();
-				Editor->setUndoRedoEnabled(false);
-				Editor->setUndoRedoEnabled(true);
-				Editor->textCursor().setPosition(0);
-				seActions["fileRevert"]->setEnabled(false);
-				seActions["editCopy"]->setEnabled(false);
-				seActions["editCut"]->setEnabled(false);
-				seActions["editClear"]->setEnabled(false);
-				textChanged = false;
-				FontTools->Fonts->RebuildList(currDoc, currItem->isAnnotation());
-				Editor->loadItemText(currItem);
-//				Editor->getCursorPosition(&CurrPara, &CurrChar);
-				updateStatus();
-				textChanged = false;
-				Editor->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
-				Editor->repaint();
-				EditorBar->offs = 0;
-//				EditorBar->doMove(0, Editor->contentsY());
-				EditorBar->setRepaint(true);
-				EditorBar->doRepaint();
-				updateProps(0, 0);
-				connectSignals();
+				activFromApp = true;
+				if (currItem!=NULL)
+				{
+					//set to false otherwise some dialog properties wont be set correctly
+					if (currItem->itemText.length() == 0)
+						firstSet = false;
+					disconnectSignals();
+					Editor->setUndoRedoEnabled(false);
+					Editor->setUndoRedoEnabled(true);
+					Editor->textCursor().setPosition(0);
+					seActions["fileRevert"]->setEnabled(false);
+					seActions["editCopy"]->setEnabled(false);
+					seActions["editCut"]->setEnabled(false);
+					seActions["editClear"]->setEnabled(false);
+					textChanged = false;
+					FontTools->Fonts->RebuildList(currDoc, currItem->isAnnotation());
+					Editor->loadItemText(currItem);
+					//				Editor->getCursorPosition(&CurrPara, &CurrChar);
+					updateStatus();
+					textChanged = false;
+					Editor->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
+					Editor->repaint();
+					EditorBar->offs = 0;
+					//				EditorBar->doMove(0, Editor->contentsY());
+					EditorBar->setRepaint(true);
+					EditorBar->doRepaint();
+					updateProps(0, 0);
+					connectSignals();
+				}
 			}
 		}
 	}

Modified: branches/Version14x/Scribus/scribus/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17485&path=/branches/Version14x/Scribus/scribus/storyeditor.h
==============================================================================
--- branches/Version14x/Scribus/scribus/storyeditor.h (original)
+++ branches/Version14x/Scribus/scribus/storyeditor.h Mon Apr 30 21:42:55 2012
@@ -161,7 +161,8 @@
 	StoryEditor* parentStoryEditor;
 
 protected slots:
-	void handleContentsChange(int position, int charsRemoved, int charsAdded); 
+	void handleContentsChange(int position, int charsRemoved, int charsAdded);
+
 
 public slots:
 	void cut();
@@ -388,11 +389,14 @@
 	virtual void changeEvent(QEvent *e);
 
 	void setCurrentDocumentAndItem(ScribusDoc *doc=NULL, PageItem *item=NULL);
+	void setSpellActive(bool ssa);
 
 	ScribusDoc* currentDocument() const;
 	PageItem* currentItem() const;
 	SEditor* Editor;
 	bool activFromApp;
+	MenuManager* seMenuMgr;
+	QMap<QString, QPointer<ScrAction> > seActions;
 
 public slots:
 	void newStyle(const QString&);
@@ -514,9 +518,9 @@
 	PrefsManager* prefsManager;
 	PrefsContext* prefs;
 
-	QMap<QString, QPointer<ScrAction> > seActions;
+
 	QStringList unicodeCharActionNames;
-	MenuManager* seMenuMgr;
+
 	QPixmap noIcon;
 
 	QToolBar* FileTools;
@@ -541,6 +545,8 @@
 	QLabel* WordC2;
 	QLabel* CharCT2;
 	QLabel* CharC2;
+
+	bool m_spellActive;
 };
 
 #endif




More information about the scribus-commit mailing list