]> git.lyx.org Git - features.git/commitdiff
Backport of r39360, r39361 and r39363:
authorStephan Witt <switt@lyx.org>
Thu, 11 Aug 2011 11:25:01 +0000 (11:25 +0000)
committerStephan Witt <switt@lyx.org>
Thu, 11 Aug 2011 11:25:01 +0000 (11:25 +0000)
- move spellchecker backend change action to actOnUpdatedPrefs where it belongs to
- add missing action for change of spellchecker_accept_compound preference
- care for a change of accept_compound and reconfigure the aspell backend accordingly
- only aspell is using spellchecker_accept_compound rc variable

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39471 a592a061-630c-0410-9148-cb99ea01b6c8

src/AspellChecker.cpp
src/LyXRC.cpp
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiPrefs.cpp
status.20x

index 284bcace7088c44d27870c0cdbc12feb3b1778bc..62eb29f6d7bb4fea5d9122d755ae3fd5f27df53f 100644 (file)
@@ -41,6 +41,7 @@ namespace {
 struct Speller {
        AspellConfig * config;
        AspellCanHaveError * e_speller;
+       bool accept_compound;
        docstring_list ignored_words_;
 };
 
@@ -255,6 +256,7 @@ AspellSpeller * AspellChecker::Private::addSpeller(Language const * lang)
                // Report run-together words as errors
                aspell_config_replace(m.config, "run-together", "false");
 
+       m.accept_compound = lyxrc.spellchecker_accept_compound;
        m.e_speller = new_aspell_speller(m.config);
        if (aspell_error_number(m.e_speller) != 0) {
                // FIXME: We should indicate somehow that this language is not supported.
@@ -278,9 +280,25 @@ AspellSpeller * AspellChecker::Private::addSpeller(Language const * lang)
 AspellSpeller * AspellChecker::Private::speller(Language const * lang)
 {
        Spellers::iterator it = spellers_.find(lang->lang());
-       if (it != spellers_.end())
-               return to_aspell_speller(it->second.e_speller);
-       
+       if (it != spellers_.end()) {
+               Speller aspell = it->second;
+               if (lyxrc.spellchecker_accept_compound != aspell.accept_compound) {
+                       // spell checker setting changed... adjust run-together
+                       aspell.accept_compound = lyxrc.spellchecker_accept_compound;
+                       if (aspell.accept_compound)
+                               // Consider run-together words as legal compounds
+                               aspell_config_replace(aspell.config, "run-together", "true");
+                       else
+                               // Report run-together words as errors
+                               aspell_config_replace(aspell.config, "run-together", "false");
+                       AspellCanHaveError * e_speller = aspell.e_speller;
+                       aspell.e_speller = new_aspell_speller(aspell.config);
+                       delete_aspell_speller(to_aspell_speller(e_speller));
+                       spellers_[lang->lang()] = aspell;
+               }
+               return to_aspell_speller(aspell.e_speller);
+       }
+
        return addSpeller(lang);
 }
 
index 1d7b3c3d8e345a041b3ce615dbccaee477919155..42116853131c00f87af534f1d48195db135e937e 100644 (file)
@@ -26,6 +26,7 @@
 #include "LyX.h"
 #include "Mover.h"
 #include "Session.h"
+#include "SpellChecker.h"
 #include "version.h"
 
 #include "graphics/GraphicsTypes.h"
@@ -2903,6 +2904,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        switch (tag) {
        case LyXRC::RC_LAST:
        case LyXRC::RC_ACCEPT_COMPOUND:
+               if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
+                       if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
        case LyXRC::RC_ALT_LANG:
        case LyXRC::RC_PLAINTEXT_LINELEN:
        case LyXRC::RC_AUTOCORRECTION_MATH:
@@ -3024,6 +3027,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_SHOW_BANNER:
        case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
        case LyXRC::RC_SPELLCHECKER:
+               if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
+                       setSpellChecker();
        case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
        case LyXRC::RC_SPELLCHECK_NOTES:
        case LyXRC::RC_SPLITINDEX_COMMAND:
index fa31c5c4684cc7466a112a7c59f14c880d0b2979..ed60ecc18b543cadfd085f9996adf024b2857f69 100644 (file)
@@ -1439,7 +1439,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                }
 
                actOnUpdatedPrefs(lyxrc_orig, lyxrc);
-               setSpellChecker();
                resetGui();
 
                break;
index 51494fb44d3cfc2b15614eae2f5c73df17628c63..e4939a9057241db8e8e5151f3800067aeac9e1d0 100644 (file)
@@ -1526,7 +1526,7 @@ void PrefSpellchecker::on_spellcheckerCB_currentIndexChanged(int index)
 {
        QString spellchecker = spellcheckerCB->itemData(index).toString();
        
-       compoundWordCB->setEnabled(spellchecker != QString("native"));
+       compoundWordCB->setEnabled(spellchecker == QString("aspell"));
 }
        
        
index 64e7b15d79209f81fd1ad694a07e0e632e4b1e00..fa2410342960251693527d506456f3eb54ca48e6 100644 (file)
@@ -60,6 +60,9 @@ What's new
 
 - Sort entries in the "More Formats and Options" dialog (bug 7714).
 
+- Enable "Accept compound" preference setting for Aspell backend only.
+  Reconfigure the aspell backend when "Accept compound" preference is
+  changed immediately.
 
 * DOCUMENTATION AND LOCALIZATION