Backport 5626 fix.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@27951 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2008-12-22 10:53:13 +00:00
parent 07ad6b8d9d
commit cf1205de05
3 changed files with 24 additions and 0 deletions

View File

@ -51,6 +51,7 @@
#include "insets/InsetCollapsable.h"
#include "insets/InsetCommand.h"
#include "insets/InsetExternal.h"
#include "insets/InsetFloatList.h"
#include "insets/InsetNewline.h"
#include "insets/InsetQuotes.h"
@ -827,7 +828,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_INSET_INSERT: {
cur.recordUndo();
// We have to avoid triggering InstantPreview loading
// before inserting into the document. See bug #5626.
bool loaded = bv->buffer().isFullyLoaded();
bv->buffer().setFullyLoaded(false);
Inset * inset = createInset(bv->buffer(), cmd);
bv->buffer().setFullyLoaded(loaded);
if (inset) {
// FIXME (Abdel 01/02/2006):
// What follows would be a partial fix for bug 2154:
@ -855,7 +863,15 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
cutSelection(cur, true, false);
cur.insert(inset);
cur.posForward();
// trigger InstantPreview now
if (inset->lyxCode() == EXTERNAL_CODE) {
InsetExternal & ins =
static_cast<InsetExternal &>(*inset);
ins.updatePreview();
}
}
break;
}

View File

@ -539,6 +539,12 @@ InsetExternalParams const & InsetExternal::params() const
}
void InsetExternal::updatePreview()
{
setParams(params_);
}
void InsetExternal::setParams(InsetExternalParams const & p)
{
params_ = p;

View File

@ -107,6 +107,8 @@ public:
InsetExternalParams const & params() const;
///
void setParams(InsetExternalParams const &);
/// Update not loaded previews
void updatePreview();
/// \returns the number of rows (\n's) of generated code.
int latex(odocstream &, OutputParams const &) const;
///