namespace {
-static unsigned int const LYXRC_FILEFORMAT = 6; // younes: add use_qimage option
+static unsigned int const LYXRC_FILEFORMAT = 7; // gb: add mime types
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
{ "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
{ "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
{ "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
+ { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
{ "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
{ "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
{ "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
#endif
spellchecker_accept_compound = false;
spellcheck_continuously = false;
+ completion_minlength = 6;
spellcheck_notes = true;
use_kbmap = false;
rtl_support = true;
lexrc >> completion_popup_after_complete;
break;
+ case RC_COMPLETION_MINLENGTH:
+ lexrc >> completion_minlength;
+ break;
+
case RC_NUMLASTFILES:
lexrc >> num_lastfiles;
break;
break;
}
case RC_FILEFORMAT: {
+ bool ok = true;
string format, extensions, prettyname, shortcut;
- lexrc >> format >> extensions >> prettyname >> shortcut;
+ if (!(lexrc >> format >> extensions))
+ ok = false;
+ if (ok && lexrc.next(true))
+ prettyname = lexrc.getString();
+ else
+ ok = false;
+ if (ok)
+ if(!(lexrc >> shortcut))
+ ok = false;
string viewer, editor;
- if (lexrc.next(true))
+ if (ok && lexrc.next(true))
viewer = lexrc.getString();
- if (lexrc.next(true))
+ else
+ ok = false;
+ if (ok && lexrc.next(true))
editor = lexrc.getString();
- string flags;
- // Hack to ensure compatibility with versions older
- // than 1.5.0
- int le = lexrc.lex();
- if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
- flags = lexrc.getString();
- if (le != Lexer::LEX_DATA) {
- // We have got a known token.
- // Therefore this is an old style
- // format definition without
- // flags.
- lexrc.pushToken(flags);
- flags.erase();
- }
- }
+ else
+ ok = false;
+ string flags, mime;
+ if (!(lexrc >> flags >> mime))
+ ok = false;
int flgs = Format::none;
while (!flags.empty()) {
string flag;
<< flag << "' for format `"
<< format << "'.");
}
- if (prettyname.empty()) {
+ if (!ok)
+ LYXERR0("Syntax error in format " << format);
+ else if (prettyname.empty()) {
if (theConverters().formatIsUsed(format))
LYXERR0("Can't delete format " << format);
else
formats.erase(format);
} else {
formats.add(format, extensions, prettyname,
- shortcut, viewer, editor, flgs);
+ shortcut, viewer, editor, mime, flgs);
}
break;
}
}
if (tag != RC_LAST)
break;
- case RC_NUMLASTFILES:
+ case RC_COMPLETION_MINLENGTH:
+ if (ignore_system_lyxrc ||
+ completion_minlength != system_lyxrc.completion_minlength) {
+ os << "\\completion_minlength " << convert<string>(completion_minlength)
+ << '\n';
+ }
+ if (tag != RC_LAST)
+ break;
+
+ case RC_NUMLASTFILES:
if (ignore_system_lyxrc ||
num_lastfiles != system_lyxrc.num_lastfiles) {
os << "\\num_lastfiles " << num_lastfiles << '\n';
format->editor() != cit->editor() ||
format->documentFormat() != cit->documentFormat() ||
format->vectorFormat() != cit->vectorFormat() ||
- format->inExportMenu() != cit->inExportMenu()) {
+ format->inExportMenu() != cit->inExportMenu() ||
+ format->mime() != cit->mime()) {
os << "\\format \"" << cit->name() << "\" \""
<< cit->extensions() << "\" \""
<< cit->prettyname() << "\" \""
flags.push_back("menu=export");
os << getStringFromVector(flags);
- os << "\"\n";
+ os << "\" \"" << cit->mime() << "\"\n";
}
}
cit != system_formats.end(); ++cit)
if (!formats.getFormat(cit->name()))
os << "\\format \"" << cit->name()
- << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
+ << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
if (tag != RC_LAST)
break;
case RC_VIEWER_ALTERNATIVES: {
case LyXRC::RC_COMPLETION_POPUP_DELAY:
case LyXRC::RC_COMPLETION_POPUP_MATH:
case LyXRC::RC_COMPLETION_POPUP_TEXT:
+ case LyXRC::RC_COMPLETION_MINLENGTH:
case LyXRC::RC_USELASTFILEPOS:
case LyXRC::RC_LOADSESSION:
case LyXRC::RC_CHKTEX_COMMAND: