mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +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 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();
|
||||
///
|
||||
|
@ -207,28 +207,22 @@ void BufferView::Pimpl::buffer(Buffer * b)
|
||||
if (buffer_) {
|
||||
lyxerr[Debug::INFO] << "Buffer addr: " << buffer_ << endl;
|
||||
buffer_->addUser(bv_);
|
||||
|
||||
// If we don't have a text object for this, we make one
|
||||
if (bv_->text == 0) {
|
||||
resizeCurrentBuffer();
|
||||
} else {
|
||||
updateScreen();
|
||||
updateScrollbar();
|
||||
}
|
||||
|
||||
// FIXME: needed when ?
|
||||
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
|
||||
// hidden. This should go here because some dialogs (eg ToC)
|
||||
// require bv_->text.
|
||||
owner_->getDialogs()->updateBufferDependent(true);
|
||||
redraw();
|
||||
} else {
|
||||
lyxerr[Debug::INFO] << " No Buffer!" << endl;
|
||||
owner_->updateMenubar();
|
||||
owner_->updateToolbar();
|
||||
owner_->getDialogs()->hideBufferDependent();
|
||||
updateScrollbar();
|
||||
workarea().redraw();
|
||||
|
||||
// Also remove all remaining text's from the testcache.
|
||||
// (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.clear();
|
||||
}
|
||||
// should update layoutchoice even if we don't have a buffer.
|
||||
|
||||
repaint();
|
||||
updateScrollbar();
|
||||
owner_->updateMenubar();
|
||||
owner_->updateToolbar();
|
||||
owner_->updateLayoutChoice();
|
||||
|
||||
owner_->updateWindowTitle();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::redraw()
|
||||
{
|
||||
lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
|
||||
workarea().redraw();
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::Pimpl::fitCursor()
|
||||
{
|
||||
bool ret;
|
||||
@ -356,10 +346,6 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
|
||||
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();
|
||||
owner_->allowInput();
|
||||
|
||||
@ -370,7 +356,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::Pimpl::updateScreen()
|
||||
void BufferView::Pimpl::repaint()
|
||||
{
|
||||
// Regenerate the screen.
|
||||
screen().redraw(bv_->text, bv_);
|
||||
@ -910,6 +896,7 @@ void BufferView::Pimpl::workAreaResize()
|
||||
// update from work area
|
||||
work_area_width = workarea().workWidth();
|
||||
work_area_height = workarea().workHeight();
|
||||
|
||||
if (buffer_ != 0) {
|
||||
if (widthChange) {
|
||||
// The visible LyXView need a resize
|
||||
@ -931,9 +918,6 @@ void BufferView::Pimpl::workAreaResize()
|
||||
// to the start of the document on vertical
|
||||
// resize
|
||||
fitCursor();
|
||||
|
||||
// The main window size has changed, repaint most stuff
|
||||
redraw();
|
||||
} else {
|
||||
screen().redraw(bv_->text, bv_);
|
||||
}
|
||||
@ -1312,7 +1296,6 @@ void BufferView::Pimpl::center()
|
||||
screen().draw(bv_->text, bv_, 0);
|
||||
}
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,8 +44,6 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
LyXScreen & screen() const;
|
||||
///
|
||||
void buffer(Buffer *);
|
||||
///
|
||||
void redraw();
|
||||
/// Return true if the cursor was fitted.
|
||||
bool fitCursor();
|
||||
///
|
||||
@ -56,8 +54,11 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
void update();
|
||||
//
|
||||
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();
|
||||
///
|
||||
|
@ -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>
|
||||
|
||||
* 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
|
||||
// error insets after we ran chktex, this must be run:
|
||||
if (removedErrorInsets || res) {
|
||||
users->redraw();
|
||||
#warning repaint needed here, or do you mean update() ?
|
||||
users->repaint();
|
||||
users->fitCursor();
|
||||
}
|
||||
users->owner()->allowInput();
|
||||
@ -3921,7 +3922,8 @@ void Buffer::resizeInsets(BufferView * bv)
|
||||
|
||||
void Buffer::redraw()
|
||||
{
|
||||
users->redraw();
|
||||
#warning repaint needed here, or do you mean update() ?
|
||||
users->repaint();
|
||||
users->fitCursor();
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,8 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
|
||||
if ((result & LaTeX::ERRORS)) {
|
||||
// Insert all errors as errors boxes
|
||||
bv->insertErrors(terr);
|
||||
bv->redraw();
|
||||
#warning repaint() or update() or nothing ?
|
||||
bv->repaint();
|
||||
bv->fitCursor();
|
||||
}
|
||||
bv->owner()->allowInput();
|
||||
@ -853,7 +854,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
if ((result & LaTeX::ERRORS)) {
|
||||
// Insert all errors as errors boxes
|
||||
bv->insertErrors(terr);
|
||||
bv->redraw();
|
||||
#warning repaint() or update() or nothing ?
|
||||
bv->repaint();
|
||||
bv->fitCursor();
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
if (bv) {
|
||||
// Remove all error insets
|
||||
if (bv->removeAutoInsets()) {
|
||||
bv->redraw();
|
||||
#warning repaint() or update() or nothing ?
|
||||
bv->repaint();
|
||||
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>
|
||||
|
||||
* guiapi.h:
|
||||
|
@ -46,9 +46,6 @@ public:
|
||||
/// return the height of the work area in pixels
|
||||
virtual int workHeight() const = 0;
|
||||
|
||||
/// FIXME: GUII
|
||||
virtual void redraw() const = 0;
|
||||
|
||||
/**
|
||||
* Update the scrollbar.
|
||||
* @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>
|
||||
|
||||
* ControlTexinfo.C: do the same for Texinfo
|
||||
|
@ -40,6 +40,8 @@ void ControlBibitem::applyParamsToInset()
|
||||
|
||||
// We need to do a redraw because the maximum
|
||||
// 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();
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ void ControlBibtex::applyParamsToInset()
|
||||
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibKey width could have changed
|
||||
lv_.view()->redraw();
|
||||
#warning are you sure you need this repaint() ?
|
||||
lv_.view()->repaint();
|
||||
lv_.view()->fitCursor();
|
||||
}
|
||||
|
||||
|
@ -303,6 +303,8 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
int y1, int y2, int yo, int xo,
|
||||
bool internal)
|
||||
{
|
||||
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << "-" << y2 << endl;
|
||||
|
||||
int y_text = text->first_y + y1;
|
||||
|
||||
// get the first needed row
|
||||
|
@ -144,8 +144,8 @@ public:
|
||||
virtual bool forceClear() const { return force_clear_; }
|
||||
|
||||
protected:
|
||||
/// copies specified area of pixmap to screen
|
||||
virtual void expose(int x, int y, int exp_width, int exp_height) = 0;
|
||||
/// cause the display of the given area of the work area
|
||||
virtual void expose(int x, int y, int w, int h) = 0;
|
||||
|
||||
/// get the work area
|
||||
virtual WorkArea & workarea() const = 0;
|
||||
|
@ -35,8 +35,8 @@ public:
|
||||
virtual int workHeight() const { return work_area->h; }
|
||||
///
|
||||
virtual void redraw() const {
|
||||
fl_redraw_object(work_area);
|
||||
fl_redraw_object(scrollbar);
|
||||
//fl_redraw_object(work_area);
|
||||
//fl_redraw_object(scrollbar);
|
||||
}
|
||||
///
|
||||
Window getWin() const { return work_area->form->window; }
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "insets/insettext.h"
|
||||
#include "ColorHandler.h"
|
||||
#include "language.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::max;
|
||||
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.
|
||||
// we need to generate an expose event for the workarea
|
||||
// and then copy from the pixmap to the screen. This
|
||||
// is the Sane Way (tm)
|
||||
lyxerr[Debug::GUI] << "expose " << w << "x" << h
|
||||
<< "+" << x << "+" << y << endl;
|
||||
XCopyArea(fl_get_display(),
|
||||
owner_.getPixmap(),
|
||||
owner_.getWin(),
|
||||
gc_copy,
|
||||
x, y,
|
||||
exp_width, exp_height,
|
||||
x, y, w, h,
|
||||
x + owner_.xpos(),
|
||||
y + owner_.ypos());
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
virtual WorkArea & workarea() const { return owner_; }
|
||||
|
||||
/// 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:
|
||||
/// our owning widget
|
||||
|
@ -1197,7 +1197,8 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
||||
|
||||
case LFUN_REMOVEERRORS:
|
||||
if (owner->view()->removeAutoInsets()) {
|
||||
owner->view()->redraw();
|
||||
#warning repaint() or update() or nothing ?
|
||||
owner->view()->repaint();
|
||||
owner->view()->fitCursor();
|
||||
}
|
||||
break;
|
||||
@ -1634,7 +1635,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
|
||||
gc.changeDisplay(true);
|
||||
}
|
||||
|
||||
owner->view()->redraw();
|
||||
owner->view()->repaint();
|
||||
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>
|
||||
|
||||
* math_factory.C:
|
||||
|
@ -278,8 +278,10 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
|
||||
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))
|
||||
bv->redraw();
|
||||
bv->repaint();
|
||||
|
||||
hull()->label(row, new_label);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user