Allow superscript (but not subscript) in IPA inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40869 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2012-03-06 09:14:24 +00:00
parent 7e615373bd
commit d550bb116a
2 changed files with 29 additions and 2 deletions

View File

@ -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,11 +209,15 @@ 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;
}
}
} // namespace lyx

View File

@ -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;