mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Cleanup handling of LFUN_LAYOUT in getStatus
The way it works is: * the inset defines forcePlainLayout() correctly * Text::getStatus acts on it. Note that, in Text::getStatus, testing for cur.inset().forcePlainLayout() does not make much sense, since one should pass the cursor idx as parameter. There are many other lfuns that do not have to be handled directly by insets. InsetScript in particular has tests for way too many lfuns.
This commit is contained in:
parent
f78967a802
commit
0d21dca360
@ -3109,7 +3109,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
docstring layout = cmd.argument();
|
||||
if (layout.empty())
|
||||
layout = tclass.defaultLayoutName();
|
||||
enable = !cur.inset().forcePlainLayout() && tclass.hasLayout(layout);
|
||||
enable = !owner_->forcePlainLayout() && tclass.hasLayout(layout);
|
||||
|
||||
flag.setOnOff(layout == cur.paragraph().layout().name());
|
||||
break;
|
||||
|
@ -263,7 +263,6 @@ bool InsetScript::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
switch (cmd.action()) {
|
||||
case LFUN_LAYOUT:
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
case LFUN_MATH_DISPLAY:
|
||||
case LFUN_BOX_INSERT:
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
///
|
||||
void read(Lexer & lex);
|
||||
///
|
||||
bool forcePlainLayout(idx_type = 0) const { return true; }
|
||||
///
|
||||
bool neverIndent() const { return true; }
|
||||
///
|
||||
int plaintext(odocstringstream & ods, OutputParams const & op,
|
||||
|
@ -3413,9 +3413,6 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
bool enabled = true;
|
||||
switch (cmd.action()) {
|
||||
case LFUN_LAYOUT:
|
||||
enabled = !forcePlainLayout();
|
||||
break;
|
||||
case LFUN_LAYOUT_PARAGRAPH:
|
||||
enabled = allowParagraphCustomization();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user