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> #include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_parinset.h" #include "math_parinset.h"
#include "math_iter.h" #include "math_iter.h"
#include "array.h" #include "array.h"
@ -80,67 +84,66 @@ MathParInset::draw(Painter & pain, int x, int y)
data.GoBegin(); data.GoBegin();
while (data.OK()) { while (data.OK()) {
data.GetPos(x, y); data.GetPos(x, y);
byte cx = data.GetChar(); byte const cx = data.GetChar();
if (cx >= ' ') { if (cx >= ' ') {
string const s = data.GetString(); string const s = data.GetString();
drawStr(pain, data.fcode(), size(), x, y, s); drawStr(pain, data.fcode(), size(), x, y, s);
mathed_char_height(LM_TC_CONST, size(), 'y', asc, des); mathed_char_height(LM_TC_CONST, size(), 'y', asc, des);
limits = false; limits = false;
} else { } else if (cx == 0) {
if (cx == 0) break;
break; } else if (MathIsInset(cx)) {
if (MathIsInset(cx)) { int yy = y;
int yy = y; MathedInset * p = data.GetInset();
MathedInset * p = data.GetInset(); if (cx == LM_TC_UP) {
if (cx == LM_TC_UP) { if (limits) {
if (limits) { x -= (xp > p->Width()) ?
x -= (xp > p->Width()) ? p->Width() + (xp - p->Width()) / 2 : xp;
p->Width() + (xp - p->Width()) / 2 : xp; yy -= (asc + p->Descent() + 4);
yy -= (asc + p->Descent() + 4); } else
} else yy -= (p->Descent() > asc) ?
yy -= (p->Descent() > asc) ? p->Descent() + 4 : asc;
p->Descent() + 4 : asc; } else if (cx == LM_TC_DOWN) {
} else if (cx == LM_TC_DOWN) { if (limits) {
if (limits) { x -= (xp > p->Width()) ?
x -= (xp > p->Width()) ? p->Width() + (xp - p->Width()) / 2 : xp;
p->Width() + (xp - p->Width()) / 2 : xp; yy += des + p->Ascent() + 2;
yy += des + p->Ascent() + 2; } else
} else yy += des + p->Ascent() / 2;
yy += des + p->Ascent() / 2; } else {
} else { asc = p->Ascent();
asc = p->Ascent(); des = p->Descent();
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;
} }
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; cxp = cx;
} }
if (cxp == LM_TC_TAB || cxp == LM_TC_CR) { if (cxp == LM_TC_TAB || cxp == LM_TC_CR) {

View File

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