mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
define InsetText::insetAllowed properly and rely on it for inset insertion in Text::dispatchsvndiff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30593 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0585f2b2b4
commit
0e8b1dc29a
@ -26,7 +26,7 @@ fi
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
save_PACKAGE=$PACKAGE
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5 silent-rules])
|
||||
PACKAGE=$save_PACKAGE
|
||||
|
||||
### Set the execute permissions of the various scripts correctly
|
||||
|
@ -2380,6 +2380,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_LABEL_INSERT:
|
||||
code = LABEL_CODE;
|
||||
break;
|
||||
case LFUN_LINE_INSERT:
|
||||
code = LINE_CODE;
|
||||
break;
|
||||
case LFUN_INFO_INSERT:
|
||||
code = INFO_CODE;
|
||||
break;
|
||||
@ -2433,6 +2436,19 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
code = SPACE_CODE;
|
||||
break;
|
||||
|
||||
case LFUN_MATH_INSERT:
|
||||
case LFUN_MATH_AMS_MATRIX:
|
||||
case LFUN_MATH_MATRIX:
|
||||
case LFUN_MATH_DELIM:
|
||||
case LFUN_MATH_BIGDELIM:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
case LFUN_MATH_MODE:
|
||||
case LFUN_MATH_MACRO:
|
||||
case LFUN_MATH_SUBSCRIPT:
|
||||
case LFUN_MATH_SUPERSCRIPT:
|
||||
code = MATH_CODE;
|
||||
break;
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
// We need to disable this, because we may get called for a
|
||||
// tabular cell via
|
||||
@ -2592,18 +2608,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
// not allowed in description items
|
||||
code = NEWPAGE_CODE;
|
||||
enable = !inDescriptionItem(cur);
|
||||
break;
|
||||
|
||||
case LFUN_MATH_INSERT:
|
||||
case LFUN_MATH_AMS_MATRIX:
|
||||
case LFUN_MATH_MATRIX:
|
||||
case LFUN_MATH_DELIM:
|
||||
case LFUN_MATH_BIGDELIM:
|
||||
// not allowed in ERT, for example.
|
||||
enable = cur.inset().insetAllowed(MATH_CODE);
|
||||
break;
|
||||
|
||||
case LFUN_DATE_INSERT: {
|
||||
string const format = cmd.argument().empty()
|
||||
? lyxrc.date_insert_format : to_utf8(cmd.argument());
|
||||
@ -2664,12 +2672,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_SERVER_GET_LAYOUT:
|
||||
case LFUN_LAYOUT:
|
||||
case LFUN_SELF_INSERT:
|
||||
case LFUN_LINE_INSERT:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
case LFUN_MATH_MODE:
|
||||
case LFUN_MATH_MACRO:
|
||||
case LFUN_MATH_SUBSCRIPT:
|
||||
case LFUN_MATH_SUPERSCRIPT:
|
||||
case LFUN_FONT_DEFAULT:
|
||||
case LFUN_FONT_UNDERLINE:
|
||||
case LFUN_FONT_STRIKEOUT:
|
||||
@ -2718,7 +2720,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
if (code != NO_CODE
|
||||
&& (cur.empty() || !cur.inset().insetAllowed(code)))
|
||||
&& (cur.empty()
|
||||
|| !cur.inset().insetAllowed(code)
|
||||
|| cur.paragraph().layout().pass_thru))
|
||||
enable = false;
|
||||
|
||||
switch (cmd.action) {
|
||||
@ -2739,17 +2743,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_ACCENT_UNDERBAR:
|
||||
case LFUN_ACCENT_UNDERDOT:
|
||||
case LFUN_APPENDIX:
|
||||
case LFUN_BOX_INSERT:
|
||||
case LFUN_BRANCH_INSERT:
|
||||
case LFUN_CAPTION_INSERT:
|
||||
case LFUN_DEPTH_DECREMENT:
|
||||
case LFUN_DEPTH_INCREMENT:
|
||||
case LFUN_ERT_INSERT:
|
||||
case LFUN_FILE_INSERT:
|
||||
case LFUN_FLEX_INSERT:
|
||||
case LFUN_FLOAT_INSERT:
|
||||
case LFUN_FLOAT_LIST_INSERT:
|
||||
case LFUN_FLOAT_WIDE_INSERT:
|
||||
case LFUN_FONT_BOLD:
|
||||
case LFUN_FONT_BOLDSYMBOL:
|
||||
case LFUN_FONT_TYPEWRITER:
|
||||
@ -2766,42 +2762,17 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_FONT_STRIKEOUT:
|
||||
case LFUN_FONT_UULINE:
|
||||
case LFUN_FONT_UWAVE:
|
||||
case LFUN_FOOTNOTE_INSERT:
|
||||
case LFUN_HYPERLINK_INSERT:
|
||||
case LFUN_INDEX_INSERT:
|
||||
case LFUN_INDEX_PRINT:
|
||||
case LFUN_INSET_INSERT:
|
||||
case LFUN_LABEL_GOTO:
|
||||
case LFUN_LABEL_INSERT:
|
||||
case LFUN_LAYOUT_TABULAR:
|
||||
case LFUN_LINE_INSERT:
|
||||
case LFUN_MARGINALNOTE_INSERT:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
case LFUN_MATH_INSERT:
|
||||
case LFUN_MATH_AMS_MATRIX:
|
||||
case LFUN_MATH_MATRIX:
|
||||
case LFUN_MATH_MODE:
|
||||
case LFUN_MENU_OPEN:
|
||||
case LFUN_NEWLINE_INSERT:
|
||||
case LFUN_NEWPAGE_INSERT:
|
||||
case LFUN_NOACTION:
|
||||
case LFUN_NOMENCL_INSERT:
|
||||
case LFUN_NOMENCL_PRINT:
|
||||
case LFUN_NOTE_INSERT:
|
||||
case LFUN_NOTE_NEXT:
|
||||
case LFUN_OPTIONAL_INSERT:
|
||||
case LFUN_PHANTOM_INSERT:
|
||||
case LFUN_REFERENCE_NEXT:
|
||||
case LFUN_SERVER_GOTO_FILE_ROW:
|
||||
case LFUN_SERVER_NOTIFY:
|
||||
case LFUN_SERVER_SET_XY:
|
||||
case LFUN_SPACE_INSERT:
|
||||
case LFUN_SPECIALCHAR_INSERT:
|
||||
case LFUN_TABULAR_INSERT:
|
||||
case LFUN_TEXTSTYLE_APPLY:
|
||||
case LFUN_TEXTSTYLE_UPDATE:
|
||||
case LFUN_TOC_INSERT:
|
||||
case LFUN_WRAP_INSERT:
|
||||
if (cur.inset().getLayout().isPassThru())
|
||||
enable = false;
|
||||
break;
|
||||
|
@ -128,12 +128,6 @@ docstring const InsetERT::buttonLabel(BufferView const & bv) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetERT::insetAllowed(InsetCode /* code */) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool InsetERT::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
bv->showDialog("ert", params2string(status(*bv)),
|
||||
|
@ -47,8 +47,6 @@ private:
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
///
|
||||
bool insetAllowed(InsetCode code) const;
|
||||
///
|
||||
int plaintext(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
int docbook(odocstream &, OutputParams const &) const;
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
///
|
||||
ParagraphList const & paragraphs() const;
|
||||
///
|
||||
bool insetAllowed(InsetCode) const { return true; }
|
||||
bool insetAllowed(InsetCode) const { return !getLayout().isPassThru(); }
|
||||
/// Allow spellchecking, except for insets with latex_language
|
||||
bool allowSpellCheck() const { return !getLayout().isPassThru(); }
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user