]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetBranch.cpp
Completion: handle undo in insets' insertCompletion methods
[features.git] / src / insets / InsetBranch.cpp
index 2b60ca6f44a4004678ecdebd76a3b2cce91c51db..c25f16a0c4c66d3f49d16a09021ced9bf12f8f3b 100644 (file)
@@ -112,7 +112,7 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
        if (inchild && master_selected != child_selected)
                symb += (child_selected ? tick : cross);
 
-    docstring inv_symb = from_ascii(params_.inverted ? "~" : "");
+       docstring inv_symb = from_ascii(params_.inverted ? "~" : "");
 
        if (decoration() == InsetDecoration::MINIMALISTIC)
                return symb + inv_symb + params_.branch;
@@ -224,9 +224,12 @@ void InsetBranch::doDispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_BRANCH_ADD:
                lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, params_.branch));
                break;
+       case LFUN_BRANCH_SYNC_ALL:
+               lyx::dispatch(FuncRequest(LFUN_INSET_FORALL, "Branch:" + params_.branch + " inset-toggle assign"));
+               break;
        case LFUN_INSET_TOGGLE:
                if (cmd.argument() == "assign")
-                       setStatus(cur, isBranchSelected() ? Open : Collapsed);
+                       setStatus(cur, (isBranchSelected(true) != params_.inverted) ? Open : Collapsed);
                else
                        InsetCollapsible::doDispatch(cur, cmd);
                break;
@@ -276,6 +279,10 @@ bool InsetBranch::getStatus(Cursor & cur, FuncRequest const & cmd,
                flag.setEnabled(buffer().parent() && isBranchSelected());
                break;
 
+       case LFUN_BRANCH_SYNC_ALL:
+               flag.setEnabled(known_branch);
+               break;
+
        case LFUN_INSET_TOGGLE:
                if (cmd.argument() == "assign")
                        flag.setEnabled(true);
@@ -314,7 +321,7 @@ bool InsetBranch::producesOutput() const
 
 void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 {
-       if (producesOutput() || ((runparams.for_searchAdv & OutputParams::SearchNonOutput) != 0)) {
+       if (producesOutput() || runparams.find_with_non_output()) {
                OutputParams rp = runparams;
                rp.inbranch = true;
                InsetText::latex(os, rp);
@@ -328,7 +335,7 @@ void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 int InsetBranch::plaintext(odocstringstream & os,
                           OutputParams const & runparams, size_t max_length) const
 {
-       if (!producesOutput() && ((runparams.for_searchAdv & OutputParams::SearchNonOutput) == 0))
+       if (!producesOutput() && !runparams.find_with_non_output())
                return 0;
 
        int len = InsetText::plaintext(os, runparams, max_length);