Source Code (Use browser search to find items of interest.)
Class Index
klyx'MathedInset (./klyx/src/math_defs.h:144)
class MathedInset {
public:
/// A math inset has a name (usually its LaTeX name), type and font-size
MathedInset(char const *nm, short ot, short st);
///
MathedInset(MathedInset*);
///
virtual ~MathedInset() { };
/// Draw the object
virtual void Draw(int x, int baseline)=0;
/// Write LaTeX and Lyx code
virtual void Write(FILE *file)=0;
/// Write LaTeX and Lyx code
virtual void Write(LString &file)=0;
/// Reproduces itself
virtual MathedInset *Clone()=0;
/// Compute the size of the object
virtual void Metrics()=0;
///
virtual int Ascent() const { return ascent; }
///
virtual int Descent() const { return descent; }
///
virtual int Width() const { return width; }
///
virtual int Height() const { return ascent + descent; }
///
virtual bool GetLimits() const { return false; }
///
virtual void SetLimits(bool) { }
///
char const *GetName() const { return name; }
///
short GetType() const { return objtype; }
///
short GetStyle() const { return size; }
//Man: Avoid to use these functions if it's not strictly necessary
///
virtual void SetType(short t) { objtype = t; }
///
virtual void SetStyle(short st) { size = st; }// Metrics(); }
///
virtual void SetName(char const* n) { name = n; }
///
void setDrawable(long unsigned int d) { pm = d; }
protected:
///
char const *name;
///
short objtype;
///
int width;
///
int ascent;
///
int descent;
///
short size;
/// This works while only one process can draw unless
/// the process have their own data
static long unsigned int pm;
/// Default metrics
static int df_asc, df_des, df_width;
/// In a near future maybe we use a better fonts renderer than X
void drawStr(short, int, int, int, byte*, int);
///
friend class MathedCursor;
///
friend void mathed_init_fonts();
};
klyx'MathedInset::drawStr() (./klyx/src/formula.C:264)
void MathedInset::drawStr(short type, int size, int x, int y, byte* s, int ls)
{
mathed_set_font(type, size);
byte sx[80];
if (MathIsBinary(type)) {
byte *ps = &sx[0];
for (int i=0; i<ls; i++) {
*(ps++) = ' ';
*(ps++) = s[i];
*(ps++) = ' ';
}
// *ps = ' ';
ls = 3*ls;
s = &sx[0];
}
GC gc = (type==LM_TC_TEX) ? latexGC: mathGC;
XDrawString(qt_display, pm, gc, x, y, (char*)s, ls);
QApplication::flushX();
}
klyx'MathedInset::MathedInset() (./klyx/src/math_defs.h:511)
MathedInset::MathedInset(char const *nm, short ot, short st):
name(nm), objtype(ot), size(st)
{
width = ascent = descent = 0;
}
inline
klyx'MathedInset::MathedInset() (./klyx/src/math_inset.C:33)
MathedInset::MathedInset(MathedInset* inset)
{
if (inset) {
name = inset->GetName();
objtype = inset->GetType();
size = inset->GetStyle();
width = inset->Width();
ascent = inset->Ascent();
descent = inset->Descent();
} else {
objtype = LM_OT_UNDEF;
size = LM_ST_TEXT;
width = ascent = descent = 0;
name = 0;
}
}