mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Update/cursor and drawing fixes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2405 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
297697dd70
commit
aae301e9cd
@ -89,9 +89,9 @@ void BufferView::redraw()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::fitCursor(LyXText * text)
|
||||
void BufferView::fitCursor()
|
||||
{
|
||||
pimpl_->fitCursor(text);
|
||||
pimpl_->fitCursor();
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
///
|
||||
void redraw();
|
||||
///
|
||||
void fitCursor(LyXText *);
|
||||
void fitCursor();
|
||||
///
|
||||
void update();
|
||||
//
|
||||
|
@ -256,7 +256,7 @@ void BufferView::Pimpl::redraw()
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::Pimpl::fitCursor(LyXText * text)
|
||||
bool BufferView::Pimpl::fitCursor()
|
||||
{
|
||||
lyx::Assert(screen_.get());
|
||||
|
||||
@ -266,7 +266,7 @@ bool BufferView::Pimpl::fitCursor(LyXText * text)
|
||||
bv_->theLockingInset()->fitInsetCursor(bv_);
|
||||
ret = true;
|
||||
} else {
|
||||
ret = screen_->fitCursor(text, bv_);
|
||||
ret = screen_->fitCursor(bv_->text, bv_);
|
||||
}
|
||||
|
||||
bv_->owner()->getDialogs()->updateParagraph();
|
||||
@ -558,7 +558,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
|
||||
|
||||
bv_->text->setSelection(bv_);
|
||||
screen_->toggleToggle(bv_->text, bv_);
|
||||
fitCursor(bv_->text);
|
||||
fitCursor();
|
||||
#if 0
|
||||
screen_->showCursor(bv_->text, bv_);
|
||||
#else
|
||||
@ -621,7 +621,11 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
screen_->toggleSelection(bv_->text, bv_);
|
||||
bv_->text->clearSelection();
|
||||
bv_->text->fullRebreak(bv_);
|
||||
#if 0
|
||||
screen_->update(bv_->text, bv_);
|
||||
#else
|
||||
update();
|
||||
#endif
|
||||
updateScrollbar();
|
||||
|
||||
// Single left click in math inset?
|
||||
@ -650,7 +654,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
bv_->text->cursor.x_fix(bv_->text->cursor.x());
|
||||
|
||||
owner_->updateLayoutChoice();
|
||||
if (fitCursor(bv_->text)) {
|
||||
if (fitCursor()) {
|
||||
selection_possible = false;
|
||||
}
|
||||
|
||||
@ -943,7 +947,7 @@ void BufferView::Pimpl::workAreaExpose()
|
||||
// fitCursor() ensures we don't jump back
|
||||
// to the start of the document on vertical
|
||||
// resize
|
||||
fitCursor(bv_->text);
|
||||
fitCursor();
|
||||
|
||||
// The main window size has changed, repaint most stuff
|
||||
redraw();
|
||||
@ -966,7 +970,18 @@ void BufferView::Pimpl::update()
|
||||
if (screen_.get() &&
|
||||
(!bv_->theLockingInset() || !bv_->theLockingInset()->nodraw()))
|
||||
{
|
||||
LyXText::text_status st = bv_->text->status();
|
||||
screen_->update(bv_->text, bv_);
|
||||
while(bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
if (bv_->text->fullRebreak(bv_)) {
|
||||
st = LyXText::NEED_MORE_REFRESH;
|
||||
bv_->text->setCursor(bv_, bv_->text->cursor.par(),
|
||||
bv_->text->cursor.pos());
|
||||
fitCursor();
|
||||
}
|
||||
bv_->text->status(bv_, st);
|
||||
screen_->update(bv_->text, bv_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1026,7 +1041,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
|
||||
}
|
||||
|
||||
if ((f & FITCUR)) {
|
||||
fitCursor(text);
|
||||
fitCursor();
|
||||
}
|
||||
|
||||
if ((f & CHANGE)) {
|
||||
@ -1060,7 +1075,7 @@ void BufferView::Pimpl::cursorToggle()
|
||||
}
|
||||
|
||||
if (!bv_->theLockingInset()) {
|
||||
screen_->cursorToggle(bv_->text, bv_);
|
||||
screen_->cursorToggle(bv_);
|
||||
} else {
|
||||
bv_->theLockingInset()->toggleInsetCursor(bv_);
|
||||
}
|
||||
@ -2985,8 +3000,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
case LFUN_INDEX_CREATE:
|
||||
{
|
||||
InsetCommandParams p("index");
|
||||
LyXText * lt = bv_->getLyXText();
|
||||
|
||||
if (argument.empty()) {
|
||||
string const idxstring(bv_->getLyXText()->getStringToIndex(bv_));
|
||||
if (!idxstring.empty())
|
||||
|
@ -37,7 +37,7 @@ struct BufferView::Pimpl : public SigC::Object {
|
||||
///
|
||||
void redraw();
|
||||
/// Return true if the cursor was fitted.
|
||||
bool fitCursor(LyXText *);
|
||||
bool fitCursor();
|
||||
///
|
||||
void redoCurrentBuffer();
|
||||
///
|
||||
|
@ -1,3 +1,13 @@
|
||||
2001-08-02 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* BufferView_pimpl.C (update): redone this function so that we
|
||||
update the text again if there was a CHANGE_IN_DRAW.
|
||||
|
||||
* screen.C (cursorToggle): removed LyXText parameter and recoded.
|
||||
(drawFromTo): added a new internal bool which is used by draw() and
|
||||
redraw() function.
|
||||
(general): some cursor drawing problems fixed.
|
||||
|
||||
2001-08-01 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* lyxfind.C (LyXFind): fixed
|
||||
|
@ -3454,7 +3454,7 @@ int Buffer::runChktex()
|
||||
// error insets after we ran chktex, this must be run:
|
||||
if (removedErrorInsets || res){
|
||||
users->redraw();
|
||||
users->fitCursor(users->text);
|
||||
users->fitCursor();
|
||||
}
|
||||
users->owner()->allowInput();
|
||||
|
||||
@ -3761,7 +3761,7 @@ void Buffer::resizeInsets(BufferView * bv)
|
||||
void Buffer::redraw()
|
||||
{
|
||||
users->redraw();
|
||||
users->fitCursor(users->text);
|
||||
users->fitCursor();
|
||||
}
|
||||
|
||||
|
||||
|
@ -800,7 +800,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
|
||||
}
|
||||
if (need_redraw) {
|
||||
bv->redraw();
|
||||
bv->fitCursor(bv->text);
|
||||
bv->fitCursor();
|
||||
}
|
||||
bv->owner()->allowInput();
|
||||
}
|
||||
@ -867,7 +867,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
// error insets after we ran LaTeX this must be run:
|
||||
if (need_redraw) {
|
||||
bv->redraw();
|
||||
bv->fitCursor(bv->text);
|
||||
bv->fitCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,5 +50,5 @@ void ControlBibitem::applyParamsToInset()
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibKey width could have changed
|
||||
lv_.view()->redraw();
|
||||
lv_.view()->fitCursor(lv_.view()->getLyXText());
|
||||
lv_.view()->fitCursor();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void ControlBibtex::applyParamsToInset()
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibKey width could have changed
|
||||
lv_.view()->redraw();
|
||||
lv_.view()->fitCursor(lv_.view()->getLyXText());
|
||||
lv_.view()->fitCursor();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
2001-08-02 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.C (draw): clear the background with the right color if
|
||||
needed. Update myself if x&max-width changed and return without doing
|
||||
anything. Let the update code handle the right stuff.
|
||||
|
||||
* insetminipage.C (getMaxWidth): fixed returning of maxwidth when
|
||||
inside another inset.
|
||||
|
||||
2001-08-01 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insetcollapsable.C (update): added an in_update bool so we avoid
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
void insetKeyPress(XKeyEvent *);
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
||||
string const &);
|
||||
string const &);
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
bool fragile, bool free_spc) const;
|
||||
|
@ -61,7 +61,7 @@ void InsetLabel::edit(BufferView * bv, int, int, unsigned int)
|
||||
bv->text->redoParagraph(bv);
|
||||
if (flag) {
|
||||
bv->redraw();
|
||||
bv->fitCursor(getLyXText(bv));
|
||||
bv->fitCursor();
|
||||
} else
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
|
||||
|
||||
|
||||
void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
|
||||
int button)
|
||||
int button)
|
||||
{
|
||||
if (button == 3) {
|
||||
showInsetDialog(bv);
|
||||
@ -334,8 +334,13 @@ void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
|
||||
int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
|
||||
const
|
||||
{
|
||||
if (!width_.empty())
|
||||
return VSpace(width_).inPixels(bv);
|
||||
if (!width_.empty()) {
|
||||
int ww1 = VSpace(width_).inPixels(bv);
|
||||
int ww2 = InsetCollapsable::getMaxWidth(bv, inset);
|
||||
if (ww2 > 0 && ww2 < ww1)
|
||||
return ww2;
|
||||
return ww1;
|
||||
}
|
||||
// this should not happen!
|
||||
return InsetCollapsable::getMaxWidth(bv, inset);
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
|
||||
sstate.selendboundary = t->selection.end.boundary();
|
||||
sstate.selection = t->selection.set();
|
||||
sstate.mark_set = t->selection.mark();
|
||||
sstate.refresh = t->refresh_row != 0;
|
||||
}
|
||||
|
||||
void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
|
||||
@ -102,6 +103,8 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
|
||||
t->selection.cursor = t->cursor;
|
||||
t->selection.set(false);
|
||||
}
|
||||
if (sstate.refresh) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,6 +320,32 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
return;
|
||||
|
||||
Painter & pain = bv->painter();
|
||||
|
||||
// this is the first thing we have to ask because if the x pos
|
||||
// changed we have to do a complete rebreak of the text as we
|
||||
// may have few space to draw in. Well we should check on this too
|
||||
if (top_x != int(x)) {
|
||||
int old_x = top_x;
|
||||
top_x = int(x);
|
||||
int nw = getMaxWidth(bv, this);
|
||||
if (nw > 0 && old_max_width != nw) {
|
||||
need_update = INIT;
|
||||
old_max_width = nw;
|
||||
bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
|
||||
return;
|
||||
} else {
|
||||
top_x = old_x;
|
||||
}
|
||||
// dummy calls so that the values are again right
|
||||
(void)ascent(bv, f);
|
||||
(void)descent(bv, f);
|
||||
(void)width(bv, f);
|
||||
}
|
||||
|
||||
// repaint the background if needed
|
||||
if (cleared && backgroundColor() != LColor::background) {
|
||||
clearInset(pain, baseline, cleared);
|
||||
}
|
||||
|
||||
// no draw is necessary !!!
|
||||
if ((drawFrame_ == LOCKED) && !locked && !par->size()) {
|
||||
@ -341,24 +370,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
(last_drawn_width!=insetWidth))) {
|
||||
clearInset(pain, baseline, cleared);
|
||||
}
|
||||
top_x = int(x);
|
||||
if (cleared)
|
||||
frame_is_visible = false;
|
||||
|
||||
if (!cleared && (need_update == NONE))
|
||||
return;
|
||||
|
||||
if (top_x != int(x)) {
|
||||
if ((getMaxWidth(bv, this) > 0) &&
|
||||
(getLyXText(bv)->width != old_max_width)) {
|
||||
resizeLyXText(bv);
|
||||
need_update |= FULL;
|
||||
old_max_width = getLyXText(bv)->width;
|
||||
bv->text->status(bv, LyXText::CHANGED_IN_DRAW);
|
||||
}
|
||||
top_x = int(x);
|
||||
clearInset(pain, baseline, cleared);
|
||||
}
|
||||
|
||||
// lyxerr << "InsetText::draw[" << this << "](" << need_update << ":" << int(x) << ":" << top_x << ")\n";
|
||||
|
||||
if (cleared || (last_drawn_width != insetWidth)) {
|
||||
@ -377,7 +395,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
inset_y = cy(bv) + drawTextYOffset;
|
||||
}
|
||||
if (!cleared && (need_update == CURSOR)
|
||||
&& !getLyXText(bv)->selection.set()) {
|
||||
&& !getLyXText(bv)->selection.set())
|
||||
{
|
||||
drawFrame(pain, cleared);
|
||||
x += last_width; // was width(bv, f);
|
||||
need_update = NONE;
|
||||
@ -404,7 +423,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
if (y_offset < 0)
|
||||
y_offset = y;
|
||||
lt->first = first;
|
||||
if (cleared) {
|
||||
if (cleared || (need_update&=(INIT|FULL))) {
|
||||
int yf = y_offset;
|
||||
y = 0;
|
||||
while ((row != 0) && (yf < ph)) {
|
||||
@ -454,10 +473,10 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
void InsetText::drawFrame(Painter & pain, bool cleared) const
|
||||
{
|
||||
if (!frame_is_visible || cleared) {
|
||||
frame_x = top_x + 1;
|
||||
frame_y = top_baseline - insetAscent + 1;
|
||||
frame_w = insetWidth - 1;
|
||||
frame_h = insetAscent + insetDescent - 1;
|
||||
frame_x = top_x; // + 1;
|
||||
frame_y = top_baseline - insetAscent; // + 1;
|
||||
frame_w = last_width; // - 2;
|
||||
frame_h = insetAscent + insetDescent; // - 2;
|
||||
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
|
||||
frame_color);
|
||||
frame_is_visible = true;
|
||||
@ -1501,7 +1520,7 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
|
||||
(cpar(bv)->getInset(cpos(bv)) != inset))
|
||||
lt->cursorLeft(bv);
|
||||
#endif
|
||||
bv->fitCursor(lt);
|
||||
bv->fitCursor();
|
||||
updateLocal(bv, CURSOR_PAR|CURSOR, true);
|
||||
showInsetCursor(bv);
|
||||
if (clear)
|
||||
@ -1578,14 +1597,10 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||
}
|
||||
if (selectall)
|
||||
selectAll(bv);
|
||||
#if 1
|
||||
lt->toggleFree(bv, font, toggleall);
|
||||
#else
|
||||
lt->setFont(bv, font, toggleall);
|
||||
#endif
|
||||
if (selectall)
|
||||
lt->clearSelection();
|
||||
bv->fitCursor(lt);
|
||||
bv->fitCursor();
|
||||
if (selectall || lt->selection.set())
|
||||
updateLocal(bv, FULL, true);
|
||||
else
|
||||
@ -1662,7 +1677,6 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
|
||||
}
|
||||
w -= (2 * TEXT_TO_INSET_OFFSET);
|
||||
return w - top_x;
|
||||
// return w - (2*TEXT_TO_INSET_OFFSET);
|
||||
}
|
||||
|
||||
|
||||
@ -1878,7 +1892,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
||||
if (!owner())
|
||||
updateLocal(bv, FULL, false);
|
||||
else
|
||||
need_update = FULL;
|
||||
need_update |= FULL;
|
||||
// this will scroll the screen such that the cursor becomes visible
|
||||
bv->updateScrollbar();
|
||||
}
|
||||
@ -1980,8 +1994,7 @@ void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const
|
||||
h = pain.paperHeight();
|
||||
if ((top_x + drawTextXOffset + w) > pain.paperWidth())
|
||||
w = pain.paperWidth();
|
||||
pain.fillRectangle(top_x+drawTextXOffset, ty, w, h,
|
||||
backgroundColor());
|
||||
pain.fillRectangle(top_x+drawTextXOffset, ty, w, h, backgroundColor());
|
||||
cleared = true;
|
||||
need_update = FULL;
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ private:
|
||||
///
|
||||
mutable int inset_y;
|
||||
///
|
||||
mutable unsigned int old_max_width;
|
||||
mutable int old_max_width;
|
||||
///
|
||||
bool no_selection;
|
||||
///
|
||||
@ -382,6 +382,7 @@ private:
|
||||
bool selendboundary;
|
||||
bool selection;
|
||||
bool mark_set;
|
||||
bool refresh;
|
||||
} sstate;
|
||||
///
|
||||
// this is needed globally so we know that we're using it actually and
|
||||
|
@ -1132,7 +1132,7 @@ string const LyXFunc::dispatch(int ac,
|
||||
case LFUN_REMOVEERRORS:
|
||||
if (owner->view()->removeAutoInsets()) {
|
||||
owner->view()->redraw();
|
||||
owner->view()->fitCursor(TEXT());
|
||||
owner->view()->fitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
///
|
||||
void hideCursor();
|
||||
///
|
||||
void cursorToggle(LyXText const *, BufferView const *);
|
||||
void cursorToggle(BufferView *) const;
|
||||
///
|
||||
void showManualCursor(LyXText const *, int x, int y,
|
||||
int asc, int desc,
|
||||
@ -102,7 +102,7 @@ private:
|
||||
|
||||
/// y1 and y2 are coordinates of the screen
|
||||
void drawFromTo(LyXText *, BufferView *, int y1, int y2,
|
||||
int y_offset = 0, int x_offset = 0);
|
||||
int y_offset = 0, int x_offset = 0, bool internal=false);
|
||||
|
||||
/// y is a coordinate of the text
|
||||
void drawOneRow(LyXText *, BufferView *, Row * row,
|
||||
|
@ -174,10 +174,10 @@ public:
|
||||
|
||||
/** Completes the insertion with a full rebreak.
|
||||
Returns true if something was broken. */
|
||||
bool fullRebreak(BufferView *);
|
||||
bool fullRebreak(BufferView *);
|
||||
|
||||
///
|
||||
Row * need_break_row;
|
||||
mutable Row * need_break_row;
|
||||
///
|
||||
mutable int refresh_y;
|
||||
///
|
||||
|
62
src/screen.C
62
src/screen.C
@ -89,11 +89,11 @@ void LyXScreen::setCursorColor()
|
||||
|
||||
void LyXScreen::redraw(LyXText * text, BufferView * bv)
|
||||
{
|
||||
drawFromTo(text, bv, 0, owner.height());
|
||||
drawFromTo(text, bv, 0, owner.height(), 0, 0, text == bv->text);
|
||||
expose(0, 0, owner.workWidth(), owner.height());
|
||||
if (cursor_visible) {
|
||||
cursor_visible = false;
|
||||
showCursor(text, bv);
|
||||
bv->showCursor();
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,8 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height)
|
||||
|
||||
|
||||
void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
int y1, int y2, int y_offset, int x_offset)
|
||||
int y1, int y2, int y_offset, int x_offset,
|
||||
bool internal)
|
||||
{
|
||||
int y_text = text->first + y1;
|
||||
|
||||
@ -124,13 +125,19 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
// y1 is now the real beginning of row on the screen
|
||||
|
||||
while (row != 0 && y < y2) {
|
||||
LyXText::text_status st = bv->text->status();
|
||||
do {
|
||||
bv->text->status(bv, st);
|
||||
LyXText::text_status st = text->status();
|
||||
text->getVisibleRow(bv, y + y_offset,
|
||||
x_offset, row, y + text->first);
|
||||
while(internal && text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
if (text->fullRebreak(bv)) {
|
||||
st = LyXText::NEED_MORE_REFRESH;
|
||||
text->setCursor(bv, text->cursor.par(), text->cursor.pos());
|
||||
bv->fitCursor();
|
||||
}
|
||||
text->status(bv, st);
|
||||
text->getVisibleRow(bv, y + y_offset,
|
||||
x_offset, row, y + text->first);
|
||||
} while (bv->text->status() == LyXText::CHANGED_IN_DRAW);
|
||||
bv->text->status(bv, st);
|
||||
x_offset, row, y + text->first);
|
||||
}
|
||||
y += row->height();
|
||||
row = row->next();
|
||||
}
|
||||
@ -154,32 +161,39 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row,
|
||||
if (((y + row->height()) > 0) &&
|
||||
((y - row->height()) <= static_cast<int>(owner.height()))) {
|
||||
// ok there is something visible
|
||||
#if 0
|
||||
LyXText::text_status st = bv->text->status();
|
||||
do {
|
||||
bv->text->status(bv, st);
|
||||
text->getVisibleRow(bv, y, x_offset, row,
|
||||
y + text->first);
|
||||
} while (bv->text->status() == LyXText::CHANGED_IN_DRAW);
|
||||
} while (!text->inset_owner &&
|
||||
text->status() == LyXText::CHANGED_IN_DRAW);
|
||||
bv->text->status(bv, st);
|
||||
#else
|
||||
text->getVisibleRow(bv, y, x_offset, row, y + text->first);
|
||||
#endif
|
||||
}
|
||||
force_clear = false;
|
||||
}
|
||||
|
||||
|
||||
/* draws the screen, starting with textposition y. uses as much already
|
||||
* printed pixels as possible */
|
||||
* printed pixels as possible */
|
||||
void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
||||
{
|
||||
if (cursor_visible) hideCursor();
|
||||
|
||||
int const old_first = text->first;
|
||||
bool internal = (text == bv->text);
|
||||
text->first = y;
|
||||
|
||||
// is any optimiziation possible?
|
||||
if ((y - old_first) < owner.height()
|
||||
&& (old_first - y) < owner.height()) {
|
||||
&& (old_first - y) < owner.height())
|
||||
{
|
||||
if (text->first < old_first) {
|
||||
drawFromTo(text, bv, 0, old_first - text->first);
|
||||
drawFromTo(text, bv, 0, old_first - text->first, 0, 0, internal);
|
||||
XCopyArea (fl_get_display(),
|
||||
owner.getWin(),
|
||||
owner.getWin(),
|
||||
@ -197,8 +211,8 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
||||
old_first - text->first);
|
||||
} else {
|
||||
drawFromTo(text, bv,
|
||||
owner.height() + old_first - text->first,
|
||||
owner.height());
|
||||
owner.height() + old_first - text->first,
|
||||
owner.height(), 0, 0, internal);
|
||||
XCopyArea (fl_get_display(),
|
||||
owner.getWin(),
|
||||
owner.getWin(),
|
||||
@ -215,7 +229,7 @@ void LyXScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
|
||||
}
|
||||
} else {
|
||||
// make a dumb new-draw
|
||||
drawFromTo(text, bv, 0, owner.height());
|
||||
drawFromTo(text, bv, 0, owner.height(), 0, 0, internal);
|
||||
expose(0, 0, owner.workWidth(), owner.height());
|
||||
}
|
||||
}
|
||||
@ -360,12 +374,12 @@ void LyXScreen::hideCursor()
|
||||
}
|
||||
|
||||
|
||||
void LyXScreen::cursorToggle(LyXText const * text, BufferView const * bv)
|
||||
void LyXScreen::cursorToggle(BufferView * bv) const
|
||||
{
|
||||
if (cursor_visible)
|
||||
hideCursor();
|
||||
bv->hideCursor();
|
||||
else
|
||||
showCursor(text, bv);
|
||||
bv->showCursor();
|
||||
}
|
||||
|
||||
|
||||
@ -435,9 +449,13 @@ void LyXScreen::update(LyXText * text, BufferView * bv,
|
||||
// ok I will update the current cursor row
|
||||
drawOneRow(text, bv, text->refresh_row, text->refresh_y,
|
||||
y_offset, x_offset);
|
||||
text->status(bv, LyXText::UNCHANGED);
|
||||
expose(0, text->refresh_y - text->first + y_offset,
|
||||
owner.workWidth(), text->refresh_row->height());
|
||||
// this because if we had a major update the refresh_row could
|
||||
// have been set to 0!
|
||||
if (text->refresh_row) {
|
||||
text->status(bv, LyXText::UNCHANGED);
|
||||
expose(0, text->refresh_y - text->first + y_offset,
|
||||
owner.workWidth(), text->refresh_row->height());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LyXText::CHANGED_IN_DRAW: // just to remove the warning
|
||||
|
12
src/text.C
12
src/text.C
@ -440,12 +440,14 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
tmpinset->update(bview, font, false);
|
||||
tmpinset->draw(bview, font, offset+row->baseline(), x,
|
||||
cleared);
|
||||
#ifdef SEEMS_TO_BE_NOT_NEEDED
|
||||
if (status_ == CHANGED_IN_DRAW) {
|
||||
UpdateInset(bview, tmpinset);
|
||||
status(bview, CHANGED_IN_DRAW);
|
||||
if (!need_break_row &&
|
||||
bview->text->status() == CHANGED_IN_DRAW)
|
||||
{
|
||||
if (row->previous() && row->previous()->par() == row->par())
|
||||
breakAgainOneRow(bview, row->previous());
|
||||
setCursor(bview, cursor.par(), cursor.pos());
|
||||
need_break_row = const_cast<Row *>(row);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
++vpos;
|
||||
|
||||
|
11
src/text2.C
11
src/text2.C
@ -779,7 +779,7 @@ void LyXText::redoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
|
||||
// and the specified par
|
||||
// This function is needed after SetLayout and SetFont etc.
|
||||
void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
||||
Paragraph const * endpar) const
|
||||
Paragraph const * endpar) const
|
||||
{
|
||||
Row * tmprow2;
|
||||
Paragraph * tmppar = 0;
|
||||
@ -797,7 +797,8 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
||||
} else {
|
||||
first_phys_par = tmprow->par();
|
||||
while (tmprow->previous()
|
||||
&& tmprow->previous()->par() == first_phys_par) {
|
||||
&& tmprow->previous()->par() == first_phys_par)
|
||||
{
|
||||
tmprow = tmprow->previous();
|
||||
y -= tmprow->height();
|
||||
}
|
||||
@ -807,8 +808,8 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
||||
status(bview, LyXText::NEED_MORE_REFRESH);
|
||||
refresh_y = y;
|
||||
refresh_row = tmprow->previous(); /* the real refresh row will
|
||||
be deleted, so I store
|
||||
the previous here */
|
||||
be deleted, so I store
|
||||
the previous here */
|
||||
// remove it
|
||||
if (tmprow->next())
|
||||
tmppar = tmprow->next()->par();
|
||||
@ -824,7 +825,7 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
|
||||
|
||||
// remove the first one
|
||||
tmprow2 = tmprow; /* this is because tmprow->previous()
|
||||
can be 0 */
|
||||
can be 0 */
|
||||
tmprow = tmprow->previous();
|
||||
removeRow(tmprow2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user