2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
+ * text.C (backspace): adjust
+
+ * tabular.C (SetMultiColumn): adjust
+
+ * CutAndPaste.C (cutSelection): adjust
+ (pasteSelection): adjust
+
+ * tabular.C (SetMultiColumn): make it take a Buffer* instead of a
+ Buffer const * as arg
+
+ * ParagraphList.C (erase): new function
+ * paragraph_funcs.C (mergeParagraph): use it
+ (mergeParagraph): make it take a Buffer* instead of a
+ BufferParams* as arg
+
* paragraph_funcs.C (breakParagraph): take ParagraphList::iterator
as arg
(breakParagraphConservative): ditto
// paste the paragraphs again, if possible
if (startpar->hasSameLayout(startpar->next()) ||
startpar->next()->empty()) {
- mergeParagraph(buffer->params, startpar);
+ mergeParagraph(buffer, startpar);
// this because endpar gets deleted here!
(*endpar) = startpar;
}
if ((*par)->next() == lastbuffer)
lastbuffer = *par;
- mergeParagraph(current_view->buffer()->params, *par);
+ mergeParagraph(current_view->buffer(), *par);
// store the new cursor position
*par = lastbuffer;
pos = lastbuffer->size();
// maybe some pasting
if (lastbuffer->next() && paste_the_end) {
if (lastbuffer->next()->hasSameLayout(lastbuffer)) {
- mergeParagraph(current_view->buffer()->params, lastbuffer);
+ mergeParagraph(current_view->buffer(), lastbuffer);
} else if (!lastbuffer->next()->size()) {
lastbuffer->next()->makeSameLayout(lastbuffer);
- mergeParagraph(current_view->buffer()->params, lastbuffer);
+ mergeParagraph(current_view->buffer(), lastbuffer);
} else if (!lastbuffer->size()) {
lastbuffer->makeSameLayout(lastbuffer->next());
- mergeParagraph(current_view->buffer()->params, lastbuffer);
+ mergeParagraph(current_view->buffer(), lastbuffer);
} else
lastbuffer->next()->stripLeadingSpaces();
}
}
+void ParagraphList::erase(ParagraphList::iterator it)
+{
+ Paragraph * prev = it->previous();
+ Paragraph * next = it->next();
+
+ prev->next(next);
+ next->previous(prev);
+
+ delete &*it;
+}
+
+
ParagraphList::iterator ParagraphList::begin()
{
return iterator(parlist);
///
void clear();
///
+ void erase(iterator it);
+ ///
iterator begin();
///
iterator begin() const;
+2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * insettext.C (collapseParagraphs): adjust
+ (appendParagraphs): make it take a Buffer* instead of a
+ BufferParams& as arg.
+ (appendParagraphs): adjust
+
2003-03-04 Angus Leeming <leeming@lyx.org>
* insetbibitem.C (localDispatch):
void InsetText::collapseParagraphs(BufferView * bv) const
{
- BufferParams const & bparams = bv->buffer()->params;
LyXText * llt = getLyXText(bv);
while (paragraphs.begin()->next()) {
llt->selection.end.pos() + paragraphs.begin()->size());
}
}
- mergeParagraph(bparams, &*paragraphs.begin());
+ mergeParagraph(bv->buffer(), paragraphs.begin());
}
reinitLyXText();
}
}
-void InsetText::appendParagraphs(BufferParams const & bparams,
+void InsetText::appendParagraphs(Buffer * buffer,
Paragraph * newpar)
{
+ BufferParams const & bparams = buffer->params;
Paragraph * buf;
Paragraph * tmpbuf = newpar;
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
// paste it!
lastbuffer->next(buf);
buf->previous(lastbuffer);
- mergeParagraph(bparams, lastbuffer);
+ mergeParagraph(buffer, lastbuffer);
reinitLyXText();
}
///
void getDrawFont(LyXFont &) const;
/// append text onto the existing text
- void appendParagraphs(BufferParams const & bp, Paragraph *);
+ void appendParagraphs(Buffer * bp, Paragraph *);
///
void addPreview(grfx::PreviewLoader &) const;
}
-void mergeParagraph(BufferParams const & bparams, ParagraphList::iterator par)
+void mergeParagraph(Buffer * buf, ParagraphList::iterator par)
{
+ BufferParams const & bparams = buf->params;
+
ParagraphList::iterator the_next = boost::next(par);
// first the DTP-stuff
++j;
}
- // delete the next paragraph
-#warning a ParagraphList::erase is needed. (Lgb)
- // Isn't this really just par?
- ParagraphList::iterator ppar = boost::prior(the_next);
- ParagraphList::iterator npar = boost::next(the_next);
- delete &*the_next;
- ppar->next(&*npar);
+ buf->paragraphs.erase(the_next);
}
* Append the next paragraph onto the tail of this one.
* Be careful, this doesent make any check at all.
*/
-void mergeParagraph(BufferParams const & bparams,
+void mergeParagraph(Buffer * buf,
ParagraphList::iterator par);
}
-void LyXTabular::SetMultiColumn(Buffer const * buffer, int cell, int number)
+void LyXTabular::SetMultiColumn(Buffer * buffer, int cell, int number)
{
cellinfo_of_cell(cell)->multicolumn = CELL_BEGIN_OF_MULTICOLUMN;
cellinfo_of_cell(cell)->alignment = column_info[column_of_cell(cell)].alignment;
#if 1
for (int i = 1; i < number; ++i) {
cellinfo_of_cell(cell+i)->multicolumn = CELL_PART_OF_MULTICOLUMN;
- cellinfo_of_cell(cell)->inset.appendParagraphs(buffer->params,
+ cellinfo_of_cell(cell)->inset.appendParagraphs(buffer,
cellinfo_of_cell(cell+i)->inset.paragraph());
cellinfo_of_cell(cell+i)->inset.clear(false);
}
///
bool IsMultiColumn(int cell, bool real = false) const;
///
- void SetMultiColumn(Buffer const *, int cell, int number);
+ void SetMultiColumn(Buffer *, int cell, int number);
///
int UnsetMultiColumn(int cell); // returns number of new cells
///
&& cursor.par()->getAlign() == tmppar->getAlign()) {
removeParagraph(tmprow);
removeRow(tmprow);
- mergeParagraph(bview->buffer()->params, cursor.par());
+ mergeParagraph(bview->buffer(), cursor.par());
if (!cursor.pos() || !cursor.par()->isSeparator(cursor.pos() - 1))
; //cursor.par()->insertChar(cursor.pos(), ' ');