docstring const InsetBranch::buttonLabel(BufferView const & bv) const
{
+ static char_type const tick = 0x2714; // ✔ U+2714 HEAVY CHECK MARK
+ static char_type const cross = 0x2716; // ✖ U+2716 HEAVY MULTIPLICATION X
docstring s = _("Branch: ") + params_.branch;
Buffer const & realbuffer = *buffer().masterBuffer();
BranchList const & branchlist = realbuffer.params().branchlist();
}
bool const master_selected = isBranchSelected();
bool const child_selected = isBranchSelected(true);
- docstring symb = docstring(1, char_type(master_selected ? 0x2714 : 0x2716));
+ docstring symb = docstring(1, master_selected ? tick : cross);
if (inchild && master_selected != child_selected)
- symb += char_type(child_selected ? 0x2714 : 0x2716);
- s = symb + s;
+ symb += child_selected ? tick : cross;
if (decoration() == InsetLayout::CLASSIC)
- return isOpen(bv) ? s : getNewLabel(s);
+ return symb + (isOpen(bv) ? s : getNewLabel(s));
else
- return params_.branch + ": " + getNewLabel(s);
+ return symb + params_.branch + ": " + getNewLabel(s);
}
InsetBranchParams params;
InsetBranch::string2params(to_utf8(cmd.argument()), params);
- cur.recordUndoInset(ATOMIC_UNDO, this);
+ cur.recordUndoInset(this);
params_.branch = params.branch;
// what we really want here is a TOC update, but that means
// a full buffer update
// An option would be to check if the master is hidden.
// If it is, unhide.
if (!master)
- buffer().undo().recordUndoFullDocument(cur);
+ buffer().undo().recordUndoBufferParams(cur);
else
// at least issue a warning for now (ugly, but better than dataloss).
frontend::Alert::warning(_("Branch state changes in master document"),
}
-int InsetBranch::plaintext(odocstream & os,
- OutputParams const & runparams) const
+int InsetBranch::plaintext(odocstringstream & os,
+ OutputParams const & runparams, size_t max_length) const
{
if (!isBranchSelected())
return 0;
- int len = InsetText::plaintext(os, runparams);
+ int len = InsetText::plaintext(os, runparams, max_length);
return len;
}
}
-void InsetBranch::forToc(docstring & os, size_t maxlen) const
+void InsetBranch::forOutliner(docstring & os, size_t const maxlen,
+ bool const shorten) const
{
if (isBranchSelected())
- InsetCollapsable::forToc(os, maxlen);
+ InsetCollapsable::forOutliner(os, maxlen, shorten);
}
}
-void InsetBranch::addToToc(DocIterator const & cpit) const
+void InsetBranch::addToToc(DocIterator const & cpit, bool output_active,
+ UpdateType utype) const
{
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetBranch &>(*this)));
-
- Toc & toc = buffer().tocBackend().toc("branch");
- docstring str = params_.branch + ": ";
- text().forToc(str, TOC_ENTRY_LENGTH);
- toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+
+ docstring tooltip;
+ text().forOutliner(tooltip, TOC_ENTRY_LENGTH);
+ docstring str = params_.branch + ": " + tooltip;
+ tooltip = support::wrapParas(tooltip, 0, 60, 2);
+
+ shared_ptr<Toc> toc = buffer().tocBackend().toc("branch");
+ toc->push_back(TocItem(pit, 0, str, output_active, tooltip));
+
// Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit);
+ bool const doing_output = output_active && isBranchSelected();
+ InsetCollapsable::addToToc(cpit, doing_output, utype);
}