#include "BufferView.h"
#include "dispatchresult.h"
#include "funcrequest.h"
+#include "FuncStatus.h"
+#include "cursor.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "LColor.h"
pi.pain.line(x + dim_.wid - 2, y + desc, x + dim_.wid - 2, y + desc - 4,
params_.labelfont.color());
+ // the name of the charstyle. Can be toggled.
if (has_label_) {
LyXFont font(params_.labelfont);
font.realize(LyXFont(LyXFont::ALL_SANE));
pi.pain.rectText(x + (dim_.wid - w) / 2, y + desc + a,
params_.type, font, LColor::none, LColor::none);
}
+
+ // a visual clue when the cursor is inside the inset
+ LCursor & cur = pi.base.bv->cursor();
+ if (cur.isInside(this)) {
+ y -= ascent();
+ pi.pain.line(x, y + 4, x, y, params_.labelfont.color());
+ pi.pain.line(x + 4, y, x, y, params_.labelfont.color());
+ pi.pain.line(x + dim_.wid - 2, y + 4, x + dim_.wid - 2, y,
+ params_.labelfont.color());
+ pi.pain.line(x + dim_.wid - 6, y, x + dim_.wid - 2, y,
+ params_.labelfont.color());
+ }
}
else
InsetText::priv_dispatch(cur, cmd);
break;
- // supress these
- // paragraph breaks not allowed in charstyle insets!
- case LFUN_BREAKPARAGRAPH:
- case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
- case LFUN_BREAKPARAGRAPH_SKIP:
- break;
default:
InsetCollapsable::priv_dispatch(cur, cmd);
}
+bool InsetCharStyle::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action) {
+ // paragraph breaks not allowed in charstyle insets
+ case LFUN_BREAKPARAGRAPH:
+ case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
+ case LFUN_BREAKPARAGRAPH_SKIP:
+ status.enabled(false);
+ return true;
+
+ default:
+ return InsetCollapsable::getStatus(cur, cmd, status);
+ }
+}
+
+
int InsetCharStyle::latex(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
#include "debug.h"
#include "dispatchresult.h"
#include "funcrequest.h"
+#include "FuncStatus.h"
#include "gettext.h"
#include "language.h"
#include "LColor.h"
break;
}
- // suppress these
- case LFUN_LAYOUT:
- case LFUN_BOLD:
- case LFUN_CODE:
- case LFUN_DEFAULT:
- case LFUN_EMPH:
- case LFUN_FREEFONT_APPLY:
- case LFUN_FREEFONT_UPDATE:
- case LFUN_NOUN:
- case LFUN_ROMAN:
- case LFUN_SANS:
- case LFUN_FRAK:
- case LFUN_ITAL:
- case LFUN_FONT_SIZE:
- case LFUN_FONT_STATE:
- case LFUN_UNDERLINE:
- break;
-
default:
InsetCollapsable::priv_dispatch(cur, cmd);
break;
}
+bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action) {
+ // suppress these
+ case LFUN_LAYOUT:
+ case LFUN_BOLD:
+ case LFUN_CODE:
+ case LFUN_DEFAULT:
+ case LFUN_EMPH:
+ case LFUN_FREEFONT_APPLY:
+ case LFUN_FREEFONT_UPDATE:
+ case LFUN_NOUN:
+ case LFUN_ROMAN:
+ case LFUN_SANS:
+ case LFUN_FRAK:
+ case LFUN_ITAL:
+ case LFUN_FONT_SIZE:
+ case LFUN_FONT_STATE:
+ case LFUN_UNDERLINE:
+ status.enabled(false);
+ return true;
+
+ default:
+ return InsetCollapsable::getStatus(cur, cmd, status);
+ }
+}
+
+
void InsetERT::setButtonLabel()
{
setLabel(status() == Collapsed ? getNewLabel(_("P-ERT")) : _("P-ERT"));