Source Code (Use browser search to find items of interest.)
Class Index
kformula'FormulaBlock (./koffice/kformula/old/widget.h:28)
class FormulaBlock
{
public:
FormulaBlock(FormulaDisplay *Mother,int Type = -1,int ID = -1,int nextID = -1,int prevID = -1,
QString Cont = "", int Child1 = -1,int Child2=-1, int Child3=-1);
/*
Return ID of a block
*/
int getID();
/*
Return the width of the block
*/
int getOX();
/*
Return the Height of the block
*/
int getOY();
/*
Return the Total width of Block and next Bloks
*/
int getTX();
/*
Return the Max Height of Block and next Bloks
*/
int getTY();
/*
Return the Max height of first (Up) half of Block and next Bloks
*/
int getLYU();
/*
Return the Max height of second (Down) half of Block and next Bloks
*/
int getLYD();
/*
Return the ID of the child block where mouse clicked (Use it on Block 0!)
*/
int getClick(QPoint click);
/*
Reduce/Enlarge the font size of the Block (recur=0) of Block & Children (recur = 1) of block
children & Next Blocks (recur = 2)
*/
void reduceFont(int recur);
void enlargeFont(int recur);
/*
Check the dimension of the block and call getDimensions() for children
*/
void getDimensions();
/*
Paint the block & his children with QPainter here in x,y
set corr=1 for monitor
corr=0 for printer
*/
void PaintIt(QPainter *here,int x,int y,int corr);
QFont fontc;
private:
FormulaDisplay *mother;
int id;
int lyu,lyd,oyu,oyd,ox,tx; //,co;
int active,getdime;
int next;
int prev;
int type; //0=string 1=root 2=integral 3=brace 4=oriz Lin/spa 5 Over Simb
QString cont; // content 2chr:open/close "l" or "v"
int child1; // exponent Bl.cont. Bl.cont. Bl.cont. numerator
int child2; // index index upindex exponent denominator
int child3; // unused downindex unused space btwn
int sp;
QRect where;
public:
int getactive() { return active; }
int getnext() { return next; }
int getprev() { return prev; }
int gettype() { return type; }
QString getcont() { return cont; }
int getchild1() { return child1; }
int getchild2() { return child2; }
int getchild3() { return child3; }
int getsp() { return sp; }
QRect getwhere() { return where; }
void setactive(int ac) {active=ac; }
void setnext(int ne) { next=ne; }
void setprev(int pr) { prev=pr; }
void settype(int ty) { type=ty; }
void setcont(const char * co) { cont=co; }
void setchild1(int c1) { child1=c1; }
void setchild2(int c2) { child2=c2; }
void setchild3(int c3) { child3=c3; }
void setsp(int s) { sp=s; }
void setwhere(QRect w) { where=w; }
};
kformula'FormulaBlock::FormulaBlock() (./koffice/kformula/notsoold/kformula_doc.cc:627)
FormulaBlock::FormulaBlock( KFormulaDocument *_doc, int Type, int ID,
int nextID, int prevID,
QString Cont, int Child1, int Child2, int Child3 )
{
active = 0;
getdime = 1;
sp = Child3;
if ( Type == 4 )
Child3 = -1;
id = ID;
m_pDoc = _doc;
next = nextID;
prev = prevID;
type = Type;
cont = Cont;
child1 = Child1;
child2 = Child2;
child3 = Child3;
if ( prev != -1 && !m_pDoc->isFree[prev] )
{
fontc = m_pDoc->Blocks[prev]->fontc;
}
else
{
fontc.setFamily( "utopia" );
fontc.setPointSize( 32 );
fontc.setWeight( QFont::Normal );
fontc.setItalic( FALSE );
}
}
kformula'FormulaBlock::reduceFont() (./koffice/kformula/notsoold/kformula_doc.cc:659)
void FormulaBlock::reduceFont( int recur )
{
int i = fontc.pointSize();
i *= 3;
i /= 4;
if ( i < 1 )
i = 1;
fontc.setPointSize(i);
if ( recur > 0 )
{
if( child1 != -1 )
m_pDoc->Blocks[child1]->reduceFont(2);
if( child2 != -1 )
m_pDoc->Blocks[child2]->reduceFont(2);
if( child3 != -1 )
m_pDoc->Blocks[child3]->reduceFont(2);
if( ( recur == 2 ) && ( next != -1 ) )
m_pDoc->Blocks[next]->reduceFont(2);
}
}
kformula'FormulaBlock::enlargeFont() (./koffice/kformula/notsoold/kformula_doc.cc:680)
void FormulaBlock::enlargeFont(int recur)
{
int i;
i = fontc.pointSize();
fontc.setPointSize( ( i * 4 ) / 3 );
if ( recur > 0 )
{
if ( child1 != -1 )
m_pDoc->Blocks[child1]->enlargeFont(2);
if ( child2 != -1 )
m_pDoc->Blocks[child2]->enlargeFont(2);
if ( child3 != -1 )
m_pDoc->Blocks[child3]->enlargeFont(2);
if( recur == 2 && next != -1 )
m_pDoc->Blocks[next]->enlargeFont(2);
}
}
/*
To Stephan:
Object are drawn as Pixmap or with lines
I'd like to put an option to use Pixmap or DrawFunctions of QPainters
Please do not modify this part of code. Only try to use KiconLoder
to load pixmaps.
There Also is a problem with drawArc.I'll explain it to you later.
Andrea
*/
kformula'FormulaBlock::PaintIt() (./koffice/kformula/notsoold/kformula_doc.cc:709)
void FormulaBlock::PaintIt( QPainter *here, int x, int y, int corr )
{
int sp1 = 0,X1 = 0,Y1 = 0,Y2 = 0,X2 = 0,X = 0;
QString str;
QString filename = kapp->kde_datadir().copy();
filename += "/kformula/pics/";
//QBitmap *mask;
QWMatrix m;
KIconLoader il;
QBitmap pm;
// QBitmap bm;
QPixmap newpm;
QFontMetrics fm = QFontMetrics(fontc);
where.setRect(x,y-lyu-1,tx,lyu+lyd+2);
//if (type==0) where.setRect(x,y-lyu,tx+1,lyu+lyd);
if( active && type != 0 )
m_pDoc->setCursor(QRect(x-1,y-oyu-1,ox+2,oyu+oyd+2));
here->setBackgroundColor(white);
switch (type)
{
case (-1) :
if( active )
here->setPen(red);
here->drawRect(x,y-5,10,10);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
case 0:
if( active )
here->setPen(red);
if ( cont == "" )
{
here->drawRect(x,y-5,10,10); type=-1;
}
if( child1 != -1 )
{
Y1 = m_pDoc->Blocks[child1]->getTY();
X1 = m_pDoc->Blocks[child1]->getTX();
}
if( child2 != -1 )
{
X2=m_pDoc->Blocks[child2]->getTX();
Y2=m_pDoc->Blocks[child2]->getTY();
}
if ( X1 >= X2 )
X2 = X1; //X2 = x in piu'
here->setFont(fontc);
here->drawText(x,y+sp,cont); // add a -co to Y
if( active )
m_pDoc->setCursor(QRect(x+fm.width(cont,m_pDoc->getPos()),y-oyu,2,oyu+oyd));
#ifdef RECT
here->drawRect(where);
#endif
if( active )
here->setPen(blue);
if( child1 != -1 )
m_pDoc->Blocks[child1]->PaintIt(here,x+ox-X2,y-oyu+ m_pDoc->Blocks[child1]->getLYU(),corr);
if( active )
here->setPen(blue);
if( child2 != -1 )
m_pDoc->Blocks[child2]->PaintIt(here,x+ox-X2,y+oyd- m_pDoc->Blocks[child2]->getLYD(),corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
//////////////////////////////////////////////////////////////////////////
case 1:
if( active )
here->setPen(red);
Y1 = m_pDoc->Blocks[child1]->getTY();
X1 = m_pDoc->Blocks[child1]->getTX();
Y2 = m_pDoc->Blocks[child1]->getLYU();
if( child2 != -1 )
{
X2 = m_pDoc->Blocks[child2]->getTX();
}
X = X2;
X2 -= Y1 / 4;
if ( X2 < 0 )
X2 = 0;
here->drawLine(x+X2,y-Y2+Y1/4,x+X2+Y1/4,y+2+m_pDoc->Blocks[child1]->getLYD());
here->drawLine(x+X2,y-Y2+Y1/4-1,x+X2+Y1/4,y+1+m_pDoc->Blocks[child1]->getLYD());
here->drawLine(x+X2+Y1/4,y-m_pDoc->Blocks[child1]->getLYU()-4,x+X2+Y1/4,
y+2+m_pDoc->Blocks[child1]->getLYD());
here->drawLine(x+X2+Y1/4,y-m_pDoc->Blocks[child1]->getLYU()-4,x+ox,y-m_pDoc->Blocks[child1]->getLYU()-4);
#ifdef RECT
here->drawRect(where);
#endif
if( active )
here->setPen(blue);
m_pDoc->Blocks[child1]->PaintIt(here,x+3+Y1/4+X2,y,corr);
if( active )
here->setPen(blue);
if( child2 != -1 )
m_pDoc->Blocks[child2]->PaintIt(here,x+1,y-oyu+
m_pDoc->Blocks[child2]->getLYU(),corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 2:
if( active )
here->setPen(red);
Y2 = m_pDoc->Blocks[child1]->getLYU();
X = 0;
if( child2 != -1 )
{
X = m_pDoc->Blocks[child2]->getTX();
X1 = m_pDoc->Blocks[child2]->getLYU();
}
if( child3 != -1 )
{
X2 = m_pDoc->Blocks[child3]->getTX();
if ( X2 > X )
X = X2;
X2 = m_pDoc->Blocks[child3]->getLYD();
}
Y1 = (oyu+oyd)/8;
if( Y1 < 3 )
Y1 = 3;
here->drawLine(x+Y1,y+oyd-Y1/2,x+Y1,y-oyu+Y1/2);
here->drawArc(x+Y1,y-oyu,Y1,Y1,0,2880);
here->drawArc(x+corr,y+oyd-Y1,Y1,Y1,2880,2880);
#ifdef RECT
here->drawRect(where);
#endif
if( active )
here->setPen(blue);
m_pDoc->Blocks[child1]->PaintIt(here,x+2*Y1+X,y,corr);
if( active )
here->setPen(blue);
if( child2 != -1 )
m_pDoc->Blocks[child2]->PaintIt(here,x+Y1+2,y-oyu+X1+Y1,corr);
if( child3 != -1 )
m_pDoc->Blocks[child3]->PaintIt(here,x+Y1+2,y+oyd-X2-Y1,corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 3:
if( active )
here->setPen(red);
Y1 = m_pDoc->Blocks[child1]->getTY();
Y2 = m_pDoc->Blocks[child1]->getLYU();
Y2 -= Y1 / 2;
Y1 = y - Y2;
Y2 = 0;
if ( child2 != -1 )
Y2 = m_pDoc->Blocks[child2]->getTX();
X1 = ox - sp / 4 - Y2;
corr = 0;
#ifdef RECT
here->drawRect(where);
#endif
for ( X2 = 0; X2 <= 1; X2++ )
{
X = X1*X2;
m.reset();
switch(cont[X2])
{
case '{' :
pm.load(filename+"par3.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case '}' :
pm.load(filename+"par3.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case '[' :
pm.load(filename+"par2.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case ']' :
pm.load(filename+"par2.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case '(' :
pm.load(filename+"par1.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case ')' :
pm.load(filename+"par1.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
// mask = new QBitmap();
// mask& = pm;
pm.setMask( pm.createHeuristicMask() );
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case 'A' :
sp1=sp/8;
here->drawLine(x+sp1+X,Y1+sp1*3,x+sp1+X,Y1+sp1);
here->drawArc(x+sp1+X,Y1 ,sp1*2,sp1*2,1440,1440);
here->drawArc(x-sp1+X,Y1+sp1*2,sp1*2,sp1*2,-1440,1439);
here->drawArc(x-sp1+X,Y1-sp1*4,sp1*2,sp1*2,0,1440);
here->drawArc(x+sp1+X,Y1-sp1*2,sp1*2,sp1*2,2880,1440);
here->drawLine(x+sp1+X,Y1-sp1*3,x+sp1+X,Y1-sp1);
break;
case 'a' :
here->drawLine(x+sp/8+X,Y1-sp/8*3,x+sp/8+X,Y1-sp/8);
here->drawArc(x+sp/8+X,Y1-sp/2,sp/4,sp/4,1440,1440);
here->drawArc(x+X-sp/8,Y1-sp/4,sp/4,sp/4,4320,1440);
here->drawLine(x+sp/8+X,Y1+sp/8,x+sp/8+X,Y1+sp/8*3);
here->drawArc(x-sp/8+X,Y1,sp/4,sp/4,0,1440);
here->drawArc(x+X+sp/8,Y1+sp/4,sp/4,sp/4,2880,1440);
//here->drawArc(100,100,sp/4,sp/4,0,5760);
break;
case 'b' :
here->drawLine(x+X,Y1-sp/2,x+X,Y1+sp/2);
here->drawLine(x+X,Y1-sp/2,x+X+sp/4,Y1-sp/2);
here->drawLine(x+X,Y1+sp/2,x+X+sp/4,Y1+sp/2);
break;
case 'B' :
here->drawLine(x+X+4*sp,Y1-sp/2,x+X+sp,Y1+sp/2);
here->drawLine(x+X+sp,Y1-sp/2,x+X+sp/4,Y1-sp/2);
here->drawLine(x+X+sp,Y1+sp/2,x+X+sp/4,Y1+sp/2);
break;
case 'c':
here->drawArc(x+X,Y1-sp/2,sp/4,sp,100*16,160*16);
here->drawArc(x+X+1,Y1-sp/2,sp/4,sp,100*16,160*16);
break;
case 'C':
here->drawArc(x+X,Y1-sp/2,sp/4,sp,280*16,160*16);
here->drawArc(x+X,Y1-sp/2,sp/4+1,sp,280*16,160*16);
break;
case '|' :
here->drawLine(x+X+sp/8,Y1-sp/2,x+X+sp/8,Y1+sp/2);
break;
case '\\' :
here->drawLine(x+X+sp/5,Y1+sp/2,x+X,Y1-sp/2);
break;
case '/' :
here->drawLine(x+X+sp/5,Y1-sp/2,x+X,Y1+sp/2);
break;
} // end of switch
} // end of for
if( active )
here->setPen(blue);
m_pDoc->Blocks[child1]->PaintIt(here,x+sp/4,y,corr);
if( child2 != -1 )
m_pDoc->Blocks[child2]->PaintIt(here,x+ox-Y2,y-oyu+m_pDoc->Blocks[child2]->getLYU(),corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 4:
if( active )
here->setPen(red);
if ( cont[0] == 'l' )
here->drawLine(x,y,x+ox,y);
X1 = m_pDoc->Blocks[child1]->getTX();
Y1 = m_pDoc->Blocks[child1]->getLYD();
X2 = m_pDoc->Blocks[child2]->getTX();
Y2 = m_pDoc->Blocks[child2]->getLYU();
if ( X1 > X2 )
{
X2 = (X1-X2)/2;
X1 = 0;
}
else
{
X1 = ( X2 - X1 ) / 2;
X2 = 0;
}
X = 2;
if ( cont[0] == 'v' )
X = X2 = X1 = 0;
#ifdef RECT
here->drawRect(where);
#endif
if( active )
here->setPen(blue);
m_pDoc->Blocks[child1]->PaintIt(here,x+X1+X,y-Y1-sp/2,corr);
if( active )
here->setPen(blue);
m_pDoc->Blocks[child2]->PaintIt(here,x+X2+X,y+Y2+sp/2,corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 5:
if( active )
here->setPen(red);
switch( cont[0] )
{
case '>':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
here->drawLine(x+ox*4/5,y-oyu,x+ox,y-oyu+sp/2);
here->drawLine(x+ox*4/5,y-oyu+sp,x+ox,y-oyu+sp/2);
break;
case '<':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
here->drawLine(x+ox/5,y-oyu,x,y-oyu+sp/2);
here->drawLine(x+ox/5,y-oyu+sp,x,y-oyu+sp/2);
break;
case '-':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
break;
case 'o':
here->drawArc(x+ox/3,y-oyu,sp,sp,0,5760);
break;
case '^':
here->drawLine(x,y-oyu+sp,x+ox/2,y-oyu);
here->drawLine(x+ox,y-oyu+sp,x+ox/2,y-oyu);
break;
}
if( active )
here->setPen(blue);
// warning("draw child1 of Symb");
if( child1 != -1 )
m_pDoc->Blocks[child1]->PaintIt(here,x,y,corr);
if( active )
here->setPen(black);
if( next != -1 )
m_pDoc->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
}
//here->setPen(black);
}
kformula'FormulaBlock::getClick() (./koffice/kformula/notsoold/kformula_doc.cc:1106)
int FormulaBlock::getClick(QPoint click)
{
int retu=0;
if ( where.contains( click ) )
{
if( child1 != -1 )
retu = m_pDoc->Blocks[child1]->getClick(click);
if( ( retu == 0 ) && ( child2 != -1 ) )
retu = m_pDoc->Blocks[child2]->getClick(click);
if( /*(type!=4)&&*/ ( retu == 0 ) && ( child3 != -1 ) )
retu = m_pDoc->Blocks[child3]->getClick(click);
if( ( retu == 0 ) && ( next != -1 ) )
retu = m_pDoc->Blocks[next]->getClick(click);
if( retu == 0 )
retu = id;
}
return( retu );
}
/**
* LYU: Larger Y (Up)
* OYU: Object Y (Up)
* LYD: Larger Y (Down)
* OYD: Object Y (Down)
* tx: Total X
* ox:Object x
*
* _._._._._tx._._._._._._._
* /\ |____ox______ | |
* LYU || |/\_ | | |
* \/ |\/ OYU | | |
-midline----| |----| |
* | OUR BLOCK | | |
* OYD=LYD | |______|
* |____________|._._._._._._
*
*/
kformula'FormulaBlock::getDimensions() (./koffice/kformula/notsoold/kformula_doc.cc:1145)
void FormulaBlock::getDimensions()
{
int X1 = 0, X2 = 0;
QFontMetrics fm(fontc);
QRect di;
if( getdime )
switch ( type )
{
case ( -1 ):
lyu = lyd = oyu = oyd = 5;
tx = ox = 10;
tx += FIXEDSPACE;
sp = -1;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx += m_pDoc->Blocks[next]->getTX();
X1 = (m_pDoc->Blocks[next]->getLYU());
X2 = (m_pDoc->Blocks[next]->getLYD());
if( lyu < X1 )
lyu = X1;
if( lyd < X2 )
lyd = X2;
}
break;
case 0:
di=fm.boundingRect(cont);
ox=fm.width(cont); //get string X
oyu=-di.top();
oyd=di.bottom();
sp=fm.strikeOutPos();
oyu-=sp;
oyd+=sp;
if(cont=="")
{
lyu=lyd=oyu=oyd=5;
tx=ox=10;
tx+=FIXEDSPACE;
sp=-1;
type=-1;
}
if (oyu<1) oyu=1;
if (oyd<1) oyd=1;
if (child1!=-1)
{
m_pDoc->Blocks[child1]->getDimensions();
X1 = m_pDoc->Blocks[child1]->getTX(); //get exponent X
oyu += (m_pDoc->Blocks[child1]->getTY() );
}
if ( child2 != -1 )
{
m_pDoc->Blocks[child2]->getDimensions();
X2 = m_pDoc->Blocks[child2]->getTX(); //get index X
oyd += (m_pDoc->Blocks[child2]->getTY() );
}
lyu = oyu;
lyd = oyd;
if ( X1 >= X2 )
ox += X1;
else
ox += X2; //add to OwnX the > x
tx = ox;
tx += FIXEDSPACE;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx += m_pDoc->Blocks[next]->getTX();
X1 = (m_pDoc->Blocks[next]->getLYU());
X2 = (m_pDoc->Blocks[next]->getLYD());
if( lyu < X1 )
lyu = X1;
if( lyd < X2 )
lyd = X2;
}
break;
case 1:
m_pDoc->Blocks[child1]->getDimensions();
// oyd=m_pDoc->Blocks[child1]->getTY()/2;
// oyu=oyd+4;
oyd = m_pDoc->Blocks[child1]->getLYD();
oyu = m_pDoc->Blocks[child1]->getLYU()+4;
ox = m_pDoc->Blocks[child1]->getTX()+oyd/2;
ox += ( oyd + oyu ) / 4 + 1;
if ( child2 != -1)
{
m_pDoc->Blocks[child2]->getDimensions();
X1 = m_pDoc->Blocks[child2]->getTY();
X1 -= oyu/4;
if ( X1 > 0 )
oyu += X1;
X1 = m_pDoc->Blocks[child2]->getTX();
X1 -= oyd / 4;
if ( X1 > 0 )
ox += X1;
}
lyu=oyu;
lyd=oyd;
tx=ox;
tx+=FIXEDSPACE;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx+=m_pDoc->Blocks[next]->getTX();
X1=(m_pDoc->Blocks[next]->getLYU());
X2=(m_pDoc->Blocks[next]->getLYD());
if( lyu < X1 )
lyu=X1;
if( lyd < X2 )
lyd=X2;
}
break;
case 2:
m_pDoc->Blocks[child1]->getDimensions();
oyd=m_pDoc->Blocks[child1]->getLYD();
oyu=m_pDoc->Blocks[child1]->getLYU();
ox=m_pDoc->Blocks[child1]->getTX();
X2=0;
if ( child2 != -1 )
{
m_pDoc->Blocks[child2]->getDimensions();
oyu+=m_pDoc->Blocks[child2]->getTY();
X1=m_pDoc->Blocks[child2]->getTX();
X2=X1;
}
if ( child3 != -1 )
{
m_pDoc->Blocks[child3]->getDimensions();
oyd+=m_pDoc->Blocks[child3]->getTY();
X1=m_pDoc->Blocks[child3]->getTX();
if (X1>X2) X2=X1;
}
// oyu+=3;
// oyd+=3;
ox+=X2;
X2=oyu+oyd;
oyu+=X2/6;
oyd+=X2/6;
ox+=X2/3;
lyu=oyu;
lyd=oyd;
tx=ox;
tx+=FIXEDSPACE;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx+=m_pDoc->Blocks[next]->getTX();
X1=(m_pDoc->Blocks[next]->getLYU());
X2=(m_pDoc->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 3:
sp=0;
m_pDoc->Blocks[child1]->getDimensions();
ox=m_pDoc->Blocks[child1]->getTX();
X2=m_pDoc->Blocks[child1]->getTY();
oyu=(m_pDoc->Blocks[child1]->getLYU());
oyd=(m_pDoc->Blocks[child1]->getLYD());
sp=(X2 / 5) * 5; // /16;
// if(sp*16<(X2)) sp++;
sp+=4;
if ( sp < 20 )
sp = 20;
X1=sp-X2; //16*sp-X2;
ox+=(sp/2);
if ( child2 != -1 )
{
m_pDoc->Blocks[child2]->getDimensions();
ox+=m_pDoc->Blocks[child2]->getTX(); //get index X
oyu+=(m_pDoc->Blocks[child2]->getTY() );
}
lyu=oyu+=X1/2;
lyd=oyd+=X1/2;
tx=ox;
tx+=FIXEDSPACE;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx+=m_pDoc->Blocks[next]->getTX();
X1=(m_pDoc->Blocks[next]->getLYU());
X2=(m_pDoc->Blocks[next]->getLYD());
if( lyu < X1 )
lyu=X1;
if( lyd < X2 )
lyd=X2;
}
break;
case 4:
//sp=child3;
m_pDoc->Blocks[child1]->getDimensions();
m_pDoc->Blocks[child2]->getDimensions();
X1=m_pDoc->Blocks[child1]->getTX();
oyu=m_pDoc->Blocks[child1]->getTY()+sp/2;
X2=m_pDoc->Blocks[child2]->getTX();
oyd=m_pDoc->Blocks[child2]->getTY()+sp/2;
lyu=oyu;
lyd=oyd;
if ( X1 >= X2 )
ox=X1+4;
else
ox=X2+4; //add to OwnX the > x
tx=ox;
tx+=FIXEDSPACE;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx+=m_pDoc->Blocks[next]->getTX();
X1=(m_pDoc->Blocks[next]->getLYU());
X2=(m_pDoc->Blocks[next]->getLYD());
if( lyu < X1 )
lyu=X1;
if( lyd < X2 )
lyd=X2;
}
break;
case 5:
if ( child1 != -1 )
{
m_pDoc->Blocks[child1]->getDimensions();
ox=m_pDoc->Blocks[child1]->getTX();
oyu=(m_pDoc->Blocks[child1]->getLYU());
oyd=(m_pDoc->Blocks[child1]->getLYD());
}
switch ( cont[0] )
{
case '>' :
sp=ox/4;
oyu+=sp;
break;
case '<' :
sp=ox/4;
oyu+=sp;
break;
case '-' :
sp=3;
oyu+=sp;
break;
case 'o' :
sp=ox/3;
oyu+=sp;
break;
case '^' :
sp=ox/5;
oyu+=sp;
break;
}
oyu+=1;
lyu=oyu;
lyd=oyd;
tx=ox;
if ( next != -1 )
{
m_pDoc->Blocks[next]->getDimensions();
tx+=m_pDoc->Blocks[next]->getTX();
X1=(m_pDoc->Blocks[next]->getLYU());
X2=(m_pDoc->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
}
}
kformula'FormulaBlock::getID() (./koffice/kformula/notsoold/kformula_doc.cc:1425)
int FormulaBlock::getID()
{
return(id);
}
kformula'FormulaBlock::getOX() (./koffice/kformula/notsoold/kformula_doc.cc:1430)
int FormulaBlock::getOX()
{
return(ox);
}
kformula'FormulaBlock::getTX() (./koffice/kformula/notsoold/kformula_doc.cc:1435)
int FormulaBlock::getTX()
{
return(tx);
}
kformula'FormulaBlock::getLYU() (./koffice/kformula/notsoold/kformula_doc.cc:1440)
int FormulaBlock::getLYU()
{
return(lyu);
}
kformula'FormulaBlock::getLYD() (./koffice/kformula/notsoold/kformula_doc.cc:1445)
int FormulaBlock::getLYD()
{
return(lyd);
}
kformula'FormulaBlock::getTY() (./koffice/kformula/notsoold/kformula_doc.cc:1450)
int FormulaBlock::getTY()
{
return(lyd+lyu);
}
kformula'FormulaBlock::setwhere() (./koffice/kformula/notsoold/kformula_doc.h:118)
void setwhere( QRect w ) { where = w; }
};
kformula'FormulaBlock::FormulaBlock() (./koffice/kformula/old/widget.cpp:952)
FormulaBlock::FormulaBlock(FormulaDisplay *Mother,int Type = -1,int ID = -1,int nextID = -1,int prevID = -1,
QString Cont = "", int Child1 = -1,int Child2=-1, int Child3=-1)
{
active=0;
getdime=1;
sp=Child3;
if (Type==4) Child3=-1;
id=ID;
mother=Mother;
next=nextID;
prev=prevID;
type=Type;
cont=Cont;
child1=Child1;
child2=Child2;
child3=Child3;
if((prev!=-1)&&(!mother->isFree[prev])) {
fontc=mother->Blocks[prev]->fontc;
}
else {
fontc.setFamily("utopia");
fontc.setPointSize(32);
fontc.setWeight(QFont::Normal);
fontc.setItalic(FALSE);
}
}
kformula'FormulaBlock::reduceFont() (./koffice/kformula/old/widget.cpp:981)
void FormulaBlock::reduceFont(int recur)
{
int i=fontc.pointSize();
i*=3;
i/=4;
if (i < 1) i = 1;
fontc.setPointSize(i);
if (recur>0) {
if(child1!=-1) mother->Blocks[child1]->reduceFont(2);
if(child2!=-1) mother->Blocks[child2]->reduceFont(2);
if(child3!=-1) mother->Blocks[child3]->reduceFont(2);
if((recur==2)&&(next!=-1)) mother->Blocks[next]->reduceFont(2);
}
}
kformula'FormulaBlock::enlargeFont() (./koffice/kformula/old/widget.cpp:996)
void FormulaBlock::enlargeFont(int recur)
{
int i;
i=fontc.pointSize();
fontc.setPointSize((i*4)/3);
if (recur>0) {
if(child1!=-1) mother->Blocks[child1]->enlargeFont(2);
if(child2!=-1) mother->Blocks[child2]->enlargeFont(2);
if(child3!=-1) mother->Blocks[child3]->enlargeFont(2);
if((recur==2)&&(next!=-1)) mother->Blocks[next]->enlargeFont(2);
}
}
/*
To Stephan:
Object are drawn as Pixmap or with lines
I'd like to put an option to use Pixmap or DrawFunctions of QPainters
Please do not modify this part of code. Only try to use KiconLoder
to load pixmaps.
There Also is a problem with drawArc.I'll explain it to you later.
Andrea
*/
kformula'FormulaBlock::PaintIt() (./koffice/kformula/old/widget.cpp:1020)
void FormulaBlock::PaintIt(QPainter *here,int x,int y,int corr)
{
int sp1=0,X1=0,Y1=0,Y2=0,X2=0,X=0;
QString str;
QString filename = getenv( "KDEDIR" );
if ( !filename.isNull() )
filename += "/share/apps/kformula/pics/";
//QBitmap *mask;
QWMatrix m;
KIconLoader il;
QBitmap pm;
// QBitmap bm;
QPixmap newpm;
QFontMetrics fm = QFontMetrics(fontc);
where.setRect(x,y-lyu-1,tx,lyu+lyd+2);
//if (type==0) where.setRect(x,y-lyu,tx+1,lyu+lyd);
if(active && (type!=0)) mother->setCursor(QRect(x-1,y-oyu-1,ox+2,oyu+oyd+2));
here->setBackgroundColor(white);
switch (type)
{
case (-1) :
if(active) here->setPen(red);
here->drawRect(x,y-5,10,10);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
case 0:
if(active) here->setPen(red);
if (cont=="") { here->drawRect(x,y-5,10,10); type=-1;}
if(child1!=-1){ Y1=mother->Blocks[child1]->getTY();
X1=mother->Blocks[child1]->getTX();
}
if(child2!=-1){ X2=mother->Blocks[child2]->getTX();
Y2=mother->Blocks[child2]->getTY();
}
if (X1>=X2) X2=X1; //X2 = x in piu'
here->setFont(fontc);
here->drawText(x,y+sp,cont); // add a -co to Y
if(active)
mother->setCursor(QRect(x+fm.width(cont,mother->getPos()),y-oyu,2,oyu+oyd));
#ifdef RECT
here->drawRect(where);
#endif
if(active) here->setPen(blue);
if(child1!=-1) mother->Blocks[child1]->PaintIt(here,x+ox-X2,y-oyu+ mother->Blocks[child1]->getLYU(),corr);
if(active) here->setPen(blue);
if(child2!=-1) mother->Blocks[child2]->PaintIt(here,x+ox-X2,y+oyd- mother->Blocks[child2]->getLYD(),corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
//////////////////////////////////////////////////////////////////////////
case 1:
if(active) here->setPen(red);
Y1=mother->Blocks[child1]->getTY();
X1=mother->Blocks[child1]->getTX();
Y2=mother->Blocks[child1]->getLYU();
if(child2!=-1){ X2=mother->Blocks[child2]->getTX();
}
X=X2;
X2-=Y1/4;
if (X2 < 0) X2=0;
here->drawLine(x+X2,y-Y2+Y1/4,x+X2+Y1/4,y+2+mother->Blocks[child1]->getLYD());
here->drawLine(x+X2,y-Y2+Y1/4-1,x+X2+Y1/4,y+1+mother->Blocks[child1]->getLYD());
here->drawLine(x+X2+Y1/4,y-mother->Blocks[child1]->getLYU()-4,x+X2+Y1/4,
y+2+mother->Blocks[child1]->getLYD());
here->drawLine(x+X2+Y1/4,y-mother->Blocks[child1]->getLYU()-4,x+ox,y-mother->Blocks[child1]->getLYU()-4);
#ifdef RECT
here->drawRect(where);
#endif
if(active) here->setPen(blue);
mother->Blocks[child1]->PaintIt(here,x+3+Y1/4+X2,y,corr);
if(active) here->setPen(blue);
if(child2!=-1)mother->Blocks[child2]->PaintIt(here,x+1,y-oyu+
mother->Blocks[child2]->getLYU(),corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 2:
if(active) here->setPen(red);
Y2=mother->Blocks[child1]->getLYU();
X=0;
if(child2!=-1){ X=mother->Blocks[child2]->getTX();
X1=mother->Blocks[child2]->getLYU();
}
if(child3!=-1){ X2=mother->Blocks[child3]->getTX();
if (X2>X) X=X2;
X2=mother->Blocks[child3]->getLYD();
}
Y1=(oyu+oyd)/8;
if(Y1<3) Y1=3;
here->drawLine(x+Y1,y+oyd-Y1/2,x+Y1,y-oyu+Y1/2);
here->drawArc(x+Y1,y-oyu,Y1,Y1,0,2880);
here->drawArc(x+corr,y+oyd-Y1,Y1,Y1,2880,2880);
#ifdef RECT
here->drawRect(where);
#endif
if(active) here->setPen(blue);
mother->Blocks[child1]->PaintIt(here,x+2*Y1+X,y,corr);
if(active) here->setPen(blue);
if(child2!=-1)mother->Blocks[child2]->PaintIt(here,x+Y1+2,y-oyu+X1+Y1,corr);
if(child3!=-1)mother->Blocks[child3]->PaintIt(here,x+Y1+2,y+oyd-X2-Y1,corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 3:
if(active) here->setPen(red);
Y1=mother->Blocks[child1]->getTY();
Y2=mother->Blocks[child1]->getLYU();
Y2-=Y1/2;
Y1=y-Y2;
Y2=0;
if (child2!=-1) Y2=mother->Blocks[child2]->getTX();
X1=ox-sp/4-Y2;
corr=0;
#ifdef RECT
here->drawRect(where);
#endif
for (X2=0;X2<=1;X2++) {
X=X1*X2;
m.reset();
switch(cont[X2])
{
case '{' :
pm.load(filename+"par3.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case '}' :
pm.load(filename+"par3.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case '[' :
pm.load(filename+"par2.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case ']' :
pm.load(filename+"par2.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case '(' :
pm.load(filename+"par1.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
here->drawPixmap(x+X,Y1-sp/2,newpm);
m.reset();
m.scale(1.0,-1.0);
pm = newpm.xForm(m);
here->drawPixmap(x+X,Y1,pm);
break;
case ')' :
pm.load(filename+"par1.xbm");
m.scale(1.0*sp/200,1.0*sp/200);
newpm = pm.xForm(m);
m.reset();
m.scale(-1.00,1.00);
pm = newpm.xForm(m);
m.reset();
m.scale(1.00,-1.00);
newpm = pm.xForm(m);
// mask = new QBitmap();
// mask& = pm;
pm.setMask( pm.createHeuristicMask() );
here->drawPixmap(x+X,Y1-sp/2,pm);
here->drawPixmap(x+X,Y1,newpm);
break;
case 'A' :
sp1=sp/8;
here->drawLine(x+sp1+X,Y1+sp1*3,x+sp1+X,Y1+sp1);
here->drawArc(x+sp1+X,Y1 ,sp1*2,sp1*2,1440,1440);
here->drawArc(x-sp1+X,Y1+sp1*2,sp1*2,sp1*2,-1440,1439);
here->drawArc(x-sp1+X,Y1-sp1*4,sp1*2,sp1*2,0,1440);
here->drawArc(x+sp1+X,Y1-sp1*2,sp1*2,sp1*2,2880,1440);
here->drawLine(x+sp1+X,Y1-sp1*3,x+sp1+X,Y1-sp1);
break;
case 'a' :
here->drawLine(x+sp/8+X,Y1-sp/8*3,x+sp/8+X,Y1-sp/8);
here->drawArc(x+sp/8+X,Y1-sp/2,sp/4,sp/4,1440,1440);
here->drawArc(x+X-sp/8,Y1-sp/4,sp/4,sp/4,4320,1440);
here->drawLine(x+sp/8+X,Y1+sp/8,x+sp/8+X,Y1+sp/8*3);
here->drawArc(x-sp/8+X,Y1,sp/4,sp/4,0,1440);
here->drawArc(x+X+sp/8,Y1+sp/4,sp/4,sp/4,2880,1440);
//here->drawArc(100,100,sp/4,sp/4,0,5760);
break;
case 'b' :
here->drawLine(x+X,Y1-sp/2,x+X,Y1+sp/2);
here->drawLine(x+X,Y1-sp/2,x+X+sp/4,Y1-sp/2);
here->drawLine(x+X,Y1+sp/2,x+X+sp/4,Y1+sp/2);
break;
case 'B' :
here->drawLine(x+X+4*sp,Y1-sp/2,x+X+sp,Y1+sp/2);
here->drawLine(x+X+sp,Y1-sp/2,x+X+sp/4,Y1-sp/2);
here->drawLine(x+X+sp,Y1+sp/2,x+X+sp/4,Y1+sp/2);
break;
case 'c':
here->drawArc(x+X,Y1-sp/2,sp/4,sp,100*16,160*16);
here->drawArc(x+X+1,Y1-sp/2,sp/4,sp,100*16,160*16);
break;
case 'C':
here->drawArc(x+X,Y1-sp/2,sp/4,sp,280*16,160*16);
here->drawArc(x+X,Y1-sp/2,sp/4+1,sp,280*16,160*16);
break;
case '|' :
here->drawLine(x+X+sp/8,Y1-sp/2,x+X+sp/8,Y1+sp/2);
break;
case '\\' :
here->drawLine(x+X+sp/5,Y1+sp/2,x+X,Y1-sp/2);
break;
case '/' :
here->drawLine(x+X+sp/5,Y1-sp/2,x+X,Y1+sp/2);
break;
} // end of switch
} // end of for
if(active) here->setPen(blue);
mother->Blocks[child1]->PaintIt(here,x+sp/4,y,corr);
if(child2!=-1) mother->Blocks[child2]->PaintIt(here,x+ox-Y2,y-oyu+mother->Blocks[child2]->getLYU(),corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 4:
if(active) here->setPen(red);
if (cont[0]=='l') here->drawLine(x,y,x+ox,y);
X1=mother->Blocks[child1]->getTX();
Y1=mother->Blocks[child1]->getLYD();
X2=mother->Blocks[child2]->getTX();
Y2=mother->Blocks[child2]->getLYU();
if (X1>X2) {X2=(X1-X2)/2; X1=0; }else{X1=(X2-X1)/2; X2=0;}
X=2;
if (cont[0]=='v') X=X2=X1=0;
#ifdef RECT
here->drawRect(where);
#endif
if(active) here->setPen(blue);
mother->Blocks[child1]->PaintIt(here,x+X1+X,y-Y1-sp/2,corr);
if(active) here->setPen(blue);
mother->Blocks[child2]->PaintIt(here,x+X2+X,y+Y2+sp/2,corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
case 5:
if(active) here->setPen(red);
switch(cont[0]) {
case '>':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
here->drawLine(x+ox*4/5,y-oyu,x+ox,y-oyu+sp/2);
here->drawLine(x+ox*4/5,y-oyu+sp,x+ox,y-oyu+sp/2);
break;
case '<':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
here->drawLine(x+ox/5,y-oyu,x,y-oyu+sp/2);
here->drawLine(x+ox/5,y-oyu+sp,x,y-oyu+sp/2);
break;
case '-':
here->drawLine(x,y-oyu+sp/2,x+ox,y-oyu+sp/2);
break;
case 'o':
here->drawArc(x+ox/3,y-oyu,sp,sp,0,5760);
break;
case '^':
here->drawLine(x,y-oyu+sp,x+ox/2,y-oyu);
here->drawLine(x+ox,y-oyu+sp,x+ox/2,y-oyu);
break;
}
if(active) here->setPen(blue);
// warning("draw child1 of Symb");
if(child1!=-1)mother->Blocks[child1]->PaintIt(here,x,y,corr);
if(active) here->setPen(black);
if(next!=-1) mother->Blocks[next]->PaintIt(here,x+ox+FIXEDSPACE,y,corr);
break;
///////////////////////////////////////////////////////////////////////////
}
//here->setPen(black);
}
kformula'FormulaBlock::getClick() (./koffice/kformula/old/widget.cpp:1356)
int FormulaBlock::getClick(QPoint click)
{
int retu;
retu=0;
if (where.contains(click))
{
if(child1 !=-1) retu=mother->Blocks[child1]->getClick(click);
if((retu==0)&&(child2!=-1)) retu=mother->Blocks[child2]->getClick(click);
if(/*(type!=4)&&*/(retu==0)&&(child3!=-1)) retu=mother->Blocks[child3]->getClick(click);
if((retu==0)&&(next!=-1)) retu=mother->Blocks[next]->getClick(click);
if(retu==0)retu=id;
}
return( retu );
}
/*
LYU: Larger Y (Up)
OYU: Object Y (Up)
LYD: Larger Y (Down)
OYD: Object Y (Down)
tx: Total X
ox:Object x
_._._._._tx._._._._._._._
/\ |____ox______ | |
LYU || |/\_ | | |
\/ |\/ OYU | | |
-midline----| |----| |
| OUR BLOCK | | |
OYD=LYD | |______|
|____________|._._._._._._
*/
kformula'FormulaBlock::getDimensions() (./koffice/kformula/old/widget.cpp:1392)
void FormulaBlock::getDimensions()
{
int X1=0,X2=0;
QFontMetrics fm(fontc);
QRect di;
if(getdime)
switch (type)
{
case (-1):
lyu=lyd=oyu=oyd=5;
tx=ox=10;
tx+=FIXEDSPACE;
sp=-1;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 0:
di=fm.boundingRect(cont);
ox=fm.width(cont); //get string X
oyu=-di.top();
oyd=di.bottom();
sp=fm.strikeOutPos();
oyu-=sp;
oyd+=sp;
if(cont==""){
lyu=lyd=oyu=oyd=5;
tx=ox=10;
tx+=FIXEDSPACE;
sp=-1;
type=-1;
}
if (oyu<1) oyu=1;
if (oyd<1) oyd=1;
if (child1!=-1){
mother->Blocks[child1]->getDimensions();
X1=mother->Blocks[child1]->getTX(); //get exponent X
oyu+=(mother->Blocks[child1]->getTY() );
}
if (child2!=-1){
mother->Blocks[child2]->getDimensions();
X2=mother->Blocks[child2]->getTX(); //get index X
oyd+=(mother->Blocks[child2]->getTY() );
}
lyu=oyu;
lyd=oyd;
if (X1>=X2) ox+=X1; else ox+=X2; //add to OwnX the > x
tx=ox;
tx+=FIXEDSPACE;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 1:
mother->Blocks[child1]->getDimensions();
// oyd=mother->Blocks[child1]->getTY()/2;
// oyu=oyd+4;
oyd=mother->Blocks[child1]->getLYD();
oyu=mother->Blocks[child1]->getLYU()+4;
ox=mother->Blocks[child1]->getTX()+oyd/2;
ox+=(oyd+oyu)/4+1;
if (child2 != -1) {
mother->Blocks[child2]->getDimensions();
X1=mother->Blocks[child2]->getTY();
X1-=oyu/4;
if (X1>0) oyu+=X1;
X1=mother->Blocks[child2]->getTX();
X1-=oyd/4;
if (X1>0) ox+=X1;
}
lyu=oyu;
lyd=oyd;
tx=ox;
tx+=FIXEDSPACE;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 2:
mother->Blocks[child1]->getDimensions();
oyd=mother->Blocks[child1]->getLYD();
oyu=mother->Blocks[child1]->getLYU();
ox=mother->Blocks[child1]->getTX();
X2=0;
if (child2 != -1) {
mother->Blocks[child2]->getDimensions();
oyu+=mother->Blocks[child2]->getTY();
X1=mother->Blocks[child2]->getTX();
X2=X1;
}
if (child3 != -1) {
mother->Blocks[child3]->getDimensions();
oyd+=mother->Blocks[child3]->getTY();
X1=mother->Blocks[child3]->getTX();
if (X1>X2) X2=X1;
}
// oyu+=3;
// oyd+=3;
ox+=X2;
X2=oyu+oyd;
oyu+=X2/6;
oyd+=X2/6;
ox+=X2/3;
lyu=oyu;
lyd=oyd;
tx=ox;
tx+=FIXEDSPACE;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 3:
sp=0;
mother->Blocks[child1]->getDimensions();
ox=mother->Blocks[child1]->getTX();
X2=mother->Blocks[child1]->getTY();
oyu=(mother->Blocks[child1]->getLYU());
oyd=(mother->Blocks[child1]->getLYD());
sp=(X2 / 5) * 5; // /16;
// if(sp*16<(X2)) sp++;
sp+=4;
if (sp < 20) sp = 20;
X1=sp-X2; //16*sp-X2;
ox+=(sp/2);
if (child2!=-1){
mother->Blocks[child2]->getDimensions();
ox+=mother->Blocks[child2]->getTX(); //get index X
oyu+=(mother->Blocks[child2]->getTY() );
}
lyu=oyu+=X1/2;
lyd=oyd+=X1/2;
tx=ox;
tx+=FIXEDSPACE;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 4:
//sp=child3;
mother->Blocks[child1]->getDimensions();
mother->Blocks[child2]->getDimensions();
X1=mother->Blocks[child1]->getTX();
oyu=mother->Blocks[child1]->getTY()+sp/2;
X2=mother->Blocks[child2]->getTX();
oyd=mother->Blocks[child2]->getTY()+sp/2;
lyu=oyu;
lyd=oyd;
if (X1>=X2) ox=X1+4; else ox=X2+4; //add to OwnX the > x
tx=ox;
tx+=FIXEDSPACE;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
case 5:
if (child1!=-1) {
mother->Blocks[child1]->getDimensions();
ox=mother->Blocks[child1]->getTX();
oyu=(mother->Blocks[child1]->getLYU());
oyd=(mother->Blocks[child1]->getLYD());
}
switch (cont[0]) {
case '>' :
sp=ox/4;
oyu+=sp;
break;
case '<' :
sp=ox/4;
oyu+=sp;
break;
case '-' :
sp=3;
oyu+=sp;
break;
case 'o' :
sp=ox/3;
oyu+=sp;
break;
case '^' :
sp=ox/5;
oyu+=sp;
break;
}
oyu+=1;
lyu=oyu;
lyd=oyd;
tx=ox;
if (next != -1) {
mother->Blocks[next]->getDimensions();
tx+=mother->Blocks[next]->getTX();
X1=(mother->Blocks[next]->getLYU());
X2=(mother->Blocks[next]->getLYD());
if(lyu<X1) lyu=X1;
if(lyd<X2) lyd=X2;
}
break;
}
}
kformula'FormulaBlock::getID() (./koffice/kformula/old/widget.cpp:1644)
int FormulaBlock::getID()
{
return(id);
}
kformula'FormulaBlock::getOX() (./koffice/kformula/old/widget.cpp:1649)
int FormulaBlock::getOX()
{
return(ox);
}
kformula'FormulaBlock::getTX() (./koffice/kformula/old/widget.cpp:1653)
int FormulaBlock::getTX()
{
return(tx);
}
kformula'FormulaBlock::getLYU() (./koffice/kformula/old/widget.cpp:1657)
int FormulaBlock::getLYU()
{
return(lyu);
}
kformula'FormulaBlock::getLYD() (./koffice/kformula/old/widget.cpp:1661)
int FormulaBlock::getLYD()
{
return(lyd);
}
kformula'FormulaBlock::getTY() (./koffice/kformula/old/widget.cpp:1665)
int FormulaBlock::getTY()
{
return(lyd+lyu);
}
kformula'FormulaBlock::setwhere() (./koffice/kformula/old/widget.h:118)
void setwhere(QRect w) { where=w; }
};