Source Code (Use browser search to find items of interest.)
Class Index
klyx'MathFracInset (./klyx/src/math_inset.h:206)
class MathFracInset: public MathParInset {
public:
///
MathFracInset(short ot=LM_OT_FRAC);
///
~MathFracInset();
///
MathedInset *Clone();
///
void Draw(int x, int baseline);
///
void Write(FILE *file);
///
void Write(LString &file);
///
void Metrics();
///
/** This does the same that SetData(LyxArrayBase*) but for both
numerator and denominator at once.
*/
void SetData(LyxArrayBase*, LyxArrayBase*);
///
void SetData(LyxArrayBase*);
///
void GetXY(int& x, int& y) const;
///
void SetFocus(int,int);
///
bool Inside(int, int);
///
LyxArrayBase * GetData();
///
bool setArgumentIdx(int i); // was bool Up/down(void);
///
int getArgumentIdx() { return (int)idx; }
///
int getMaxArgumentIdx() { return 1; }
///
void SetStyle(short);
protected:
///
short idx;
///
MathParInset *den;
///
int w0, w1, des0, dh;
};
/// A delimiter
klyx'MathFracInset::Draw() (./klyx/src/math_draw.C:275)
MathFracInset::Draw(int x, int y)
{
short idxp = idx;
short sizex = size;
idx = 0;
if (size==LM_ST_DISPLAY) size++;
MathParInset::Draw(x+(width-w0)/2, y - des0);
den->Draw(x+(width-w1)/2, y + den->Ascent() + 2 - dh);
size = sizex;
if (objtype==LM_OT_FRAC)
XDrawLine(qt_display, pm, mathLineGC, x+2, y-dh, x+width-4, y - dh);
QApplication::flushX();
idx = idxp;
}
void
klyx'MathFracInset::Metrics() (./klyx/src/math_draw.C:292)
MathFracInset::Metrics()
{
if (!dh) {
int a, b;
dh = mathed_char_height(LM_TC_CONST, size, 'I', a, b)/2;
}
short idxp = idx;
short sizex = size;
idx = 0;
if (size==LM_ST_DISPLAY) size++;
MathParInset::Metrics();
size = sizex;
w0 = width;
int as = Height() + 2 + dh;
des0 = Descent() + 2 + dh;
den->Metrics();
w1 = den->Width();
width = ((w0 > w1) ? w0: w1) + 12;
ascent = as;
descent = den->Height()+ 2 - dh;
idx = idxp;
}
void
klyx'MathFracInset::MathFracInset() (./klyx/src/math_inset.C:186)
MathFracInset::MathFracInset(short ot): MathParInset(LM_ST_TEXT, "frac", ot)
{
den = new MathParInset(LM_ST_TEXT); // this leaks
dh = 0;
idx = 0;
if (objtype==LM_OT_STACKREL) {
flag |= LMPF_SCRIPT;
SetName("stackrel");
}
}
klyx'MathFracInset::~MathFracInset() (./klyx/src/math_inset.C:198)
MathFracInset::~MathFracInset()
{
delete den;
}
klyx'MathFracInset::Clone() (./klyx/src/math_inset.C:203)
MathedInset *MathFracInset::Clone()
{
MathFracInset* p = new MathFracInset(GetType());
MathedIter itn(array);
MathedIter itd(den->GetData());
p->SetData(itn.Copy(), itd.Copy());
p->idx = idx;
p->dh = dh;
return p;
}
klyx'MathFracInset::setArgumentIdx() (./klyx/src/math_inset.C:214)
bool MathFracInset::setArgumentIdx(int i)
{
if (i==0 || i==1) {
idx = i;
return true;
} else
return false;
}
klyx'MathFracInset::SetStyle() (./klyx/src/math_inset.C:224)
void MathFracInset::SetStyle(short st)
{
MathParInset::SetStyle(st);
dh = 0;
den->SetStyle((size==LM_ST_DISPLAY) ? LM_ST_TEXT: size);
}
klyx'MathFracInset::SetData() (./klyx/src/math_inset.C:231)
void MathFracInset::SetData(LyxArrayBase *n, LyxArrayBase *d)
{
den->SetData(d);
MathParInset::SetData(n);
}
klyx'MathFracInset::SetData() (./klyx/src/math_inset.C:237)
void MathFracInset::SetData(LyxArrayBase *d)
{
if (idx==0)
MathParInset::SetData(d);
else {
den->SetData(d);
}
}
klyx'MathFracInset::GetXY() (./klyx/src/math_inset.C:246)
void MathFracInset::GetXY(int& x, int& y) const
{
if (idx==0)
MathParInset::GetXY(x, y);
else
den->GetXY(x, y);
}
klyx'MathFracInset::GetData() (./klyx/src/math_inset.C:254)
LyxArrayBase *MathFracInset::GetData()
{
if (idx==0)
return array;
else
return den->GetData();
}
klyx'MathFracInset::Inside() (./klyx/src/math_inset.C:263)
bool MathFracInset::Inside(int x, int y)
{
int xx = xo - (width-w0)/2;
return (x>=xx && x<=xx+width && y<=yo+descent && y>=yo-ascent);
}
klyx'MathFracInset::SetFocus() (./klyx/src/math_inset.C:270)
void MathFracInset::SetFocus(int /*x*/, int y)
{
// fprintf(stderr, "y %d %d %d ", y, yo, den->yo);
idx = (y > yo) ? 1: 0;
}
klyx'MathFracInset::Write() (./klyx/src/math_write.C:228)
void MathFracInset::Write(FILE *outf)
{
LString output;
MathFracInset::Write(output);
fprintf(outf, "%s", output.c_str());
}
klyx'MathFracInset::Write() (./klyx/src/math_write.C:235)
void MathFracInset::Write(LString &outf)
{
outf += '\\';
outf += name;
outf += '{';
MathParInset::Write(outf);
outf += "}{";
den->Write(outf);
outf += '}';
}