partial fix for bug 622, cosmetic rest remains open

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10195 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2005-07-15 00:39:44 +00:00
parent 8c58a8db20
commit 1a9992c796
19 changed files with 55 additions and 42 deletions

View File

@ -875,8 +875,7 @@ void BufferView::Pimpl::trackChanges()
bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
{
lyxerr << BOOST_CURRENT_FUNCTION
<< "[ cmd0 " << cmd0 << "]" << endl;
//lyxerr << BOOST_CURRENT_FUNCTION << "[ cmd0 " << cmd0 << "]" << endl;
// This is only called for mouse related events including
// LFUN_FILE_OPEN generated by drag-and-drop.
@ -910,10 +909,10 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
// Build temporary cursor.
cmd.y = min(max(cmd.y,-1), workarea().workHeight());
InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
lyxerr << BOOST_CURRENT_FUNCTION
<< " * hit inset at tip: " << inset << endl;
lyxerr << BOOST_CURRENT_FUNCTION
<< " * created temp cursor:" << cur << endl;
//lyxerr << BOOST_CURRENT_FUNCTION
// << " * hit inset at tip: " << inset << endl;
//lyxerr << BOOST_CURRENT_FUNCTION
// << " * created temp cursor:" << cur << endl;
// Put anchor at the same position.
cur.resetAnchor();

View File

@ -1,15 +1,15 @@
2005-05-07 André Pönitz <poenitz@gmx.net>
2005-07-14 André Pönitz <poenitz@gmx.net>
* undo.C (recordUndoFullBuffer): implement undo for
textclass switches
2005-05-07 André Pönitz <poenitz@gmx.net>
2005-07-14 André Pönitz <poenitz@gmx.net>
* cursor.C (setSelection): open insets when selection is set there
to avoid crashs with cold coord cache
2005-05-07 André Pönitz <poenitz@gmx.net>
2005-07-14 André Pönitz <poenitz@gmx.net>
* trans_mgr.C (insert): move cursor to the right after inserting
a char.

View File

@ -176,10 +176,10 @@ void InsetBase::edit(LCursor &, bool)
}
InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
InsetBase * InsetBase::editXY(LCursor &, int x, int y)
{
lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
return const_cast<InsetBase*>(this);
return this;
}

View File

@ -106,7 +106,7 @@ public:
/// cursor enters
virtual void edit(LCursor & cur, bool left);
/// cursor enters
virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
virtual InsetBase * editXY(LCursor & cur, int x, int y);
/// compute the size of the object returned in dim
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;

View File

@ -260,13 +260,12 @@ void InsetCollapsable::edit(LCursor & cur, bool left)
}
InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
{
//lyxerr << "InsetCollapsable: edit xy" << endl;
if (status_ == Collapsed) {
return const_cast<InsetCollapsable*>(this);
}
cur.push(const_cast<InsetCollapsable&>(*this));
if (status_ == Collapsed)
return this;
cur.push(*this);
return InsetText::editXY(cur, x, y);
}

View File

@ -96,7 +96,7 @@ protected:
///
void edit(LCursor & cur, bool left);
///
InsetBase * editXY(LCursor & cur, int x, int y) const;
InsetBase * editXY(LCursor & cur, int x, int y);
///
void setInlined() { status_ = Inlined; }

View File

