* Status.15x: updates.

* buffer.h: changed() signal do not have an argument now.

* BufferView.C:
  - setBuffer(): changed update() call to updateMetrics().
  - update(): sanitize how the flags are used.
  - scrollDocView():  add a call to updateMetrics() at the end.

* LyXFunc::dispatch(): adjust changed() signal emission.

* LyXText/text3.C:
  - cursorPrevious(): delete BufferView::update call; adjust cursor flag.
  - cursorNext(): ditto.

* frontends/LyXView.C: adjust Buffer::changed() signal connection.

* frontends/WorkArea.[Ch]:
  - redraw(): no need to re-update the metrics if we don't change views.
  

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15997 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-11-20 14:42:18 +00:00
parent 502f07307f
commit 34600f5055
9 changed files with 46 additions and 52 deletions

View File

@ -144,21 +144,6 @@ EDITING
* Copy/paste using middle mouse button inserts musical notes.
* open a file; mark with the mouse and scroll; assert will fail:
Row const & LyXText::getRowNearY(BufferView const & bv, int y, pit_type pit) const
{
Paragraph const & par = pars_[pit];
int yy = bv.coordCache().get(this, pit).y_ - par.ascent();
BOOST_ASSERT(!par.rows().empty());
RowList::const_iterator rit = par.rows().begin();
RowList::const_iterator const rlast = boost::prior(par.rows().end());
for (; rit != rlast; yy += rit->height(), ++rit)
if (yy + rit->height() > y)
break;
return *rit;
}
* new document; insert note; place cursor in front of the note; activate change tracking;
press delete =>
@ -205,19 +190,21 @@ LAYOUT
PAINTING & PERFORMANCE
* Selection highlighting is broken. Test case: two paragraphs with "Hello"
and "World"; move cursor past "Wor", press Shift+Up
* Too much painting 2 (Edwin 3/11/2006): There is also a lot of painting going
on when selecting text. When selecting a word the whole screen is repainted.
PARTLY FIXED (Abdel 2006-11-20): there's a full repaint only when the mouse is
released. More to come in this area.
* Too much painting 1 (Edwin 3/11/2006): when i click in the workarea (to put
the cursor in another part of the text) the screen is repainted *twice*
whereas it seems to me that no repainting is necessary at all.
* Too much painting 2 (Edwin 3/11/2006): There is also a lot of painting going
on when selecting text. When selecting a word the whole screen is repainted.
PARTLY FIXED (Abdel 2006-11-20): except for math insets.
* Too much painting 3 (Edwin 3/11/2006): the screen is repainted even when the
selection does not change (moving the mouse with the left button pushed down
always triggers a repaint).
PARTLY FIXED (Abdel 2006-11-20): When within the main text inset only the
current line is repainted.
* The cursor is not L-shaped for foreign languages
@ -462,3 +449,10 @@ CREDITS:
* M-x is broken (does not bring up the minibuffer).
FIXED (Bo, 2006-11-18): set toolbar flag in display function.
* open a file; mark with the mouse and scroll; assert will fail:
FIXED (Abdel 2006-11-20): side effect of updateMetrics() cleanup.
* Selection highlighting is broken. Test case: two paragraphs with "Hello"
and "World"; move cursor past "Wor", press Shift+Up
FIXED (Abdel 2006-11-20): side effect of updateMetrics() cleanup.

View File

@ -197,7 +197,7 @@ void BufferView::setBuffer(Buffer * b)
}
}
update();
updateMetrics(false);
if (buffer_ && graphics::Previews::status() != LyXRC::PREVIEW_OFF)
graphics::Previews::get().generateBufferPreviews(*buffer_);
@ -367,25 +367,22 @@ std::pair<bool, bool> BufferView::update(Update::flags flags)
// The second drawing step is done in WorkArea::redraw() if needed.
// Case when no explicit update is requested.
if (!(flags & (Update::SinglePar | Update::Force))) {
if (fitCursor() || multiParSel()) {
// a CoordCache update is needed
updateMetrics(false);
// tell the frontend to update the screen.
return make_pair(true, false);
}
if (!flags) {
// no need to do anything.
return make_pair(false, false);
}
// We are now in the case (Update::SinglePar | Update::Force)
bool single_par = flags & Update::SinglePar;
bool full_metrics = flags & Update::Force;
if (flags & Update::MultiParSel)
full_metrics |= multiParSel();
bool const single_par = !full_metrics;
updateMetrics(single_par);
// Don't forget to do check for fitCursor() and multiParSel().
fitCursor();
multiParSel();
if (flags & Update::FitCursor && fitCursor())
updateMetrics(false);
// tell the frontend to update the screen.
return make_pair(true, single_par);
}
@ -476,6 +473,7 @@ void BufferView::scrollDocView(int value)
t.redoParagraph(*this, anchor_ref_);
int const h = t.getPar(anchor_ref_).height();
offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
updateMetrics(false);
}

