mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Introduce a new LyXAction property 'NoInternal' to take care of LFUNs that should not be applied to internal Buffers and use that in BufferView.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31433 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c9f1c6cf5f
commit
d5d3ccc0fa
@ -37,6 +37,7 @@
|
||||
#include "LayoutFile.h"
|
||||
#include "Lexer.h"
|
||||
#include "LyX.h"
|
||||
#include "LyXAction.h"
|
||||
#include "lyxfind.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "Layout.h"
|
||||
@ -1092,11 +1093,13 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
string const argument = to_utf8(cmd.argument());
|
||||
Cursor & cur = d->cursor_;
|
||||
|
||||
// Don't dispatch function that does not apply to internal buffers.
|
||||
if (buffer_.isInternal() && lyxaction.funcHasFlag(cmd.action, LyXAction::NoInternal))
|
||||
return false;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_BUFFER_PARAMS_APPLY: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
DocumentClass const * const oldClass = buffer_.params().documentClassPtr();
|
||||
cur.recordUndoFullDocument();
|
||||
istringstream ss(to_utf8(cmd.argument()));
|
||||
@ -1118,8 +1121,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_LAYOUT_MODULES_CLEAR: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
DocumentClass const * const oldClass =
|
||||
buffer_.params().documentClassPtr();
|
||||
cur.recordUndoFullDocument();
|
||||
@ -1131,8 +1132,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_LAYOUT_MODULE_ADD: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
BufferParams const & params = buffer_.params();
|
||||
if (!params.moduleCanBeAdded(argument)) {
|
||||
LYXERR0("Module `" << argument <<
|
||||
@ -1150,8 +1149,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_APPLY: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
if (!LayoutFileList::get().load(argument, buffer_.temppath()) &&
|
||||
!LayoutFileList::get().load(argument, buffer_.filePath()))
|
||||
break;
|
||||
@ -1175,15 +1172,11 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_LOAD:
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
LayoutFileList::get().load(argument, buffer_.temppath()) ||
|
||||
LayoutFileList::get().load(argument, buffer_.filePath());
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_RELOAD: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
DocumentClass const * const oldClass = buffer_.params().documentClassPtr();
|
||||
LayoutFileIndex bc = buffer_.params().baseClassID();
|
||||
LayoutFileList::get().reset(bc);
|
||||
@ -1256,8 +1249,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_PARAGRAPH_GOTO: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
int const id = convert<int>(cmd.getArg(0));
|
||||
int const pos = convert<int>(cmd.getArg(1));
|
||||
int i = 0;
|
||||
|
@ -1440,7 +1440,7 @@ void LyXAction::init()
|
||||
* \li Origin: rgh, 25 August 2007
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", Noop, Layout },
|
||||
{ LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", NoInternal, Layout },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_LAYOUT_MODULE_ADD
|
||||
* \li Action: Adds a module.
|
||||
@ -1450,7 +1450,7 @@ void LyXAction::init()
|
||||
* \li Origin: rgh, 25 August 2007
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_LAYOUT_MODULE_ADD, "layout-module-add", Noop, Layout },
|
||||
{ LFUN_LAYOUT_MODULE_ADD, "layout-module-add", NoInternal, Layout },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_LAYOUT_RELOAD
|
||||
* \li Action: Reloads layout information.
|
||||
@ -1462,7 +1462,7 @@ void LyXAction::init()
|
||||
* \li Origin: rgh, 3 September 2007
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_LAYOUT_RELOAD, "layout-reload", Noop, Layout },
|
||||
{ LFUN_LAYOUT_RELOAD, "layout-reload", NoInternal, Layout },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_TEXTCLASS_APPLY
|
||||
* \li Action: Sets the text class for the current buffer.
|
||||
@ -1471,7 +1471,7 @@ void LyXAction::init()
|
||||
the filename, minus the ".layout" extension.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_TEXTCLASS_APPLY, "textclass-apply", Noop, Layout },
|
||||
{ LFUN_TEXTCLASS_APPLY, "textclass-apply", NoInternal, Layout },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_TEXTCLASS_LOAD
|
||||
* \li Action: Loads information for a textclass from disk.
|
||||
@ -1480,7 +1480,7 @@ void LyXAction::init()
|
||||
the filename, minus the ".layout" extension.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_TEXTCLASS_LOAD, "textclass-load", Noop, Layout },
|
||||
{ LFUN_TEXTCLASS_LOAD, "textclass-load", NoInternal, Layout },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_MARK_OFF
|
||||
@ -1916,7 +1916,7 @@ void LyXAction::init()
|
||||
* \li Origin: Dekel, 26 Aug 2000
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_PARAGRAPH_GOTO, "paragraph-goto", ReadOnly, Edit },
|
||||
{ LFUN_PARAGRAPH_GOTO, "paragraph-goto", ReadOnly | NoInternal, Edit },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_BREAK_PARAGRAPH
|
||||
* \li Action: Breaks the current paragraph at the current location.
|
||||
@ -3090,7 +3090,7 @@ void LyXAction::init()
|
||||
* \li Origin: leeming, 30 Mar 2004
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_BUFFER_PARAMS_APPLY, "buffer-params-apply", Noop, Buffer },
|
||||
{ LFUN_BUFFER_PARAMS_APPLY, "buffer-params-apply", NoInternal, Buffer },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_FILE_INSERT
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
NoUpdate = 8, //< Does not (usually) require update
|
||||
SingleParUpdate = 16, //< Usually only requires this par updated
|
||||
AtPoint = 32, //< dispatch first to inset at cursor if there is one
|
||||
NoInternal = 64, //< Cannot be used for internal, non-document Buffers
|
||||
};
|
||||
|
||||
LyXAction();
|
||||
|
Loading…
Reference in New Issue
Block a user