#include "lyxlex.h"
#include "paragraph.h"
-#include "support/std_sstream.h"
+#include <sstream>
using std::string;
using std::auto_ptr;
font.decSize();
font.decSize();
- setLabel("Branch: " + params_.branch);
+ string s = "Branch: " + params_.branch;
+ setLabel(isOpen() ? s : getNewLabel(s) );
font.setColor(LColor::foreground);
if (!params_.branch.empty())
setBackgroundColor(lcolor.getFromLyXName(params_.branch));
InsetCollapsable::priv_dispatch(cur, cmd);
break;
+
+ case LFUN_INSET_TOGGLE:
+ // We assume that this lfun is indeed going to be dispatched.
+ cur.dispatched();
+
+ if (cmd.argument == "open")
+ setStatus(Open);
+ else if (cmd.argument == "close") {
+ setStatus(Collapsed);
+ leaveInset(cur, *this);
+ } else if (cmd.argument == "toggle") {
+ if (isOpen()) {
+ setStatus(Collapsed);
+ leaveInset(cur, *this);
+ } else
+ setStatus(Open);
+
+ // The branch inset uses "assign".
+ } else if (cmd.argument == "assign"
+ || cmd.argument.empty()) {
+ BranchList const & branchlist =
+ cur.buffer().params().branchlist();
+ if (isBranchSelected(branchlist)) {
+ if (status() != Open)
+ setStatus(Open);
+ else
+ cur.undispatched();
+ } else {
+ if (status() != Collapsed) {
+ setStatus(Collapsed);
+ leaveInset(cur, *this);
+ } else
+ cur.undispatched();
+ }
+ }
+ break;
+
default:
InsetCollapsable::priv_dispatch(cur, cmd);
break;
OutputParams const & runparams) const
{
return isBranchSelected(buf.params().branchlist()) ?
- inset.latex(buf, os, runparams) : 0;
+ InsetText::latex(buf, os, runparams) : 0;
}
OutputParams const & runparams) const
{
return isBranchSelected(buf.params().branchlist()) ?
- inset.linuxdoc(buf, os, runparams) : 0;
+ InsetText::linuxdoc(buf, os, runparams) : 0;
}
OutputParams const & runparams) const
{
return isBranchSelected(buf.params().branchlist()) ?
- inset.docbook(buf, os, runparams) : 0;
+ InsetText::docbook(buf, os, runparams) : 0;
}
OutputParams const & runparams) const
{
return isBranchSelected(buf.params().branchlist()) ?
- inset.plaintext(buf, os, runparams): 0;
+ InsetText::plaintext(buf, os, runparams): 0;
}
void InsetBranch::validate(LaTeXFeatures & features) const
{
- inset.validate(features);
+ InsetText::validate(features);
}
-string const InsetBranchMailer:: name_("branch");
+string const InsetBranchMailer::name_("branch");
InsetBranchMailer::InsetBranchMailer(InsetBranch & inset)
: inset_(inset)