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

accent: dot, two dots, three dots, accent grave, accent acute, breve

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49850 954022d7-b5bf-4e40-9824-e11837661b57
parent aa2666aa
This diff is collapsed.
......@@ -3958,48 +3958,70 @@ CMathContent.prototype =
arg2.addTxt("θ");
break;
case 152:
/*var diac = this.addMComponent(15);
diac.init(3);
diac.fillPlaceholders();*/
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_ONE_DOT}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 153:
var diac = this.addMComponent(15);
diac.init(4);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_TWO_DOTS}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 154:
var diac = this.addMComponent(15);
diac.init(5);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_THREE_DOTS}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 155:
var diac = this.addMComponent(12);
diac.init();
diac.setIndex(-1);
diac.fillPlaceholders();
break;
case 156:
var diac = this.addMComponent(12);
diac.init();
diac.setIndex(1);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_CIRCUMFLEX}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 157:
var diac = this.addMComponent(15);
diac.init(2);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_ACUTE}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 158:
var diac = this.addMComponent(15);
diac.init(1);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_GRAVE}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 159:
var diac = this.addMComponent(13);
diac.init();
diac.setIndex(1);
diac.fillPlaceholders();
var accent = this.addMComponent(MATH_ACCENT);
var props =
{
chr: {type: ACCENT_BREVE}
};
accent.init(props);
accent.fillPlaceholders();
break;
case 160:
var accent = this.addMComponent(MATH_ACCENT);
......
......@@ -97,7 +97,10 @@ var ACCENT_DOUBLE_LINE = 8;
var SINGLE_LINE = 9;
var DOUBLE_LINE = 10;
var ACCENT_TILDE = 11;
var MATH_TEXT = 12;
var ACCENT_BREVE = 12;
var ACCENT_INVERT_BREVE = 13;
var MATH_TEXT = 14;
var MATRIX_CENTER = 0;
var MATRIX_TOP = 1;
......
//var NameFunctions = ["min", "max", "lim", "log", "ln", "sin", "cos", "tg", "ctg", "ch", "sh", "th", "cth", "sec", "csc", "cot", "csch", "sech", "coth"];
//var NameFunctions = ["min", "max", "lim", "log", "ln", "sin", "cos", "tan", "ctg", "cosh", "sinh", "tanh", "cth", "sec", "csc", "cot", "csch", "sech", "coth"];
//var Diff = ["dx","dy","dθ"];
function CLogarithm()
{
CSubMathBase.call(this,1,2);
}
extend(CLogarithm, CSubMathBase);
CLogarithm.prototype.setContent = function()
{
var oBase = new CMathContent();
var GParams = Common_CopyObj(this.params);
GParams.bMText = false;
oBase.init(GParams);
oBase.relate(this);
oBase.addText("log");
//oBase.setContent.apply(oBase, NameFunctions.minimax[3] );
var oFunc = new CDegreeOrdinary(-1);
oFunc.init(this.params);
oFunc.relate(this);
oFunc.setContent(oBase); //здесь выставляется для Base, что родительский класс CDegree...
//todo
//проверить !!!
//var oArg = new CMathBase(1, 1);
var oArg = new CMathContent();
oArg.init(this.params);
oArg.relate(this);
oArg.fillPlaceholders();
CLogarithm.superclass.setContent.call(this, oFunc, oArg);
}
CLogarithm.prototype.getFunction = function()
{
return this.elements[0][0].getBase();
}
CLogarithm.prototype.getBase = function()
{
return this.elements[0][0].getIterator();
}
CLogarithm.prototype.getArgument = function()
{
return this.elements[0][1];
}
function CLimLowUp()
{
CMathBase.call(this);
}
extend(CLimLowUp, CMathBase);
CLimLowUp.prototype.init = function(props)
{
this.type = props.type;
this.setDimension(2, 1);
var oBase = new CMathContent();
oBase.setOwnTPrp({Italic: false});
var oIter = new CMathContent();
oIter.setReduct(DEGR_REDUCT);
if(props.type == LIMIT_LOW)
this.addMCToContent(oBase, oIter);
else if(props.type == LIMIT_UP)
this.addMCToContent(oIter, oBase);
}
CLimLowUp.prototype.getCenter = function()
{
return this.elements[0][0].size.center;
}
CLimLowUp.prototype.getFName = function()
{
return this.elements[0][0];
}
CLimLowUp.prototype.getIterator = function()
{
return this.elements[1][0];
}
CLimLowUp.prototype.setDistance = function()
{
this.dH = 0.03674768518518519*this.getTxtPrp().FontSize;
}
function old_CMinimax()
{
CSubMathBase.call(this);
}
extend(old_CMinimax, CSubMathBase);
old_CMinimax.prototype.init = function()
{
this.setDimension(1, 2);
var oFunc = new old_CMinimaxFunc();
oFunc.init();
var oArg = new CMathContent();
this.addMCToContent(oFunc, oArg);
}
old_CMinimax.prototype.getFName = function()
{
return this.elements[0][0].getBase();
}
old_CMinimax.prototype.getIterator = function()
{
return this.elements[0][0].getIterator();
}
old_CMinimax.prototype.getArgument = function()
{
return this.elements[0][1];
}
old_CMinimax.prototype.setDistance = function()
{
this.dW = this.getTxtPrp().FontSize/6*g_dKoef_pt_to_mm;
this.dH = 0;
}
function CMathFunc()
{
CMathBase.call(this);
}
extend(CMathFunc, CMathBase);
CMathFunc.prototype.init = function()
{
this.setDimension(1, 2);
this.setContent();
this.elements[0][0].setOwnTPrp({Italic: false}); // trigonometrical function
//this.elements[0][0].mergeTxtPrp({Italic: false}); // trigonometrical function
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.getTxtPrp().FontSize/6*g_dKoef_pt_to_mm;
}
CMathFunc.prototype.getFName = function()
{
return this.elements[0][0];
}
CMathFunc.prototype.getArgument = function()
{
return this.elements[0][1];
}
function old_CDifferential(num)
{
this.num = num;
CSubMathBase.call(this, 1,1);
}
extend(old_CDifferential, CSubMathBase);
old_CDifferential.prototype.setContent = function()
{
var oDiff = new CMathContent();
oDiff.init(this.params);
oDiff.addText(Diff[this.num]);
old_CMathFunc.superclass.setContent.call(this, oDiff);
}
function old_CTrigFunc(num)
{
if(num != num + 0 || num < 0 || num > 14)
return;
this.num = num;
//CSubMathBase.call(this, 1, 2);
CMathBase.call(this, 1,2);
}
//extend(old_CTrigFunc,CSubMathBase);
extend(old_CTrigFunc, CMathBase);
old_CTrigFunc.prototype.setContent = function()
{
var oFunc = new CMathContent();
var GParms = Common_CopyObj(this.params);
GParms.bMText = false;
oFunc.init(GParms);
oFunc.setContent.apply(oFunc, NameFunctions.trig[this.num] );
var oArg = new CMathContent();
oArg.init(this.params);
oArg.fillPlaceholders();
old_CTrigFunc.superclass.setContent.call(this, oFunc, oArg);
}
old_CTrigFunc.prototype.setDistance = function()
{
//todo
//переделать!
this.dW = slashWidth(this.params.font);
this.dH = 0;
}
old_CTrigFunc.prototype.getFunction = function()
{
return this.elemens[0][0];
}
old_CTrigFunc.prototype.getArgument = function()
{
return this.elemens[0][1];
}
......@@ -4195,7 +4195,7 @@ CDelimiter.prototype.setPosition = function(position)
y = this.pos.y;
var pos = {x: x, y: y + this.align(this.begOper)};
this.begOper.setPosition([pos]);
this.begOper.setPosition(pos);
x += this.begOper.size.width;
var content = this.elements[0][0];
......@@ -4220,7 +4220,7 @@ CDelimiter.prototype.setPosition = function(position)
this.sepOper.setPosition(Positions);
pos = {x: x, y: y + this.align(this.endOper)};
this.endOper.setPosition([pos]);
this.endOper.setPosition(pos);
}
CDelimiter.prototype.findDisposition = function(pos)
{
......@@ -4332,13 +4332,13 @@ function COperator(glyph)
{
this.glyph = glyph;
this.positions = null;
this.pos = null;
this.coordGlyph = null;
this.size = {width: 0, height: 0};
}
COperator.prototype.draw = function()
{
if(this.glyph !== -1)
/*if(this.glyph !== -1)
{
var lng = this.coordGlyph.XX.length;
......@@ -4354,7 +4354,23 @@ COperator.prototype.draw = function()
this.glyph.draw(X, Y);
}
}*/
if(this.glyph !== -1)
{
var lng = this.coordGlyph.XX.length;
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.pos.x + this.coordGlyph.XX[j]);
Y.push(this.pos.y + this.coordGlyph.YY[j]);
}
this.glyph.draw(X, Y);
}
}
COperator.prototype.fixSize = function(measure)
{
......@@ -4387,9 +4403,10 @@ COperator.prototype.fixSize = function(measure)
this.size = { width: width, height: height, center: center};
}
}
COperator.prototype.setPosition = function(positions)
COperator.prototype.setPosition = function(pos)
{
this.positions = positions;
this.pos = pos;
//this.positions = positions;
}
COperator.prototype.IsJustDraw = function()
{
......@@ -4418,7 +4435,8 @@ COperator.prototype.setTxtPrp = function(txtPrp)
this.glyph.setTxtPrp(txtPrp);
}
function CGroupCharacter()
function old_CGroupCharacter()
{
this.operator = null;
this.vertJust = VJUST_TOP;
......@@ -4426,8 +4444,8 @@ function CGroupCharacter()
CSubMathBase.call(this);
}
extend(CGroupCharacter, CSubMathBase);
CGroupCharacter.prototype.init = function(props)
extend(old_CGroupCharacter, CSubMathBase);
old_CGroupCharacter.prototype.init = function(props)
{
if(props.pos === "top" || props.location === LOCATION_TOP)
this.loc = LOCATION_TOP;
......@@ -4446,7 +4464,7 @@ CGroupCharacter.prototype.init = function(props)
this.setDimension(1, 1);
this.setContent();
}
CGroupCharacter.prototype.recalculateSize = function()
old_CGroupCharacter.prototype.recalculateSize = function()
{
var content = this.elements[0][0];
......@@ -4467,12 +4485,12 @@ CGroupCharacter.prototype.recalculateSize = function()
this.size = {height: height, width: width, center: center};
}
CGroupCharacter.prototype.draw = function()
old_CGroupCharacter.prototype.draw = function()
{
this.elements[0][0].draw();
this.operator.draw();
}
CGroupCharacter.prototype.setPosition = function(pos)
old_CGroupCharacter.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.center};
......@@ -4496,11 +4514,11 @@ CGroupCharacter.prototype.setPosition = function(pos)
this.operator.setPosition([pos]);
}
}
CGroupCharacter.prototype.align = function(element)
old_CGroupCharacter.prototype.align = function(element)
{
return (this.size.width - element.size.width)/2;
}
CGroupCharacter.prototype.findDisposition = function(pos)
old_CGroupCharacter.prototype.findDisposition = function(pos)
{
var curs_X = 0,
curs_Y = 0;
......@@ -4549,4 +4567,156 @@ CGroupCharacter.prototype.findDisposition = function(pos)
posCurs = {x: curs_X, y: curs_Y};
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
\ No newline at end of file
}
function CCharacter()
{
this.operator = null;
CSubMathBase.call(this);
}
extend(CCharacter, CSubMathBase);
CCharacter.prototype.setOperator = function(operator)
{
this.operator = operator;
var tPrp = this.getTxtPrp();
this.operator.setTxtPrp(tPrp);
this.setDimension(1, 1);
this.setContent();
}
CCharacter.prototype.recalculateSize = function()
{
var content = this.elements[0][0];
this.operator.fixSize(this.elements[0][0].size.width);
var width = content.size.width > this.operator.size.width ? content.size.width : this.operator.size.width,
height = content.size.height + this.operator.size.height,
center = this.getCenter();
this.size = {height: height, width: width, center: center};
}
CCharacter.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.center};
var alignOp = this.align(this.operator),
alignCnt = this.align(this.elements[0][0]);
if(this.loc === LOCATION_TOP)
{
var pos = {x: this.pos.x + alignOp, y: this.pos.y};
this.operator.setPosition(pos);
pos = {x: this.pos.x + alignCnt, y: this.pos.y + this.operator.size.height};
this.elements[0][0].setPosition(pos);
}
else if(this.loc === LOCATION_BOT)
{
var pos = {x: this.pos.x + alignCnt, y: this.pos.y};
this.elements[0][0].setPosition(pos);
pos = {x: this.pos.x + alignOp, y: this.pos.y + this.elements[0][0].size.height};
this.operator.setPosition(pos);
}
}
CCharacter.prototype.align = function(element)
{
return (this.size.width - element.size.width)/2;
}
CCharacter.prototype.draw = function()
{
this.elements[0][0].draw();
this.operator.draw();
}
CCharacter.prototype.findDisposition = function(pos)
{
var curs_X = 0,
curs_Y = 0;
var X, Y;
var inside_flag = -1;
var content = this.elements[0][0],
align = this.align(content);
if(pos.x < align)
{
X = 0;
inside_flag = 0;
}
else if(pos.x > align + content.size.width)
{
X = content.size.width;
inside_flag = 1;
}
else
X = pos.x - align;
if(this.loc === LOCATION_TOP)
{
if(pos.y < this.operator.size.height)
{
Y = 0;
inside_flag = 2;
}
else
Y = pos.y - this.operator.size.height;
}
else if(this.loc === LOCATION_BOT)
{
if(pos.y > content.size.height)
{
Y = content.size.height;
inside_flag = 2;
}
else
Y = pos.y;
}
var mouseCoord = {x: X, y: Y},
posCurs = {x: curs_X, y: curs_Y};
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
function CGroupCharacter()
{
this.vertJust = VJUST_TOP;
this.loc = LOCATION_BOT;
CCharacter.call(this);
}
extend(CGroupCharacter, CCharacter);
CGroupCharacter.prototype.init = function(props)
{
if(props.vertJust === "top" || props.justif == VJUST_TOP)
this.vertJust = VJUST_TOP;
else if(props.vertJust === "bottom"|| props.justif == VJUST_BOT)
this.vertJust = VJUST_BOT;
if(props.pos === "top" || props.location === LOCATION_TOP)
this.loc = LOCATION_TOP;
else if(props.pos === "bot" || props.location === LOCATION_BOT)
this.loc = LOCATION_BOT;
var operator = new COperator ( GetGlyph_GrChr(props.chr, this.loc) );
this.setOperator(operator);
}
CGroupCharacter.prototype.getCenter = function()
{
var center;
if(this.vertJust === VJUST_TOP && this.loc === LOCATION_TOP)
center = this.operator.size.height/2;
else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_TOP )
center = this.operator.size.height + this.elements[0][0].size.center;
else if(this.vertJust === VJUST_TOP && this.loc === LOCATION_BOT )
center = this.elements[0][0].size.center;
else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_BOT )
center = this.operator.size.height/2 + this.elements[0][0].size.height;
return center;
}
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