summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-04-30 21:42:55 +0000
committercraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-04-30 21:42:55 +0000
commit03f92217ee2336adcbf9b1343ea03edac490ade5 (patch)
tree54300e6b248f5b341d8de29649d4175edfae5742
parent8f5f4c57942487fafbeced90e981810b20c809b5 (diff)
downloadscribus-03f92217ee2336adcbf9b1343ea03edac490ade5.tar.gz
scribus-03f92217ee2336adcbf9b1343ea03edac490ade5.tar.xz
scribus-03f92217ee2336adcbf9b1343ea03edac490ade5.zip
Update hunspell plugin, plugin manager to allow SE to see plugins, scplugin to have SE plugin attributes
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17485 11d20701-8431-0410-a711-e3c959e3b870
-rw-r--r--CMakeLists.txt32
-rw-r--r--resources/dicts/CMakeLists.txt8
-rw-r--r--scribus/pluginmanager.cpp60
-rw-r--r--scribus/pluginmanager.h6
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp10
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspelldialog.h6
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp17
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspellplugin.h3
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp54
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h11
-rw-r--r--scribus/scplugin.cpp4
-rw-r--r--scribus/scplugin.h6
-rw-r--r--scribus/scraction.cpp2
-rw-r--r--scribus/scraction.h3
-rw-r--r--scribus/storyeditor.cpp84
-rw-r--r--scribus/storyeditor.h12
16 files changed, 245 insertions, 73 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c5bcf95..b5ee752 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,8 +78,8 @@ PROJECT(scribus)
#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 @@ IF(APPLE)
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 @@ IF (WITH_ASPELL)
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 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
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$"
diff --git a/resources/dicts/CMakeLists.txt b/resources/dicts/CMakeLists.txt
index 01643a9..1dfce04 100644
--- a/resources/dicts/CMakeLists.txt
+++ b/resources/dicts/CMakeLists.txt
@@ -4,5 +4,9 @@ ${CMAKE_SOURCE_DIR}/scribus
)
#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)
diff --git a/scribus/pluginmanager.cpp b/scribus/pluginmanager.cpp
index 7c04eae..d1666b1 100644
--- a/scribus/pluginmanager.cpp
+++ b/scribus/pluginmanager.cpp
@@ -25,6 +25,7 @@ for which a new license (GPL+exception) is in place.
#include "prefsfile.h"
#include "scpaths.h"
#include "commonstrings.h"
+#include "storyeditor.h"
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
@@ -354,6 +355,65 @@ bool PluginManager::setupPluginActions(ScribusMainWindow *mw)
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);
diff --git a/scribus/pluginmanager.h b/scribus/pluginmanager.h
index 67e1500..84b9aef 100644
--- a/scribus/pluginmanager.h
+++ b/scribus/pluginmanager.h
@@ -21,6 +21,7 @@ class ScPlugin;
class ScActionPlugin;
class ScPersistentPlugin;
class PrefsContext;
+class StoryEditor;
/**
* \brief PluginManager handles plugin loading, unloading, and running.
@@ -63,6 +64,11 @@ public:
*/
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*);
diff --git a/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp b/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
index d36b08b..7c2c5a7 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
+++ b/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
@@ -11,7 +11,7 @@ for which a new license (GPL+exception) is in place.
#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 @@ HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, PageItem *frame
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 @@ void HunspellDialog::goToNextWord(int i)
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 @@ void HunspellDialog::changeWord()
if(m_wfList->at(wfListIndex).ignore || m_wfList->at(wfListIndex).changed)
goToNextWord();
replaceWord(wfListIndex);
- m_docChanged=true;
goToNextWord();
}
@@ -102,7 +101,6 @@ void HunspellDialog::changeAllWords()
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 @@ void HunspellDialog::replaceWord(int i)
{
//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)
diff --git a/scribus/plugins/tools/hunspellcheck/hunspelldialog.h b/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
index 668966d..634490c 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
+++ b/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
@@ -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 @@ class PLUGIN_API HunspellDialog : public QDialog, private Ui::HunspellDialogBase
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 @@ class PLUGIN_API HunspellDialog : public QDialog, private Ui::HunspellDialogBase
private:
ScribusDoc* m_doc;
- PageItem* fTC;
+ StoryText* m_Itext;
QStringList* m_dictEntries;
Hunspell **m_hspellers;
QList<WordsFound>* m_wfList;
diff --git a/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp b/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
index 5b089a7..b4fbaab 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
+++ b/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
@@ -7,6 +7,7 @@ for which a new license (GPL+exception) is in place.
#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 @@ void HunspellPlugin::languageChange()
// 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 @@ void HunspellPlugin::languageChange()
// 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 @@ bool HunspellPlugin::run(ScribusDoc* doc, QString target)
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()
{
diff --git a/scribus/plugins/tools/hunspellcheck/hunspellplugin.h b/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
index 0b89101..8102cfa 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
+++ b/scribus/plugins/tools/hunspellcheck/hunspellplugin.h
@@ -24,6 +24,7 @@ class PLUGIN_API HunspellPlugin : public ScActionPlugin
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 @@ class PLUGIN_API HunspellPlugin : public ScActionPlugin
virtual void addToMainWindowMenu(ScribusMainWindow *) {};
// Special features (none)
+
+ QWidget *m_parent;
};
extern "C" PLUGIN_API int hunspellplugin_getPluginAPIVersion();
diff --git a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
index 1b169e7..8fff975 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
+++ b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp
@@ -12,6 +12,7 @@ for which a new license (GPL+exception) is in place.
#include "scpaths.h"
#include "scribusdoc.h"
#include "scribus.h"
+#include "storyeditor.h"
#include "text/specialchars.h"
#include "util.h"
@@ -31,6 +32,8 @@ HunspellPluginImpl::HunspellPluginImpl() : QObject(0)
{
hspellers=NULL;
numDicts=0;
+ m_runningForSE=false;
+ m_SE=NULL;
}
HunspellPluginImpl::~HunspellPluginImpl()
@@ -55,7 +58,17 @@ bool HunspellPluginImpl::run(const QString & target, ScribusDoc* doc)
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 @@ bool HunspellPluginImpl::checkWithHunspell()
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)
+bool HunspellPluginImpl::checkWithHunspellSE()
+{
+ StoryText *iText=&(m_SE->Editor->StyledText);
+ parseTextFrame(iText);
+ openGUIForStoryEditor(iText);
+ m_SE->Editor->updateAll();
+ return true;
+}
+
+bool HunspellPluginImpl::parseTextFrame(StoryText *iText)
{
- StoryText *iText=&frameToCheck->itemText;
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 @@ bool HunspellPluginImpl::parseTextFrame(PageItem *frameToCheck)
return true;
}
-bool HunspellPluginImpl::openGUIForTextFrame(PageItem *frameToCheck)
+bool HunspellPluginImpl::openGUIForTextFrame(StoryText *iText)
{
- HunspellDialog hsDialog(m_doc->scMW(), m_doc, frameToCheck);
+ HunspellDialog hsDialog(m_doc->scMW(), m_doc, iText);
hsDialog.set(&dictEntries, hspellers, &wordsToCorrect);
hsDialog.exec();
if (hsDialog.docChanged())
@@ -195,3 +215,19 @@ bool HunspellPluginImpl::openGUIForTextFrame(PageItem *frameToCheck)
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;
+}
+
diff --git a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
index d664682..0443c10 100644
--- a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
+++ b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.h
@@ -17,6 +17,8 @@ for which a new license (GPL+exception) is in place.
class QString;
class ScribusDoc;
class PageItem;
+class StoryText;
+class StoryEditor;
@@ -30,8 +32,11 @@ class HunspellPluginImpl : public QObject
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 @@ class HunspellPluginImpl : public QObject
QStringList dictEntries;
QStringList affEntries;
ScribusDoc* m_doc;
+ bool m_runningForSE;
+ StoryEditor* m_SE;
};
#endif
diff --git a/scribus/scplugin.cpp b/scribus/scplugin.cpp
index 2d0e870..a34aca1 100644
--- a/scribus/scplugin.cpp
+++ b/scribus/scplugin.cpp
@@ -100,6 +100,10 @@ ScActionPlugin::ScActionPlugin() : ScPlugin()
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()
diff --git a/scribus/scplugin.h b/scribus/scplugin.h
index 8289971..bc9b942 100644
--- a/scribus/scplugin.h
+++ b/scribus/scplugin.h
@@ -278,6 +278,10 @@ class SCRIBUS_API ScActionPlugin : public ScPlugin
// -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 @@ class SCRIBUS_API ScPersistentPlugin : public ScPlugin
//
// 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
diff --git a/scribus/scraction.cpp b/scribus/scraction.cpp
index 8834fdf..d57cba7 100644
--- a/scribus/scraction.cpp
+++ b/scribus/scraction.cpp
@@ -187,6 +187,8 @@ void ScrAction::triggeredToTriggeredData()
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)
diff --git a/scribus/scraction.h b/scribus/scraction.h
index 23d68dc..6c8a236 100644
--- a/scribus/scraction.h
+++ b/scribus/scraction.h
@@ -35,7 +35,7 @@ class SCRIBUS_API ScrAction : public QAction
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 @@ signals:
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);
diff --git a/scribus/storyeditor.cpp b/scribus/storyeditor.cpp
index 3859a25..ce9398e 100644
--- a/scribus/storyeditor.cpp
+++ b/scribus/storyeditor.cpp
@@ -1547,6 +1547,7 @@ StoryEditor::StoryEditor(QWidget* parent) : QMainWindow(parent, Qt::Window), //
charSelect(NULL),
charSelectUsed(false)
{
+ m_spellActive=false;
prefsManager=PrefsManager::instance();
#ifdef Q_WS_MAC
noIcon = loadIcon("noicon.xpm");
@@ -1811,6 +1812,9 @@ void StoryEditor::buildMenus()
seMenuMgr->addMenuToMenuBar("Edit");
seMenuMgr->addMenuToMenuBar("Insert");
seMenuMgr->addMenuToMenuBar("Settings");
+
+ ScCore->pluginManager->setupPluginActions(this);
+ ScCore->pluginManager->languageChange();
}
void StoryEditor::buildGUI()
@@ -2105,6 +2109,11 @@ void StoryEditor::setCurrentDocumentAndItem(ScribusDoc *doc, PageItem *item)
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 @@ void StoryEditor::keyPressEvent (QKeyEvent * e)
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 (!m_spellActive)
{
- if ((!activFromApp) && (!textChanged) && (!blockUpdate))
+ if ( ev->type() == QEvent::WindowDeactivate )
+ {
+ if ((currItem!=NULL) && (!blockUpdate))
+ updateTextFrame();
+ activFromApp = false;
+ // Editor->getCursorPosition(&CurrPara, &CurrChar);
+ }
+ if ( ev->type() == QEvent::WindowActivate )
{
- activFromApp = true;
- if (currItem!=NULL)
+ 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();
+ }
}
}
}
diff --git a/scribus/storyeditor.h b/scribus/storyeditor.h
index 2d94f22..3528e6c 100644
--- a/scribus/storyeditor.h
+++ b/scribus/storyeditor.h
@@ -161,7 +161,8 @@ protected:
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 @@ public:
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 @@ protected:
PrefsManager* prefsManager;
PrefsContext* prefs;
- QMap<QString, QPointer<ScrAction> > seActions;
+
QStringList unicodeCharActionNames;
- MenuManager* seMenuMgr;
+
QPixmap noIcon;
QToolBar* FileTools;
@@ -541,6 +545,8 @@ protected:
QLabel* WordC2;
QLabel* CharCT2;
QLabel* CharC2;
+
+ bool m_spellActive;
};
#endif