* ifrelatives is a helper function to check whether a buffer has a master or children.
+* lyxfiles-open opens the new examples or templates dialog.
+
* 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
Menu "file"
Item "New|N" "buffer-new"
- Item "New from Template...|m" "dialog-show lyxfiles templates"
+ Item "New from Template...|m" "lyxfiles-open templates"
Item "Open...|O" "file-open"
Submenu "Open Recent|t" "file_lastfiles"
- Item "Open Example...|p" "dialog-show lyxfiles examples"
+ Item "Open Example...|p" "lyxfiles-open examples"
Separator
Item "Close|C" "buffer-close"
Item "Close All" "buffer-close-all"
LFUN_TOOLBAR_SET, // spitz 20201217
// 385
LFUN_INSET_SPLIT, // jspitzm 20201222
+ LFUN_LYXFILES_OPEN, // jspitzm 20210210
LFUN_LASTACTION // end of the table
};
*/
{ LFUN_HELP_OPEN, "help-open", NoBuffer | Argument, Buffer },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_LYXFILES_OPEN
+ * \li Action: Open lyxfiles (templates/examples). Create a view if he have none.
+ * \li Syntax: lyxfiles-open [<TYPE>]
+ * \li Params: <TYPE>: templates or examples. Default is templates.
+ * \li Origin: spitz, 10 Feb 2021
+ * \endvar
+ */
+ { LFUN_LYXFILES_OPEN, "lyxfiles-open", NoBuffer | Argument, Buffer },
+
/*!
* \var lyx::FuncCode lyx::LFUN_HREF_INSERT
* \li Action: Inserts hyperlinks into the document (clickable in pdf output).
case LFUN_BUFFER_NEW:
case LFUN_BUFFER_NEW_TEMPLATE:
case LFUN_FILE_OPEN:
+ case LFUN_LYXFILES_OPEN:
case LFUN_HELP_OPEN:
case LFUN_SCREEN_FONT_UPDATE:
case LFUN_SET_COLOR:
break;
}
+ case LFUN_LYXFILES_OPEN: {
+ // This is the actual reason for this method (#12106).
+ validateCurrentView();
+ if (!current_view_
+ || (!lyxrc.open_buffers_in_tabs
+ && current_view_->documentBufferView() != nullptr))
+ createView();
+ string arg = to_utf8(cmd.argument());
+ if (arg.empty())
+ // set default
+ arg = "templates";
+ if (arg != "templates" && arg != "examples") {
+ current_view_->message(_("Wrong argument. Must be 'examples' or 'templates'."));
+ break;
+ }
+ lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "lyxfiles " + arg));
+ break;
+ }
+
case LFUN_SET_COLOR: {
string const lyx_name = cmd.getArg(0);
string x11_name = cmd.getArg(1);