remove toggleToggle

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7427 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-28 21:22:42 +00:00
parent 2b2b83803a
commit efff440e70
14 changed files with 33 additions and 97 deletions

View File

@ -239,12 +239,6 @@ void BufferView::toggleSelection(bool b)
}
void BufferView::toggleToggle()
{
pimpl_->toggleToggle();
}
void BufferView::center()
{
pimpl_->center();

View File

@ -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();

View File

@ -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;

View File

@ -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());

View File

@ -1,3 +1,13 @@
2003-07-29 André Pönitz <poenitz@gmx.net>
* BufferView.[Ch]:
* BufferView_pimpl.[Ch]:
* lyxfunc.C:
* text2.C:
* text3.C:
* textcursor.[Ch]: remove toggleToggle & Co
2003-07-28 José Matos <jamatos@fep.up.pt>
* buffer.C (readParagraph):

View File

@ -1,3 +1,8 @@
2003-07-29 André Pönitz <poenitz@gmx.net>
* screen.[Ch]: remove toggleToggle.
2003-07-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* Menubar.h: do not use a pimpl, but rather an abstract class

View File

@ -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<int>((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<int>(text->top_y() + workarea().workHeight())) - offset;
int const top = min(max(top_tmp, text->top_y()),
static_cast<int>(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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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

View File

@ -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