git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6665 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-04-01 00:01:42 +00:00
parent 9d466bcfe9
commit ce1f7f2578
6 changed files with 53 additions and 55 deletions

View File

@ -1,3 +1,11 @@
2003-04-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (redoParagraphs): rewrite (with help from Alfredo) for
RowList::iterator.
* lyxtext.h (rows): drop one version and leve a const variant that
returns a RowList::iterator.
2003-03-31 Angus Leeming <leeming@lyx.org>
* text.C (fill): ensure that the signature is the same as that in the

View File

@ -1,3 +1,9 @@
2003-04-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetminipage.C (localDispatch): adjust
* insetert.C (localDispatch): adjust
2003-03-31 John Levon <levon@movementarian.org>
* insetgraphics.C:

View File

@ -455,7 +455,7 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
* taken by the text).
*/
LyXText * t = inset.getLyXText(cmd.view());
t->need_break_row = &*t->rows().begin();
t->need_break_row = t->rows().begin();
t->fullRebreak();
t->setCursorIntern(t->cursor.par(), t->cursor.pos());
inset.update(cmd.view(), true);

View File

@ -120,7 +120,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
/* FIXME: I refuse to believe we have to live
* with ugliness like this ... */
LyXText * t = inset.getLyXText(cmd.view());
t->need_break_row = &*t->rows().begin();
t->need_break_row = t->rows().begin();
t->fullRebreak();
inset.update(cmd.view(), true);
t->setCursorIntern(t->cursor.par(), t->cursor.pos());

View File

@ -247,10 +247,7 @@ public:
RowList::iterator
getRow(Paragraph * par, lyx::pos_type pos, int & y) const;
RowList & rows() {
return rowlist_;
}
RowList const & rows() const {
RowList & rows() const {
return rowlist_;
}

View File

@ -679,83 +679,72 @@ void LyXText::redoDrawingOfParagraph(LyXCursor const & cur)
void LyXText::redoParagraphs(LyXCursor const & cur,
Paragraph const * endpar)
{
Row * tmprow = cur.row();
RowList::iterator tmprit = cur.row();
int y = cur.y() - tmprow->baseline();
int y = cur.y() - tmprit->baseline();
Paragraph * first_phys_par = 0;
if (!tmprow->previous()) {
if (tmprit == rows().begin()) {
// a trick/hack for UNDO
// This is needed because in an UNDO/REDO we could have changed
// the ownerParagrah() so the paragraph inside the row is NOT
// my really first par anymore. Got it Lars ;) (Jug 20011206)
first_phys_par = ownerParagraph();
} else {
first_phys_par = tmprow->par();
// Find first row of this paragraph.
while (tmprow->previous()
&& tmprow->previous()->par() == first_phys_par)
first_phys_par = tmprit->par();
while (tmprit != rows().begin()
&& boost::prior(tmprit)->par() == first_phys_par)
{
tmprow = tmprow->previous();
y -= tmprow->height();
--tmprit;
y -= tmprit->height();
}
}
Row * prevrow = tmprow->previous();
RowList::iterator prevrit;
if (tmprit != rows().begin()) {
prevrit = boost::prior(tmprit);
} else {
prevrit = tmprit;
y = prevrit ->height();
}
// Remove all the rows until we reach endpar
// remove it
Paragraph * tmppar = 0;
if (tmprow->next())
tmppar = tmprow->next()->par();
while (tmprow->next() && tmppar != endpar) {
removeRow(tmprow->next());
if (tmprow->next()) {
tmppar = tmprow->next()->par();
if (boost::next(tmprit) != rows().end())
tmppar = boost::next(tmprit)->par();
while (boost::next(tmprit) != rows().end() && tmppar != endpar) {
removeRow(boost::next(tmprit));
if (boost::next(tmprit) != rows().end()) {
tmppar = boost::next(tmprit)->par();
} else {
tmppar = 0;
}
}
// Remove the first of the paragraphs rows.
// This is because tmprow->previous() can be 0
Row * tmprow2 = tmprow;
tmprow = tmprow->previous();
removeRow(tmprow2);
// remove the first one
RowList::iterator tmprit2 = tmprit; /* this is because tmprow->previous()
can be 0 */
++tmprit;
removeRow(tmprit2);
// Reinsert the paragraphs.
tmppar = first_phys_par;
do {
if (tmppar) {
if (!tmprow) {
insertParagraph(tmppar, rowlist_.begin());
} else {
insertParagraph(tmppar, tmprow->next());
}
if (!tmprow) {
tmprow = &*rows().begin();
}
while (tmprow->next()
&& tmprow->next()->par() == tmppar) {
tmprow = tmprow->next();
insertParagraph(tmppar, tmprit);
while (tmprit != rows().end()
&& tmprit->par() == tmppar) {
++tmprit;
}
tmppar = tmppar->next();
}
} while (tmppar && tmppar != endpar);
// this is because of layout changes
if (prevrow) {
setHeightOfRow(prevrow);
const_cast<LyXText *>(this)->postPaint(y - prevrow->height());
} else {
setHeightOfRow(rows().begin());
const_cast<LyXText *>(this)->postPaint(0);
}
setHeightOfRow(prevrit);
const_cast<LyXText *>(this)->postPaint(y - prevrit->height());
if (tmprow && tmprow->next())
setHeightOfRow(tmprow->next());
if (tmprit != rows().end() && boost::next(tmprit) != rows().end())
setHeightOfRow(boost::next(tmprit));
updateCounters();
}
@ -1230,7 +1219,6 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par)
textclass.counters().step(fl.type());
// Doesn't work... yet.
#warning use boost.format
#if USE_BOOST_FORMAT
s = boost::io::str(boost::format(_("%1$s #:")) % fl.name());
// s << boost::format(_("%1$s %1$d:")
@ -1877,8 +1865,7 @@ void LyXText::setCurrentFont()
// returns the column near the specified x-coordinate of the row
// x is set to the real beginning of this column
pos_type
LyXText::getColumnNearX(RowList::iterator rit, int & x,
bool & boundary) const
LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const
{
float tmpx = 0.0;
float fill_separator;