* export-cancel: Used to cancel background export processes.
+* ifrelatives is a helper function to check whether a buffer has a master or children.
+
* master-buffer-forall executes an lfun in the master and all children of a document.
* paragraph-select is a new convenience function to select the paragraph
// 380
LFUN_BUFFER_RESET_EXPORT, // spitz 20191226
LFUN_MASTER_BUFFER_FORALL, // spitz 20191231
+ LFUN_IF_RELATIVES, // spitz 20200102
LFUN_LASTACTION // end of the table
};
*/
{ LFUN_ICON_SIZE, "icon-size", NoBuffer, Buffer },
+
+/*!
+ * \var lyx::FuncCode lyx::LFUN_IF_RELATIVES
+ * \li Action: Helper function for master-related actions
+ * \li Notion: In a buffer, the function will be disabled if the buffer
+ * has no master or children. It thus allows to enable
+ * actions only in documents with master/children
+ * \li Syntax: ifrelatives <ACTION>
+ * \li Origin: spitz, 2 January 2020
+ * \endvar
+ */
+ { LFUN_IF_RELATIVES, "ifrelatives", Noop, Buffer },
+
/*!
* \var lyx::FuncCode lyx::LFUN_INDEX_INSERT
* \li Action: Inserts Index entry.
break;
}
+ case LFUN_IF_RELATIVES: {
+ string const lfun = to_utf8(cmd.argument());
+ BufferView const * bv =
+ current_view_ ? current_view_->currentBufferView() : nullptr;
+ if (!bv || (bv->buffer().parent() == nullptr && !bv->buffer().hasChildren())) {
+ enable = false;
+ break;
+ }
+ FuncRequest func(lyxaction.lookupFunc(lfun));
+ func.setOrigin(cmd.origin());
+ flag = getStatus(func);
+ break;
+ }
+
case LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE:
case LFUN_REPEAT:
case LFUN_PREFERENCES_SAVE:
break;
}
+ case LFUN_IF_RELATIVES: {
+ string const lfun = to_utf8(cmd.argument());
+ FuncRequest func(lyxaction.lookupFunc(lfun));
+ func.setOrigin(cmd.origin());
+ FuncStatus const stat = getStatus(func);
+ if (stat.enabled()) {
+ dispatch(func);
+ break;
+ }
+ break;
+ }
+
case LFUN_PREFERENCES_SAVE:
lyxrc.write(support::makeAbsPath("preferences",
package().user_support().absFileName()), false);