#include "WordLangTuple.h"
#include "insets/InsetBibtex.h"
+#include "insets/InsetCitation.h"
#include "insets/InsetCommand.h" // ChangeRefs
#include "insets/InsetExternal.h"
#include "insets/InsetGraphics.h"
return 0;
}
+
/// Note that comparing contents can only be used for InsetCommand
bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
docstring const & contents)
// handle their dispatch here, for reasons explained there, so we'll
// handle this here, too, for consistency.
case LFUN_BRANCH_ACTIVATE:
- case LFUN_BRANCH_DEACTIVATE: {
- BranchList const & branchList = buffer().params().branchlist();
+ case LFUN_BRANCH_DEACTIVATE:
+ case LFUN_BRANCH_MASTER_ACTIVATE:
+ case LFUN_BRANCH_MASTER_DEACTIVATE: {
+ bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
+ BranchList const & branchList = master ? buffer().masterBuffer()->params().branchlist()
+ : buffer().params().branchlist();
docstring const branchName = cmd.argument();
flag.setEnabled(!branchName.empty() && branchList.find(branchName));
break;
case LFUN_LAYOUT_MODULE_ADD: {
BufferParams const & params = buffer_.params();
- if (!params.moduleCanBeAdded(argument)) {
+ if (!params.layoutModuleCanBeAdded(argument)) {
LYXERR0("Module `" << argument <<
"' cannot be added due to failed requirements or "
"conflicts with installed modules.");
cur.forwardInset();
cur.beginUndoGroup();
while(cur && iterations < max_iter) {
- Inset * ins = cur.nextInset();
+ Inset * const ins = cur.nextInset();
if (!ins)
break;
docstring insname = ins->layoutName();
break;
insname = insname.substr(0, i);
}
- cur.forwardInset();
+ // if we did not delete the inset, skip it
+ if (!cur.nextInset() || cur.nextInset() == ins)
+ cur.forwardInset();
}
cur.endUndoGroup();
cur = savecur;
arg = token(argument, '|', 0);
opt1 = token(argument, '|', 1);
}
+
+ // if our cursor is direclty in front of or behind a citation inset,
+ // we will instead add the new key to it.
+ Inset * inset = cur.nextInset();
+ if (!inset || inset->lyxCode() != CITE_CODE)
+ inset = cur.prevInset();
+ if (inset && inset->lyxCode() == CITE_CODE) {
+ InsetCitation * icite = static_cast<InsetCitation *>(inset);
+ if (icite->addKey(arg)) {
+ dr.forceBufferUpdate();
+ dr.screenUpdate(Update::FitCursor | Update::SinglePar);
+ if (!opt1.empty())
+ LYXERR0("Discarding optional argument to citation-insert.");
+ }
+ dispatched = true;
+ break;
+ }
InsetCommandParams icp(CITE_CODE);
icp["key"] = from_utf8(arg);
if (!opt1.empty())
// So, if this does get fixed, this code can be moved back to Buffer.cpp,
// and the corresponding code in getStatus() should be moved back, too.
case LFUN_BRANCH_ACTIVATE:
- case LFUN_BRANCH_DEACTIVATE: {
- BranchList & branch_list = buffer().params().branchlist();
+ case LFUN_BRANCH_DEACTIVATE:
+ case LFUN_BRANCH_MASTER_ACTIVATE:
+ case LFUN_BRANCH_MASTER_DEACTIVATE: {
+ bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
+ Buffer * buf = master ? const_cast<Buffer *>(buffer().masterBuffer())
+ : &buffer();
+
docstring const branch_name = cmd.argument();
// the case without a branch name is handled elsewhere
if (branch_name.empty()) {
dispatched = false;
break;
}
- Branch * branch = branch_list.find(branch_name);
+ Branch * branch = buf->params().branchlist().find(branch_name);
if (!branch) {
LYXERR0("Branch " << branch_name << " does not exist.");
dr.setError(true);
dr.setMessage(msg);
break;
}
- bool activate = cmd.action() == LFUN_BRANCH_ACTIVATE;
+ bool activate = (cmd.action() == LFUN_BRANCH_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE);
if (branch->isSelected() != activate) {
branch->setSelected(activate);
cur.recordUndoFullDocument();