mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Extracted from r14281
* 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
This commit is contained in:
parent
ca55190481
commit
28c5673ff4
@ -408,3 +408,15 @@ ViewMetricsInfo const & BufferView::viewMetricsInfo()
|
||||
{
|
||||
return pimpl_->viewMetricsInfo();
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::needsRedraw() const
|
||||
{
|
||||
return pimpl_->needsRedraw();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::needsRedraw(bool redraw_needed)
|
||||
{
|
||||
pimpl_->needsRedraw(redraw_needed);
|
||||
}
|
||||
|
@ -226,6 +226,10 @@ public:
|
||||
|
||||
///
|
||||
ViewMetricsInfo const & viewMetricsInfo();
|
||||
|
||||
///
|
||||
bool needsRedraw() const;
|
||||
void needsRedraw(bool redraw_needed);
|
||||
private:
|
||||
///
|
||||
class Pimpl;
|
||||
|
@ -139,7 +139,7 @@ T * getInsetByCode(LCursor & cur, InsetBase::Code code)
|
||||
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;
|
||||
|
||||
@ -699,39 +699,38 @@ void BufferView::Pimpl::update(Update::flags flags)
|
||||
<< "] 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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,6 +120,15 @@ public:
|
||||
|
||||
///
|
||||
ViewMetricsInfo const & viewMetricsInfo();
|
||||
///
|
||||
bool needsRedraw() const
|
||||
{
|
||||
return needs_redraw_;
|
||||
}
|
||||
void needsRedraw(bool redraw_needed)
|
||||
{
|
||||
needs_redraw_ = redraw_needed;
|
||||
}
|
||||
private:
|
||||
///
|
||||
int width_;
|
||||
@ -127,6 +136,8 @@ private:
|
||||
int height_;
|
||||
///
|
||||
ScrollbarParameters scrollbarParameters_;
|
||||
///
|
||||
bool needs_redraw_;
|
||||
|
||||
/// An error list (replaces the error insets)
|
||||
ErrorList errorlist_;
|
||||
|
@ -81,14 +81,20 @@ LyXView::LyXView(Gui & owner)
|
||||
}
|
||||
|
||||
|
||||
LyXView::~LyXView()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void LyXView::setWorkArea(WorkArea * work_area)
|
||||
{
|
||||
work_area_ = work_area;
|
||||
}
|
||||
|
||||
|
||||
LyXView::~LyXView()
|
||||
void LyXView::redrawWorkArea()
|
||||
{
|
||||
work_area_->redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,6 +153,9 @@ public:
|
||||
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).
|
||||
/**
|
||||
|
@ -155,10 +155,20 @@ void WorkArea::checkAndGreyOut()
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@ -167,7 +177,14 @@ void WorkArea::redraw(BufferView & bv)
|
||||
( 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user