View File

@ -120,7 +120,7 @@ public:
bool hasParWithID(int id) const;
/// This signal is emitted when the buffer is changed.
boost::signal<void(bool)> changed;
boost::signal<void()> changed;
/// This signal is emitted when some parsing error shows up.
boost::signal<void(std::string)> errors;
/// This signal is emitted when some message shows up.

View File

@ -169,7 +169,7 @@ void LyXView::connectBuffer(Buffer & buf)
bufferChangedConnection_ =
buf.changed.connect(
boost::bind(&WorkArea::redraw, work_area_, _1));
boost::bind(&WorkArea::redraw, work_area_));
errorsConnection_ =
buf.errors.connect(

View File

@ -131,7 +131,7 @@ void WorkArea::startBlinkingCursor()
}
void WorkArea::redraw(bool singlePar)
void WorkArea::redraw()
{
if (!buffer_view_ || !buffer_view_->buffer()) {
greyed_out_ = true;
@ -140,7 +140,11 @@ void WorkArea::redraw(bool singlePar)
return;
}
buffer_view_->updateMetrics(singlePar && hasFocus());
// No need to do anything if this is the current view. The BufferView
// metrics are already up to date.
if (&lyx_view_ != &theApp->currentView())
// FIXME: it would be nice to optimize for the off-screen case.
buffer_view_->updateMetrics(false);
updateScrollbar();
@ -210,7 +214,7 @@ void WorkArea::dispatch(FuncRequest const & cmd0)
toggleCursor();
if (needRedraw.first)
redraw(needRedraw.second);
redraw();
}

View File

@ -83,7 +83,7 @@ public:
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
/// redraw the screen, without using existing pixmap
virtual void redraw(bool singlePar = false);
virtual void redraw();
///
void stopBlinkingCursor();
void startBlinkingCursor();

View File

@ -1718,7 +1718,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
std::pair<bool, bool> needSecondUpdate = view()->update(updateFlags);
if (needSecondUpdate.first)
view()->buffer()->changed(needSecondUpdate.second);
view()->buffer()->changed();
lyx_view_->updateStatusBar();

View File

@ -222,9 +222,9 @@ public:
///
bool cursorEnd(LCursor & cur);
///
bool cursorPrevious(LCursor & cur);
void cursorPrevious(LCursor & cur);
///
bool cursorNext(LCursor & cur);
void cursorNext(LCursor & cur);
///
bool cursorTop(LCursor & cur);
///

View File

@ -198,16 +198,15 @@ string const freefont2string()
}
bool LyXText::cursorPrevious(LCursor & cur)
void LyXText::cursorPrevious(LCursor & cur)
{
pos_type cpos = cur.pos();
pit_type cpar = cur.pit();
int x = cur.x_target();
// FIXME: there would maybe a need for this 'updated' boolean in the future...
bool updated = setCursorFromCoordinates(cur, x, 0);
if (updated)
cur.bv().update();
updated |= cursorUp(cur);
if (cpar == cur.pit() && cpos == cur.pos()) {
@ -217,19 +216,18 @@ bool LyXText::cursorPrevious(LCursor & cur)
}
finishUndo();
return updated;
cur.updateFlags(Update::Force | Update::FitCursor);
}
bool LyXText::cursorNext(LCursor & cur)
void LyXText::cursorNext(LCursor & cur)
{
pos_type cpos = cur.pos();
pit_type cpar = cur.pit();
int x = cur.x_target();
// FIXME: there would maybe a need for this 'updated' boolean in the future...
bool updated = setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1);
if (updated)
cur.bv().update();
updated |= cursorDown(cur);
if (cpar == cur.pit() && cpos == cur.pos()) {
@ -239,7 +237,7 @@ bool LyXText::cursorNext(LCursor & cur)
}
finishUndo();
return updated;
cur.updateFlags(Update::Force | Update::FitCursor);
}
@ -500,7 +498,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_UP);
} else {
needsUpdate |= cursorPrevious(cur);
cursorPrevious(cur);
}
break;
@ -512,7 +510,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_DOWN);
} else {
needsUpdate |= cursorNext(cur);
cursorNext(cur);
}
break;