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
This commit is contained in:
André Pönitz 2008-11-16 12:22:54 +00:00
parent 0778007050
commit 8e366b1cab
7 changed files with 105 additions and 143 deletions

View File

@ -122,6 +122,7 @@ LexerKeyword lyxrcTags[] = {
{ "\\path_prefix", LyXRC::RC_PATH_PREFIX }, { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT }, { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
{ "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN }, { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
{ "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
{ "\\preview", LyXRC::RC_PREVIEW }, { "\\preview", LyXRC::RC_PREVIEW },
{ "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS }, { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
{ "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR }, { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
@ -173,7 +174,6 @@ LexerKeyword lyxrcTags[] = {
{ "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE }, { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
// compatibility with versions older than 1.4.0 only // compatibility with versions older than 1.4.0 only
{ "\\use_pspell", LyXRC::RC_USE_SPELL_LIB }, { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
{ "\\use_spell_lib", LyXRC::RC_USE_SPELL_LIB },
// compatibility with versions older than 1.4.0 only // compatibility with versions older than 1.4.0 only
{ "\\use_tempdir", LyXRC::RC_USETEMPDIR }, { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
{ "\\use_tooltip", LyXRC::RC_USE_TOOLTIP }, { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
@ -259,8 +259,6 @@ void LyXRC::setDefaults()
backupdir_path.erase(); backupdir_path.erase();
display_graphics = true; display_graphics = true;
// Spellchecker settings: // Spellchecker settings:
use_spell_lib = true;
spellchecker_command = "aspell";
spellchecker_accept_compound = false; spellchecker_accept_compound = false;
spellchecker_use_input_encoding = false; spellchecker_use_input_encoding = false;
spellchecker_use_alt_lang = false; spellchecker_use_alt_lang = false;
@ -370,7 +368,8 @@ int LyXRC::read(istream & is)
int LyXRC::read(Lexer & lexrc) int LyXRC::read(Lexer & lexrc)
{ {
if (!lexrc.isOK()) return -2; if (!lexrc.isOK())
return -2;
while (lexrc.isOK()) { while (lexrc.isOK()) {
// By using two switches we take advantage of the compiler // By using two switches we take advantage of the compiler
@ -383,11 +382,14 @@ int LyXRC::read(Lexer & lexrc)
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case Lexer::LEX_UNDEF: case Lexer::LEX_UNDEF:
// dro[ obsolete tag
if (lexrc.getString() != "\\plaintest_roff_command")
lexrc.printError("Unknown tag `$$Token'"); lexrc.printError("Unknown tag `$$Token'");
continue; continue;
case Lexer::LEX_FEOF: case Lexer::LEX_FEOF:
continue; continue;
default: break; default:
break;
} }
switch (static_cast<LyXRCTags>(le)) { switch (static_cast<LyXRCTags>(le)) {
case RC_INPUT: // Include file case RC_INPUT: // Include file
@ -402,21 +404,18 @@ int LyXRC::read(Lexer & lexrc)
} }
break; break;
case RC_BINDFILE: case RC_BINDFILE:
if (lexrc.next()) { if (lexrc.next())
bind_file = os::internal_path(lexrc.getString()); bind_file = os::internal_path(lexrc.getString());
}
break; break;
case RC_DEFFILE: case RC_DEFFILE:
if (lexrc.next()) { if (lexrc.next())
def_file = os::internal_path(lexrc.getString()); def_file = os::internal_path(lexrc.getString());
}
break; break;
case RC_UIFILE: case RC_UIFILE:
if (lexrc.next()) { if (lexrc.next())
ui_file = os::internal_path(lexrc.getString()); ui_file = os::internal_path(lexrc.getString());
}
break; break;
case RC_AUTORESET_OPTIONS: case RC_AUTORESET_OPTIONS:
@ -827,17 +826,13 @@ int LyXRC::read(Lexer & lexrc)
lexrc >> dialogs_iconify_with_main; lexrc >> dialogs_iconify_with_main;
break; break;
case RC_PLAINTEXT_ROFF_COMMAND:
(void) lexrc.getString(); // Obsoleted in 1.7
break;
case RC_PLAINTEXT_LINELEN: case RC_PLAINTEXT_LINELEN:
lexrc >> plaintext_linelen; lexrc >> plaintext_linelen;
break; break;
// Spellchecker settings: // 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: case RC_ACCEPT_COMPOUND:
lexrc >> spellchecker_accept_compound; lexrc >> spellchecker_accept_compound;
break; break;
@ -1081,6 +1076,15 @@ int LyXRC::read(Lexer & lexrc)
lexrc >> open_buffers_in_tabs; lexrc >> open_buffers_in_tabs;
break; 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: case RC_LAST:
break; // this is just a dummy 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) if (tag != RC_LAST)
break; break;
// Ignore it // Ignore it
case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 1.7
if (tag != RC_LAST)
break;
case RC_PLAINTEXT_LINELEN: case RC_PLAINTEXT_LINELEN:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
plaintext_linelen != system_lyxrc.plaintext_linelen) { 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" os << "\n#\n"
<< "# SPELLCHECKER SECTION ##############################\n" << "# SPELLCHECKER SECTION ##############################\n"
<< "#\n\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<string>(use_spell_lib) << '\n';
}
if (tag != RC_LAST)
break;
case RC_SPELL_COMMAND: case RC_SPELL_COMMAND:
if (ignore_system_lyxrc || // Obsoleted in 1.7
spellchecker_command != system_lyxrc.spellchecker_command) { case RC_USE_SPELL_LIB:
os << "\\spell_command \"" << escapeCommand(spellchecker_command) << "\"\n"; // Obsoleted in 1.7
}
if (tag != RC_LAST)
break;
case RC_ACCEPT_COMPOUND: case RC_ACCEPT_COMPOUND:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) { 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."); str = _("De-select if you don't want the startup banner.");
break; break;
case RC_SPELL_COMMAND:
str = _("What command runs the spellchecker?");
break;
case RC_TEMPDIRPATH: case RC_TEMPDIRPATH:
str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX."); str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
break; break;

View File

@ -39,6 +39,7 @@ public:
RC_ACCEPT_COMPOUND = 1, RC_ACCEPT_COMPOUND = 1,
RC_ALT_LANG, RC_ALT_LANG,
RC_PLAINTEXT_LINELEN, RC_PLAINTEXT_LINELEN,
RC_PLAINTEXT_ROFF_COMMAND,
RC_AUTOREGIONDELETE, RC_AUTOREGIONDELETE,
RC_AUTORESET_OPTIONS, RC_AUTORESET_OPTIONS,
RC_AUTOSAVE, RC_AUTOSAVE,
@ -303,10 +304,6 @@ public:
unsigned int autosave; unsigned int autosave;
/// ///
unsigned int plaintext_linelen; unsigned int plaintext_linelen;
/// use library instead of process
bool use_spell_lib;
/// spellchecker command
std::string spellchecker_command;
/// Accept compound words in spellchecker? /// Accept compound words in spellchecker?
bool spellchecker_accept_compound; bool spellchecker_accept_compound;
/// Pass input encoding switch to the spellchecker? /// Pass input encoding switch to the spellchecker?

View File

@ -181,7 +181,9 @@ vector<string> loadableImageFormats()
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Icon loading support code. //
// Icon loading support code
//
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
namespace { namespace {
@ -371,8 +373,11 @@ QIcon getIcon(FuncRequest const & f, bool unknown)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//
// LyX server support code. // LyX server support code.
//
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
class SocketNotifier : public QSocketNotifier class SocketNotifier : public QSocketNotifier
{ {
public: public:
@ -388,7 +393,9 @@ public:
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//
// Mac specific stuff goes here... // Mac specific stuff goes here...
//
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
class MenuTranslator : public QTranslator class MenuTranslator : public QTranslator
@ -485,8 +492,9 @@ public:
#endif #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<GuiApplication *>(theApp());
}
void GuiApplication::clearSession() void GuiApplication::clearSession()
{ {
QSettings settings; QSettings settings;
@ -1612,6 +1626,7 @@ frontend::Selection & theSelection()
return frontend::guiApp->selection(); return frontend::guiApp->selection();
} }
} // namespace lyx } // namespace lyx
#include "moc_GuiApplication.cpp" #include "moc_GuiApplication.cpp"

View File

@ -162,8 +162,7 @@ QString iconName(FuncRequest const & f, bool unknown);
/// \return an icon for the given action. /// \return an icon for the given action.
QIcon getIcon(FuncRequest const & f, bool unknown); QIcon getIcon(FuncRequest const & f, bool unknown);
static GuiApplication * theGuiApp() GuiApplication * theGuiApp();
{ return dynamic_cast<GuiApplication *>(theApp()); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -1035,7 +1035,6 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
setupUi(this); setupUi(this);
connect(persDictionaryPB, SIGNAL(clicked()), this, SLOT(select_dict())); connect(persDictionaryPB, SIGNAL(clicked()), this, SLOT(select_dict()));
spellCommandCO->setEnabled(false);
connect(altLanguageED, SIGNAL(textChanged(QString)), connect(altLanguageED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
@ -1047,26 +1046,11 @@ PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(inputEncodingCB, SIGNAL(clicked()), connect(inputEncodingCB, SIGNAL(clicked()),
this, SIGNAL(changed())); this, SIGNAL(changed()));
spellCommandCO->addItem(qt_("aspell"));
#ifdef USE_ASPELL
spellCommandCO->addItem(qt_("aspell (library)"));
#endif
} }
void PrefSpellchecker::apply(LyXRC & rc) const 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 // FIXME: remove spellchecker_use_alt_lang
rc.spellchecker_alt_lang = fromqstr(altLanguageED->text()); rc.spellchecker_alt_lang = fromqstr(altLanguageED->text());
rc.spellchecker_use_alt_lang = !rc.spellchecker_alt_lang.empty(); 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) 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 // FIXME: remove spellchecker_use_alt_lang
altLanguageED->setText(toqstr(rc.spellchecker_alt_lang)); altLanguageED->setText(toqstr(rc.spellchecker_alt_lang));
// FIXME: remove spellchecker_use_esc_chars // FIXME: remove spellchecker_use_esc_chars
@ -2572,7 +2545,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
void GuiPreferences::addModule(PrefModule * module) void GuiPreferences::addModule(PrefModule * module)
{ {
LASSERT(module, /**/); LASSERT(module, return);
if (module->category().isEmpty()) if (module->category().isEmpty())
prefsPS->addPanel(module, module->title()); prefsPS->addPanel(module, module->title());
else else
@ -2694,7 +2667,7 @@ QString GuiPreferences::browsekbmap(QString const & file) const
QString GuiPreferences::browsedict(QString const & file) const QString GuiPreferences::browsedict(QString const & file) const
{ {
return browseFile(file, qt_("Choose personal dictionary"), return browseFile(file, qt_("Choose personal dictionary"),
QStringList(lyxrc.use_spell_lib ? qt_("*.pws") : qt_("*.ispell"))); QStringList(qt_("*.pws")));
} }

View File

@ -199,7 +199,6 @@ static SpellBase * createSpeller(BufferParams const & bp)
: bp.language->code(); : bp.language->code();
#if defined(USE_ASPELL) #if defined(USE_ASPELL)
if (lyxrc.use_spell_lib)
return new ASpell(bp, lang); return new ASpell(bp, lang);
#endif #endif
return new SpellBase; return new SpellBase;

View File

@ -1,33 +1,33 @@
<ui version="4.0" > <ui version="4.0">
<class>PrefSpellcheckerUi</class> <class>PrefSpellcheckerUi</class>
<widget class="QWidget" name="PrefSpellcheckerUi" > <widget class="QWidget" name="PrefSpellcheckerUi">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>319</width> <width>340</width>
<height>198</height> <height>198</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string/> <string/>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<property name="margin" > <property name="margin">
<number>9</number> <number>9</number>
</property> </property>
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="6" column="0" colspan="3" > <item row="5" column="0" colspan="3">
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType">
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@ -35,15 +35,15 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="3" > <item row="2" column="3">
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType">
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>41</width> <width>41</width>
<height>22</height> <height>22</height>
@ -51,86 +51,73 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="2" > <item row="2" column="2">
<widget class="QPushButton" name="persDictionaryPB" > <widget class="QPushButton" name="persDictionaryPB">
<property name="text" > <property name="text">
<string>Br&amp;owse...</string> <string>Br&amp;owse...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="0" column="0">
<widget class="QLabel" name="altLanguageLA" > <widget class="QLabel" name="altLanguageLA">
<property name="text" > <property name="text">
<string>Al&amp;ternative language:</string> <string>Al&amp;ternative language:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>altLanguageED</cstring> <cstring>altLanguageED</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" > <item row="1" column="1">
<widget class="QLineEdit" name="escapeCharactersED" /> <widget class="QLineEdit" name="escapeCharactersED"/>
</item> </item>
<item row="3" column="1" > <item row="2" column="1">
<widget class="QLineEdit" name="persDictionaryED" > <widget class="QLineEdit" name="persDictionaryED">
<property name="toolTip" > <property name="toolTip">
<string>Specify a personal dictionary file other than the default</string> <string>Specify a personal dictionary file other than the default</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="2" column="0">
<widget class="QComboBox" name="spellCommandCO" /> <widget class="QLabel" name="persDictionaryLA">
</item> <property name="text">
<item row="3" column="0" >
<widget class="QLabel" name="persDictionaryLA" >
<property name="text" >
<string>Personal &amp;dictionary:</string> <string>Personal &amp;dictionary:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>persDictionaryED</cstring> <cstring>persDictionaryED</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="1" column="0">
<widget class="QLabel" name="escapeCharactersLA" > <widget class="QLabel" name="escapeCharactersLA">
<property name="text" > <property name="text">
<string>Escape cha&amp;racters:</string> <string>Escape cha&amp;racters:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>escapeCharactersED</cstring> <cstring>escapeCharactersED</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" > <item row="0" column="1">
<widget class="QLabel" name="spellCommandLA" > <widget class="QLineEdit" name="altLanguageED">
<property name="text" > <property name="toolTip">
<string>Spellchec&amp;ker executable:</string>
</property>
<property name="buddy" >
<cstring>spellCommandCO</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="altLanguageED" >
<property name="toolTip" >
<string>Override the language used for the spellchecker</string> <string>Override the language used for the spellchecker</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="3" > <item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="inputEncodingCB" > <widget class="QCheckBox" name="inputEncodingCB">
<property name="text" > <property name="text">
<string>Use input encod&amp;ing</string> <string>Use input encod&amp;ing</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="3" > <item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="compoundWordCB" > <widget class="QCheckBox" name="compoundWordCB">
<property name="toolTip" > <property name="toolTip">
<string>Accept words such as "diskdrive"</string> <string>Accept words such as &quot;diskdrive&quot;</string>
</property> </property>
<property name="text" > <property name="text">
<string>Accept compound &amp;words</string> <string>Accept compound &amp;words</string>
</property> </property>
</widget> </widget>
@ -138,7 +125,6 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>spellCommandCO</tabstop>
<tabstop>altLanguageED</tabstop> <tabstop>altLanguageED</tabstop>
<tabstop>escapeCharactersED</tabstop> <tabstop>escapeCharactersED</tabstop>
<tabstop>persDictionaryED</tabstop> <tabstop>persDictionaryED</tabstop>
@ -147,7 +133,7 @@
<tabstop>inputEncodingCB</tabstop> <tabstop>inputEncodingCB</tabstop>
</tabstops> </tabstops>
<includes> <includes>
<include location="local" >qt_i18n.h</include> <include location="local">qt_i18n.h</include>
</includes> </includes>
<resources/> <resources/>
<connections/> <connections/>