move inlines add pragma

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1647 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-03-01 13:37:48 +00:00
parent 2862a8fbcc
commit 76957e7e5e
2 changed files with 162 additions and 76 deletions

View File

@ -1,5 +1,9 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_parinset.h"
#include "math_iter.h"
#include "array.h"
@ -80,67 +84,66 @@ MathParInset::draw(Painter & pain, int x, int y)
data.GoBegin();
while (data.OK()) {
data.GetPos(x, y);
byte cx = data.GetChar();
byte const cx = data.GetChar();
if (cx >= ' ') {
string const s = data.GetString();
drawStr(pain, data.fcode(), size(), x, y, s);
mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
limits = false;
} else {
if (cx == 0)
break;
if (MathIsInset(cx)) {
int yy = y;
MathedInset * p = data.GetInset();
if (cx == LM_TC_UP) {
if (limits) {
x -= (xp > p->Width()) ?
p->Width() + (xp - p->Width()) / 2 : xp;
yy -= (asc + p->Descent() + 4);
} else
yy -= (p->Descent() > asc) ?
p->Descent() + 4 : asc;
} else if (cx == LM_TC_DOWN) {
if (limits) {
x -= (xp > p->Width()) ?
p->Width() + (xp - p->Width()) / 2 : xp;
yy += des + p->Ascent() + 2;
} else
yy += des + p->Ascent() / 2;
} else {
asc = p->Ascent();
des = p->Descent();
}
p->draw(pain, x, yy);
if (cx != LM_TC_UP && cx != LM_TC_DOWN) {
limits = p->GetLimits();
if (limits)
xp = p->Width();
}
data.Next();
} else if (cx == LM_TC_TAB) {
if (cxp == cx
|| cxp == LM_TC_CR || data.IsFirst()) {
pain.rectangle(x, y - df_asc,
df_width, df_asc,
LColor::mathline);
}
data.Next();
limits = false;
} else if (cx == LM_TC_CR) {
if (cxp == LM_TC_TAB
|| cxp == LM_TC_CR || data.IsFirst()) {
pain.rectangle(x, y - df_asc,
df_width, df_asc,
LColor::mathline);
}
data.Next();
limits = false;
} else {
lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl;
break;
} else if (cx == 0) {
break;
} else if (MathIsInset(cx)) {
int yy = y;
MathedInset * p = data.GetInset();
if (cx == LM_TC_UP) {
if (limits) {
x -= (xp > p->Width()) ?
p->Width() + (xp - p->Width()) / 2 : xp;
yy -= (asc + p->Descent() + 4);
} else
yy -= (p->Descent() > asc) ?
p->Descent() + 4 : asc;
} else if (cx == LM_TC_DOWN) {
if (limits) {
x -= (xp > p->Width()) ?
p->Width() + (xp - p->Width()) / 2 : xp;
yy += des + p->Ascent() + 2;
} else
yy += des + p->Ascent() / 2;
} else {
asc = p->Ascent();
des = p->Descent();
}
p->draw(pain, x, yy);
if (cx != LM_TC_UP && cx != LM_TC_DOWN) {
limits = p->GetLimits();
if (limits)
xp = p->Width();
}
data.Next();
} else if (cx == LM_TC_TAB) {
if (cxp == cx
|| cxp == LM_TC_CR || data.IsFirst()) {
pain.rectangle(x, y - df_asc,
df_width, df_asc,
LColor::mathline);
}
data.Next();
limits = false;
} else if (cx == LM_TC_CR) {
if (cxp == LM_TC_TAB
|| cxp == LM_TC_CR || data.IsFirst()) {
pain.rectangle(x, y - df_asc,
df_width, df_asc,
LColor::mathline);
}
data.Next();
limits = false;
} else {
lyxerr << "GMathed Error: Unrecognized code[" << cx << "]" << endl;
break;
}
cxp = cx;
}
if (cxp == LM_TC_TAB || cxp == LM_TC_CR) {

View File

@ -6,6 +6,10 @@
#include "math_inset.h"
#include "math_defs.h"
#ifdef __GNUG__
#pragma interface
#endif
class MathedRowSt;
class MathedArray;
@ -13,7 +17,7 @@ class MathedArray;
/** The math paragraph base class, base to all editable math objects
\author Alejandro Aguilar Sierra
*/
class MathParInset: public MathedInset {
class MathParInset : public MathedInset {
public:
///
MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
@ -44,38 +48,34 @@ public:
virtual bool Inside(int, int);
// Tab stuff used by Matrix.
///
virtual void SetAlign(char, string const &) {}
virtual void SetAlign(char, string const &);
///
virtual int GetColumns() const { return 1; }
virtual int GetColumns() const;
///
virtual int GetRows() const { return 1; }
virtual int GetRows() const;
///
virtual bool isMatrix() const { return false; }
virtual bool isMatrix() const;
// Vertical switching
///
virtual bool setArgumentIdx(int i) { return (i == 0); }
virtual bool setArgumentIdx(int i);
///
virtual bool setNextArgIdx() { return false; }
virtual bool setNextArgIdx();
///
virtual int getArgumentIdx() const { return 0; }
virtual int getArgumentIdx() const;
///
virtual int getMaxArgumentIdx() const { return 0; }
virtual int getMaxArgumentIdx() const;
///
virtual void SetStyle(short);
///
virtual MathedRowSt * getRowSt() const;
///
virtual void setRowSt(MathedRowSt *) {}
virtual void setRowSt(MathedRowSt *);
///
virtual bool Permit(short f) const;
///
int xo() const {
return xo_;
}
int xo() const;
///
int yo() const {
return yo_;
}
int yo() const;
///
void clear();
protected:
@ -84,17 +84,100 @@ protected:
///
short flag;
///
void xo(int tx) {
xo_ = tx;
}
void xo(int tx);
///
void yo(int ty) {
yo_ = ty;
}
void yo(int ty);
private:
/// Cursor start position
int xo_;
///
int yo_;
};
inline
void MathParInset::SetAlign(char, string const &)
{}
inline
int MathParInset::GetColumns() const
{
return 1;
}
inline
int MathParInset::GetRows() const
{
return 1;
}
inline
bool MathParInset::isMatrix() const
{
return false;
}
inline
bool MathParInset::setArgumentIdx(int i)
{
return (i == 0);
}
inline
bool MathParInset::setNextArgIdx()
{
return false;
}
inline
int MathParInset::getArgumentIdx() const
{
return 0;
}
inline
int MathParInset::getMaxArgumentIdx() const
{
return 0;
}
inline
void MathParInset::setRowSt(MathedRowSt *)
{}
inline
int MathParInset::xo() const
{
return xo_;
}
inline
int MathParInset::yo() const
{
return yo_;
}
inline
void MathParInset::xo(int tx)
{
xo_ = tx;
}
inline
void MathParInset::yo(int ty)
{
yo_ = ty;
}
#endif