mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
better fix for anchorrow problem
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7555 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9a7cef54a6
commit
43637efd25
@ -76,7 +76,8 @@ void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
||||
|
||||
text->top_y(y);
|
||||
|
||||
drawFromTo(text, bv, 0, owner_.height(), 0, 0);
|
||||
// not needed in the xforms frontend anymore
|
||||
//drawFromTo(text, bv, 0, owner_.height(), 0, 0);
|
||||
repaint();
|
||||
|
||||
owner_.getPainter().end();
|
||||
|
@ -66,13 +66,8 @@ public:
|
||||
/// our buffer's default layout font
|
||||
LyXFont defaultfont_;
|
||||
private:
|
||||
/** the 'anchor' row: the position of this row remains constant
|
||||
* with respect to the top of the screen
|
||||
*/
|
||||
RowList::iterator anchor_row_;
|
||||
/** the pixel offset with respect to this row of top_y
|
||||
*/
|
||||
int anchor_row_offset_;
|
||||
/// offset of dran area to document start.
|
||||
int anchor_y_;
|
||||
public:
|
||||
/// update all cached row positions
|
||||
void updateRowPositions();
|
||||
|
33
src/text.C
33
src/text.C
@ -97,10 +97,7 @@ void LyXText::updateRowPositions()
|
||||
|
||||
int LyXText::top_y() const
|
||||
{
|
||||
if (anchor_row_ == endRow())
|
||||
return 0;
|
||||
|
||||
return anchor_row_->y() + anchor_row_offset_;
|
||||
return anchor_y_;
|
||||
}
|
||||
|
||||
|
||||
@ -109,32 +106,8 @@ void LyXText::top_y(int newy)
|
||||
if (ownerParagraphs().begin()->rows.empty())
|
||||
return;
|
||||
|
||||
if (isInInset()) {
|
||||
anchor_row_ = firstRow();
|
||||
anchor_row_offset_ = newy;
|
||||
return;
|
||||
}
|
||||
|
||||
lyxerr[Debug::GUI] << "setting top y = " << newy << endl;
|
||||
|
||||
int y = newy;
|
||||
ParagraphList::iterator dummypit;
|
||||
anchor_row_ = getRowNearY(y, dummypit);
|
||||
anchor_row_offset_ = newy - y;
|
||||
lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_
|
||||
<< " offset: " << anchor_row_offset_ << endl;
|
||||
}
|
||||
|
||||
|
||||
void LyXText::anchor_row(RowList::iterator rit)
|
||||
{
|
||||
int old_y = top_y();
|
||||
anchor_row_offset_ = 0;
|
||||
anchor_row_ = rit;
|
||||
anchor_row_offset_ = old_y - top_y();
|
||||
lyxerr[Debug::GUI] << "anchor_row(): changing reference to row: "
|
||||
<< &*anchor_row_ << " offset: "
|
||||
<< anchor_row_offset_ << endl;
|
||||
anchor_y_ = newy;
|
||||
lyxerr[Debug::GUI] << "changing reference to offset: " << anchor_y_ << endl;
|
||||
}
|
||||
|
||||
|
||||
|
32
src/text2.C
32
src/text2.C
@ -60,19 +60,15 @@ using lyx::pos_type;
|
||||
|
||||
|
||||
LyXText::LyXText(BufferView * bv)
|
||||
: height(0), width(0), anchor_row_offset_(0),
|
||||
: height(0), width(0), anchor_y_(0),
|
||||
inset_owner(0), the_locking_inset(0), bv_owner(bv)
|
||||
{
|
||||
anchor_row_ = endRow();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
LyXText::LyXText(BufferView * bv, InsetText * inset)
|
||||
: height(0), width(0), anchor_row_offset_(0),
|
||||
: height(0), width(0), anchor_y_(0),
|
||||
inset_owner(inset), the_locking_inset(0), bv_owner(bv)
|
||||
{
|
||||
anchor_row_ = endRow();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void LyXText::init(BufferView * bview)
|
||||
@ -87,8 +83,7 @@ void LyXText::init(BufferView * bview)
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
anchor_row_ = endRow();
|
||||
anchor_row_offset_ = 0;
|
||||
anchor_y_ = 0;
|
||||
|
||||
current_font = getFont(beg, 0);
|
||||
|
||||
@ -559,12 +554,9 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
|
||||
RowList::iterator end = pit->rows.end();
|
||||
|
||||
// remove rows of paragraph
|
||||
int anchor_cnt = -1;
|
||||
for (int i = 0; rit != end; ++rit, ++i) {
|
||||
if (rit == anchor_row_)
|
||||
anchor_cnt = i;
|
||||
for (int i = 0; rit != end; ++rit, ++i)
|
||||
height -= rit->height();
|
||||
}
|
||||
|
||||
pit->rows.clear();
|
||||
|
||||
// rebreak the paragraph
|
||||
@ -589,13 +581,6 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
|
||||
setHeightOfRow(pit, tmprow);
|
||||
}
|
||||
|
||||
if (anchor_cnt == -1) {
|
||||
if (anchor_cnt >= pit->rows.size())
|
||||
anchor_cnt = pit->rows.size();
|
||||
anchor_row_ = pit->rows.begin();
|
||||
advance(anchor_row_, anchor_cnt);
|
||||
}
|
||||
|
||||
//lyxerr << "redoParagraph: " << pit->rows.size() << " rows\n";
|
||||
}
|
||||
|
||||
@ -617,8 +602,7 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
anchor_row_ = endRow();
|
||||
anchor_row_offset_ = 0;
|
||||
//anchor_y_ = 0;
|
||||
|
||||
ParagraphList::iterator pit = ownerParagraphs().begin();
|
||||
ParagraphList::iterator end = ownerParagraphs().end();
|
||||
|
Loading…
Reference in New Issue
Block a user