#include "FuncStatus.h"
#include "Lexer.h"
#include "OutputParams.h"
+#include "output_xhtml.h"
#include "TextClass.h"
#include "TocBackend.h"
{}
-InsetBranch::~InsetBranch()
-{
- hideDialogs("branch", this);
-}
-
-
void InsetBranch::write(ostream & os) const
{
+ os << "Branch ";
params_.write(os);
+ os << '\n';
InsetCollapsable::write(os);
}
}
-ColorCode InsetBranch::backgroundColor() const
+ColorCode InsetBranch::backgroundColor(PainterInfo const & pi) const
{
if (params_.branch.empty())
- return Inset::backgroundColor();
+ return Inset::backgroundColor(pi);
// FIXME UNICODE
ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
if (c == Color_none)
}
-bool InsetBranch::showInsetDialog(BufferView * bv) const
-{
- bv->showDialog("branch", params2string(params()),
- const_cast<InsetBranch *>(this));
- return true;
-}
-
-
void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY: {
InsetBranchParams params;
InsetBranch::string2params(to_utf8(cmd.argument()), params);
params_.branch = params.branch;
+ // what we really want here is a TOC update, but that means
+ // a full buffer update
+ cur.forceBufferUpdate();
break;
}
-
- case LFUN_INSET_DIALOG_UPDATE:
- cur.bv().updateDialog("branch", params2string(params()));
- break;
-
case LFUN_BRANCH_ACTIVATE:
case LFUN_BRANCH_DEACTIVATE: {
// FIXME: I do not like this cast, but have no other idea...
if (!our_branch)
break;
}
- our_branch->setSelected(cmd.action == LFUN_BRANCH_ACTIVATE);
+ our_branch->setSelected(cmd.action() == LFUN_BRANCH_ACTIVATE);
break;
}
-
case LFUN_INSET_TOGGLE:
if (cmd.argument() == "assign")
setStatus(cur, isBranchSelected() ? Open : Collapsed);
bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
- switch (cmd.action) {
+ switch (cmd.action()) {
case LFUN_INSET_MODIFY:
- case LFUN_INSET_DIALOG_UPDATE:
flag.setEnabled(true);
break;
}
-docstring InsetBranch::xhtml(odocstream & os, OutputParams const & rp) const
+docstring InsetBranch::xhtml(XHTMLStream & xs, OutputParams const & rp) const
{
if (isBranchSelected())
- return InsetText::xhtml(os, rp);
+ return InsetText::xhtml(xs, rp);
return docstring();
}
string InsetBranch::params2string(InsetBranchParams const & params)
{
ostringstream data;
- data << "branch" << ' ';
params.write(data);
return data.str();
}
Lexer lex;
lex.setStream(data);
lex.setContext("InsetBranch::string2params");
- lex >> "branch" >> "Branch";
params.read(lex);
}
Toc & toc = buffer().tocBackend().toc("branch");
docstring const str = params_.branch + ": " + text().getPar(0).asString();
- toc.push_back(TocItem(pit, 0, str));
+ toc.push_back(TocItem(pit, 0, str, toolTipText()));
// Proceed with the rest of the inset.
InsetCollapsable::addToToc(cpit);
}
void InsetBranchParams::write(ostream & os) const
{
- os << "Branch " << to_utf8(branch) << '\n';
+ os << to_utf8(branch);
}
void InsetBranchParams::read(Lexer & lex)
{
- lex.eatLine();
- branch = lex.getDocString();
+ lex >> branch;
}
} // namespace lyx