Commit d4de1001 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Поля со свойствами у Accent, BorderBox, Bar, Box, Degree, DegreeSubSup,...

Поля со свойствами у Accent, BorderBox, Bar, Box, Degree, DegreeSubSup, Fraction строго по документации


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56281 954022d7-b5bf-4e40-9824-e11837661b57
parent 6da8f013
...@@ -785,14 +785,14 @@ ParaMath.prototype = ...@@ -785,14 +785,14 @@ ParaMath.prototype =
if(argSize == -1) if(argSize == -1)
{ {
FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26; //FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26;
//FSize = 0.65*FSize; FSize = 0.65*FSize;
} }
else if(argSize == -2) else if(argSize == -2)
{ {
FSize = -0.0004*FSize*FSize + 0.66*FSize + 0.87; //FSize = -0.0004*FSize*FSize + 0.66*FSize + 0.87;
//FSize = 0.65*FSize*FSize; FSize = 0.65*0.65*FSize;
} }
tPrp.FontSize = FSize; tPrp.FontSize = FSize;
......
...@@ -1006,9 +1006,18 @@ function CAccent(props) ...@@ -1006,9 +1006,18 @@ function CAccent(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_ACCENT; this.kind = MATH_ACCENT;
this.chr = null; //// Properties
this.Pr =
{
chr: null,
chrType: null
};
/*this.chr = null;
this.chrType = null; this.chrType = null;
this.loc = LOCATION_TOP; this.loc = LOCATION_TOP;*/
/////////////////
this.operator = new COperator(OPER_ACCENT); this.operator = new COperator(OPER_ACCENT);
...@@ -1019,17 +1028,13 @@ function CAccent(props) ...@@ -1019,17 +1028,13 @@ function CAccent(props)
this.init(props); this.init(props);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
extend(CAccent, CMathBase); extend(CAccent, CMathBase);
CAccent.prototype.init = function(props) CAccent.prototype.init = function(props)
{ {
this.chr = props.chr; this.Pr.chr = props.chr;
this.chrType = props.chrType; this.Pr.chrType = props.chrType;
//this.operator.init(prp, defaultPrp); //this.operator.init(prp, defaultPrp);
//this.operator.relate(this); //this.operator.relate(this);
...@@ -1038,17 +1043,20 @@ CAccent.prototype.init = function(props) ...@@ -1038,17 +1043,20 @@ CAccent.prototype.init = function(props)
this.setContent(); this.setContent();
this.elements[0][0].SetDot(true); this.elements[0][0].SetDot(true);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
} }
CAccent.prototype.setChr = function(chr) CAccent.prototype.setChr = function(chr)
{ {
this.chr = chr; this.Pr.chr = chr;
this.chrType = null; this.Pr.chrType = null;
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
} }
CAccent.prototype.setChrType = function(chrType) CAccent.prototype.setChrType = function(chrType)
{ {
this.chr = null; this.Pr.chr = null;
this.chrType = chrType; this.Pr.chrType = chrType;
this.RecalcInfo.bProps = true; this.RecalcInfo.bProps = true;
} }
CAccent.prototype.old_init = function(properties) CAccent.prototype.old_init = function(properties)
...@@ -1596,14 +1604,7 @@ CAccent.prototype.setPosition = function(pos) ...@@ -1596,14 +1604,7 @@ CAccent.prototype.setPosition = function(pos)
} }
CAccent.prototype.getAscent = function() CAccent.prototype.getAscent = function()
{ {
var ascent; return this.operator.size.height + this.elements[0][0].size.ascent;
if(this.loc === LOCATION_TOP )
ascent = this.operator.size.height + this.elements[0][0].size.ascent;
else if(this.loc === LOCATION_BOT )
ascent = this.elements[0][0].size.ascent;
return ascent;
} }
CAccent.prototype.getPropsForWrite = function() CAccent.prototype.getPropsForWrite = function()
{ {
...@@ -1627,8 +1628,8 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1627,8 +1628,8 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
{ {
var prp = var prp =
{ {
type: this.chrType, type: this.Pr.chrType,
chr: this.chr, chr: this.Pr.chr,
loc: LOCATION_TOP loc: LOCATION_TOP
}; };
...@@ -1637,13 +1638,14 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1637,13 +1638,14 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
type: ACCENT_CIRCUMFLEX type: ACCENT_CIRCUMFLEX
}; };
this.operator.init(prp, defaultPrp); this.operator.setProperties(prp, defaultPrp);
this.operator.relate(this);
this.chr = String.fromCharCode(this.operator.code); this.chr = String.fromCharCode(this.operator.code);
this.chrType = this.operator.typeOper; this.chrType = this.operator.typeOper;
} }
this.operator.relate(this);
var base = this.elements[0][0]; var base = this.elements[0][0];
base.Resize(this, ParaMath, oMeasure); base.Resize(this, ParaMath, oMeasure);
......
...@@ -5,39 +5,39 @@ function CBorderBox(props) ...@@ -5,39 +5,39 @@ function CBorderBox(props)
this.gapBrd = 0; this.gapBrd = 0;
this.bLeft = true; /*this.bLeft = true;
this.bRight = true; this.bRight = true;
this.bTop = true; this.bTop = true;
this.bBot = true; this.bBot = true;
/*this.bLeft = false;
this.bRight = false;
this.bTop = true;
this.bBot = false;*/
this.bLDiag = false; this.bLDiag = false;
this.bRDiag = false; this.bRDiag = false;
this.bHor = false; this.bHor = false;
this.bVert = false; this.bVert = false;*/
/*this.bLDiag = true; this.Pr =
this.bRDiag = true;*/ {
hideLeft: false,
/*this.bHor = true; hideRight: false,
this.bVert = true;*/ hideTop: false,
hideBot: false,
strikeBLTR: true,
strikeTLBR: true,
strikeH: true,
strikeV: true
};
CMathBase.call(this); CMathBase.call(this);
this.init(props); this.init(props);
this.setCtrPrp(props.ctrPrp); this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id ); g_oTableId.Add(this, this.Id);
} }
extend(CBorderBox, CMathBase); extend(CBorderBox, CMathBase);
CBorderBox.prototype.init = function(props) CBorderBox.prototype.init = function(props)
{ {
if(typeof(props) !== "undefined" && props !== null) /*if(typeof(props) !== "undefined" && props !== null)
{ {
if(props.hideLeft === true || props.hideLeft === 1) if(props.hideLeft === true || props.hideLeft === 1)
this.bLeft = false; this.bLeft = false;
...@@ -59,13 +59,42 @@ CBorderBox.prototype.init = function(props) ...@@ -59,13 +59,42 @@ CBorderBox.prototype.init = function(props)
if(props.strikeV === true || props.strikeV === 1) if(props.strikeV === true || props.strikeV === 1)
this.bVert = true; this.bVert = true;
} }*/
this.setDimension(1, 1); this.setBorders(props);
this.setDimension(1, 1);
this.setContent(); this.setContent();
}
CBorderBox.prototype.setBorders = function(props)
{
if(typeof(props) !== "undefined" && props !== null)
{
if(typeof(this.Pr.hideLeft) !== "undefined" && this.Pr.hideLeft !== null)
this.Pr.hideLeft = props.hideLeft;
if(typeof(this.Pr.hideRight) !== "undefined" && this.Pr.hideRight !== null)
this.Pr.hideRight = props.hideRight;
if(typeof(this.Pr.hideTop) !== "undefined" && this.Pr.hideTop !== null)
this.Pr.hideTop = props.hideTop;
if(typeof(this.Pr.hideBot) !== "undefined" && this.Pr.hideBot !== null)
this.Pr.hideBot = props.hideBot;
if(typeof(this.Pr.strikeBLTR) !== "undefined" && this.Pr.strikeBLTR !== null) // right diagonal
this.Pr.strikeBLTR = props.strikeBLTR;
if(typeof(this.Pr.strikeTLBR) !== "undefined" && this.Pr.strikeTLBR !== null) // left diagonal
this.Pr.strikeTLBR = props.strikeTLBR;
if(typeof(this.Pr.strikeH) !== "undefined" && this.Pr.strikeH !== null)
this.Pr.strikeH = props.strikeH;
/// вызов этой функции обязательно в конце if(typeof(this.Pr.strikeV) !== "undefined" && this.Pr.strikeV !== null)
//this.WriteContentsToHistory(); this.Pr.strikeV = props.strikeV;
}
this.RecalcInfo.bProps = true;
} }
CBorderBox.prototype.recalculateSize = function() CBorderBox.prototype.recalculateSize = function()
{ {
...@@ -77,17 +106,17 @@ CBorderBox.prototype.recalculateSize = function() ...@@ -77,17 +106,17 @@ CBorderBox.prototype.recalculateSize = function()
this.gapBrd = this.Get_CompiledCtrPrp().FontSize*0.08104587131076388; this.gapBrd = this.Get_CompiledCtrPrp().FontSize*0.08104587131076388;
if(this.bTop) if(this.Pr.hideTop == false)
{ {
height += this.gapBrd; height += this.gapBrd;
ascent += this.gapBrd; ascent += this.gapBrd;
} }
if(this.bBot) if(this.Pr.hideBot == false)
height += this.gapBrd; height += this.gapBrd;
if(this.bLeft) if(this.Pr.hideLeft == false)
width += this.gapBrd; width += this.gapBrd;
if(this.bRight) if(this.Pr.hideRight == false)
width += this.gapBrd; width += this.gapBrd;
width += this.GapLeft + this.GapRight; width += this.GapLeft + this.GapRight;
...@@ -100,7 +129,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -100,7 +129,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
//var penW = this.Get_CompiledCtrPrp().FontSize* 25.4/72 * 0.06 ; //var penW = this.Get_CompiledCtrPrp().FontSize* 25.4/72 * 0.06 ;
var penW = this.Get_CompiledCtrPrp().FontSize*0.02; var penW = this.Get_CompiledCtrPrp().FontSize*0.02;
if(this.bTop) if(this.Pr.hideTop == false)
{ {
var x1 = this.pos.x + x, var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW/2, x2 = this.pos.x + x + this.size.width - penW/2,
...@@ -116,7 +145,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -116,7 +145,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawHorLine(0, y1 + penW, x1 + 2*25.4/96, x2 , 25.4/96);*/ pGraphics.drawHorLine(0, y1 + penW, x1 + 2*25.4/96, x2 , 25.4/96);*/
} }
if(this.bBot) if(this.Pr.hideBot == false)
{ {
var x1 = this.pos.x + x, var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - penW/2, x2 = this.pos.x + x + this.size.width - penW/2,
...@@ -126,7 +155,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -126,7 +155,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawHorLine(0, y1, x1, x2, penW); pGraphics.drawHorLine(0, y1, x1, x2, penW);
} }
if(this.bLeft) if(this.Pr.hideLeft == false)
{ {
var x1 = this.pos.x + x, var x1 = this.pos.x + x,
y1 = this.pos.y + y, y1 = this.pos.y + y,
...@@ -136,7 +165,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -136,7 +165,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawVerLine(0, x1, y1, y2, penW); pGraphics.drawVerLine(0, x1, y1, y2, penW);
} }
if(this.bRight) if(this.Pr.hideRight == false)
{ {
var x1 = this.pos.x + x + this.size.width - penW/2, var x1 = this.pos.x + x + this.size.width - penW/2,
y1 = this.pos.y + y, y1 = this.pos.y + y,
...@@ -146,7 +175,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -146,7 +175,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
pGraphics.drawVerLine(0, x1, y1, y2, penW); pGraphics.drawVerLine(0, x1, y1, y2, penW);
} }
if(this.bLDiag) if(this.Pr.strikeTLBR) // left diagonal
{ {
var pW = penW*0.8; var pW = penW*0.8;
var x1 = this.pos.x + x , y1 = this.pos.y + y, var x1 = this.pos.x + x , y1 = this.pos.y + y,
...@@ -172,7 +201,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics) ...@@ -172,7 +201,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
} }
if(this.bRDiag) if(this.Pr.strikeBLTR) // right diagonal
{ {
var pW = penW*0.8; var pW = penW*0.8;
var x1 = this.pos.x + x + this.size.width - pW - penW, y1 = this.pos.y + y, var x1 = this.pos.x + x + this.size.width - pW - penW, y1 = this.pos.y + y,
...@@ -225,9 +254,9 @@ CBorderBox.prototype.setPosition = function(pos) ...@@ -225,9 +254,9 @@ CBorderBox.prototype.setPosition = function(pos)
var x = this.pos.x + this.GapLeft, y = this.pos.y; var x = this.pos.x + this.GapLeft, y = this.pos.y;
if(this.bLeft) if(this.Pr.hideLeft == false)
x += this.gapBrd; x += this.gapBrd;
if(this.bTop) if(this.Pr.hideTop == false)
y += this.gapBrd; y += this.gapBrd;
this.elements[0][0].setPosition({x : x, y: y}); this.elements[0][0].setPosition({x : x, y: y});
...@@ -240,9 +269,9 @@ CBorderBox.prototype.findDisposition = function(mCoord) ...@@ -240,9 +269,9 @@ CBorderBox.prototype.findDisposition = function(mCoord)
var shX = 0, shY = 0; var shX = 0, shY = 0;
if(this.bLeft) if(this.Pr.hideLeft == false)
shX = this.gapBrd; shX = this.gapBrd;
if(this.bTop) if(this.Pr.hideTop == false)
shY = this.gapBrd; shY = this.gapBrd;
var sCont = this.elements[0][0].size; var sCont = this.elements[0][0].size;
...@@ -290,7 +319,7 @@ CBorderBox.prototype.getBase = function() ...@@ -290,7 +319,7 @@ CBorderBox.prototype.getBase = function()
} }
CBorderBox.prototype.getPropsForWrite = function() CBorderBox.prototype.getPropsForWrite = function()
{ {
var props = {}; /*var props = {};
props.hideLeft = !this.bLeft; props.hideLeft = !this.bLeft;
props.hideRight = !this.bRight; props.hideRight = !this.bRight;
...@@ -302,7 +331,9 @@ CBorderBox.prototype.getPropsForWrite = function() ...@@ -302,7 +331,9 @@ CBorderBox.prototype.getPropsForWrite = function()
props.strikeH = this.bHor; props.strikeH = this.bHor;
props.strikeV = this.bVert; props.strikeV = this.bVert;
return props; return props;*/
return this.Pr;
} }
CBorderBox.prototype.Save_Changes = function(Data, Writer) CBorderBox.prototype.Save_Changes = function(Data, Writer)
{ {
...@@ -414,7 +445,7 @@ function CBox(props) ...@@ -414,7 +445,7 @@ function CBox(props)
CMathBase.call(this); CMathBase.call(this);
this.init(props); this.init(props);
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
extend(CBox, CMathBase); extend(CBox, CMathBase);
...@@ -441,8 +472,8 @@ CBox.prototype.init = function(props) ...@@ -441,8 +472,8 @@ CBox.prototype.init = function(props)
if(this.opEmu) if(this.opEmu)
this.elements[0][0].decreaseArgSize(); this.elements[0][0].decreaseArgSize();
/// вызов этой функции обязательно в конце if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
//this.WriteContentsToHistory(); this.setCtrPrp(props.ctrPrp);
} }
CBox.prototype.getBase = function() CBox.prototype.getBase = function()
{ {
...@@ -541,69 +572,76 @@ function CBar(props) ...@@ -541,69 +572,76 @@ function CBar(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_BAR; this.kind = MATH_BAR;
this.loc = LOCATION_BOT; this.Pr =
{
pos: LOCATION_BOT
};
//this.loc = LOCATION_BOT;
this.operator = new COperator(OPER_BAR); this.operator = new COperator(OPER_BAR);
CCharacter.call(this); CCharacter.call(this);
this.init(props); this.init(props);
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
extend(CBar, CCharacter); extend(CBar, CCharacter);
CBar.prototype.init = function(props) CBar.prototype.init = function(props)
{ {
if(props.pos === LOCATION_TOP || props.location === LOCATION_TOP) if(props.pos === LOCATION_TOP || props.location === LOCATION_TOP)
this.loc = LOCATION_TOP; this.Pr.pos = LOCATION_TOP;
else if(props.pos === LOCATION_BOT || props.location === LOCATION_BOT) else if(props.pos === LOCATION_BOT || props.location === LOCATION_BOT)
this.loc = LOCATION_BOT; this.Pr.pos = LOCATION_BOT;
/*var glyph = new COperatorLine(); if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
var props = this.setCtrPrp(props.ctrPrp);
{ }
location: this.loc, CBar.prototype.setLocation = function(pos)
turn: TURN_0 {
}; this.Pr.pos = pos;
glyph.init(props); this.RecalcInfo.bProps = true;
}
this.setOperator( new COperator(glyph) );*/ CBar.prototype.Resize = function()
{
var props = if(this.RecalcInfo.bCtrPrp == true)
{ {
location: this.loc, this.Set_CompiledCtrPrp();
type: DELIMITER_LINE this.RecalcInfo.bCtrPrp = false;
}; }
var defaultProps = if(this.RecalcInfo.bProps == true)
{ {
loc: LOCATION_BOT var prp =
}; {
loc: this.Pr.pos,
type: DELIMITER_LINE
};
this.setCharacter(props, defaultProps); var defaultProps =
{
loc: LOCATION_BOT
};
this.setCharacter(prp, defaultProps);
}
/// вызов этой функции обязательно в конце CBar.superclass.Resize.call(this);
//this.WriteContentsToHistory();
} }
CBar.prototype.getAscent = function() CBar.prototype.getAscent = function()
{ {
var ascent; var ascent;
if(this.loc === LOCATION_TOP ) if(this.Pr.pos === LOCATION_TOP )
ascent = this.operator.size.height + this.elements[0][0].size.ascent; ascent = this.operator.size.height + this.elements[0][0].size.ascent;
else if(this.loc === LOCATION_BOT ) else if(this.Pr.pos === LOCATION_BOT )
ascent = this.elements[0][0].size.ascent; ascent = this.elements[0][0].size.ascent;
return ascent; return ascent;
} }
CBar.prototype.getPropsForWrite = function() CBar.prototype.getPropsForWrite = function()
{ {
var props = return this.Pr;
{
pos: this.loc
};
return props;
} }
CBar.prototype.Save_Changes = function(Data, Writer) CBar.prototype.Save_Changes = function(Data, Writer)
{ {
...@@ -669,9 +707,6 @@ CPhantom.prototype.init = function(props) ...@@ -669,9 +707,6 @@ CPhantom.prototype.init = function(props)
this.props = props; this.props = props;
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
/// вызов этой функции обязательно в конце
//this.WriteContentsToHistory();
} }
CPhantom.prototype.getPropsForWrite = function() CPhantom.prototype.getPropsForWrite = function()
{ {
......
...@@ -3,10 +3,15 @@ function CDegree(props) ...@@ -3,10 +3,15 @@ function CDegree(props)
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREE; this.kind = MATH_DEGREE;
this.type = DEGREE_SUPERSCRIPT ; //this.type = DEGREE_SUPERSCRIPT;
this.upBase = 0; // отступ сверху для основания this.upBase = 0; // отступ сверху для основания
this.upIter = 0; // отступ сверху для итератора this.upIter = 0; // отступ сверху для итератора
this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта //this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
this.Pr =
{
type: DEGREE_SUPERSCRIPT
};
CMathBase.call(this); CMathBase.call(this);
...@@ -17,10 +22,10 @@ function CDegree(props) ...@@ -17,10 +22,10 @@ function CDegree(props)
extend(CDegree, CMathBase); extend(CDegree, CMathBase);
CDegree.prototype.init = function(props) CDegree.prototype.init = function(props)
{ {
if(props.alnScr === true || props.alnScr === 1) /*if(props.alnScr === true || props.alnScr === 1)
this.alnScr = true; this.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0) else if(props.alnScr === false || props.alnScr === 0)
this.alnScr = false; this.alnScr = false;*/
var oBase = new CMathContent(); var oBase = new CMathContent();
...@@ -28,9 +33,9 @@ CDegree.prototype.init = function(props) ...@@ -28,9 +33,9 @@ CDegree.prototype.init = function(props)
oBase = props.oBase; oBase = props.oBase;
if(props.type === DEGREE_SUPERSCRIPT) if(props.type === DEGREE_SUPERSCRIPT)
this.type = DEGREE_SUPERSCRIPT; this.Pr.type = DEGREE_SUPERSCRIPT;
else if(props.type === DEGREE_SUBSCRIPT) else if(props.type === DEGREE_SUBSCRIPT)
this.type = DEGREE_SUBSCRIPT; this.Pr.type = DEGREE_SUBSCRIPT;
this.setDimension(1, 2); this.setDimension(1, 2);
...@@ -38,9 +43,6 @@ CDegree.prototype.init = function(props) ...@@ -38,9 +43,6 @@ CDegree.prototype.init = function(props)
oDegree.decreaseArgSize(); oDegree.decreaseArgSize();
this.addMCToContent(oBase, oDegree); this.addMCToContent(oBase, oDegree);
/// вызов этой функции обязательно в конце
//this.WriteContentsToHistory();
} }
/*CDegree.prototype.init_2 = function(props, oBase) /*CDegree.prototype.init_2 = function(props, oBase)
{ {
...@@ -58,9 +60,9 @@ CDegree.prototype.init = function(props) ...@@ -58,9 +60,9 @@ CDegree.prototype.init = function(props)
}*/ }*/
CDegree.prototype.recalculateSize = function(oMeasure) CDegree.prototype.recalculateSize = function(oMeasure)
{ {
if(this.type === DEGREE_SUPERSCRIPT) if(this.Pr.type === DEGREE_SUPERSCRIPT)
this.recalculateSup(oMeasure); this.recalculateSup(oMeasure);
else if(this.type === DEGREE_SUBSCRIPT) else if(this.Pr.type === DEGREE_SUBSCRIPT)
this.recalculateSubScript(oMeasure); this.recalculateSubScript(oMeasure);
} }
CDegree.prototype.old__recalculateSup = function(oMeasure) CDegree.prototype.old__recalculateSup = function(oMeasure)
...@@ -473,14 +475,18 @@ CDegree.prototype.getBase = function() ...@@ -473,14 +475,18 @@ CDegree.prototype.getBase = function()
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
CDegree.prototype.getPropsForWrite = function() /*CDegree.prototype.getPropsForWrite = function()
{ {
var props = {}; var props = {};
props.type = this.type; props.type = this.type;
props.alnScr = this.alnScr; //props.alnScr = this.alnScr;
return props; return props;
}*/
CDegree.prototype.getPropsForWrite = function()
{
return this.Pr;
} }
CDegree.prototype.IsPlhIterator = function() CDegree.prototype.IsPlhIterator = function()
{ {
...@@ -503,7 +509,7 @@ CDegree.prototype.Write_ToBinary2 = function( Writer ) ...@@ -503,7 +509,7 @@ CDegree.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2( this.elements[0][1].Id ); Writer.WriteString2( this.elements[0][1].Id );
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
Writer.WriteLong( this.type ); Writer.WriteLong( this.Pr.type );
} }
CDegree.prototype.Read_FromBinary2 = function( Reader ) CDegree.prototype.Read_FromBinary2 = function( Reader )
...@@ -517,7 +523,7 @@ CDegree.prototype.Read_FromBinary2 = function( Reader ) ...@@ -517,7 +523,7 @@ CDegree.prototype.Read_FromBinary2 = function( Reader )
this.elements[0][1] = Element1; this.elements[0][1] = Element1;
this.CtrPrp.Read_FromBinary(Reader); this.CtrPrp.Read_FromBinary(Reader);
this.type = Reader.GetLong(); this.Pr.type = Reader.GetLong();
} }
CDegree.prototype.Get_Id = function() CDegree.prototype.Get_Id = function()
{ {
...@@ -694,8 +700,16 @@ function CDegreeSubSup(props) ...@@ -694,8 +700,16 @@ function CDegreeSubSup(props)
this.kind = MATH_DEGREESubSup; this.kind = MATH_DEGREESubSup;
this.gapBase = 0; this.gapBase = 0;
this.type = DEGREE_SubSup;
this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта this.Pr =
{
type: DEGREE_SubSup,
alnScr: false
};
//this.type = DEGREE_SubSup;
//this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
CMathBase.call(this); CMathBase.call(this);
this.init(props); this.init(props);
...@@ -706,19 +720,17 @@ extend(CDegreeSubSup, CMathBase); ...@@ -706,19 +720,17 @@ extend(CDegreeSubSup, CMathBase);
CDegreeSubSup.prototype.init = function(props) CDegreeSubSup.prototype.init = function(props)
{ {
if(props.alnScr === true || props.alnScr === 1) if(props.alnScr === true || props.alnScr === 1)
this.alnScr = true; this.Pr.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0) else if(props.alnScr === false || props.alnScr === 0)
this.alnScr = false; this.Pr.alnScr = false;
var oBase = new CMathContent(); var oBase = new CMathContent();
if(props.indef == 2) /// props include Base for CNary if(props.indef == 2) /// props include Base for CNary
oBase = props.oBase; oBase = props.oBase;
if(props.type === DEGREE_SubSup) if(props.type === DEGREE_SubSup || props.type === DEGREE_PreSubSup)
this.type = DEGREE_SubSup; this.Pr.type = props.type;
else if(props.type === DEGREE_PreSubSup)
this.type = DEGREE_PreSubSup;
this.setDimension(1, 2); this.setDimension(1, 2);
...@@ -730,12 +742,12 @@ CDegreeSubSup.prototype.init = function(props) ...@@ -730,12 +742,12 @@ CDegreeSubSup.prototype.init = function(props)
oIters.lUp = 0; oIters.lUp = 0;
oIters.lD = 0; oIters.lD = 0;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
oIters.alignHor(-1, 0); oIters.alignHor(-1, 0);
this.addMCToContent(oBase, oIters); this.addMCToContent(oBase, oIters);
} }
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
oIters.alignHor(-1, 1); oIters.alignHor(-1, 1);
this.addMCToContent(oIters, oBase); this.addMCToContent(oIters, oBase);
...@@ -787,12 +799,12 @@ CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure) ...@@ -787,12 +799,12 @@ CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
var iters, base; var iters, base;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
iters = this.elements[0][1]; iters = this.elements[0][1];
base = this.elements[0][0]; base = this.elements[0][0];
} }
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
iters = this.elements[0][0]; iters = this.elements[0][0];
base = this.elements[0][1]; base = this.elements[0][1];
...@@ -830,12 +842,12 @@ CDegreeSubSup.prototype.old_recalculateSize = function(oMeasure) ...@@ -830,12 +842,12 @@ CDegreeSubSup.prototype.old_recalculateSize = function(oMeasure)
var iters, base; var iters, base;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
iters = this.elements[0][1]; iters = this.elements[0][1];
base = this.elements[0][0]; base = this.elements[0][0];
} }
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
iters = this.elements[0][0]; iters = this.elements[0][0];
base = this.elements[0][1]; base = this.elements[0][1];
...@@ -911,12 +923,12 @@ CDegreeSubSup.prototype._recalculateSize = function(oMeasure) ...@@ -911,12 +923,12 @@ CDegreeSubSup.prototype._recalculateSize = function(oMeasure)
var iters, base; var iters, base;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
iters = this.elements[0][1]; iters = this.elements[0][1];
base = this.elements[0][0]; base = this.elements[0][0];
} }
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
iters = this.elements[0][0]; iters = this.elements[0][0];
base = this.elements[0][1]; base = this.elements[0][1];
...@@ -1022,12 +1034,12 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure) ...@@ -1022,12 +1034,12 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
var iters, base; var iters, base;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
iters = this.elements[0][1]; iters = this.elements[0][1];
base = this.elements[0][0]; base = this.elements[0][0];
} }
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
iters = this.elements[0][0]; iters = this.elements[0][0];
base = this.elements[0][1]; base = this.elements[0][1];
...@@ -1089,7 +1101,7 @@ CDegreeSubSup.prototype.old_setPosition = function(pos) ...@@ -1089,7 +1101,7 @@ CDegreeSubSup.prototype.old_setPosition = function(pos)
{ {
this.pos = {x: pos.x, y: pos.y - this.size.ascent}; this.pos = {x: pos.x, y: pos.y - this.size.ascent};
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
var iters = this.elements[0][1], var iters = this.elements[0][1],
base = this.elements[0][0]; base = this.elements[0][0];
...@@ -1105,7 +1117,7 @@ CDegreeSubSup.prototype.old_align = function(x, y) ...@@ -1105,7 +1117,7 @@ CDegreeSubSup.prototype.old_align = function(x, y)
{ {
var _x = 0, _y = 0; var _x = 0, _y = 0;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
if(x == 0 && y == 0) if(x == 0 && y == 0)
_y = this.elements[0][1].upper; _y = this.elements[0][1].upper;
...@@ -1122,7 +1134,7 @@ CDegreeSubSup.prototype.align = function(x, y) ...@@ -1122,7 +1134,7 @@ CDegreeSubSup.prototype.align = function(x, y)
{ {
var _x = 0, _y = 0; var _x = 0, _y = 0;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
if(x == 0 && y == 0) if(x == 0 && y == 0)
_y = this.gapBase; _y = this.gapBase;
...@@ -1139,9 +1151,9 @@ CDegreeSubSup.prototype.getBase = function() ...@@ -1139,9 +1151,9 @@ CDegreeSubSup.prototype.getBase = function()
{ {
var base; var base;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
base = this.elements[0][0]; base = this.elements[0][0];
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
base = this.elements[0][1]; base = this.elements[0][1];
return base; return base;
...@@ -1150,9 +1162,9 @@ CDegreeSubSup.prototype.getUpperIterator = function() ...@@ -1150,9 +1162,9 @@ CDegreeSubSup.prototype.getUpperIterator = function()
{ {
var iter; var iter;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
iter = this.elements[0][1].getUpperIterator(); iter = this.elements[0][1].getUpperIterator();
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
iter = this.elements[0][0].getUpperIterator(); iter = this.elements[0][0].getUpperIterator();
return iter; return iter;
...@@ -1161,21 +1173,23 @@ CDegreeSubSup.prototype.getLowerIterator = function() ...@@ -1161,21 +1173,23 @@ CDegreeSubSup.prototype.getLowerIterator = function()
{ {
var iter; var iter;
if(this.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
iter = this.elements[0][1].getLowerIterator(); iter = this.elements[0][1].getLowerIterator();
else if(this.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
iter = this.elements[0][0].getLowerIterator(); iter = this.elements[0][0].getLowerIterator();
return iter; return iter;
} }
CDegreeSubSup.prototype.getPropsForWrite = function() CDegreeSubSup.prototype.getPropsForWrite = function()
{ {
var props = {}; /*var props = {};
props.type = this.type; props.type = this.type;
props.alnScr = this.alnScr; props.alnScr = this.alnScr;
return props; return props;*/
return this.Pr;
} }
CDegreeSubSup.prototype.Save_Changes = function(Data, Writer) CDegreeSubSup.prototype.Save_Changes = function(Data, Writer)
{ {
...@@ -1194,8 +1208,8 @@ CDegreeSubSup.prototype.Write_ToBinary2 = function( Writer ) ...@@ -1194,8 +1208,8 @@ CDegreeSubSup.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2( this.elements[0][1].Id ); Writer.WriteString2( this.elements[0][1].Id );
this.CtrPrp.Write_ToBinary(Writer); this.CtrPrp.Write_ToBinary(Writer);
Writer.WriteLong( this.type ); Writer.WriteLong( this.Pr.type );
if ( this.type == DEGREE_SubSup ) if ( this.Pr.type == DEGREE_SubSup )
{ {
var StartPos = Writer.GetCurPosition(); var StartPos = Writer.GetCurPosition();
Writer.Skip(4); Writer.Skip(4);
...@@ -1222,8 +1236,8 @@ CDegreeSubSup.prototype.Read_FromBinary2 = function( Reader ) ...@@ -1222,8 +1236,8 @@ CDegreeSubSup.prototype.Read_FromBinary2 = function( Reader )
this.elements[0][1] = Element1; this.elements[0][1] = Element1;
this.CtrPrp.Read_FromBinary(Reader); this.CtrPrp.Read_FromBinary(Reader);
this.type = Reader.GetLong(); this.Pr.type = Reader.GetLong();
if ( this.type == DEGREE_SubSup ) if ( this.Pr.type == DEGREE_SubSup )
{ {
var Flags = Reader.GetLong(); var Flags = Reader.GetLong();
if ( Flags & 1 ) if ( Flags & 1 )
......
...@@ -9,19 +9,26 @@ function CFraction(props) ...@@ -9,19 +9,26 @@ function CFraction(props)
CMathBase.call(this); CMathBase.call(this);
this.init(props); this.init(props);
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
extend(CFraction, CMathBase); extend(CFraction, CMathBase);
CFraction.prototype.init = function(props) CFraction.prototype.init = function(props)
{ {
var bValid = typeof(props.type) !== "undefined" && props.type !== null; this.setType(props.type);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CFraction.prototype.setType = function(type)
{
var bValid = typeof(type) !== "undefined" && type !== null;
if(bValid) if(bValid)
{ {
var bBar = props.type === BAR_FRACTION || props.type === NO_BAR_FRACTION, var bBar = type === BAR_FRACTION || type === NO_BAR_FRACTION,
bSkew = props.type === SKEWED_FRACTION, bSkew = type === SKEWED_FRACTION,
bLin = props.type === LINEAR_FRACTION; bLin = type === LINEAR_FRACTION;
if(bBar || bSkew || bLin) // на всякий случай if(bBar || bSkew || bLin) // на всякий случай
this.type = props.type; this.type = props.type;
...@@ -30,10 +37,8 @@ CFraction.prototype.init = function(props) ...@@ -30,10 +37,8 @@ CFraction.prototype.init = function(props)
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION) if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
{ {
var num = new CNumerator(); var num = new CNumerator();
//num.init();
var den = new CDenominator(); var den = new CDenominator();
//den.init();
this.setDimension(2, 1); this.setDimension(2, 1);
...@@ -52,9 +57,6 @@ CFraction.prototype.init = function(props) ...@@ -52,9 +57,6 @@ CFraction.prototype.init = function(props)
this.setDimension(1, 2); this.setDimension(1, 2);
this.setContent(); this.setContent();
} }
/// вызов этой функции обязательно в конце
// this.WriteContentsToHistory();
} }
CFraction.prototype.getType = function() CFraction.prototype.getType = function()
{ {
......
...@@ -2264,7 +2264,7 @@ function COperator(type) ...@@ -2264,7 +2264,7 @@ function COperator(type)
this.shiftAccent = 0; this.shiftAccent = 0;
} }
COperator.prototype.init = function(properties, defaultProps) // props (chr, type, location), defaultProps (chr, location) COperator.prototype.setProperties = function(properties, defaultProps) // props (chr, type, location), defaultProps (chr, location)
{ {
var props = this.getProps(properties, defaultProps); var props = this.getProps(properties, defaultProps);
...@@ -3330,7 +3330,7 @@ CDelimiter.prototype.init = function(props) ...@@ -3330,7 +3330,7 @@ CDelimiter.prototype.init = function(props)
{ {
type: PARENTHESIS_LEFT type: PARENTHESIS_LEFT
}; };
this.begOper.init(begPrp, begDefaultPrp); this.begOper.setProperties(begPrp, begDefaultPrp);
this.begOper.relate(this); this.begOper.relate(this);
var endPrp = var endPrp =
...@@ -3344,7 +3344,7 @@ CDelimiter.prototype.init = function(props) ...@@ -3344,7 +3344,7 @@ CDelimiter.prototype.init = function(props)
type: PARENTHESIS_RIGHT type: PARENTHESIS_RIGHT
}; };
this.endOper.init(endPrp, endDefaultPrp); this.endOper.setProperties(endPrp, endDefaultPrp);
this.endOper.relate(this); this.endOper.relate(this);
var sepPrp = var sepPrp =
...@@ -3361,7 +3361,7 @@ CDelimiter.prototype.init = function(props) ...@@ -3361,7 +3361,7 @@ CDelimiter.prototype.init = function(props)
if(props.column == 1 ) if(props.column == 1 )
sepPrp.type = OPERATOR_EMPTY; sepPrp.type = OPERATOR_EMPTY;
this.sepOper.init(sepPrp, sepDefaultPrp); this.sepOper.setProperties(sepPrp, sepDefaultPrp);
this.sepOper.relate(this); this.sepOper.relate(this);
if(props.shape == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_MATH) if(props.shape == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_MATH)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment