#include "Lexer.h"
#include "OutputParams.h"
#include "TextClass.h"
+#include "TocBackend.h"
#include "support/debug.h"
#include "support/gettext.h"
if (!params_.branch.empty()) {
// FIXME UNICODE
ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
- if (c == Color_none) {
+ if (c == Color_none)
s = _("Undef: ") + s;
- }
}
if (decoration() == InsetLayout::Classic)
setLabel(isOpen() ? s : getNewLabel(s) );
ColorCode InsetBranch::backgroundColor() const
{
- if (!params_.branch.empty()) {
- // FIXME UNICODE
- ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
- if (c == Color_none) {
- c = Color_error;
- }
- return c;
- } else
+ if (params_.branch.empty())
return Inset::backgroundColor();
+ // FIXME UNICODE
+ ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
+ if (c == Color_none)
+ c = Color_error;
+ return c;
}
switch (cmd.action) {
case LFUN_INSET_MODIFY:
case LFUN_INSET_DIALOG_UPDATE:
- flag.enabled(true);
+ flag.setEnabled(true);
break;
case LFUN_INSET_TOGGLE:
if (cmd.argument() == "open" || cmd.argument() == "close" ||
cmd.argument() == "toggle")
- flag.enabled(true);
+ flag.setEnabled(true);
else if (cmd.argument() == "assign" || cmd.argument().empty()) {
if (isBranchSelected())
- flag.enabled(status() != Open);
+ flag.setEnabled(status() != Open);
else
- flag.enabled(status() != Collapsed);
+ flag.setEnabled(status() != Collapsed);
} else
- flag.enabled(true);
+ flag.setEnabled(true);
break;
default:
}
+void InsetBranch::addToToc(DocIterator const & cpit)
+{
+ DocIterator pit = cpit;
+ pit.push_back(CursorSlice(*this));
+
+ Toc & toc = buffer().tocBackend().toc("branch");
+ docstring const str = params_.branch + ": " + text_.getPar(0).asString();
+ toc.push_back(TocItem(pit, 0, str));
+}
+
+
void InsetBranchParams::write(ostream & os) const
{
os << "Branch " << to_utf8(branch) << '\n';