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 },
{ "\\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<LyXRCTags>(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<string>(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;

View File

@ -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?

View File

@ -181,7 +181,9 @@ vector<string> 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<GuiApplication *>(theApp());
}
void GuiApplication::clearSession()
{
QSettings settings;
@ -1612,6 +1626,7 @@ frontend::Selection & theSelection()
return frontend::guiApp->selection();
}
} // namespace lyx
#include "moc_GuiApplication.cpp"

View File

@ -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<GuiApplication *>(theApp()); }
GuiApplication * theGuiApp();
} // namespace frontend
} // namespace lyx

View File

@ -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);
}

View File

@ -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;
}

View File

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