mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
redraw() cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4450 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
07188bd4fc
commit
1cadf458e3
@ -71,9 +71,9 @@ void BufferView::resize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::redraw()
|
void BufferView::repaint()
|
||||||
{
|
{
|
||||||
pimpl_->redraw();
|
pimpl_->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +59,12 @@ public:
|
|||||||
void buffer(Buffer * b);
|
void buffer(Buffer * b);
|
||||||
///
|
///
|
||||||
void resize();
|
void resize();
|
||||||
///
|
/**
|
||||||
void redraw();
|
* Repaint the pixmap. Used for when we don't want
|
||||||
|
* to go through the full update() logic, just a simple
|
||||||
|
* repaint of the whole screen.
|
||||||
|
*/
|
||||||
|
void repaint();
|
||||||
///
|
///
|
||||||
bool fitCursor();
|
bool fitCursor();
|
||||||
///
|
///
|
||||||
|
@ -207,28 +207,22 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
|||||||
if (buffer_) {
|
if (buffer_) {
|
||||||
lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
|
lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
|
||||||
buffer_->addUser(bv_);
|
buffer_->addUser(bv_);
|
||||||
|
|
||||||
// If we don't have a text object for this, we make one
|
// If we don't have a text object for this, we make one
|
||||||
if (bv_->text == 0) {
|
if (bv_->text == 0) {
|
||||||
resizeCurrentBuffer();
|
resizeCurrentBuffer();
|
||||||
} else {
|
|
||||||
updateScreen();
|
|
||||||
updateScrollbar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: needed when ?
|
||||||
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
|
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
|
||||||
owner_->updateMenubar();
|
|
||||||
owner_->updateToolbar();
|
|
||||||
// Similarly, buffer-dependent dialogs should be updated or
|
// Similarly, buffer-dependent dialogs should be updated or
|
||||||
// hidden. This should go here because some dialogs (eg ToC)
|
// hidden. This should go here because some dialogs (eg ToC)
|
||||||
// require bv_->text.
|
// require bv_->text.
|
||||||
owner_->getDialogs()->updateBufferDependent(true);
|
owner_->getDialogs()->updateBufferDependent(true);
|
||||||
redraw();
|
|
||||||
} else {
|
} else {
|
||||||
lyxerr[Debug::INFO] << " No Buffer!" << endl;
|
lyxerr[Debug::INFO] << " No Buffer!" << endl;
|
||||||
owner_->updateMenubar();
|
|
||||||
owner_->updateToolbar();
|
|
||||||
owner_->getDialogs()->hideBufferDependent();
|
owner_->getDialogs()->hideBufferDependent();
|
||||||
updateScrollbar();
|
|
||||||
workarea().redraw();
|
|
||||||
|
|
||||||
// Also remove all remaining text's from the testcache.
|
// Also remove all remaining text's from the testcache.
|
||||||
// (there should not be any!) (if there is any it is a
|
// (there should not be any!) (if there is any it is a
|
||||||
@ -237,20 +231,16 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
|||||||
textcache.show(lyxerr, "buffer delete all");
|
textcache.show(lyxerr, "buffer delete all");
|
||||||
textcache.clear();
|
textcache.clear();
|
||||||
}
|
}
|
||||||
// should update layoutchoice even if we don't have a buffer.
|
|
||||||
|
repaint();
|
||||||
|
updateScrollbar();
|
||||||
|
owner_->updateMenubar();
|
||||||
|
owner_->updateToolbar();
|
||||||
owner_->updateLayoutChoice();
|
owner_->updateLayoutChoice();
|
||||||
|
|
||||||
owner_->updateWindowTitle();
|
owner_->updateWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::Pimpl::redraw()
|
|
||||||
{
|
|
||||||
lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
|
|
||||||
workarea().redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool BufferView::Pimpl::fitCursor()
|
bool BufferView::Pimpl::fitCursor()
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
@ -356,10 +346,6 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
|||||||
|
|
||||||
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
|
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
|
||||||
|
|
||||||
// this will scroll the screen such that the cursor becomes visible
|
|
||||||
updateScrollbar();
|
|
||||||
redraw();
|
|
||||||
|
|
||||||
setState();
|
setState();
|
||||||
owner_->allowInput();
|
owner_->allowInput();
|
||||||
|
|
||||||
@ -370,7 +356,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::Pimpl::updateScreen()
|
void BufferView::Pimpl::repaint()
|
||||||
{
|
{
|
||||||
// Regenerate the screen.
|
// Regenerate the screen.
|
||||||
screen().redraw(bv_->text, bv_);
|
screen().redraw(bv_->text, bv_);
|
||||||
@ -910,6 +896,7 @@ void BufferView::Pimpl::workAreaResize()
|
|||||||
// update from work area
|
// update from work area
|
||||||
work_area_width = workarea().workWidth();
|
work_area_width = workarea().workWidth();
|
||||||
work_area_height = workarea().workHeight();
|
work_area_height = workarea().workHeight();
|
||||||
|
|
||||||
if (buffer_ != 0) {
|
if (buffer_ != 0) {
|
||||||
if (widthChange) {
|
if (widthChange) {
|
||||||
// The visible LyXView need a resize
|
// The visible LyXView need a resize
|
||||||
@ -931,9 +918,6 @@ void BufferView::Pimpl::workAreaResize()
|
|||||||
// to the start of the document on vertical
|
// to the start of the document on vertical
|
||||||
// resize
|
// resize
|
||||||
fitCursor();
|
fitCursor();
|
||||||
|
|
||||||
// The main window size has changed, repaint most stuff
|
|
||||||
redraw();
|
|
||||||
} else {
|
} else {
|
||||||
screen().redraw(bv_->text, bv_);
|
screen().redraw(bv_->text, bv_);
|
||||||
}
|
}
|
||||||
@ -1312,7 +1296,6 @@ void BufferView::Pimpl::center()
|
|||||||
screen().draw(bv_->text, bv_, 0);
|
screen().draw(bv_->text, bv_, 0);
|
||||||
}
|
}
|
||||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
|||||||
LyXScreen & screen() const;
|
LyXScreen & screen() const;
|
||||||
///
|
///
|
||||||
void buffer(Buffer *);
|
void buffer(Buffer *);
|
||||||
///
|
|
||||||
void redraw();
|
|
||||||
/// Return true if the cursor was fitted.
|
/// Return true if the cursor was fitted.
|
||||||
bool fitCursor();
|
bool fitCursor();
|
||||||
///
|
///
|
||||||
@ -56,8 +54,11 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
|||||||
void update();
|
void update();
|
||||||
//
|
//
|
||||||
void update(LyXText *, BufferView::UpdateCodes);
|
void update(LyXText *, BufferView::UpdateCodes);
|
||||||
/// Update pixmap of screen
|
/**
|
||||||
void updateScreen();
|
* Repaint pixmap. Used for when we've made a visible
|
||||||
|
* change but don't need the full update() logic
|
||||||
|
*/
|
||||||
|
void repaint();
|
||||||
///
|
///
|
||||||
void workAreaResize();
|
void workAreaResize();
|
||||||
///
|
///
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* buffer.C:
|
||||||
|
* converter.C:
|
||||||
|
* exporter.C:
|
||||||
|
* lyxfunc.C:
|
||||||
|
* BufferView.h:
|
||||||
|
* BufferView.C: use repaint()
|
||||||
|
|
||||||
|
* BufferView_pimpl.h:
|
||||||
|
* BufferView_pimpl.C: s/updateScreen()/repaint()/
|
||||||
|
as it's a clearer description. Remove superfluous
|
||||||
|
redraws.
|
||||||
|
|
||||||
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* text.C: fix bug 488. Not ideal, but getting
|
* text.C: fix bug 488. Not ideal, but getting
|
||||||
|
@ -3634,7 +3634,8 @@ int Buffer::runChktex()
|
|||||||
// if we removed error insets before we ran chktex or if we inserted
|
// if we removed error insets before we ran chktex or if we inserted
|
||||||
// error insets after we ran chktex, this must be run:
|
// error insets after we ran chktex, this must be run:
|
||||||
if (removedErrorInsets || res) {
|
if (removedErrorInsets || res) {
|
||||||
users->redraw();
|
#warning repaint needed here, or do you mean update() ?
|
||||||
|
users->repaint();
|
||||||
users->fitCursor();
|
users->fitCursor();
|
||||||
}
|
}
|
||||||
users->owner()->allowInput();
|
users->owner()->allowInput();
|
||||||
@ -3921,7 +3922,8 @@ void Buffer::resizeInsets(BufferView * bv)
|
|||||||
|
|
||||||
void Buffer::redraw()
|
void Buffer::redraw()
|
||||||
{
|
{
|
||||||
users->redraw();
|
#warning repaint needed here, or do you mean update() ?
|
||||||
|
users->repaint();
|
||||||
users->fitCursor();
|
users->fitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +796,8 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
|
|||||||
if ((result & LaTeX::ERRORS)) {
|
if ((result & LaTeX::ERRORS)) {
|
||||||
// Insert all errors as errors boxes
|
// Insert all errors as errors boxes
|
||||||
bv->insertErrors(terr);
|
bv->insertErrors(terr);
|
||||||
bv->redraw();
|
#warning repaint() or update() or nothing ?
|
||||||
|
bv->repaint();
|
||||||
bv->fitCursor();
|
bv->fitCursor();
|
||||||
}
|
}
|
||||||
bv->owner()->allowInput();
|
bv->owner()->allowInput();
|
||||||
@ -853,7 +854,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
|||||||
if ((result & LaTeX::ERRORS)) {
|
if ((result & LaTeX::ERRORS)) {
|
||||||
// Insert all errors as errors boxes
|
// Insert all errors as errors boxes
|
||||||
bv->insertErrors(terr);
|
bv->insertErrors(terr);
|
||||||
bv->redraw();
|
#warning repaint() or update() or nothing ?
|
||||||
|
bv->repaint();
|
||||||
bv->fitCursor();
|
bv->fitCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
|||||||
if (bv) {
|
if (bv) {
|
||||||
// Remove all error insets
|
// Remove all error insets
|
||||||
if (bv->removeAutoInsets()) {
|
if (bv->removeAutoInsets()) {
|
||||||
bv->redraw();
|
#warning repaint() or update() or nothing ?
|
||||||
|
bv->repaint();
|
||||||
bv->fitCursor();
|
bv->fitCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* WorkArea.h: remove redraw()
|
||||||
|
|
||||||
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
|
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* guiapi.h:
|
* guiapi.h:
|
||||||
|
@ -46,9 +46,6 @@ public:
|
|||||||
/// return the height of the work area in pixels
|
/// return the height of the work area in pixels
|
||||||
virtual int workHeight() const = 0;
|
virtual int workHeight() const = 0;
|
||||||
|
|
||||||
/// FIXME: GUII
|
|
||||||
virtual void redraw() const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the scrollbar.
|
* Update the scrollbar.
|
||||||
* @param height the total document height in pixels
|
* @param height the total document height in pixels
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* ControlBibtex.C:
|
||||||
|
* ControlBibitem.C: use repaint()
|
||||||
|
|
||||||
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* ControlTexinfo.C: do the same for Texinfo
|
* ControlTexinfo.C: do the same for Texinfo
|
||||||
|
@ -40,6 +40,8 @@ void ControlBibitem::applyParamsToInset()
|
|||||||
|
|
||||||
// We need to do a redraw because the maximum
|
// We need to do a redraw because the maximum
|
||||||
// InsetBibKey width could have changed
|
// InsetBibKey width could have changed
|
||||||
lv_.view()->redraw();
|
#warning please check you mean repaint() not update(),
|
||||||
|
#warning and whether the repaint() is needed at all
|
||||||
|
lv_.view()->repaint();
|
||||||
lv_.view()->fitCursor();
|
lv_.view()->fitCursor();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@ void ControlBibtex::applyParamsToInset()
|
|||||||
|
|
||||||
// We need to do a redraw because the maximum
|
// We need to do a redraw because the maximum
|
||||||
// InsetBibKey width could have changed
|
// InsetBibKey width could have changed
|
||||||
lv_.view()->redraw();
|
#warning are you sure you need this repaint() ?
|
||||||
|
lv_.view()->repaint();
|
||||||
lv_.view()->fitCursor();
|
lv_.view()->fitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +303,8 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
|||||||
int y1, int y2, int yo, int xo,
|
int y1, int y2, int yo, int xo,
|
||||||
bool internal)
|
bool internal)
|
||||||
{
|
{
|
||||||
|
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << "-" << y2 << endl;
|
||||||
|
|
||||||
int y_text = text->first_y + y1;
|
int y_text = text->first_y + y1;
|
||||||
|
|
||||||
// get the first needed row
|
// get the first needed row
|
||||||
|
@ -144,8 +144,8 @@ public:
|
|||||||
virtual bool forceClear() const { return force_clear_; }
|
virtual bool forceClear() const { return force_clear_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// copies specified area of pixmap to screen
|
/// cause the display of the given area of the work area
|
||||||
virtual void expose(int x, int y, int exp_width, int exp_height) = 0;
|
virtual void expose(int x, int y, int w, int h) = 0;
|
||||||
|
|
||||||
/// get the work area
|
/// get the work area
|
||||||
virtual WorkArea & workarea() const = 0;
|
virtual WorkArea & workarea() const = 0;
|
||||||
|
@ -35,8 +35,8 @@ public:
|
|||||||
virtual int workHeight() const { return work_area->h; }
|
virtual int workHeight() const { return work_area->h; }
|
||||||
///
|
///
|
||||||
virtual void redraw() const {
|
virtual void redraw() const {
|
||||||
fl_redraw_object(work_area);
|
//fl_redraw_object(work_area);
|
||||||
fl_redraw_object(scrollbar);
|
//fl_redraw_object(scrollbar);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
Window getWin() const { return work_area->form->window; }
|
Window getWin() const { return work_area->form->window; }
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
#include "ColorHandler.h"
|
#include "ColorHandler.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
using std::min;
|
using std::min;
|
||||||
@ -185,18 +186,15 @@ void XScreen::hideCursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XScreen::expose(int x, int y, int exp_width, int exp_height)
|
void XScreen::expose(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
// FIXME: here we should definitely NOT do this.
|
lyxerr[Debug::GUI] << "expose " << w << "x" << h
|
||||||
// we need to generate an expose event for the workarea
|
<< "+" << x << "+" << y << endl;
|
||||||
// and then copy from the pixmap to the screen. This
|
|
||||||
// is the Sane Way (tm)
|
|
||||||
XCopyArea(fl_get_display(),
|
XCopyArea(fl_get_display(),
|
||||||
owner_.getPixmap(),
|
owner_.getPixmap(),
|
||||||
owner_.getWin(),
|
owner_.getWin(),
|
||||||
gc_copy,
|
gc_copy,
|
||||||
x, y,
|
x, y, w, h,
|
||||||
exp_width, exp_height,
|
|
||||||
x + owner_.xpos(),
|
x + owner_.xpos(),
|
||||||
y + owner_.ypos());
|
y + owner_.ypos());
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ protected:
|
|||||||
virtual WorkArea & workarea() const { return owner_; }
|
virtual WorkArea & workarea() const { return owner_; }
|
||||||
|
|
||||||
/// Copies specified area of pixmap to screen
|
/// Copies specified area of pixmap to screen
|
||||||
virtual void expose(int x, int y, int exp_width, int exp_height);
|
virtual void expose(int x, int y, int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// our owning widget
|
/// our owning widget
|
||||||
|
@ -1197,7 +1197,8 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
|||||||
|
|
||||||
case LFUN_REMOVEERRORS:
|
case LFUN_REMOVEERRORS:
|
||||||
if (owner->view()->removeAutoInsets()) {
|
if (owner->view()->removeAutoInsets()) {
|
||||||
owner->view()->redraw();
|
#warning repaint() or update() or nothing ?
|
||||||
|
owner->view()->repaint();
|
||||||
owner->view()->fitCursor();
|
owner->view()->fitCursor();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1634,7 +1635,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
|||||||
gc.changeDisplay(true);
|
gc.changeDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->view()->redraw();
|
owner->view()->repaint();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* formula.C: use repaint()
|
||||||
|
|
||||||
2002-06-16 André Pönitz <poenitz@gmx.net>
|
2002-06-16 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* math_factory.C:
|
* math_factory.C:
|
||||||
|
@ -278,8 +278,10 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
|
|||||||
hull()->numbered(row, true);
|
hull()->numbered(row, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning FIXME: please check you really mean repaint() ... is it needed,
|
||||||
|
#warning and if so, should it be update() instead ?
|
||||||
if (!new_label.empty() && bv->ChangeRefsIfUnique(old_label, new_label))
|
if (!new_label.empty() && bv->ChangeRefsIfUnique(old_label, new_label))
|
||||||
bv->redraw();
|
bv->repaint();
|
||||||
|
|
||||||
hull()->label(row, new_label);
|
hull()->label(row, new_label);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user