diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp index 482938a844..9bcb0e2b6b 100644 --- a/src/insets/InsetIPA.cpp +++ b/src/insets/InsetIPA.cpp @@ -15,6 +15,8 @@ #include "BufferParams.h" #include "BufferView.h" #include "Cursor.h" +#include "FuncRequest.h" +#include "FuncStatus.h" #include "LaTeXFeatures.h" #include "Lexer.h" #include "LyXRC.h" @@ -61,6 +63,24 @@ void InsetIPA::write(ostream & os) const } +bool InsetIPA::getStatus(Cursor & cur, FuncRequest const & cmd, + FuncStatus & flag) const +{ + switch (cmd.action()) { + case LFUN_SCRIPT_INSERT: { + if (cmd.argument() == "subscript") { + flag.setEnabled(false); + return true; + } + break; + } + default: + break; + } + return InsetText::getStatus(cur, cmd, flag); +} + + void InsetIPA::addPreview(DocIterator const & inset_pos, graphics::PreviewLoader &) const { @@ -189,10 +209,14 @@ void InsetIPA::latex(otexstream & os, OutputParams const & runparams) const bool InsetIPA::insetAllowed(InsetCode code) const { - if (code == ERT_CODE) + switch (code) { + // code that is allowed + case ERT_CODE: + case SCRIPT_CODE: return true; - else + default: return false; + } } diff --git a/src/insets/InsetIPA.h b/src/insets/InsetIPA.h index 09c0e83e3f..124516349c 100644 --- a/src/insets/InsetIPA.h +++ b/src/insets/InsetIPA.h @@ -55,6 +55,9 @@ public: void draw(PainterInfo & pi, int x, int y) const; + /// + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; + void addPreview(DocIterator const & inset_pos, graphics::PreviewLoader & ploader) const;