Remove drawText[XY]Offset. No change in functionality

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7716 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2003-09-09 09:05:22 +00:00
parent 67ad3b90ef
commit 5020a84fc1
3 changed files with 23 additions and 26 deletions

View File

@ -1,3 +1,7 @@
2003-09-09 Martin Vermeer <martin.vermeer@hut.fi>
* insettext.[Ch]: remove drawText[XY]Offset
2003-09-08 Angus Leeming <leeming@lyx.org> 2003-09-08 Angus Leeming <leeming@lyx.org>
* insetcollapsable.C: * insetcollapsable.C:

View File

@ -109,8 +109,6 @@ void InsetText::init(InsetText const * ins)
boost::bind(&Paragraph::setInsetOwner, _1, this)); boost::bind(&Paragraph::setInsetOwner, _1, this));
top_y = 0; top_y = 0;
no_selection = true; no_selection = true;
drawTextXOffset = 0;
drawTextYOffset = 0;
locked = false; locked = false;
old_par = paragraphs.end(); old_par = paragraphs.end();
in_insetAllowed = false; in_insetAllowed = false;
@ -257,8 +255,8 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
top_y = y - dim_.asc; top_y = y - dim_.asc;
if (the_locking_inset && cpar() == inset_par && cpos() == inset_pos) { if (the_locking_inset && cpar() == inset_par && cpos() == inset_pos) {
inset_x = cx() - x + drawTextXOffset; inset_x = cx() - x;
inset_y = cy() + drawTextYOffset; inset_y = cy();
} }
x += TEXT_TO_INSET_OFFSET; x += TEXT_TO_INSET_OFFSET;
@ -362,8 +360,8 @@ void InsetText::lockInset(BufferView * bv)
void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset) void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
{ {
the_locking_inset = inset; the_locking_inset = inset;
inset_x = cx() - top_x + drawTextXOffset; inset_x = cx() - top_x;
inset_y = cy() + drawTextYOffset; inset_y = cy();
inset_pos = cpos(); inset_pos = cpos();
inset_par = cpar(); inset_par = cpar();
inset_boundary = cboundary(); inset_boundary = cboundary();
@ -381,10 +379,12 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
ParagraphList::iterator pend = paragraphs.end(); ParagraphList::iterator pend = paragraphs.end();
int const id = inset->id(); int const id = inset->id();
lyxerr << "inset:" << inset << " " << id << endl;
for (; pit != pend; ++pit) { for (; pit != pend; ++pit) {
InsetList::iterator it = pit->insetlist.begin(); InsetList::iterator it = pit->insetlist.begin();
InsetList::iterator const end = pit->insetlist.end(); InsetList::iterator const end = pit->insetlist.end();
for (; it != end; ++it) { for (; it != end; ++it) {
lyxerr << "it->inset:" << it->inset << endl;
if (it->inset == inset) { if (it->inset == inset) {
lyxerr << "InsetText::lockInsetInInset: 1 a" << endl; lyxerr << "InsetText::lockInsetInInset: 1 a" << endl;
text_.setCursorIntern(pit, it->pos); text_.setCursorIntern(pit, it->pos);
@ -398,6 +398,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
lyxerr << "InsetText::lockInsetInInset: 2" << endl; lyxerr << "InsetText::lockInsetInInset: 2" << endl;
text_.setCursorIntern(pit, it->pos); text_.setCursorIntern(pit, it->pos);
it->inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT)); it->inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
lyxerr << "recurse" << endl;
return the_locking_inset->lockInsetInInset(bv, inset); return the_locking_inset->lockInsetInInset(bv, inset);
} }
} }
@ -414,8 +415,8 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
if (the_locking_inset && the_locking_inset == inset) { if (the_locking_inset && the_locking_inset == inset) {
if (cpar() == inset_par && cpos() == inset_pos) { if (cpar() == inset_par && cpos() == inset_pos) {
lyxerr[Debug::INSETS] << "OK" << endl; lyxerr[Debug::INSETS] << "OK" << endl;
inset_x = cx() - top_x + drawTextXOffset; inset_x = cx() - top_x;
inset_y = cy() + drawTextYOffset; inset_y = cy();
} else { } else {
lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl; lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl;
} }
@ -464,7 +465,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
if (!locked) if (!locked)
lockInset(bv); lockInset(bv);
int tmp_x = cmd.x - drawTextXOffset; int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y(); int tmp_y = cmd.y + dim_.asc - bv->top_y();
InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
@ -502,8 +503,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
} }
int old_top_y = bv->top_y(); int old_top_y = bv->top_y();
text_.setCursorFromCoordinates(cmd.x - drawTextXOffset, text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
cmd.y + dim_.asc);
// set the selection cursor! // set the selection cursor!
text_.selection.cursor = text_.cursor; text_.selection.cursor = text_.cursor;
text_.cursor.x_fix(text_.cursor.x()); text_.cursor.x_fix(text_.cursor.x());
@ -543,7 +543,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
if (the_locking_inset) if (the_locking_inset)
return the_locking_inset->localDispatch(cmd1); return the_locking_inset->localDispatch(cmd1);
int tmp_x = cmd.x - drawTextXOffset; int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y(); int tmp_y = cmd.y + dim_.asc - bv->top_y();
InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
bool ret = false; bool ret = false;
@ -557,8 +557,8 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
if (isHighlyEditableInset(inset)) if (isHighlyEditableInset(inset))
ret = inset->localDispatch(cmd1); ret = inset->localDispatch(cmd1);
else { else {
inset_x = cx(bv) - top_x + drawTextXOffset; inset_x = cx(bv) - top_x;
inset_y = cy() + drawTextYOffset; inset_y = cy();
cmd1.x = cmd.x - inset_x; cmd1.x = cmd.x - inset_x;
cmd1.y = cmd.x - inset_y; cmd1.y = cmd.x - inset_y;
inset->edit(bv, cmd1.x, cmd1.y, cmd.button()); inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
@ -589,8 +589,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
BufferView * bv = cmd.view(); BufferView * bv = cmd.view();
LyXCursor cur = text_.cursor; LyXCursor cur = text_.cursor;
text_.setCursorFromCoordinates text_.setCursorFromCoordinates (cmd.x, cmd.y + dim_.asc);
(cmd.x - drawTextXOffset, cmd.y + dim_.asc);
text_.cursor.x_fix(text_.cursor.x()); text_.cursor.x_fix(text_.cursor.x());
if (cur == text_.cursor) if (cur == text_.cursor)
return; return;
@ -637,8 +636,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
// cycle hopefully (Jug 20020509) // cycle hopefully (Jug 20020509)
// FIXME: GUII I've changed this to none: probably WRONG // FIXME: GUII I've changed this to none: probably WRONG
if (!checkAndActivateInset(bv, cmd.x, tmp_y, mouse_button::none)) { if (!checkAndActivateInset(bv, cmd.x, tmp_y, mouse_button::none)) {
text_.setCursorFromCoordinates(cmd.x - drawTextXOffset, text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
cmd.y + dim_.asc);
text_.cursor.x(text_.cursor.x()); text_.cursor.x(text_.cursor.x());
text_.cursor.x_fix(text_.cursor.x()); text_.cursor.x_fix(text_.cursor.x());
} }
@ -1391,7 +1389,6 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
mouse_button::state button) mouse_button::state button)
{ {
x -= drawTextXOffset;
int dummyx = x; int dummyx = x;
int dummyy = y + dim_.asc; int dummyy = y + dim_.asc;
InsetOld * inset = getLyXText(bv)->checkInsetHit(dummyx, dummyy); InsetOld * inset = getLyXText(bv)->checkInsetHit(dummyx, dummyy);
@ -1409,8 +1406,8 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
x = dim_.wid; x = dim_.wid;
if (y < 0) if (y < 0)
y = dim_.des; y = dim_.des;
inset_x = cx() - top_x + drawTextXOffset; inset_x = cx() - top_x;
inset_y = cy() + drawTextYOffset; inset_y = cy();
FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button); FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
inset->localDispatch(cmd); inset->localDispatch(cmd);
if (!the_locking_inset) if (!the_locking_inset)
@ -1582,7 +1579,7 @@ void InsetText::clearInset(BufferView * bv, int start_x, int baseline) const
} }
if (ty + h > pain.paperHeight()) if (ty + h > pain.paperHeight())
h = pain.paperHeight(); h = pain.paperHeight();
if (top_x + drawTextXOffset + w > pain.paperWidth()) if (top_x + w > pain.paperWidth())
w = pain.paperWidth(); w = pain.paperWidth();
pain.fillRectangle(start_x + 1, ty + 1, w - 3, h - 1, backgroundColor()); pain.fillRectangle(start_x + 1, ty + 1, w - 3, h - 1, backgroundColor());
} }

View File

@ -209,10 +209,6 @@ protected:
/// lock an inset inside this one /// lock an inset inside this one
void lockInset(BufferView *, UpdatableInset *); void lockInset(BufferView *, UpdatableInset *);
/// ///
mutable int drawTextXOffset;
///
mutable int drawTextYOffset;
///
bool autoBreakRows; bool autoBreakRows;
/// ///
DrawFrame drawFrame_; DrawFrame drawFrame_;