+2003-04-16 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * undo_funcs.C (textHandleUndo): ajust (rather big adsjust this one)
+
+ * text2.C (deleteEmptyParagraphMechanism): adjust
+
+ * text2.[Ch] (ownerParagraph): delete func (both of them
+
2003-04-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* text_funcs.C (transposeChars): use ParagraphList::iterator here.
// special owner functions
///
ParagraphList & ownerParagraphs() const;
- //
- void ownerParagraph(Paragraph *) const;
- // set it searching first for the right owner using the paragraph id
- void ownerParagraph(int id, Paragraph *) const;
/// return true if this is owned by an inset.
bool isInInset() const;
deleted = true;
+ bool selection_position_was_oldcursor_position = (
+ selection.cursor.par() == old_cursor.par()
+ && selection.cursor.pos() == old_cursor.pos());
+
if (old_cursor.row() != rows().begin()) {
RowList::iterator
prevrow = boost::prior(old_cursor.row());
// delete old row
removeRow(old_cursor.row());
- if (ownerParagraphs().begin() == old_cursor.par()) {
- ownerParagraph(&*boost::next(ownerParagraphs().begin()));
- }
-#warning FIXME Do the proper ParagraphList operation here (Lgb)
// delete old par
- delete &*old_cursor.par();
+ ownerParagraphs().erase(old_cursor.par());
/* Breakagain the next par. Needed because of
* the parindent that can occur or dissappear.
// delete old row
removeRow(old_cursor.row());
// delete old par
- if (ownerParagraphs().begin() == old_cursor.par()) {
- ownerParagraph(&*boost::next(ownerParagraphs().begin()));
- }
-#warning FIXME Do the proper ParagraphList operations here. (Lgb)
- delete &*old_cursor.par();
+ ownerParagraphs().erase(old_cursor.par());
/* Breakagain the next par. Needed because of
the parindent that can occur or dissappear.
// correct cursor y
setCursorIntern(cursor.par(), cursor.pos());
- if (selection.cursor.par() == old_cursor.par()
- && selection.cursor.pos() == old_cursor.pos()) {
+ if (selection_position_was_oldcursor_position) {
// correct selection
selection.cursor = cursor;
}
}
-void LyXText::ownerParagraph(Paragraph * p) const
-{
- if (inset_owner) {
- inset_owner->paragraph(p);
- } else {
- bv_owner->buffer()->paragraphs.set(p);
- }
-}
-
-
-void LyXText::ownerParagraph(int id, Paragraph * p) const
-{
- Paragraph * op = bv_owner->buffer()->getParFromID(id);
- if (op && op->inInset()) {
- static_cast<InsetText *>(op->inInset())->paragraph(p);
- } else {
- ownerParagraph(p);
- }
-}
-
-
LyXText::refresh_status LyXText::refreshStatus() const
{
return refresh_status_;
#include "BufferView.h"
#include "buffer.h"
#include "insets/updatableinset.h"
+#include "insets/insettext.h"
#include "debug.h"
#include "support/LAssert.h"
undopar->previous(before);
if (before)
before->next(undopar);
- else
- bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
- undopar);
-
+ else {
+ int id = firstUndoParagraph(bv, undo.number_of_inset_id)->id();
+ Paragraph * op = bv->buffer()->getParFromID(id);
+ if (op && op->inInset()) {
+ static_cast<InsetText*>(op->inInset())->paragraph(undopar);
+ } else {
+ bv->buffer()->paragraphs.set(undopar);
+ }
+ }
} else {
// We enter here on DELETE undo operations where we have to
// substitue the second paragraph with the first if the removed
// one is the first!
if (!before && behind) {
- bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
- behind);
+ int id = firstUndoParagraph(bv, undo.number_of_inset_id)->id();
+ Paragraph * op = bv->buffer()->getParFromID(id);
+ if (op && op->inInset()) {
+ static_cast<InsetText*>(op->inInset())->paragraph(behind);
+ } else {
+ bv->buffer()->paragraphs.set(behind);
+ }
+
undopar = behind;
}
}