* frontends/LyXView:
- redrawWorkArea(): new temporary method called from within
BufferView::pimpl::update() that calls WorkArea::redraw()
in order to do the actual screen redrawing.
* frontends/WorkArea:
- the redraw() method now check if the the attached bufferView
needs a screen redraw().
* BufferView:
- needsRedraw(): new method for WorkArea::redraw()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14381
a592a061-630c-0410-9148-
cb99ea01b6c8
{
return pimpl_->viewMetricsInfo();
}
+
+
+bool BufferView::needsRedraw() const
+{
+ return pimpl_->needsRedraw();
+}
+
+
+void BufferView::needsRedraw(bool redraw_needed)
+{
+ pimpl_->needsRedraw(redraw_needed);
+}
///
ViewMetricsInfo const & viewMetricsInfo();
+
+ ///
+ bool needsRedraw() const;
+ void needsRedraw(bool redraw_needed);
private:
///
class Pimpl;
BufferView::Pimpl::Pimpl(BufferView & bv, LyXView * owner)
: bv_(&bv), owner_(owner), buffer_(0), wh_(0), cursor_timeout(400),
using_xterm_cursor(false), cursor_(bv),
- multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0)
+ multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0), needs_redraw_(false)
{
xsel_cache_.set = false;
<< "] buffer: " << buffer_ << endl;
}
+ // This, together with doneUpdating(), verifies (using
+ // asserts) that screen redraw is not called from
+ // within itself.
+ theCoords.startUpdating();
+
// Check needed to survive LyX startup
if (buffer_) {
// Update macro store
buffer_->buildMacros();
- // This, together with doneUpdating(), verifies (using
- // asserts) that screen redraw is not called from
- // within itself.
- theCoords.startUpdating();
-
// First drawing step
bool singlePar = flags & Update::SinglePar;
- bool forceupdate(flags & (Update::Force | Update::SinglePar));
+ needs_redraw_ = flags & (Update::Force | Update::SinglePar);
if ((flags & (Update::FitCursor | Update::MultiParSel))
&& (fitCursor() || multiParSel())) {
- forceupdate = true;
+ needs_redraw_ = true;
singlePar = false;
}
- if (forceupdate) {
+ if (needs_redraw_) {
// Second drawing step
updateMetrics(singlePar);
- owner_->workArea()->redraw(*bv_);
- } else {
- // Abort updating of the coord
- // cache - just restore the old one
- theCoords.doneUpdating();
}
- } else
- owner_->workArea()->greyOut();
+ }
+ owner_->redrawWorkArea();
owner_->view_state_changed();
+
+ // Abort updating of the coord
+ // cache - just restore the old one
+ theCoords.doneUpdating();
}
///
ViewMetricsInfo const & viewMetricsInfo();
+ ///
+ bool needsRedraw() const
+ {
+ return needs_redraw_;
+ }
+ void needsRedraw(bool redraw_needed)
+ {
+ needs_redraw_ = redraw_needed;
+ }
private:
///
int width_;
int height_;
///
ScrollbarParameters scrollbarParameters_;
+ ///
+ bool needs_redraw_;
/// An error list (replaces the error insets)
ErrorList errorlist_;
}
+LyXView::~LyXView()
+{
+}
+
+
void LyXView::setWorkArea(WorkArea * work_area)
{
work_area_ = work_area;
}
-LyXView::~LyXView()
+void LyXView::redrawWorkArea()
{
+ work_area_->redraw();
}
virtual lyx::frontend::Gui & gui();
lyx::frontend::WorkArea * workArea() const { return work_area_; }
+
+ /// Temporary method used by the kernel to redraw the work area.
+ virtual void redrawWorkArea();
protected:
/// current work area (screen view of a BufferView).
/**
}
-void WorkArea::redraw(BufferView & bv)
+void WorkArea::redraw()
{
+ BOOST_ASSERT(buffer_view_);
+
+ if (!buffer_view_->buffer()) {
+ greyOut();
+ return;
+ }
+
+ if (!buffer_view_->needsRedraw())
+ return;
+
greyed_out_ = false;
- ViewMetricsInfo const & vi = bv.viewMetricsInfo();
+ ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
getPainter().start();
paintText(*buffer_view_, vi);
lyxerr[Debug::DEBUG] << "Redraw screen" << endl;
( vi.p2 < vi.size - 1 ? vi.y2 : height() );
expose(0, ymin, width(), ymax - ymin);
getPainter().end();
- theCoords.doneUpdating();
+ //theCoords.doneUpdating();
+ buffer_view_->needsRedraw(false);
+
+ if (lyxerr.debugging(Debug::DEBUG)) {
+ lyxerr[Debug::DEBUG]
+ << " ymin = " << ymin << " width() = " << width()
+ << " ymax-ymin = " << ymax-ymin << std::endl;
+ }
}
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
/// redraw the screen, without using existing pixmap
- virtual void redraw(BufferView & bv);
+ virtual void redraw();
/// grey out (no buffer)
void greyOut();