make init of the lyxtext explicit

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2194 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-07-06 15:41:17 +00:00
parent ec5d8718c5
commit 217e8059ae
4 changed files with 28 additions and 88 deletions

View File

@ -305,6 +305,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
the_locking_inset = bv_->theLockingInset();
delete bv_->text;
bv_->text = new LyXText(bv_);
bv_->text->init(bv_);
} else {
// See if we have a text in TextCache that fits
// the new buffer_ with the correct width.
@ -320,6 +321,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
textcache.show(lyxerr, "resizeCurrentBuffer");
} else {
bv_->text = new LyXText(bv_);
bv_->text->init(bv_);
}
}
updateScreen();

View File

@ -1,3 +1,12 @@
2001-07-06 Lars Gullik Bjønnes <larsbj@birdstep.com>
* BufferView_pimpl.C (resizeCurrentBuffer): init the new LyXText
* text2.C (LyXText): use initialization lists.
* lyxtext.h (Selection): initialize set_ and mark_
(init): remove method
2001-07-05 Dekel Tsur <dekelts@tau.ac.il>
* LaTeX.C (scanLogFile): Parse rerun messages from latex packages.

View File

@ -223,6 +223,9 @@ public:
/** The structrue that keeps track of the selections set. */
struct Selection {
Selection()
: set_(false), mark_(false)
{}
bool set() const {
return set_;
}
@ -511,8 +514,6 @@ public:
(bidi_start <= pos && pos <= bidi_end);
}
private:
///
void init();
///
mutable Row * firstrow;
///

View File

@ -49,78 +49,21 @@ using std::pair;
LyXText::LyXText(BufferView * bv)
{
bv_owner = bv;
inset_owner = 0;
init();
}
: number_of_rows(0), height(0), width(0), first(0),
bv_owner(bv), inset_owner(0), the_locking_inset(0),
need_break_row(0), refresh_y(0), status(LyXText::UNCHANGED),
undo_finished(true), undo_frozen(false), firstrow(0), lastrow(0),
copylayouttype(0)
{}
LyXText::LyXText(InsetText * inset)
{
inset_owner = inset;
bv_owner = 0;
init();
}
void LyXText::init()
{
the_locking_inset = 0;
firstrow = 0;
lastrow = 0;
number_of_rows = 0;
refresh_y = 0;
height = 0;
width = 0;
first = 0;
status = LyXText::UNCHANGED;
// set cursor at the very top position
selection.set(true); /* these setting is necessary
because of the delete-empty-
paragraph mechanism in
SetCursor */
if (bv_owner) {
Paragraph * par = ownerParagraph();
current_font = getFont(bv_owner->buffer(), par, 0);
while (par) {
insertParagraph(bv_owner, par, lastrow);
par = par->next();
}
setCursor(bv_owner, firstrow->par(), 0);
} else
current_font = LyXFont(LyXFont::ALL_SANE);
selection.cursor = cursor;
selection.set(false);
selection.mark(false);
// no rebreak necessary
need_break_row = 0;
undo_finished = true;
undo_frozen = false;
// Default layouttype for copy environment type
copylayouttype = 0;
#if 0
// Dump all rowinformation:
Row * tmprow = firstrow;
lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n";
while (tmprow) {
lyxerr << tmprow->baseline() << '\t'
<< tmprow->par << '\t'
<< tmprow->pos() << '\t'
<< tmprow->height << '\t'
<< tmprow->ascent_of_text << '\t'
<< tmprow->fill << '\n';
tmprow = tmprow->next();
}
lyxerr.flush();
#endif
}
: number_of_rows(0), height(0), width(0), first(0),
bv_owner(0), inset_owner(inset), the_locking_inset(0),
need_break_row(0), refresh_y(0), status(LyXText::UNCHANGED),
undo_finished(true), undo_frozen(false), firstrow(0), lastrow(0),
copylayouttype(0)
{}
void LyXText::init(BufferView * bview)
@ -136,25 +79,9 @@ void LyXText::init(BufferView * bview)
}
setCursorIntern(bview, firstrow->par(), 0);
selection.cursor = cursor;
#if 0
printf("TP = %x\n",inset_owner->owner());
// Dump all rowinformation:
Row * tmprow = firstrow;
lyxerr << "Width = " << width << endl;
lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n";
while (tmprow) {
lyxerr << tmprow->baseline() << '\t'
<< tmprow->par() << '\t'
<< tmprow->pos() << '\t'
<< tmprow->height() << '\t'
<< tmprow->ascent_of_text() << '\t'
<< tmprow->fill() << '\n';
tmprow = tmprow->next();
}
lyxerr.flush();
#endif
}
LyXText::~LyXText()
{
// Delete all rows, this does not touch the paragraphs!
@ -298,6 +225,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
par->setFont(pos, font);
}
void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
Paragraph::size_type pos, LyXFont const & fnt)
{