mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Try to end the neverending fixIfBroken saga
This is a fixup to the series of commits522516d9
,d0acc3e5
,13c3c148
. Actually the right thing to consider in all situations is isActive(), which really means `can a cursor be in there?'. Improve the description of isActive() and editable() in Inset.h. Set isActive() to false for InsetInfo, since no cursor should ever go there. Again part of #10667.
This commit is contained in:
parent
4d09650e93
commit
fc7fb6a564
@ -562,9 +562,7 @@ bool DocIterator::fixIfBroken()
|
|||||||
size_t n = slices_.size();
|
size_t n = slices_.size();
|
||||||
for (; i != n; ++i) {
|
for (; i != n; ++i) {
|
||||||
CursorSlice & cs = slices_[i];
|
CursorSlice & cs = slices_[i];
|
||||||
if (&cs.inset() != inset
|
if (&cs.inset() != inset || ! cs.inset().isActive()) {
|
||||||
|| (cs.inset().inMathed() ? ! cs.inset().isActive()
|
|
||||||
: ! cs.inset().editable())) {
|
|
||||||
// the whole slice is wrong, chop off this as well
|
// the whole slice is wrong, chop off this as well
|
||||||
--i;
|
--i;
|
||||||
LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");
|
LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");
|
||||||
|
@ -342,18 +342,18 @@ public:
|
|||||||
size_t const maxlen = TOC_ENTRY_LENGTH,
|
size_t const maxlen = TOC_ENTRY_LENGTH,
|
||||||
bool const shorten = true) const;
|
bool const shorten = true) const;
|
||||||
|
|
||||||
|
/// Can a cursor be put in there ?
|
||||||
|
/// Forced to false for insets that have hidden contents, like
|
||||||
|
/// InsetMathCommand and InsetInfo.
|
||||||
|
virtual bool isActive() const { return nargs() > 0; }
|
||||||
/// can the contents of the inset be edited on screen ?
|
/// can the contents of the inset be edited on screen ?
|
||||||
// true for InsetCollapsables (not ButtonOnly) (not InsetInfo), InsetText
|
// equivalent to isActive except for closed InsetCollapsable
|
||||||
virtual bool editable() const;
|
virtual bool editable() const;
|
||||||
/// has the Inset settings that can be modified in a dialog ?
|
/// has the Inset settings that can be modified in a dialog ?
|
||||||
virtual bool hasSettings() const;
|
virtual bool hasSettings() const;
|
||||||
/// can we go further down on mouse click?
|
/// can we go further down on mouse click?
|
||||||
// true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular
|
/// true for InsetCaption, InsetCollapsables (not ButtonOnly), InsetTabular
|
||||||
virtual bool descendable(BufferView const &) const { return false; }
|
virtual bool descendable(BufferView const &) const { return false; }
|
||||||
/// is this an inset that can be moved into?
|
|
||||||
/// FIXME: merge with editable()
|
|
||||||
// true for InsetTabular & InsetText
|
|
||||||
virtual bool isActive() const { return nargs() > 0; }
|
|
||||||
/// can we click at the specified position ?
|
/// can we click at the specified position ?
|
||||||
virtual bool clickable(BufferView const &, int, int) const { return false; }
|
virtual bool clickable(BufferView const &, int, int) const { return false; }
|
||||||
/// Move one cell backwards
|
/// Move one cell backwards
|
||||||
|
@ -101,6 +101,8 @@ public:
|
|||||||
///
|
///
|
||||||
Inset * editXY(Cursor & cur, int x, int y);
|
Inset * editXY(Cursor & cur, int x, int y);
|
||||||
///
|
///
|
||||||
|
bool isActive() const { return false; }
|
||||||
|
///
|
||||||
bool editable() const { return false; }
|
bool editable() const { return false; }
|
||||||
///
|
///
|
||||||
bool hasSettings() const { return true; }
|
bool hasSettings() const { return true; }
|
||||||
|
Loading…
Reference in New Issue
Block a user