bug 2081: Disallow insertion of marginal note in float table.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10582 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-11-02 11:27:08 +00:00
parent dfe4c05d4f
commit b063595be8
3 changed files with 24 additions and 51 deletions

View File

@ -72,7 +72,7 @@ public:
BranchList() : separator_("|") {} BranchList() : separator_("|") {}
/// ///
bool empty() { return list.empty(); } bool empty() const { return list.empty(); }
/// ///
void clear() { list.clear(); } void clear() { list.clear(); }
/// ///

View File

@ -1,3 +1,9 @@
2005-10-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (getStatus): re-enable disabled code. (bug 2081)
* BranchList.h (empty): constify.
2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2005-10-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (getStatus): * text3.C (getStatus):

View File

@ -17,6 +17,7 @@
#include "lyxtext.h" #include "lyxtext.h"
#include "BranchList.h"
#include "FloatList.h" #include "FloatList.h"
#include "FuncStatus.h" #include "FuncStatus.h"
#include "buffer.h" #include "buffer.h"
@ -1561,8 +1562,10 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {
BOOST_ASSERT(cur.text() == this); BOOST_ASSERT(cur.text() == this);
LyXFont const & font = real_current_font; LyXFont const & font = real_current_font;
bool enable = true; bool enable = true;
InsetBase::Code code = InsetBase::NO_CODE;
switch (cmd.action) { switch (cmd.action) {
@ -1574,11 +1577,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
enable = changeDepthAllowed(cur, INC_DEPTH); enable = changeDepthAllowed(cur, INC_DEPTH);
break; break;
case LFUN_INSET_OPTARG:
enable = numberOfOptArgs(cur.paragraph())
< cur.paragraph().layout()->optionalargs;
break;
case LFUN_APPENDIX: case LFUN_APPENDIX:
flag.setOnOff(cur.paragraph().params().startOfAppendix()); flag.setOnOff(cur.paragraph().params().startOfAppendix());
return true; return true;
@ -1587,10 +1585,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
enable = (cur.paragraph().layout()->labeltype == LABEL_BIBLIO); enable = (cur.paragraph().layout()->labeltype == LABEL_BIBLIO);
break; break;
#if 0
// the functions which insert insets
InsetBase::Code code = InsetBase::NO_CODE;
switch (cmd.action) {
case LFUN_DIALOG_SHOW_NEW_INSET: case LFUN_DIALOG_SHOW_NEW_INSET:
if (cmd.argument == "bibitem") if (cmd.argument == "bibitem")
code = InsetBase::BIBITEM_CODE; code = InsetBase::BIBITEM_CODE;
@ -1668,7 +1662,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
break; break;
case LFUN_INSERT_CHARSTYLE: case LFUN_INSERT_CHARSTYLE:
code = InsetBase::CHARSTYLE_CODE; code = InsetBase::CHARSTYLE_CODE;
if (buf->params().getLyXTextClass().charstyles().empty()) if (cur.buffer().params().getLyXTextClass().charstyles().empty())
enable = false; enable = false;
break; break;
case LFUN_INSERT_BOX: case LFUN_INSERT_BOX:
@ -1676,7 +1670,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
break; break;
case LFUN_INSERT_BRANCH: case LFUN_INSERT_BRANCH:
code = InsetBase::BRANCH_CODE; code = InsetBase::BRANCH_CODE;
if (buf->getMasterBuffer()->params().branchlist().empty()) if (cur.buffer().getMasterBuffer()->params().branchlist().empty())
enable = false; enable = false;
break; break;
case LFUN_INSERT_LABEL: case LFUN_INSERT_LABEL:
@ -1684,6 +1678,8 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
break; break;
case LFUN_INSET_OPTARG: case LFUN_INSET_OPTARG:
code = InsetBase::OPTARG_CODE; code = InsetBase::OPTARG_CODE;
enable = numberOfOptArgs(cur.paragraph())
< cur.paragraph().layout()->optionalargs;
break; break;
case LFUN_ENVIRONMENT_INSERT: case LFUN_ENVIRONMENT_INSERT:
code = InsetBase::BOX_CODE; code = InsetBase::BOX_CODE;
@ -1718,6 +1714,11 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
if (cur.inTexted()) if (cur.inTexted())
code = InsetBase::SPACE_CODE; code = InsetBase::SPACE_CODE;
break; break;
#ifdef WITH_WARNINGS
#warning This LFUN is not used anymore and should be nuked (JMarc 29/10/2005)
#endif
#if 0
case LFUN_INSET_DIALOG_SHOW: { case LFUN_INSET_DIALOG_SHOW: {
InsetBase * inset = cur.nextInset(); InsetBase * inset = cur.nextInset();
enable = inset; enable = inset;
@ -1731,37 +1732,8 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
} }
break; break;
} }
default:
break;
}
if (code != InsetBase::NO_CODE
&& (cur.empty() || !cur.inset().insetAllowed(code)))
enable = false;
#endif #endif
case LFUN_DIALOG_SHOW_NEW_INSET:
case LFUN_INSET_ERT:
case LFUN_INSERT_BOX:
case LFUN_INSERT_BRANCH:
case LFUN_ENVIRONMENT_INSERT:
case LFUN_INDEX_INSERT:
case LFUN_INDEX_PRINT:
case LFUN_TOC_INSERT:
case LFUN_HTMLURL:
case LFUN_URL:
case LFUN_QUOTE:
case LFUN_HYPHENATION:
case LFUN_LIGATURE_BREAK:
case LFUN_HFILL:
case LFUN_MENU_SEPARATOR:
case LFUN_LDOTS:
case LFUN_END_OF_SENTENCE:
case LFUN_SPACE_INSERT:
case LFUN_INSET_DIALOG_SHOW:
break;
case LFUN_INSET_MODIFY: case LFUN_INSET_MODIFY:
// We need to disable this, because we may get called for a // We need to disable this, because we may get called for a
// tabular cell via // tabular cell via
@ -1848,15 +1820,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_PASTESELECTION: case LFUN_PASTESELECTION:
case LFUN_DATE_INSERT: case LFUN_DATE_INSERT:
case LFUN_SELFINSERT: case LFUN_SELFINSERT:
case LFUN_INSERT_LABEL:
case LFUN_INSERT_NOTE:
case LFUN_INSERT_CHARSTYLE:
case LFUN_INSET_FLOAT:
case LFUN_INSET_FOOTNOTE:
case LFUN_INSET_MARGINAL:
case LFUN_INSET_WIDE_FLOAT:
case LFUN_INSET_WRAP:
case LFUN_TABULAR_INSERT:
case LFUN_INSERT_LINE: case LFUN_INSERT_LINE:
case LFUN_INSERT_PAGEBREAK: case LFUN_INSERT_PAGEBREAK:
case LFUN_MATH_DISPLAY: case LFUN_MATH_DISPLAY:
@ -1893,7 +1856,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_HUNG_UMLAUT: case LFUN_HUNG_UMLAUT:
case LFUN_CIRCLE: case LFUN_CIRCLE:
case LFUN_OGONEK: case LFUN_OGONEK:
case LFUN_FLOAT_LIST:
case LFUN_ACCEPT_CHANGE: case LFUN_ACCEPT_CHANGE:
case LFUN_REJECT_CHANGE: case LFUN_REJECT_CHANGE:
case LFUN_THESAURUS_ENTRY: case LFUN_THESAURUS_ENTRY:
@ -1910,6 +1872,11 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
default: default:
return false; return false;
} }
if (code != InsetBase::NO_CODE
&& (cur.empty() || !cur.inset().insetAllowed(code)))
enable = false;
flag.enabled(enable); flag.enabled(enable);
return true; return true;
} }