cursor cosmetics for \underset

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7596 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-22 16:14:26 +00:00
parent ffe9f5f430
commit 430ba66080
5 changed files with 61 additions and 20 deletions

View File

@ -101,22 +101,22 @@ bool MathNestInset::idxLeft(idx_type & idx, pos_type & pos) const
} }
bool MathNestInset::idxFirst(idx_type & i, pos_type & pos) const bool MathNestInset::idxFirst(idx_type & idx, pos_type & pos) const
{ {
if (nargs() == 0) if (nargs() == 0)
return false; return false;
i = 0; idx = 0;
pos = 0; pos = 0;
return true; return true;
} }
bool MathNestInset::idxLast(idx_type & i, pos_type & pos) const bool MathNestInset::idxLast(idx_type & idx, pos_type & pos) const
{ {
if (nargs() == 0) if (nargs() == 0)
return false; return false;
i = nargs() - 1; idx = nargs() - 1;
pos = cell(i).size(); pos = cell(idx).size();
return true; return true;
} }

View File

@ -19,10 +19,6 @@ using std::max;
using std::auto_ptr; using std::auto_ptr;
MathOversetInset::MathOversetInset()
{}
auto_ptr<InsetBase> MathOversetInset::clone() const auto_ptr<InsetBase> MathOversetInset::clone() const
{ {
return auto_ptr<InsetBase>(new MathOversetInset(*this)); return auto_ptr<InsetBase>(new MathOversetInset(*this));
@ -51,6 +47,22 @@ void MathOversetInset::draw(PainterInfo & pi, int x, int y) const
} }
bool MathOversetInset::idxFirst(idx_type & i, pos_type & pos) const
{
i = 1;
pos = 0;
return true;
}
bool MathOversetInset::idxLast(idx_type & i, pos_type & pos) const
{
i = 1;
pos = cell(i).size();
return true;
}
void MathOversetInset::write(WriteStream & os) const void MathOversetInset::write(WriteStream & os) const
{ {
os << "\\overset{" << cell(0) << "}{" << cell(1) << '}'; os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';

View File

@ -19,13 +19,15 @@
class MathOversetInset : public MathFracbaseInset { class MathOversetInset : public MathFracbaseInset {
public: public:
/// ///
MathOversetInset(); std::auto_ptr<InsetBase> clone() const;
///
virtual std::auto_ptr<InsetBase> clone() const;
/// ///
void metrics(MetricsInfo & mi, Dimension & dim) const; void metrics(MetricsInfo & mi, Dimension & dim) const;
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
///
bool idxFirst(idx_type & idx, pos_type & pos) const;
///
bool idxLast(idx_type & idx, pos_type & pos) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;

View File

@ -19,10 +19,6 @@ using std::max;
using std::auto_ptr; using std::auto_ptr;
MathUndersetInset::MathUndersetInset()
{}
auto_ptr<InsetBase> MathUndersetInset::clone() const auto_ptr<InsetBase> MathUndersetInset::clone() const
{ {
return auto_ptr<InsetBase>(new MathUndersetInset(*this)); return auto_ptr<InsetBase>(new MathUndersetInset(*this));
@ -51,6 +47,34 @@ void MathUndersetInset::draw(PainterInfo & pi, int x, int y) const
} }
bool MathUndersetInset::idxFirst(idx_type & i, pos_type & pos) const
{
i = 1;
pos = 0;
return true;
}
bool MathUndersetInset::idxLast(idx_type & i, pos_type & pos) const
{
i = 1;
pos = cell(i).size();
return true;
}
bool MathUndersetInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
int targetx) const
{
idx_type target = up; // up ? 1 : 0, since upper cell has idx 1
if (idx == target)
return false;
idx = target;
pos = cell(idx).x2pos(targetx);
return true;
}
void MathUndersetInset::write(WriteStream & os) const void MathUndersetInset::write(WriteStream & os) const
{ {
os << "\\underset{" << cell(0) << "}{" << cell(1) << '}'; os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';

View File

@ -19,14 +19,17 @@
class MathUndersetInset : public MathFracbaseInset { class MathUndersetInset : public MathFracbaseInset {
public: public:
/// ///
MathUndersetInset(); std::auto_ptr<InsetBase> clone() const;
///
virtual std::auto_ptr<InsetBase> clone() const;
/// ///
void metrics(MetricsInfo & mi, Dimension & dim) const; void metrics(MetricsInfo & mi, Dimension & dim) const;
/// ///
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
///
bool idxFirst(idx_type & idx, pos_type & pos) const;
///
bool idxLast(idx_type & idx, pos_type & pos) const;
///
bool idxUpDown(idx_type & idx, pos_type & pos, bool up, int targetx) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///