http://bugzilla.lyx.org/show_bug.cgi?id=3503
Bug 3503 is a consequence of checkin
http://www.lyx.org/trac/changeset/17837
The following patch tries to fix bug 2993 in a better way: all actions
not marked as readonly will make the buffer dirty by themselves.
I chose to use the dispatch mechanism recursively, which has the
slight problem that the cursor is not set inside the isnet.
There is however a problem with the whole idea anyway: if we really
fix the bug, it will not be possible to open/close insets (think
notes) in read-only documents (think documentation). I think it is not
acceptable.
So finally my proposal might be: revert 17837 and mark bug 2993 as
WONTFIX.
Thoughts? Bo?
JMarc
Index: src/LyXAction.C
===================================================================
--- src/LyXAction.C (révision 17981)
+++ src/LyXAction.C (copie de travail)
@@ -242,9 +242,9 @@ void LyXAction::init()
{ LFUN_NOTE_INSERT, "note-insert", Noop },
{ LFUN_BOX_INSERT, "box-insert", Noop },
{ LFUN_NOTE_NEXT, "note-next", ReadOnly },
- { LFUN_INSET_TOGGLE, "", ReadOnly },
- { LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", ReadOnly },
- { LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", ReadOnly },
+ { LFUN_INSET_TOGGLE, "", Noop},
+ { LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", Noop },
+ { LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", Noop },
{ LFUN_PARAGRAPH_DOWN, "paragraph-down", ReadOnly | NoUpdate},
{ LFUN_PARAGRAPH_DOWN_SELECT, "paragraph-down-select", ReadOnly },
{ LFUN_PARAGRAPH_GOTO, "paragraph-goto", ReadOnly },
Index: src/insets/InsetCollapsable.cpp
===================================================================
--- src/insets/InsetCollapsable.cpp (révision 17981)
+++ src/insets/InsetCollapsable.cpp (copie de travail)
@@ -24,6 +24,7 @@
#include "FuncStatus.h"
#include "gettext.h"
#include "LColor.h"
+#include "lyxfunc.h"
#include "lyxlex.h"
#include "funcrequest.h"
#include "metricsinfo.h"
@@ -370,15 +371,7 @@ void InsetCollapsable::doDispatch(LCurso
break;
// Left button is clicked, the user asks to
// toggle the inset visual state.
- cur.dispatched();
- cur.updateFlags(Update::Force | Update::FitCursor);
- if (status() == Collapsed) {
- setStatus(cur, Open);
- edit(cur, true);
- }
- else {
- setStatus(cur, Collapsed);
- }
+ lyx::dispatch(FuncRequest(LFUN_NEXT_INSET_TOGGLE));
cur.bv().cursor() = cur;
break;
}
@@ -443,9 +436,6 @@ void InsetCollapsable::setStatus(LCursor
setButtonLabel();
if (status_ == Collapsed)
cur.leaveInset(*this);
- // Because we save CollapseStatus in lyx file, change of status
- // should lead to a dirty buffer. (This fixes bug 2993).
- cur.bv().buffer()->markDirty();
}