AuthorList authorlist;
BranchList branchlist;
+ IgnoreList spellignore;
Bullet temp_bullets[4];
Bullet user_defined_bullets[4];
IndicesList indiceslist;
isfontcolor = false;
// light gray is the default font color for greyed-out notes
notefontcolor = lyx::rgbFromHexName("#cccccc");
+ isnotefontcolor = false;
boxbgcolor = lyx::rgbFromHexName("#ff0000");
+ isboxbgcolor = false;
compressed = lyxrc.save_compressed;
for (int iter = 0; iter < 4; ++iter) {
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
}
+typedef std::vector<WordLangTuple> IgnoreList;
+
+
+IgnoreList & BufferParams::spellignore()
+{
+ return pimpl_->spellignore;
+}
+
+
+IgnoreList const & BufferParams::spellignore() const
+{
+ return pimpl_->spellignore;
+}
+
+
+bool BufferParams::spellignored(WordLangTuple const & wl) const
+{
+ bool has_item = false;
+ vector<WordLangTuple> il = spellignore();
+ vector<WordLangTuple>::const_iterator it = il.begin();
+ for (; it != il.end(); ++it) {
+ if (it->lang()->code() != wl.lang()->code())
+ continue;
+ if (it->word() == wl.word()) {
+ has_item = true;
+ break;
+ }
+ }
+ return has_item;
+}
+
+
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
{
LASSERT(index < 4, return pimpl_->temp_bullets[0]);
string BufferParams::readToken(Lexer & lex, string const & token,
- FileName const & filepath)
+ FileName const & filename)
{
string result;
+ FileName const & filepath = filename.onlyPath();
if (token == "\\textclass") {
lex.next();
}
if (tok == "\\color") {
lex.eatLine();
- string color = lex.getString();
+ vector<string> const colors = getVectorFromString(lex.getString(), " ");
+ string const lmcolor = colors.front();
+ string dmcolor;
+ if (colors.size() > 1)
+ dmcolor = colors.back();
if (branch_ptr)
- branch_ptr->setColor(color);
- // Update also the Color table:
- if (color == "none")
- color = lcolor.getX11HexName(Color_background);
- // FIXME UNICODE
- lcolor.setColor(to_utf8(branch), color);
+ branch_ptr->setColors(lmcolor, dmcolor);
}
}
} else if (token == "\\index") {
color = lcolor.getX11HexName(Color_background);
// FIXME UNICODE
if (!shortcut.empty())
- lcolor.setColor(to_utf8(shortcut), color);
+ lcolor.setColor(to_utf8(shortcut)+ "@" + filename.absFileName(), color);
}
}
+ } else if (token == "\\spellchecker_ignore") {
+ lex.eatLine();
+ docstring wl = lex.getDocString();
+ docstring language;
+ docstring word = split(wl, language, ' ');
+ Language const * lang = languages.getLanguage(to_ascii(language));
+ if (lang)
+ spellignore().push_back(WordLangTuple(word, lang));
} else if (token == "\\author") {
lex.eatLine();
istringstream ss(lex.getString());
string color = lex.getString();
notefontcolor = lyx::rgbFromHexName(color);
lcolor.setColor("notefontcolor", color);
+ lcolor.setLaTeXName("notefontcolor", "note_fontcolor");
+ lcolor.setGUIName("notefontcolor", N_("greyedout inset text"));
+ // set a local name for the painter
+ lcolor.setColor("notefontcolor@" + filename.absFileName(), color);
+ isnotefontcolor = true;
} else if (token == "\\boxbgcolor") {
lex.eatLine();
string color = lex.getString();
boxbgcolor = lyx::rgbFromHexName(color);
- lcolor.setColor("boxbgcolor", color);
+ lcolor.setColor("boxbgcolor@" + filename.absFileName(), color);
+ isboxbgcolor = true;
} else if (token == "\\paperwidth") {
lex >> paperwidth;
} else if (token == "\\paperheight") {
os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
if (isfontcolor)
os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
- if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
+ if (isnotefontcolor)
os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
- if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
+ if (isboxbgcolor)
os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
for (auto const & br : branchlist()) {
os << "\\branch " << to_utf8(br.branch())
<< "\n\\selected " << br.isSelected()
<< "\n\\filename_suffix " << br.hasFileNameSuffix()
- << "\n\\color " << lyx::X11hexname(br.color())
+ << "\n\\color " << br.lightModeColor() << " " << br.darkModeColor()
<< "\n\\end_branch"
<< "\n";
}
<< "\n";
}
+ for (auto const & si : spellignore()) {
+ os << "\\spellchecker_ignore " << si.lang()->lang()
+ << " " << to_utf8(si.word())
+ << "\n";
+ }
+
if (!paperwidth.empty())
os << "\\paperwidth "
<< VSpace(paperwidth).asLyXCommand() << '\n';
// use \PassOptionsToPackage here because the user could have
// already loaded subfig in the preamble.
if (features.mustProvide("subfig"))
- atlyxpreamble << "\\@ifundefined{showcaptionsetup}{}{%\n"
- " \\PassOptionsToPackage{caption=false}{subfig}}\n"
+ atlyxpreamble << "\\ifdefined\\showcaptionsetup\n"
+ " % Caption package is used. Advise subfig not to load it again.\n"
+ " \\PassOptionsToPackage{caption=false}{subfig}\n"
+ "\\fi\n"
"\\usepackage{subfig}\n";
// Itemize bullet settings need to be last in case the user
}
-void BufferParams::makeDocumentClass(bool const clone)
+void BufferParams::makeDocumentClass(bool clone, bool internal)
{
if (!baseClass())
return;
for (auto const & mod : layout_modules_)
mods.push_back(mod);
- doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone);
+ doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone, internal);
TextClass::ReturnValues success = TextClass::OK;
if (!forced_local_layout_.empty())