#include "FuncStatus.h"
#include "Lexer.h"
#include "LyX.h"
-#include "OutputParams.h"
+#include "output_docbook.h"
#include "output_xhtml.h"
#include "TextClass.h"
#include "TocBackend.h"
+#include "support/convert.h"
#include "support/debug.h"
#include "support/gettext.h"
#include "support/lstrings.h"
if (inchild && master_selected != child_selected)
symb += (child_selected ? tick : cross);
- if (decoration() == InsetLayout::MINIMALISTIC)
- return symb + params_.branch;
+ docstring inv_symb = from_ascii(params_.inverted ? "~" : "");
+
+ if (decoration() == InsetDecoration::MINIMALISTIC)
+ return symb + inv_symb + params_.branch;
docstring s;
if (inmaster && inchild)
s = _("Branch (master): ");
else // !inmaster && !inchild
s = _("Branch (undefined): ");
- s += params_.branch;
+ s += inv_symb + params_.branch;
return symb + s;
}
{
if (params_.branch.empty())
return Inset::backgroundColor(pi);
+ string const branch_id = (buffer().masterParams().branchlist().find(params_.branch))
+ ? convert<string>(buffer().masterParams().branchlist().id())
+ : convert<string>(buffer().params().branchlist().id());
// FIXME UNICODE
- ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
+ string const branchcol = "branch" + branch_id + to_utf8(params_.branch);
+ ColorCode c = lcolor.getFromLyXName(branchcol);
if (c == Color_none)
c = Color_error;
return c;
// cur.forceBufferUpdate() is not enough
buf->updateBuffer();
}
+
+ // if branch exists in a descendant, update previews.
+ // TODO: only needed if "Show preview" is enabled in the included inset.
+ bool exists_in_desc = false;
+ for (auto const & it : buf->getDescendants()) {
+ if (it->params().branchlist().find(params_.branch))
+ exists_in_desc = true;
+ }
+ if (exists_in_desc) {
+ // TODO: ideally we would only update the previews of the
+ // specific children that have this branch directly or
+ // in one of their descendants
+ buf->removePreviews();
+ buf->updatePreviews();
+ }
break;
}
case LFUN_BRANCH_INVERT:
void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
{
- if (producesOutput()) {
+ if (producesOutput() || ((runparams.for_searchAdv & OutputParams::SearchNonOutput) != 0)) {
OutputParams rp = runparams;
rp.inbranch = true;
InsetText::latex(os, rp);
+ // These need to be passed upstream
+ runparams.need_maketitle = rp.need_maketitle;
+ runparams.have_maketitle = rp.have_maketitle;
}
}
int InsetBranch::plaintext(odocstringstream & os,
OutputParams const & runparams, size_t max_length) const
{
- if (!producesOutput())
+ if (!producesOutput() && ((runparams.for_searchAdv & OutputParams::SearchNonOutput) == 0))
return 0;
int len = InsetText::plaintext(os, runparams, max_length);
}
-int InsetBranch::docbook(odocstream & os,
- OutputParams const & runparams) const
+void InsetBranch::docbook(XMLStream & xs, OutputParams const & runparams) const
{
- return producesOutput() ? InsetText::docbook(os, runparams) : 0;
+ if (producesOutput()) {
+ OutputParams rp = runparams;
+ rp.par_begin = 0;
+ rp.par_end = text().paragraphs().size();
+ docbookParagraphs(text(), buffer(), xs, rp);
+ }
}
-docstring InsetBranch::xhtml(XHTMLStream & xs, OutputParams const & rp) const
+docstring InsetBranch::xhtml(XMLStream & xs, OutputParams const & rp) const
{
if (producesOutput()) {
OutputParams newrp = rp;
}
-void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype)
+void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted)
{
setLabel(params_.branch + (params_.inverted ? " (-)" : ""));
- InsetCollapsible::updateBuffer(it, utype);
+ InsetCollapsible::updateBuffer(it, utype, deleted);
}