From: André Pönitz Date: Sun, 16 Nov 2008 12:22:54 +0000 (+0000) Subject: remove spellchecker command and flag telling us whether to use a process or a X-Git-Tag: 2.0.0~7730 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8e366b1cab08e144f4709dfd6a35852a18249b79;p=features.git remove spellchecker command and flag telling us whether to use a process or a library. Somebody schould create a rc2rc script... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27531 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index e822fcbcfa..be650c3a74 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -122,6 +122,7 @@ LexerKeyword lyxrcTags[] = { { "\\path_prefix", LyXRC::RC_PATH_PREFIX }, { "\\personal_dictionary", LyXRC::RC_PERS_DICT }, { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN }, + { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND }, { "\\preview", LyXRC::RC_PREVIEW }, { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS }, { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR }, @@ -173,7 +174,6 @@ LexerKeyword lyxrcTags[] = { { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE }, // compatibility with versions older than 1.4.0 only { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB }, - { "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB }, // compatibility with versions older than 1.4.0 only { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, @@ -259,8 +259,6 @@ void LyXRC::setDefaults() backupdir_path.erase(); display_graphics = true; // Spellchecker settings: - use_spell_lib = true; - spellchecker_command = "aspell"; spellchecker_accept_compound = false; spellchecker_use_input_encoding = false; spellchecker_use_alt_lang = false; @@ -370,7 +368,8 @@ int LyXRC::read(istream & is) int LyXRC::read(Lexer & lexrc) { - if (!lexrc.isOK()) return -2; + if (!lexrc.isOK()) + return -2; while (lexrc.isOK()) { // By using two switches we take advantage of the compiler @@ -382,12 +381,15 @@ int LyXRC::read(Lexer & lexrc) int le = lexrc.lex(); switch (le) { - case Lexer::LEX_UNDEF: - lexrc.printError("Unknown tag `$$Token'"); - continue; - case Lexer::LEX_FEOF: - continue; - default: break; + case Lexer::LEX_UNDEF: + // dro[ obsolete tag + if (lexrc.getString() != "\\plaintest_roff_command") + lexrc.printError("Unknown tag `$$Token'"); + continue; + case Lexer::LEX_FEOF: + continue; + default: + break; } switch (static_cast(le)) { case RC_INPUT: // Include file @@ -402,21 +404,18 @@ int LyXRC::read(Lexer & lexrc) } break; case RC_BINDFILE: - if (lexrc.next()) { + if (lexrc.next()) bind_file = os::internal_path(lexrc.getString()); - } break; case RC_DEFFILE: - if (lexrc.next()) { + if (lexrc.next()) def_file = os::internal_path(lexrc.getString()); - } break; case RC_UIFILE: - if (lexrc.next()) { + if (lexrc.next()) ui_file = os::internal_path(lexrc.getString()); - } break; case RC_AUTORESET_OPTIONS: @@ -827,17 +826,13 @@ int LyXRC::read(Lexer & lexrc) lexrc >> dialogs_iconify_with_main; break; + case RC_PLAINTEXT_ROFF_COMMAND: + (void) lexrc.getString(); // Obsoleted in 1.7 + break; case RC_PLAINTEXT_LINELEN: lexrc >> plaintext_linelen; break; // Spellchecker settings: - case RC_USE_SPELL_LIB: - lexrc >> use_spell_lib; - break; - case RC_SPELL_COMMAND: - if (lexrc.next(true)) - spellchecker_command = lexrc.getString(); - break; case RC_ACCEPT_COMPOUND: lexrc >> spellchecker_accept_compound; break; @@ -1081,6 +1076,15 @@ int LyXRC::read(Lexer & lexrc) lexrc >> open_buffers_in_tabs; break; + // Obsoleted in 1.7 + case RC_SPELL_COMMAND: + (void) lexrc.getString(); + break; + // Obsoleted in 1.7 + case RC_USE_SPELL_LIB: + (void) lexrc.getString(); + break; + case RC_LAST: break; // this is just a dummy } @@ -2042,6 +2046,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; // Ignore it + case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 1.7 + if (tag != RC_LAST) + break; case RC_PLAINTEXT_LINELEN: if (ignore_system_lyxrc || plaintext_linelen != system_lyxrc.plaintext_linelen) { @@ -2072,20 +2079,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c os << "\n#\n" << "# SPELLCHECKER SECTION ##############################\n" << "#\n\n"; - case RC_USE_SPELL_LIB: - if (ignore_system_lyxrc || - use_spell_lib != system_lyxrc.use_spell_lib) { - os << "\\use_spell_lib " << convert(use_spell_lib) << '\n'; - } - if (tag != RC_LAST) - break; case RC_SPELL_COMMAND: - if (ignore_system_lyxrc || - spellchecker_command != system_lyxrc.spellchecker_command) { - os << "\\spell_command \"" << escapeCommand(spellchecker_command) << "\"\n"; - } - if (tag != RC_LAST) - break; + // Obsoleted in 1.7 + case RC_USE_SPELL_LIB: + // Obsoleted in 1.7 case RC_ACCEPT_COMPOUND: if (ignore_system_lyxrc || spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) { @@ -2792,10 +2789,6 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("De-select if you don't want the startup banner."); break; - case RC_SPELL_COMMAND: - str = _("What command runs the spellchecker?"); - break; - case RC_TEMPDIRPATH: str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX."); break; diff --git a/src/LyXRC.h b/src/LyXRC.h index f0aaa209f4..361f22badc 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -39,6 +39,7 @@ public: RC_ACCEPT_COMPOUND = 1, RC_ALT_LANG, RC_PLAINTEXT_LINELEN, + RC_PLAINTEXT_ROFF_COMMAND, RC_AUTOREGIONDELETE, RC_AUTORESET_OPTIONS, RC_AUTOSAVE, @@ -303,10 +304,6 @@ public: unsigned int autosave; /// unsigned int plaintext_linelen; - /// use library instead of process - bool use_spell_lib; - /// spellchecker command - std::string spellchecker_command; /// Accept compound words in spellchecker? bool spellchecker_accept_compound; /// Pass input encoding switch to the spellchecker? diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index f2efabdcc5..febe4de406 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -181,7 +181,9 @@ vector loadableImageFormats() //////////////////////////////////////////////////////////////////////// -// Icon loading support code. +// +// Icon loading support code +// //////////////////////////////////////////////////////////////////////// namespace { @@ -371,8 +373,11 @@ QIcon getIcon(FuncRequest const & f, bool unknown) //////////////////////////////////////////////////////////////////////// +// // LyX server support code. +// //////////////////////////////////////////////////////////////////////// + class SocketNotifier : public QSocketNotifier { public: @@ -388,7 +393,9 @@ public: //////////////////////////////////////////////////////////////////////// +// // Mac specific stuff goes here... +// //////////////////////////////////////////////////////////////////////// class MenuTranslator : public QTranslator @@ -485,8 +492,9 @@ public: #endif /////////////////////////////////////////////////////////////// -// You can find more platform specific stuff -// at the end of this file... +// +// You can find more platform specific stuff at the end of this file... +// /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -734,6 +742,12 @@ GuiApplication::GuiApplication(int & argc, char ** argv) } +GuiApplication * theGuiApp() +{ + return dynamic_cast(theApp()); +} + + void GuiApplication::clearSession() { QSettings settings; @@ -1612,6 +1626,7 @@ frontend::Selection & theSelection() return frontend::guiApp->selection(); } + } // namespace lyx #include "moc_GuiApplication.cpp" diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index 6135e94db0..086a8322cd 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -162,8 +162,7 @@ QString iconName(FuncRequest const & f, bool unknown); /// \return an icon for the given action. QIcon getIcon(FuncRequest const & f, bool unknown); -static GuiApplication * theGuiApp() -{ return dynamic_cast(theApp()); } +GuiApplication * theGuiApp(); } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 1346924ae5..9bcd2c480b 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1035,7 +1035,6 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form) setupUi(this); connect(persDictionaryPB, SIGNAL(clicked()), this, SLOT(select_dict())); - spellCommandCO->setEnabled(false); connect(altLanguageED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); @@ -1047,26 +1046,11 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form) this, SIGNAL(changed())); connect(inputEncodingCB, SIGNAL(clicked()), this, SIGNAL(changed())); - - spellCommandCO->addItem(qt_("aspell")); -#ifdef USE_ASPELL - spellCommandCO->addItem(qt_("aspell (library)")); -#endif } void PrefSpellchecker::apply(LyXRC & rc) const { - switch (spellCommandCO->currentIndex()) { - case 0: - rc.use_spell_lib = false; - rc.spellchecker_command = fromqstr(spellCommandCO->currentText()); - break; - case 1: - rc.use_spell_lib = true; - break; - } - // FIXME: remove spellchecker_use_alt_lang rc.spellchecker_alt_lang = fromqstr(altLanguageED->text()); rc.spellchecker_use_alt_lang = !rc.spellchecker_alt_lang.empty(); @@ -1083,17 +1067,6 @@ void PrefSpellchecker::apply(LyXRC & rc) const void PrefSpellchecker::update(LyXRC const & rc) { - spellCommandCO->setCurrentIndex(0); - - if (rc.spellchecker_command == "aspell") - spellCommandCO->setCurrentIndex(0); - - if (rc.use_spell_lib) { -#if defined(USE_ASPELL) - spellCommandCO->setCurrentIndex(1); -#endif - } - // FIXME: remove spellchecker_use_alt_lang altLanguageED->setText(toqstr(rc.spellchecker_alt_lang)); // FIXME: remove spellchecker_use_esc_chars @@ -2572,7 +2545,7 @@ GuiPreferences::GuiPreferences(GuiView & lv) void GuiPreferences::addModule(PrefModule * module) { - LASSERT(module, /**/); + LASSERT(module, return); if (module->category().isEmpty()) prefsPS->addPanel(module, module->title()); else @@ -2694,12 +2667,12 @@ QString GuiPreferences::browsekbmap(QString const & file) const QString GuiPreferences::browsedict(QString const & file) const { return browseFile(file, qt_("Choose personal dictionary"), - QStringList(lyxrc.use_spell_lib ? qt_("*.pws") : qt_("*.ispell"))); + QStringList(qt_("*.pws"))); } QString GuiPreferences::browse(QString const & file, - QString const & title) const + QString const & title) const { return browseFile(file, title, QStringList(), true); } diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 2718e06ccc..be77ce0f50 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -199,8 +199,7 @@ static SpellBase * createSpeller(BufferParams const & bp) : bp.language->code(); #if defined(USE_ASPELL) - if (lyxrc.use_spell_lib) - return new ASpell(bp, lang); + return new ASpell(bp, lang); #endif return new SpellBase; } diff --git a/src/frontends/qt4/ui/PrefSpellcheckerUi.ui b/src/frontends/qt4/ui/PrefSpellcheckerUi.ui index c56603c2c1..fd9d30b434 100644 --- a/src/frontends/qt4/ui/PrefSpellcheckerUi.ui +++ b/src/frontends/qt4/ui/PrefSpellcheckerUi.ui @@ -1,33 +1,33 @@ - + PrefSpellcheckerUi - - + + 0 0 - 319 + 340 198 - + - - + + 9 - + 6 - + - + Qt::Vertical - + QSizePolicy::Expanding - + 20 20 @@ -35,15 +35,15 @@ - + - + Qt::Horizontal - + QSizePolicy::Expanding - + 41 22 @@ -51,86 +51,73 @@ - - - + + + Br&owse... - - - + + + Al&ternative language: - + altLanguageED - - + + - - - + + + Specify a personal dictionary file other than the default - - - - - - + + + Personal &dictionary: - + persDictionaryED - - - + + + Escape cha&racters: - + escapeCharactersED - - - - Spellchec&ker executable: - - - spellCommandCO - - - - - - + + + Override the language used for the spellchecker - - - + + + Use input encod&ing - - - - Accept words such as "diskdrive" + + + + Accept words such as "diskdrive" - + Accept compound &words @@ -138,7 +125,6 @@ - spellCommandCO altLanguageED escapeCharactersED persDictionaryED @@ -147,7 +133,7 @@ inputEncodingCB - qt_i18n.h + qt_i18n.h