From d550bb116aefc654f320a4180f0ccdffc0adb0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 6 Mar 2012 09:14:24 +0000 Subject: [PATCH] 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 --- src/insets/InsetIPA.cpp | 28 ++++++++++++++++++++++++++-- src/insets/InsetIPA.h | 3 +++ 2 files changed, 29 insertions(+), 2 deletions(-) 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;