drop a few fitCursor() and draw() calls

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7563 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-18 08:23:03 +00:00
parent 997914c5ca
commit 7000451e00
14 changed files with 55 additions and 106 deletions

View File

@ -444,7 +444,6 @@ void BufferView::replaceWord(string const & replacestring)
// FIXME: should be done through LFUN
buffer()->markDirty();
fitCursor();
update();
}

View File

@ -489,7 +489,8 @@ void BufferView::Pimpl::scrollDocView(int value)
screen().hideCursor();
screen().draw(bv_->text, bv_, value);
bv_->text->top_y(value);
//screen().draw();
if (!lyxrc.cursor_follows_scrollbar)
return;
@ -767,14 +768,14 @@ void BufferView::Pimpl::insetUnlock()
void BufferView::Pimpl::center()
{
LyXText * t = bv_->text;
LyXText * text = bv_->text;
beforeChange(t);
beforeChange(text);
int const half_height = workarea().workHeight() / 2;
int new_y = 0;
if (t->cursor.y() > half_height)
new_y = t->cursor.y() - half_height;
if (text->cursor.y() > half_height)
new_y = text->cursor.y() - half_height;
// FIXME: look at this comment again ...
@ -787,8 +788,8 @@ void BufferView::Pimpl::center()
// and also might have moved top_y() must make sure to call
// updateScrollbar() currently. Never mind that this is a
// pretty obfuscated way of updating t->top_y()
screen().draw(t, bv_, new_y);
text->top_y(new_y);
//screen().draw();
update();
}
@ -817,7 +818,7 @@ InsetOld * BufferView::Pimpl::getInsetByCode(InsetOld::Code code)
return it != buffer_->inset_iterator_end() ? (*it) : 0;
#else
// Ok, this is a little bit too brute force but it
// should work for now. Better infrastructure is comming. (Lgb)
// should work for now. Better infrastructure is coming. (Lgb)
Buffer * b = bv_->buffer();
LyXCursor cursor = bv_->getLyXText()->cursor;
@ -1179,7 +1180,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
if (name == "bibitem") {
// We need to do a redraw because the maximum
// InsetBibitem width could have changed
bv_->fitCursor();
#warning check whether the update() is needed at all
bv_->update();
}
@ -1201,12 +1201,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break;
case LFUN_LAYOUT_PARAGRAPH: {
Paragraph const * par = &*bv_->getLyXText()->cursor.par();
if (!par)
break;
string data;
params2string(*par, data);
params2string(*bv_->getLyXText()->cursor.par(), data);
data = "show\n" + data;
bv_->owner()->getDialogs().show("paragraph", data);

View File

@ -1,17 +1,26 @@
2003-08-18 André Pönitz <poenitz@gmx.net>
* BufferView.C:
* BufferView_pimpl.C:
* lyxfind.C:
* paragraph_funcs.C:
* rowpainter.C:
* text3.C: remove LyXScreen::draw() and fitCursor calls
2003-08-17 Martin Vermeer <martin.vermeer@hut.fi>
* src/BranchList.[Ch]:
* src/InsetList.[Ch]:
* src/LColor.[Ch]:
* src/LyXAction.C:
* src/Makefile.am:
* src/MenuBackend.[Ch]:
* src/bufferparams.[Ch]:
* src/factory.C:
* src/lfuns.h:
* src/lyxfunc.C:
* src/text3.C: implements the 'branch inset'
* BranchList.[Ch]:
* InsetList.[Ch]:
* LColor.[Ch]:
* LyXAction.C:
* Makefile.am:
* MenuBackend.[Ch]:
* bufferparams.[Ch]:
* factory.C:
* lfuns.h:
* lyxfunc.C:
* text3.C: implements the 'branch inset'
idea. This allows the output of various versions of a document
from a single source version, selectively outputing or suppressing
output of parts of the text.

View File

@ -1,7 +1,11 @@
2003-08-18 André Pönitz <poenitz@gmx.net>
* screen.[Ch]: remove draw()
2003-08-15 André Pönitz <poenitz@gmx.net>
* screen.[Ch]: remove toggle selection
* screen.[Ch]: remove toggleSelection()
2003-08-02 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>

View File

@ -68,22 +68,6 @@ void QScreen::expose(int x, int y, int w, int h)
}
void QScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
QPixmap * p = owner_.getPixmap();
owner_.getPainter().start();
text->top_y(y);
// not needed in the xforms frontend anymore
//drawFromTo(text, bv, 0, owner_.height(), 0, 0);
repaint();
owner_.getPainter().end();
}
void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
{
cursor_x_ = x;

View File

@ -29,14 +29,6 @@ public:
virtual ~QScreen();
/**
* draw the screen from a given position
* @param y the text position to draw from
*
* Uses as much of the already printed pixmap as possible
*/
virtual void draw(LyXText *, BufferView *, unsigned int y);
protected:
/// get the work area
virtual WorkArea & workarea() const { return owner_; }

View File

@ -236,8 +236,8 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
if (newtop == text->top_y())
return false;
draw(text, bv, newtop);
text->top_y(newtop);
//draw();
return true;
}
@ -289,10 +289,9 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
// Is a change necessary?
int const newtop = topCursorVisible(text);
bool const result = (newtop != text->top_y());
if (result) {
draw(text, bv, newtop);
}
text->top_y(newtop);
//if (result)
// draw();
return result;
}
@ -309,7 +308,7 @@ void LyXScreen::redraw(BufferView & bv)
workarea().getPainter().start();
bv.text->updateRowPositions();
drawFromTo(bv.text, &bv, 0, workarea().workHeight(), 0, 0);
drawFromTo(bv.text, &bv);
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
@ -340,32 +339,27 @@ void LyXScreen::greyOut()
workarea().getPainter().image(x, y, w, h, *splash_image);
string const & splash_text = splash.text();
LyXFont const & splash_font = splash.font();
x += 260;
y += 265;
workarea().getPainter().text(x, y, splash_text, splash_font);
workarea().getPainter().text(x, y, splash.text(), splash.font());
}
expose(0, 0, workarea().workWidth(), workarea().workHeight());
workarea().getPainter().end();
}
void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
int y1, int y2, int yo, int xo)
void LyXScreen::drawFromTo(LyXText * text, BufferView * bv)
{
lyxerr[Debug::GUI] << "screen: drawFromTo " << y1 << '-' << y2 << endl;
hideCursor();
int const y2 = workarea().workHeight();
int const topy = text->top_y();
int y_text = topy + y1;
int y_text = topy;
ParagraphList::iterator dummypit;
RowList::iterator rit = text->getRowNearY(y_text, dummypit);
int y = y_text - topy;
y = paintRows(*bv, *text, rit, xo, y, y, y2, yo);
y = paintRows(*bv, *text, rit, 0, y, y, y2, 0);
// maybe we have to clear the screen at the bottom
if (y < y2 && !text->isInInset()) {

View File

@ -38,14 +38,6 @@ public:
virtual ~LyXScreen();
/**
* draw the screen from a given position
* @param y the text position to draw from
*
* Uses as much of the already printed pixmap as possible
*/
virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
/**
* fit the cursor onto the visible work area, scrolling if necessary
* @param bv the buffer view
@ -115,11 +107,10 @@ protected:
/// hide the cursor
virtual void removeCursor() = 0;
/// y1 and y2 are coordinates of the screen
void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0);
private:
/// y1 and y2 are coordinates of the screen
void drawFromTo(LyXText *, BufferView *);
/// grey out (no buffer)
void greyOut();

View File

@ -169,15 +169,3 @@ void XScreen::expose(int x, int y, int w, int h)
x + owner_.xpos(),
y + owner_.ypos());
}
void XScreen::draw(LyXText * text, BufferView * bv, unsigned int y)
{
text->top_y(y);
// make a dumb new-draw
//drawFromTo(text, bv, 0, owner_.workHeight(), 0, 0);
//expose(0, 0, owner_.workWidth(), owner_.workHeight());
XSync(fl_get_display(), 0);
}

View File

@ -35,10 +35,6 @@ public:
/// Sets the cursor color to LColor::cursor.
virtual void setCursorColor();
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
virtual void draw(LyXText *, BufferView *, unsigned int y);
protected:
/// get the work area
virtual WorkArea & workarea() const { return owner_; }

View File

@ -208,7 +208,6 @@ int replace(BufferView * bv,
// FIXME: should be called via an LFUN
bv->buffer()->markDirty();
bv->fitCursor();
bv->update();
return replace_count;
@ -263,7 +262,6 @@ bool find(BufferView * bv,
bv->unlockInset(bv->theLockingInset());
found = false;
}
bv->fitCursor();
bv->update();
return found;
@ -397,7 +395,6 @@ bool findNextChange(BufferView * bv)
found = false;
}
bv->fitCursor();
bv->update();
return found;

View File

@ -472,8 +472,8 @@ TeXOnePar(Buffer const * buf,
LatexRunParams const & runparams,
string const & everypar)
{
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '" << everypar
<< "'" << endl;
lyxerr[Debug::LATEX] << "TeXOnePar... " << &*pit << " '"
<< everypar << "'" << endl;
BufferParams const & bparams = buf->params;
InsetOld const * in = pit->inInset();
@ -481,10 +481,10 @@ TeXOnePar(Buffer const * buf,
LyXLayout_ptr style;
// well we have to check if we are in an inset with unlimited
// lenght (all in one row) if that is true then we don't allow
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
if ((in == 0) || !in->forceDefaultParagraphs(in)) {
if (in == 0 || !in->forceDefaultParagraphs(in)) {
style = pit->layout();
if (pit->params().startOfAppendix()) {
@ -740,7 +740,7 @@ void latexParagraphs(Buffer const * buf,
// length (all in one row) if that is true then we don't allow
// any special options in the paragraph and also we don't allow
// any environment other then "Standard" to be valid!
if ((in == 0) || !in->forceDefaultParagraphs(in)) {
if (in == 0 || !in->forceDefaultParagraphs(in)) {
LyXLayout_ptr const & layout = par->layout();
if (layout->intitle) {

View File

@ -1068,7 +1068,7 @@ int getLengthMarkerHeight(BufferView const & bv, VSpace const & vsp)
int paintRows(BufferView const & bv, LyXText const & text,
RowList::iterator rit, int xo, int y, int yf, int y2, int yo)
{
//lyxerr << "paintRows: rit: " << &*rit << endl;
lyxerr << " paintRows: rit: " << &*rit << endl;
const_cast<LyXText&>(text).updateRowPositions();
int yy = yf - y;

View File

@ -1248,7 +1248,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
bv->text->setSelection();
bv->update();
bv->fitCursor();
break;
}
@ -1424,7 +1423,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
// stack. They don't *have* to
// alter the document...
// (Joacim)
// ...or maybe the SetCursorParUndo()
// ...or maybe the recordUndo()
// below isn't necessary at all anylonger?
if (inset_hit->lyxCode() == InsetOld::REF_CODE)
recordUndo(bv, Undo::ATOMIC);