]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBranch.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetBranch.cpp
index 61f3353774e3e9f84914d66a78b2b497a0661c0b..82b5ad8dacda178e587f9849b725e6db63388af7 100644 (file)
@@ -48,6 +48,7 @@ InsetBranch::InsetBranch(Buffer * buf, InsetBranchParams const & params)
 
 void InsetBranch::write(ostream & os) const
 {
+       os << "Branch ";
        params_.write(os);
        os << '\n';
        InsetCollapsable::write(os);
@@ -113,11 +114,14 @@ ColorCode InsetBranch::backgroundColor(PainterInfo const & pi) const
 
 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_BRANCH_ACTIVATE:
@@ -132,7 +136,7 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
                        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:
@@ -152,7 +156,7 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
 bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
        case LFUN_INSET_MODIFY:
                flag.setEnabled(true);
                break;
@@ -260,7 +264,6 @@ string InsetBranch::params2string(InsetBranchParams const & params)
 {
        ostringstream data;
        params.write(data);
-       data << '\n';
        return data.str();
 }
 
@@ -275,7 +278,6 @@ void InsetBranch::string2params(string const & in, InsetBranchParams & params)
        Lexer lex;
        lex.setStream(data);
        lex.setContext("InsetBranch::string2params");
-       lex >> "Branch";
        params.read(lex);
 }
 
@@ -287,7 +289,7 @@ void InsetBranch::addToToc(DocIterator const & cpit)
 
        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);
 }
@@ -295,14 +297,13 @@ void InsetBranch::addToToc(DocIterator const & cpit)
 
 void InsetBranchParams::write(ostream & os) const
 {
-       os << "Branch " << to_utf8(branch);
+       os << to_utf8(branch);
 }
 
 
 void InsetBranchParams::read(Lexer & lex)
 {
-       lex.eatLine();
-       branch = lex.getDocString();
+       lex >> branch;
 }
 
 } // namespace lyx