mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
The rowlist1 patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6644 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
473e2d7b76
commit
00488a1f56
@ -1,3 +1,17 @@
|
||||
2003-03-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* text2.C (init): use rowlist_.end() and not 0.
|
||||
(insertRow): change to take a RowList::iterator as arg, adjust
|
||||
for this.
|
||||
(insertParagraph): change to take a RowList::iterator as arg,
|
||||
adjust for this.
|
||||
(redoParagraphs): remove some debug msgs.
|
||||
|
||||
* text.C (appendParagraph): change to take a RowList::iterator
|
||||
arg, adjust for this.
|
||||
(breakAgain): add an assert
|
||||
(breakAgainOneRow): ditto
|
||||
|
||||
2003-03-29 John Levon <levon@movementarian.org>
|
||||
|
||||
* text2.C: do not clear selection after inc/decDepth
|
||||
|
@ -510,8 +510,9 @@ private:
|
||||
|
||||
/** inserts a new row behind the specified row, increments
|
||||
the touched counters */
|
||||
void insertRow(Row * row, Paragraph * par, lyx::pos_type pos);
|
||||
|
||||
RowList::iterator
|
||||
insertRow(RowList::iterator rowit,
|
||||
Paragraph * par, lyx::pos_type pos);
|
||||
/// removes the row and reset the touched counters
|
||||
void removeRow(Row * row);
|
||||
|
||||
@ -519,11 +520,11 @@ private:
|
||||
void removeParagraph(Row * row);
|
||||
|
||||
/// insert the specified paragraph behind the specified row
|
||||
void insertParagraph(Paragraph * par, Row * row);
|
||||
void insertParagraph(Paragraph * par, RowList::iterator rowit);
|
||||
|
||||
/** appends the implizit specified paragraph behind the specified row,
|
||||
* start at the implizit given position */
|
||||
void appendParagraph(Row * row);
|
||||
void appendParagraph(RowList::iterator rowit);
|
||||
|
||||
///
|
||||
void breakAgain(Row * row);
|
||||
|
19
src/text.C
19
src/text.C
@ -1312,20 +1312,21 @@ void LyXText::setHeightOfRow(Row * row)
|
||||
|
||||
// Appends the implicit specified paragraph before the specified row,
|
||||
// start at the implicit given position
|
||||
void LyXText::appendParagraph(Row * row)
|
||||
void LyXText::appendParagraph(RowList::iterator rowit)
|
||||
{
|
||||
pos_type const last = row->par()->size();
|
||||
lyx::Assert(rowit != rowlist_.end());
|
||||
|
||||
pos_type const last = rowit->par()->size();
|
||||
bool done = false;
|
||||
|
||||
do {
|
||||
pos_type z = rowBreakPoint(*row);
|
||||
pos_type z = rowBreakPoint(*rowit);
|
||||
|
||||
Row * tmprow = row;
|
||||
RowList::iterator tmprow = rowit;
|
||||
|
||||
if (z < last) {
|
||||
++z;
|
||||
insertRow(row, row->par(), z);
|
||||
row = row->next();
|
||||
rowit = insertRow(rowit, rowit->par(), z);
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
@ -1334,7 +1335,7 @@ void LyXText::appendParagraph(Row * row)
|
||||
// fixed fill setting now by calling inset->update() in
|
||||
// SingleWidth when needed!
|
||||
tmprow->fill(fill(*tmprow, workWidth()));
|
||||
setHeightOfRow(tmprow);
|
||||
setHeightOfRow(&*tmprow);
|
||||
|
||||
} while (!done);
|
||||
}
|
||||
@ -1342,6 +1343,8 @@ void LyXText::appendParagraph(Row * row)
|
||||
|
||||
void LyXText::breakAgain(Row * row)
|
||||
{
|
||||
lyx::Assert(row);
|
||||
|
||||
bool not_ready = true;
|
||||
|
||||
do {
|
||||
@ -1387,6 +1390,8 @@ void LyXText::breakAgain(Row * row)
|
||||
// this is just a little changed version of break again
|
||||
void LyXText::breakAgainOneRow(Row * row)
|
||||
{
|
||||
lyx::Assert(row);
|
||||
|
||||
pos_type z = rowBreakPoint(*row);
|
||||
Row * tmprow = row;
|
||||
|
||||
|
28
src/text2.C
28
src/text2.C
@ -88,7 +88,7 @@ void LyXText::init(BufferView * bview, bool reinit)
|
||||
|
||||
while (par) {
|
||||
if (rowlist_.empty())
|
||||
insertParagraph(par, 0);
|
||||
insertParagraph(par, rowlist_.end());
|
||||
else
|
||||
insertParagraph(par, lastRow());
|
||||
par = par->next();
|
||||
@ -263,18 +263,18 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
|
||||
|
||||
// inserts a new row before the specified row, increments
|
||||
// the touched counters
|
||||
void LyXText::insertRow(Row * row, Paragraph * par,
|
||||
RowList::iterator
|
||||
LyXText::insertRow(RowList::iterator rowit, Paragraph * par,
|
||||
pos_type pos)
|
||||
{
|
||||
Row * tmprow = new Row;
|
||||
tmprow->par(par);
|
||||
tmprow->pos(pos);
|
||||
|
||||
if (!row) {
|
||||
rowlist_.insert(rowlist_.begin(), tmprow);
|
||||
} else {
|
||||
rowlist_.insert(row->next(), tmprow);
|
||||
}
|
||||
if (rowit == rowlist_.end())
|
||||
return rowlist_.insert(rowlist_.begin(), tmprow);
|
||||
else
|
||||
return rowlist_.insert(boost::next(rowit), tmprow);
|
||||
}
|
||||
|
||||
|
||||
@ -326,17 +326,13 @@ void LyXText::removeParagraph(Row * row)
|
||||
}
|
||||
|
||||
|
||||
void LyXText::insertParagraph(Paragraph * par, Row * row)
|
||||
void LyXText::insertParagraph(Paragraph * par, RowList::iterator rowit)
|
||||
{
|
||||
// insert a new row, starting at position 0
|
||||
insertRow(row, par, 0);
|
||||
RowList::iterator rit = insertRow(rowit, par, 0);
|
||||
|
||||
// and now append the whole paragraph before the new row
|
||||
if (!row) {
|
||||
appendParagraph(firstRow());
|
||||
} else {
|
||||
appendParagraph(row->next());
|
||||
}
|
||||
appendParagraph(rit);
|
||||
}
|
||||
|
||||
|
||||
@ -715,11 +711,8 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
|
||||
// the ownerParagrah() so the paragraph inside the row is NOT
|
||||
// my really first par anymore. Got it Lars ;) (Jug 20011206)
|
||||
first_phys_par = ownerParagraph();
|
||||
lyxerr << "ownerParagraph" << endl;
|
||||
|
||||
} else {
|
||||
first_phys_par = tmprow->par();
|
||||
lyxerr << "tmprow->par()" << endl;
|
||||
|
||||
// Find first row of this paragraph.
|
||||
while (tmprow->previous()
|
||||
@ -756,6 +749,7 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
|
||||
do {
|
||||
if (tmppar) {
|
||||
insertParagraph(tmppar, tmprow);
|
||||
|
||||
if (!tmprow) {
|
||||
tmprow = firstRow();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user