@ -1158,11 +1158,11 @@ int InsetTabular::dist(idx_type const cell, int x, int y) const
}
InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y) const
InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
{
//lyxerr << "InsetTabular::editXY: " << this << endl;
cur.selection() = false;
cur.push(const_cast<InsetTabular&>(*this));
cur.push(*this);
cur.idx() = getNearestCell(x, y);
resetPos(cur);
return cell(cur.idx())->text_.editXY(cur, x, y);

View File

@ -130,7 +130,7 @@ public:
/// lock cell with given index
void edit(LCursor & cur, bool left);
///
InsetBase * editXY(LCursor & cur, int x, int y) const;
InsetBase * editXY(LCursor & cur, int x, int y);
/// can we go further down on mouse click?
bool descendable() const { return true; }

View File

@ -288,7 +288,7 @@ void InsetText::edit(LCursor & cur, bool left)
}
InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
{
old_pit = -1;
return text_.editXY(cur, x, y);

View File

@ -124,7 +124,7 @@ public:
///
void edit(LCursor & cur, bool left);
///
InsetBase * editXY(LCursor & cur, int x, int y) const;
InsetBase * editXY(LCursor & cur, int x, int y);
/// number of cells in this inset
size_t nargs() const { return 1; }

View File

@ -180,7 +180,7 @@ public:
///
void setCursorFromCoordinates(LCursor & cur, int x, int y);
///
InsetBase * editXY(LCursor & cur, int x, int y) const;
InsetBase * editXY(LCursor & cur, int x, int y);
/// Move cursor one line up.
/**
* Returns true if an update is needed after the move.

View File

@ -1,18 +1,22 @@
2005-07-16 André Pönitz <poenitz@lyx.org>
2005-07-15 Andreas Vox <vox@arcor.de>
* math_hullinset.C (editXY): partial fix for #622
2005-07-14 André Pönitz <poenitz@lyx.org>
* math_hullinset.C (BREAKLINE): choose between eqnarray and
align according to user preference
2005-07-16 André Pönitz <poenitz@lyx.org>
2005-07-14 André Pönitz <poenitz@lyx.org>
* math_charinset.C (mathmlize): escape <, >, and & on export
2005-07-16 André Pönitz <poenitz@lyx.org>
2005-07-14 André Pönitz <poenitz@lyx.org>
* math_gridinset.C (doDispatch): cur.undispatched on LFUN_ESCAPE
2005-07-16 André Pönitz <poenitz@lyx.org>
2005-07-14 André Pönitz <poenitz@lyx.org>
* math_gridinset.C (doDispatch): cur.undispatched on LFUN_NEXT/PRIOR

View File

@ -183,6 +183,16 @@ MathHullInset & MathHullInset::operator=(MathHullInset const & other)
}
InsetBase * MathHullInset::editXY(LCursor & cur, int x, int y)
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
edit(cur, true);
return this;
}
return MathNestInset::editXY(cur, x, y);
}
MathInset::mode_type MathHullInset::currentMode() const
{
if (type_ == "none")

View File

@ -196,6 +196,8 @@ public:
///
void edit(LCursor & cur, bool left);
///
InsetBase * editXY(LCursor & cur, int x, int y);
///
bool display() const;
///
Code lyxCode() const;

View File

@ -987,19 +987,19 @@ void MathNestInset::edit(LCursor & cur, bool left)
}
InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
{
int idx_min = 0;
int dist_min = 1000000;
for (idx_type i = 0; i < nargs(); ++i) {
int d = cell(i).dist(x, y);
for (idx_type i = 0, n = nargs(); i != n; ++i) {
int const d = cell(i).dist(x, y);
if (d < dist_min) {
dist_min = d;
idx_min = i;
}
}
MathArray const & ar = cell(idx_min);
cur.push(const_cast<MathNestInset&>(*this));
MathArray & ar = cell(idx_min);
cur.push(*this);
cur.idx() = idx_min;
cur.pos() = ar.x2pos(x - ar.xo());
lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
@ -1009,7 +1009,7 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
if (ar[i]->covers(x, y))
return ar[i].nucleus()->editXY(cur, x, y);
}
return const_cast<MathNestInset*>(this);
return this;
}

View File

@ -41,7 +41,7 @@ public:
///
void edit(LCursor & cur, bool left);
///
InsetBase * editXY(LCursor & cur, int x, int y) const;
InsetBase * editXY(LCursor & cur, int x, int y);
/// order of movement through the cells when pressing the left key
bool idxLeft(LCursor &) const;

View File

@ -912,7 +912,7 @@ Row const & LyXText::getRowNearY(int y, pit_type pit) const
// x,y are absolute screen coordinates
// sets cursor recursively descending into nested editable insets
InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
{
pit_type pit = getPitNearY(y);
BOOST_ASSERT(pit != -1);
@ -932,7 +932,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
if (!inset) {
// Either we deconst editXY or better we move current_font
// and real_current_font to LCursor
const_cast<LyXText *>(this)->setCurrentFont(cur);
setCurrentFont(cur);
return 0;
}
@ -946,7 +946,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
--cur.pos();
inset = inset->editXY(cur, x, y);
if (cur.top().text() == this)
const_cast<LyXText *>(this)->setCurrentFont(cur);
setCurrentFont(cur);
return inset;
}

View File

@ -288,7 +288,6 @@ bool LyXText::isRTL(Paragraph const & par) const
void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
{
lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();
@ -1062,7 +1061,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
// don't set anchor_
bvcur.setCursor(cur);
bvcur.selection() = true;
lyxerr << "MOTION: " << bv->cursor() << endl;
//lyxerr << "MOTION: " << bv->cursor() << endl;
}
} else

View File

@ -65,8 +65,8 @@ void doRecordUndo(Undo::undo_kind kind,
undo.cursor = cur;
undo.bparams = bparams ;
undo.isFullBuffer = isFullBuffer;
lyxerr << "recordUndo: cur: " << cur << endl;
lyxerr << "recordUndo: pos: " << cur.pos() << endl;
//lyxerr << "recordUndo: cur: " << cur << endl;
//lyxerr << "recordUndo: pos: " << cur.pos() << endl;
//lyxerr << "recordUndo: cell: " << cell << endl;
undo.from = first_pit;
undo.end = cell.lastpit() - last_pit;