mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
add ParagraphList::erase, make mergeParagraph take a Buffer* arg, adjust other funcs to suit
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6344 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4bc6c8ebd5
commit
30a9dd7f98
@ -1,5 +1,20 @@
|
||||
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
|
||||
|
@ -165,7 +165,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
|
||||
// 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;
|
||||
}
|
||||
@ -377,20 +377,20 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
|
||||
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();
|
||||
}
|
||||
|
@ -95,6 +95,18 @@ void ParagraphList::clear()
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
///
|
||||
void clear();
|
||||
///
|
||||
void erase(iterator it);
|
||||
///
|
||||
iterator begin();
|
||||
///
|
||||
iterator begin() const;
|
||||
|
@ -1,3 +1,10 @@
|
||||
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):
|
||||
|
@ -2770,7 +2770,6 @@ bool InsetText::checkInsertChar(LyXFont & font)
|
||||
|
||||
void InsetText::collapseParagraphs(BufferView * bv) const
|
||||
{
|
||||
BufferParams const & bparams = bv->buffer()->params;
|
||||
LyXText * llt = getLyXText(bv);
|
||||
|
||||
while (paragraphs.begin()->next()) {
|
||||
@ -2791,7 +2790,7 @@ void InsetText::collapseParagraphs(BufferView * bv) const
|
||||
llt->selection.end.pos() + paragraphs.begin()->size());
|
||||
}
|
||||
}
|
||||
mergeParagraph(bparams, &*paragraphs.begin());
|
||||
mergeParagraph(bv->buffer(), paragraphs.begin());
|
||||
}
|
||||
reinitLyXText();
|
||||
}
|
||||
@ -2805,9 +2804,10 @@ void InsetText::getDrawFont(LyXFont & font) const
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@ -2837,7 +2837,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
|
||||
// paste it!
|
||||
lastbuffer->next(buf);
|
||||
buf->previous(lastbuffer);
|
||||
mergeParagraph(bparams, lastbuffer);
|
||||
mergeParagraph(buffer, lastbuffer);
|
||||
|
||||
reinitLyXText();
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
///
|
||||
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;
|
||||
|
@ -154,8 +154,10 @@ void breakParagraphConservative(BufferParams const & bparams,
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
@ -173,13 +175,7 @@ void mergeParagraph(BufferParams const & bparams, ParagraphList::iterator par)
|
||||
++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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ void breakParagraphConservative(BufferParams const & bparams,
|
||||
* 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);
|
||||
|
||||
|
||||
|
@ -1542,7 +1542,7 @@ LyXTabular::cellstruct * LyXTabular::cellinfo_of_cell(int cell) const
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@ -1552,7 +1552,7 @@ void LyXTabular::SetMultiColumn(Buffer const * buffer, int cell, int number)
|
||||
#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);
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ public:
|
||||
///
|
||||
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
|
||||
///
|
||||
|
@ -2440,7 +2440,7 @@ void LyXText::backspace(BufferView * bview)
|
||||
&& 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(), ' ');
|
||||
|
Loading…
Reference in New Issue
Block a user