mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-19 05:53:35 +00:00
branch: Fix #6045: Possible to insert table floats into figure floats.
The lfuns, LFUN_FLOAT_INSERT and LFUN_WRAP_INSERT are now only enabled when they should be. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31318 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0c0b77274a
commit
0113ce8310
@ -52,13 +52,15 @@
|
|||||||
#include "insets/InsetCollapsable.h"
|
#include "insets/InsetCollapsable.h"
|
||||||
#include "insets/InsetCommand.h"
|
#include "insets/InsetCommand.h"
|
||||||
#include "insets/InsetExternal.h"
|
#include "insets/InsetExternal.h"
|
||||||
|
#include "insets/InsetFloat.h"
|
||||||
|
#include "insets/InsetGraphics.h"
|
||||||
|
#include "insets/InsetGraphicsParams.h"
|
||||||
#include "insets/InsetFloatList.h"
|
#include "insets/InsetFloatList.h"
|
||||||
#include "insets/InsetNewline.h"
|
#include "insets/InsetNewline.h"
|
||||||
#include "insets/InsetQuotes.h"
|
#include "insets/InsetQuotes.h"
|
||||||
#include "insets/InsetSpecialChar.h"
|
#include "insets/InsetSpecialChar.h"
|
||||||
#include "insets/InsetText.h"
|
#include "insets/InsetText.h"
|
||||||
#include "insets/InsetGraphics.h"
|
#include "insets/InsetWrap.h"
|
||||||
#include "insets/InsetGraphicsParams.h"
|
|
||||||
|
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
#include "support/debug.h"
|
#include "support/debug.h"
|
||||||
@ -2062,9 +2064,36 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
break;
|
break;
|
||||||
case LFUN_FLOAT_INSERT:
|
case LFUN_FLOAT_INSERT:
|
||||||
case LFUN_FLOAT_WIDE_INSERT:
|
case LFUN_FLOAT_WIDE_INSERT:
|
||||||
|
// FIXME: If there is a selection, we should check whether there
|
||||||
|
// are floats in the selection, but this has performance issues, see
|
||||||
|
// LFUN_CHANGE_ACCEPT/REJECT.
|
||||||
code = FLOAT_CODE;
|
code = FLOAT_CODE;
|
||||||
// not allowed in description items
|
if (inDescriptionItem(cur))
|
||||||
enable = !inDescriptionItem(cur);
|
// not allowed in description items
|
||||||
|
enable = false;
|
||||||
|
else {
|
||||||
|
InsetCode const inset_code = cur.inset().lyxCode();
|
||||||
|
|
||||||
|
// algorithm floats cannot be put in another float
|
||||||
|
if (to_utf8(cmd.argument()) == "algorithm") {
|
||||||
|
enable = inset_code != WRAP_CODE && inset_code != FLOAT_CODE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for figures and tables: only allow in another
|
||||||
|
// float or wrap if it is of the same type and
|
||||||
|
// not a subfloat already
|
||||||
|
if(cur.inset().lyxCode() == code) {
|
||||||
|
InsetFloat const & ins =
|
||||||
|
static_cast<InsetFloat const &>(cur.inset());
|
||||||
|
enable = ins.params().type == to_utf8(cmd.argument())
|
||||||
|
&& !ins.params().subfloat;
|
||||||
|
} else if(cur.inset().lyxCode() == WRAP_CODE) {
|
||||||
|
InsetWrap const & ins =
|
||||||
|
static_cast<InsetWrap const &>(cur.inset());
|
||||||
|
enable = ins.params().type == to_utf8(cmd.argument());
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LFUN_WRAP_INSERT:
|
case LFUN_WRAP_INSERT:
|
||||||
code = WRAP_CODE;
|
code = WRAP_CODE;
|
||||||
|
@ -380,9 +380,16 @@ int InsetFloat::docbook(odocstream & os, OutputParams const & runparams) const
|
|||||||
|
|
||||||
bool InsetFloat::insetAllowed(InsetCode code) const
|
bool InsetFloat::insetAllowed(InsetCode code) const
|
||||||
{
|
{
|
||||||
return code != FOOT_CODE
|
// The case that code == FLOAT_CODE is handled in Text3.cpp,
|
||||||
&& code != MARGIN_CODE
|
// because we need to know what type of float is meant.
|
||||||
&& (code != FLOAT_CODE || !params_.subfloat);
|
switch(code) {
|
||||||
|
case WRAP_CODE:
|
||||||
|
case FOOT_CODE:
|
||||||
|
case MARGIN_CODE:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return InsetCollapsable::insetAllowed(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ What's new
|
|||||||
|
|
||||||
- Sort document classes case insensitively (bug 1492).
|
- Sort document classes case insensitively (bug 1492).
|
||||||
|
|
||||||
|
- Disable to insert floats into another float when this is not
|
||||||
|
allowed (bug 6045).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user