diff --git a/src/BufferView.C b/src/BufferView.C index 4df23aa3e6..f42d68981b 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -239,12 +239,6 @@ void BufferView::toggleSelection(bool b) } -void BufferView::toggleToggle() -{ - pimpl_->toggleToggle(); -} - - void BufferView::center() { pimpl_->center(); diff --git a/src/BufferView.h b/src/BufferView.h index 5b3b10ca00..808166592e 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -176,8 +176,6 @@ public: bool fitLockedInsetCursor(int x, int y, int asc, int desc); /// FIXME void toggleSelection(bool = true); - /// FIXME: my word ! - void toggleToggle(); /// hide the cursor if it is visible void hideCursor(); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 1526c5112b..2efe77dc3d 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -463,7 +463,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() void BufferView::Pimpl::repaint() { // Regenerate the screen. - screen().redraw(bv_->text, bv_); + screen().redraw(bv_, bv_->text); } @@ -820,12 +820,6 @@ void BufferView::Pimpl::toggleSelection(bool b) } -void BufferView::Pimpl::toggleToggle() -{ - screen().toggleToggle(bv_->text, bv_); -} - - void BufferView::Pimpl::center() { LyXText * t = bv_->text; diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 17433f37b9..799d513d1e 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -97,8 +97,6 @@ struct BufferView::Pimpl : public boost::signals::trackable { /// void toggleSelection(bool = true); /// - void toggleToggle(); - /// void center(); /// bool insertInset(InsetOld * inset, string const & lout = string()); diff --git a/src/ChangeLog b/src/ChangeLog index 04e50276f4..49b6ed8817 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ + +2003-07-29 André Pönitz + + * BufferView.[Ch]: + * BufferView_pimpl.[Ch]: + * lyxfunc.C: + * text2.C: + * text3.C: + * textcursor.[Ch]: remove toggleToggle & Co + 2003-07-28 José Matos * buffer.C (readParagraph): diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 76f0356731..8e9303ba9d 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ + +2003-07-29 André Pönitz + + * screen.[Ch]: remove toggleToggle. + 2003-07-25 Jean-Marc Lasgouttes * Menubar.h: do not use a pimpl, but rather an abstract class diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 8679a0c44f..6a4721c9a0 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -228,20 +228,17 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text, if (y + desc - text->top_y() >= vheight) newtop = y - 3 * vheight / 4; // the scroll region must be so big!! - else if (y - asc < text->top_y() - && text->top_y() > 0) { + else if (y - asc < text->top_y() && text->top_y() > 0) newtop = y - vheight / 4; - } newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb) - if (newtop != text->top_y()) { - draw(text, bv, newtop); - text->top_y(newtop); - return true; - } + if (newtop == text->top_y()) + return false; - return false; + draw(text, bv, newtop); + text->top_y(newtop); + return true; } @@ -271,10 +268,8 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text) newtop = cursor.y() - vheight / 2; } - } else if (static_cast((cursor.y()) - row->baseline()) < - top_y && top_y > 0) { - if (row->height() < vheight - && row->height() > vheight / 4) { + } else if (int(cursor.y() - row->baseline()) < top_y && top_y > 0) { + if (row->height() < vheight && row->height() > vheight / 4) { newtop = cursor.y() - row->baseline(); } else { // scroll up @@ -355,36 +350,7 @@ void LyXScreen::toggleSelection(LyXText * text, BufferView * bv, } -void LyXScreen::toggleToggle(LyXText * text, BufferView * bv, - int yo, int xo) -{ - if (text->toggle_cursor.par() == text->toggle_end_cursor.par() - && text->toggle_cursor.pos() == text->toggle_end_cursor.pos()) - return; - - int const top_tmp = text->toggle_cursor.y() - - text->getRow(text->toggle_cursor)->baseline(); - int const bottom_tmp = text->toggle_end_cursor.y() - - text->getRow(text->toggle_end_cursor)->baseline() - + text->getRow(text->toggle_end_cursor)->height(); - - int const offset = yo < 0 ? yo : 0; - int const bottom = min(max(bottom_tmp, text->top_y()), - static_cast(text->top_y() + workarea().workHeight())) - offset; - int const top = min(max(top_tmp, text->top_y()), - static_cast(text->top_y() + workarea().workHeight())) - offset; - - workarea().getPainter().start(); - - drawFromTo(text, bv, top - text->top_y(), bottom - text->top_y(), yo, xo); - expose(0, top - text->top_y(), workarea().workWidth(), - bottom - text->top_y() - (top - text->top_y())); - - workarea().getPainter().end(); -} - - -void LyXScreen::redraw(LyXText * text, BufferView * bv) +void LyXScreen::redraw(BufferView * bv, LyXText * text) { greyed_out_ = !text; diff --git a/src/frontends/screen.h b/src/frontends/screen.h index 4628e9ea43..9f87cb5c6b 100644 --- a/src/frontends/screen.h +++ b/src/frontends/screen.h @@ -61,7 +61,7 @@ public: int x, int y, int a, int d); /// redraw the screen, without using existing pixmap - virtual void redraw(LyXText *, BufferView *); + virtual void redraw(BufferView * bv, LyXText * text); /** * topCursorVisible - get a new "top" to make the cursor visible @@ -108,10 +108,6 @@ public: virtual void toggleSelection(LyXText *, BufferView *, bool = true, int y_offset = 0, int x_offset = 0); - /// FIXME - at least change the name !! - virtual void toggleToggle(LyXText *, BufferView *, - int y_offset = 0, int x_offset = 0); - protected: /// cause the display of the given area of the work area virtual void expose(int x, int y, int w, int h) = 0; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index ce2d91175c..1f22e6987e 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -791,11 +791,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd) if (cur == text_.cursor) return; text_.setSelection(); - bool flag = (text_.toggle_cursor.par() != text_.toggle_end_cursor.par() || - text_.toggle_cursor.pos() != text_.toggle_end_cursor.pos()); - if (flag) { - updateLocal(bv, SELECTION, false); - } + updateLocal(bv, SELECTION, false); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 7510fec113..f271dad9d0 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -127,7 +127,7 @@ void LyXFunc::moveCursorUpdate(bool flag, bool selecting) if (selecting || TEXT(flag)->selection.mark()) { TEXT(flag)->setSelection(); if (!TEXT(flag)->isInInset()) - view()->toggleToggle(); + view()->repaint(); } view()->update(TEXT(flag), BufferView::SELECT); diff --git a/src/text2.C b/src/text2.C index 1ce87ebd57..2498956b4c 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2075,16 +2075,10 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) #endif // correct all cursors held by the LyXText fixCursorAfterDelete(cursor, old_cursor); - fixCursorAfterDelete(selection.cursor, - old_cursor); - fixCursorAfterDelete(selection.start, - old_cursor); + fixCursorAfterDelete(selection.cursor, old_cursor); + fixCursorAfterDelete(selection.start, old_cursor); fixCursorAfterDelete(selection.end, old_cursor); - fixCursorAfterDelete(last_sel_cursor, - old_cursor); - fixCursorAfterDelete(toggle_cursor, old_cursor); - fixCursorAfterDelete(toggle_end_cursor, - old_cursor); + fixCursorAfterDelete(last_sel_cursor, old_cursor); return false; } } diff --git a/src/text3.C b/src/text3.C index a4ef8ec0f4..3f0d72df35 100644 --- a/src/text3.C +++ b/src/text3.C @@ -72,7 +72,7 @@ namespace { if (lt->isInInset()) bv->updateInset(lt->inset_owner); else - bv->toggleToggle(); + bv->repaint(); } if (!lt->isInInset()) { bv->update(lt, BufferView::SELECT); @@ -1334,7 +1334,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd) if (!bv->text->selection.set()) bv->update(BufferView::UPDATE); bv->text->setSelection(); - bv->screen().toggleToggle(bv->text, bv); + bv->repaint(); bv->fitCursor(); break; } diff --git a/src/textcursor.C b/src/textcursor.C index 3d96366e83..ecb6584a8e 100644 --- a/src/textcursor.C +++ b/src/textcursor.C @@ -14,17 +14,6 @@ bool TextCursor::setSelection() selection.set(true); - // first the toggling area - if (cursor.y() < last_sel_cursor.y() - || (cursor.y() == last_sel_cursor.y() - && cursor.x() < last_sel_cursor.x())) { - toggle_end_cursor = last_sel_cursor; - toggle_cursor = cursor; - } else { - toggle_end_cursor = cursor; - toggle_cursor = last_sel_cursor; - } - last_sel_cursor = cursor; // and now the whole selection diff --git a/src/textcursor.h b/src/textcursor.h index 530bb22840..5e1c982c70 100644 --- a/src/textcursor.h +++ b/src/textcursor.h @@ -75,10 +75,6 @@ struct TextCursor { /// needed for the toggling (cursor position on last selection made) LyXCursor last_sel_cursor; - /// needed for toggling the selection in screen.C - LyXCursor toggle_cursor; - /// needed for toggling the selection in screen.C - LyXCursor toggle_end_cursor; }; #endif