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

finished equation

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47507 954022d7-b5bf-4e40-9824-e11837661b57
parent 8e4fa62a
...@@ -359,7 +359,8 @@ CControlComposition.prototype = ...@@ -359,7 +359,8 @@ CControlComposition.prototype =
}, },
AddMathComponent: function(indef) AddMathComponent: function(indef)
{ {
this.Content[this.CurPos].AddMathComponent(indef); this.Content[this.CurPos].AddMathEquation(indef);
//this.Content[this.CurPos].AddMathComponent(indef);
}, },
Paragraph_Add: function(TextPr) Paragraph_Add: function(TextPr)
{ {
...@@ -369,6 +370,10 @@ CControlComposition.prototype = ...@@ -369,6 +370,10 @@ CControlComposition.prototype =
font[i] = TextPr[i]; font[i] = TextPr[i];
this.Content[this.CurPos].updateTextPrp(font); this.Content[this.CurPos].updateTextPrp(font);
},
DrawSelect2: function()
{
this.Content[0].DrawSelect2();
} }
} }
var MathControl = new CControlComposition(); var MathControl = new CControlComposition();
...@@ -1004,7 +1009,7 @@ function Create_Structures() ...@@ -1004,7 +1009,7 @@ function Create_Structures()
}; };
path = "url('Math/img/bracket_2.png')"; path = "url('Math/img/bracket_2.png')";
Set_Container(dim, path, 118); Set_Container(dim, path, 121);
dim = dim =
{ {
...@@ -1015,7 +1020,7 @@ function Create_Structures() ...@@ -1015,7 +1020,7 @@ function Create_Structures()
}; };
path = "url('Math/img/bracket_3.png')"; path = "url('Math/img/bracket_3.png')";
Set_Container(dim, path, 119); Set_Container(dim, path, 122);
} }
...@@ -1053,7 +1058,7 @@ function Create_Structures() ...@@ -1053,7 +1058,7 @@ function Create_Structures()
}; };
var path = "url('Math/img/trig_function.png')"; var path = "url('Math/img/trig_function.png')";
Set_Container(dim, path, 121); Set_Container(dim, path, 124);
dim = dim =
{ {
...@@ -1064,7 +1069,7 @@ function Create_Structures() ...@@ -1064,7 +1069,7 @@ function Create_Structures()
}; };
path = "url('Math/img/trig_function_1.png')"; path = "url('Math/img/trig_function_1.png')";
Set_Container(dim, path, 147); Set_Container(dim, path, 150);
} }
var Accent = document.createElement("div"); var Accent = document.createElement("div");
...@@ -1100,7 +1105,7 @@ function Create_Structures() ...@@ -1100,7 +1105,7 @@ function Create_Structures()
}; };
var path = "url('Math/img/accent.png')"; var path = "url('Math/img/accent.png')";
Set_Container(dim, path, 148); Set_Container(dim, path, 151);
dim = dim =
{ {
...@@ -1110,7 +1115,7 @@ function Create_Structures() ...@@ -1110,7 +1115,7 @@ function Create_Structures()
heightEqt: 80 heightEqt: 80
} }
path = "url('Math/img/accent_1.png')"; path = "url('Math/img/accent_1.png')";
Set_Container(dim, path, 168); Set_Container(dim, path, 171);
dim = dim =
{ {
...@@ -1120,7 +1125,7 @@ function Create_Structures() ...@@ -1120,7 +1125,7 @@ function Create_Structures()
heightEqt: 80 heightEqt: 80
} }
path = "url('Math/img/accent_2.png')"; path = "url('Math/img/accent_2.png')";
Set_Container(dim, path, 170); Set_Container(dim, path, 173);
dim = dim =
{ {
...@@ -1130,7 +1135,7 @@ function Create_Structures() ...@@ -1130,7 +1135,7 @@ function Create_Structures()
heightEqt: 80 heightEqt: 80
} }
path = "url('Math/img/accent_3.png')"; path = "url('Math/img/accent_3.png')";
Set_Container(dim, path, 171); Set_Container(dim, path, 174);
dim = dim =
{ {
...@@ -1150,7 +1155,7 @@ function Create_Structures() ...@@ -1150,7 +1155,7 @@ function Create_Structures()
heightEqt: 80 heightEqt: 80
} }
path = "url('Math/img/accent_4.png')"; path = "url('Math/img/accent_4.png')";
Set_Container(dim, path, 172); Set_Container(dim, path, 175);
dim = dim =
{ {
...@@ -1160,7 +1165,7 @@ function Create_Structures() ...@@ -1160,7 +1165,7 @@ function Create_Structures()
heightEqt: 80 heightEqt: 80
} }
path = "url('Math/img/accent_5.png')"; path = "url('Math/img/accent_5.png')";
Set_Container(dim, path, 173); Set_Container(dim, path, 176);
} }
...@@ -1198,7 +1203,7 @@ function Create_Structures() ...@@ -1198,7 +1203,7 @@ function Create_Structures()
}; };
var path = "url('Math/img/logarithm.png')"; var path = "url('Math/img/logarithm.png')";
Set_Container(dim, path, 174); Set_Container(dim, path, 177);
dim = dim =
{ {
...@@ -1209,7 +1214,7 @@ function Create_Structures() ...@@ -1209,7 +1214,7 @@ function Create_Structures()
}; };
path = "url('Math/img/logarithm_1.png')"; path = "url('Math/img/logarithm_1.png')";
Set_Container(dim, path, 180); Set_Container(dim, path, 183);
dim = dim =
{ {
...@@ -1220,7 +1225,7 @@ function Create_Structures() ...@@ -1220,7 +1225,7 @@ function Create_Structures()
}; };
path = "url('Math/img/logarithm_2.png')"; path = "url('Math/img/logarithm_2.png')";
Set_Container(dim, path, 181); Set_Container(dim, path, 184);
} }
var Operator = document.createElement("div"); var Operator = document.createElement("div");
...@@ -1256,7 +1261,7 @@ function Create_Structures() ...@@ -1256,7 +1261,7 @@ function Create_Structures()
}; };
var path = "url('Math/img/operators.png')"; var path = "url('Math/img/operators.png')";
Set_Container(dim, path, 182); Set_Container(dim, path, 185);
dim = dim =
{ {
...@@ -1267,7 +1272,7 @@ function Create_Structures() ...@@ -1267,7 +1272,7 @@ function Create_Structures()
}; };
path = "url('Math/img/operators_1.png')"; path = "url('Math/img/operators_1.png')";
Set_Container(dim, path, 189); Set_Container(dim, path, 192);
dim = dim =
{ {
...@@ -1278,7 +1283,7 @@ function Create_Structures() ...@@ -1278,7 +1283,7 @@ function Create_Structures()
}; };
path = "url('Math/img/operators_2.png')"; path = "url('Math/img/operators_2.png')";
Set_Container(dim, path, 201); Set_Container(dim, path, 204);
dim = dim =
{ {
...@@ -1289,7 +1294,7 @@ function Create_Structures() ...@@ -1289,7 +1294,7 @@ function Create_Structures()
}; };
path = "url('Math/img/operators_3.png')"; path = "url('Math/img/operators_3.png')";
Set_Container(dim, path, 202); Set_Container(dim, path, 205);
} }
...@@ -1326,7 +1331,7 @@ function Create_Structures() ...@@ -1326,7 +1331,7 @@ function Create_Structures()
}; };
var path = "url('Math/img/matrix.png')"; var path = "url('Math/img/matrix.png')";
Set_Container(dim, path, 203); Set_Container(dim, path, 206);
dim = dim =
{ {
...@@ -1337,7 +1342,7 @@ function Create_Structures() ...@@ -1337,7 +1342,7 @@ function Create_Structures()
}; };
path = "url('Math/img/matrix_1.png')"; path = "url('Math/img/matrix_1.png')";
Set_Container(dim, path, 223); Set_Container(dim, path, 226);
} }
MathDesign.bStruct = false; MathDesign.bStruct = false;
......
...@@ -913,6 +913,23 @@ CMathBase.prototype = ...@@ -913,6 +913,23 @@ CMathBase.prototype =
this.recalculateSize(); this.recalculateSize();
this.Parent.ResizeReverse(); this.Parent.ResizeReverse();
}, },
ResizeReverse_2: function() //for finished equation
{
this.ResizeDirect();
this.Parent.ResizeReverse();
},
ResizeDirect: function()
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].ResizeDirect();
}
this.recalculateSize();
},
getCenter: function(_height) getCenter: function(_height)
{ {
var res = 0; var res = 0;
...@@ -1010,5 +1027,9 @@ CMathBase.prototype = ...@@ -1010,5 +1027,9 @@ CMathBase.prototype =
for(var i=0; i < this.nRow; i++) for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
this.elements[i][j].hidePlaceholder(flag); this.elements[i][j].hidePlaceholder(flag);
},
getElement: function(x, y)
{
return this.elements[x][y];
} }
} }
...@@ -213,4 +213,8 @@ CBorderBox.prototype.findDisposition = function(mCoord) ...@@ -213,4 +213,8 @@ CBorderBox.prototype.findDisposition = function(mCoord)
return {pos: posCurs, mCoord: coord, inside_flag: inside_flag}; return {pos: posCurs, mCoord: coord, inside_flag: inside_flag};
}
CBorderBox.prototype.getElement = function()
{
return this.elements[0][0];
} }
\ No newline at end of file
...@@ -12,6 +12,7 @@ function CDegree(type) ...@@ -12,6 +12,7 @@ function CDegree(type)
return degr; return degr;
} }
function CDegreeOrdinary(index) function CDegreeOrdinary(index)
{ {
this.index = index; this.index = index;
...@@ -20,7 +21,7 @@ function CDegreeOrdinary(index) ...@@ -20,7 +21,7 @@ function CDegreeOrdinary(index)
} }
extend(CDegreeOrdinary, CMathBase); extend(CDegreeOrdinary, CMathBase);
CDegreeOrdinary.prototype.SH_DEGR = 2/3; CDegreeOrdinary.prototype.SH_DEGR = 2/3;
CDegreeOrdinary.prototype.setContent = function() CDegreeOrdinary.prototype.old_setContent = function()
{ {
var oBase = null; var oBase = null;
if(arguments.length > 0) if(arguments.length > 0)
...@@ -41,6 +42,28 @@ CDegreeOrdinary.prototype.setContent = function() ...@@ -41,6 +42,28 @@ CDegreeOrdinary.prototype.setContent = function()
CDegreeOrdinary.superclass.setContent.call(this, oBase, oDegree); CDegreeOrdinary.superclass.setContent.call(this, oBase, oDegree);
}
CDegreeOrdinary.prototype.setContent = function()
{
var oBase = null;
if(arguments.length > 0)
oBase = arguments[0];
else
{
oBase = new CMathContent();
oBase.init( this.params );
oBase.relate(this);
oBase.fillPlaceholders();
}
var oDegree = new CMathContent();
oDegree.init( this.params );
oDegree.relate(this);
oDegree.fillPlaceholders();
oDegree.setFont(getTypeDegree(this.params.font), -1);
CDegreeOrdinary.superclass.setContent.call(this, oBase, oDegree);
} }
CDegreeOrdinary.prototype.recalculateSize = function() CDegreeOrdinary.prototype.recalculateSize = function()
{ {
...@@ -176,6 +199,65 @@ CDegreeOrdinary.prototype.findDisposition = function( mCoord ) ...@@ -176,6 +199,65 @@ CDegreeOrdinary.prototype.findDisposition = function( mCoord )
return {pos: {x: X, y: Y}, mCoord: mCoord, inside_flag: inside_flag}; return {pos: {x: X, y: Y}, mCoord: mCoord, inside_flag: inside_flag};
} }
CDegreeOrdinary.prototype.getIterator = function()
{
return this.elements[0][1];
}
CDegreeOrdinary.prototype.getUpperIterator = function()
{
return this.elements[0][1];
}
CDegreeOrdinary.prototype.getLowerIterator = function()
{
return this.elements[0][1];
}
CDegreeOrdinary.prototype.getBase = function()
{
return this.elements[0][0];
}
function CIterators()
{
CMathBase.call(this, 2, 1);
}
extend(CIterators, CMathBase);
CIterators.prototype.setDistance = function()
{
var descF = this.elements[0][0].size.height - this.elements[0][0].size.center ,
ascS = this.elements[1][0].size.center ;
var up = 0;
var down = 0;
if(this.lUp > descF)
up = this.lUp - descF;
if( this.lD > ascS )
down = this.lD - ascS;
this.dH = up + down;
this.dW = 0;
}
CIterators.prototype.getCenter = function()
{
var center = 0;
var descF = this.elements[0][0].size.height - this.elements[0][0].size.center;
if( this.lUp > descF )
center = this.elements[0][0].size.center + this.lUp;
else
center = this.elements[0][0].size.height;
return center;
}
CIterators.prototype.getUpperIterator = function()
{
return this.elements[0][0];
}
CIterators.prototype.getLowerIterator = function()
{
return this.elements[1][0];
}
function CDegreeSubSup(type) function CDegreeSubSup(type)
{ {
...@@ -183,7 +265,7 @@ function CDegreeSubSup(type) ...@@ -183,7 +265,7 @@ function CDegreeSubSup(type)
this.type = type; this.type = type;
} }
extend(CDegreeSubSup, CSubMathBase); extend(CDegreeSubSup, CSubMathBase);
CDegreeSubSup.prototype.setContent = function() CDegreeSubSup.prototype.old_setContent = function()
{ {
var oBase = null; var oBase = null;
...@@ -197,54 +279,58 @@ CDegreeSubSup.prototype.setContent = function() ...@@ -197,54 +279,58 @@ CDegreeSubSup.prototype.setContent = function()
oBase.fillPlaceholders(); oBase.fillPlaceholders();
} }
var oDegree = new CMathBase(2, 1); var oIters = new CIterators();
oDegree.init( this.params ); oIters.init( this.params );
oDegree.relate(this); oIters.relate(this);
oDegree.fillPlaceholders(); oIters.fillPlaceholders();
oDegree.setFont(getTypeDegree(this.params.font), -1); oIters.setFont(getTypeDegree(this.params.font), -1);
oDegree.setDistance = function() {
var metrics = this.params.font.metrics;
var descF = this.elements[0][0].size.height - this.elements[0][0].size.center ,
ascS = this.elements[1][0].size.center ;
var up = 0; oIters.lUp = 0;
var down = 0; oIters.lD = 0;
if(this.lUp > descF)
up = this.lUp - descF;
if( this.lD > ascS )
down = this.lD - ascS;
this.dH = up + down; if(this.type == 0)
this.dW = 0; {
oIters.alignHor(-1, 0);
}; CDegreeSubSup.superclass.setContent.call(this, oBase, oIters);
oDegree.getCenter = function() }
else
{ {
var center = 0; oIters.alignHor(-1, 1);
var descF = this.elements[0][0].size.height - this.elements[0][0].size.center; CDegreeSubSup.superclass.setContent.call(this, oIters, oBase);
}
}
CDegreeSubSup.prototype.setContent = function()
{
if( this.lUp > descF ) var oBase = null;
center = this.elements[0][0].size.center + this.lUp; if(arguments.length > 0)
else oBase = arguments[0];
center = this.elements[0][0].size.height; else
{
oBase = new CMathContent(1, 1);
oBase.init( this.params );
oBase.relate(this);
oBase.fillPlaceholders();
}
return center; var oIters = new CIterators();
}; oIters.init( this.params );
oIters.relate(this);
oIters.fillPlaceholders();
oIters.setFont(getTypeDegree(this.params.font), -1);
oDegree.lUp = 0; oIters.lUp = 0;
oDegree.lD = 0; oIters.lD = 0;
if(this.type == 0) if(this.type == 0)
{ {
oDegree.alignHor(-1, 0); oIters.alignHor(-1, 0);
CDegreeSubSup.superclass.setContent.call(this, oBase, oDegree); CDegreeSubSup.superclass.setContent.call(this, oBase, oIters);
} }
else else
{ {
oDegree.alignHor(-1, 1); oIters.alignHor(-1, 1);
CDegreeSubSup.superclass.setContent.call(this, oDegree, oBase); CDegreeSubSup.superclass.setContent.call(this, oIters, oBase);
} }
} }
CDegreeSubSup.prototype.recalculateSize = function() CDegreeSubSup.prototype.recalculateSize = function()
...@@ -266,6 +352,40 @@ CDegreeSubSup.prototype.recalculateSize = function() ...@@ -266,6 +352,40 @@ CDegreeSubSup.prototype.recalculateSize = function()
CSubMathBase.superclass.recalculateSize.call(this); CSubMathBase.superclass.recalculateSize.call(this);
} }
CDegreeSubSup.prototype.getBase = function()
{
var base;
if(this.type == 0)
base = this.elements[0][0];
else
base = this.elements[0][1];
return base;
}
CDegreeSubSup.prototype.getUpperIterator = function()
{
var iter;
if(this.type == 0)
iter = this.elements[0][1].getUpperIterator();
else
iter = this.elements[0][0].getUpperIterator();
return iter;
}
CDegreeSubSup.prototype.getLowerIterator = function()
{
var iter;
if(this.type == 0)
iter = this.elements[0][1].getLowerIterator();
else
iter = this.elements[0][0].getLowerIterator();
return iter;
}
//выяcнить: почему и с этой ф-ией и без нее работает всё ok... //выяcнить: почему и с этой ф-ией и без нее работает всё ok...
//всё ok, т.к. в контенте 2 элемента, и их center сравниваем //всё ok, т.к. в контенте 2 элемента, и их center сравниваем
/*CDegreeSubSup.prototype.getCenter = function() /*CDegreeSubSup.prototype.getCenter = function()
......
...@@ -78,6 +78,10 @@ CBaseDiacritic.prototype.IsIncline = function() ...@@ -78,6 +78,10 @@ CBaseDiacritic.prototype.IsIncline = function()
return this.elements[0][0].IsIncline(); return this.elements[0][0].IsIncline();
} }
CBaseDiacritic.prototype.getBase = function()
{
return this.elements[0][0];
}
function CCircumflex(id) function CCircumflex(id)
{ {
......
...@@ -10381,5 +10381,11 @@ CDocument.prototype = ...@@ -10381,5 +10381,11 @@ CDocument.prototype =
var Coords = this.DrawingDocument.ConvertCoordsToCursorWR( Comment_X, Comment_Y, Comment_PageNum ); var Coords = this.DrawingDocument.ConvertCoordsToCursorWR( Comment_X, Comment_Y, Comment_PageNum );
editor.sync_UpdateCommentPosition( Comment.Get_Id(), Coords.X, Coords.Y ); editor.sync_UpdateCommentPosition( Comment.Get_Id(), Coords.X, Coords.Y );
} }
},
Selection_Draw_Page: function()
{
//var i = 100;
MathControl.DrawSelect2();
} }
}; };
...@@ -39,7 +39,14 @@ CBarFraction.prototype.draw = function() ...@@ -39,7 +39,14 @@ CBarFraction.prototype.draw = function()
CBarFraction.superclass.draw.call(this); CBarFraction.superclass.draw.call(this);
} }
CBarFraction.prototype.getNumerator = function()
{
return this.elements[0][0].getElement();
}
CBarFraction.prototype.getDenominator = function()
{
return this.elements[1][0].getElement();
}
////////// //////////
function CNumerator() function CNumerator()
...@@ -132,6 +139,10 @@ CNumerator.prototype.setPosition = function(pos) ...@@ -132,6 +139,10 @@ CNumerator.prototype.setPosition = function(pos)
this.elements[0][0].setPosition({x: x, y: y}); this.elements[0][0].setPosition({x: x, y: y});
} }
CNumerator.prototype.getElement = function(txt)
{
return this.elements[0][0];
}
function CDenominator() function CDenominator()
{ {
...@@ -232,6 +243,10 @@ CDenominator.prototype.setGapCoeff = function(coeff) ...@@ -232,6 +243,10 @@ CDenominator.prototype.setGapCoeff = function(coeff)
this.recalculateSize(); this.recalculateSize();
} }
} }
CDenominator.prototype.getElement = function(txt)
{
return this.elements[0][0];
}
////////// //////////
...@@ -425,6 +440,14 @@ CSkewedFraction.prototype.draw = function() ...@@ -425,6 +440,14 @@ CSkewedFraction.prototype.draw = function()
MathControl.pGraph._l(xx2, yy2); MathControl.pGraph._l(xx2, yy2);
MathControl.pGraph.ds(); MathControl.pGraph.ds();
} }
CSkewedFraction.prototype.getNumerator = function()
{
return this.elements[0][0];
}
CSkewedFraction.prototype.getDenominator = function()
{
return this.elements[0][1];
}
////////// //////////
...@@ -503,6 +526,14 @@ CLinearFraction.prototype.draw = function() ...@@ -503,6 +526,14 @@ CLinearFraction.prototype.draw = function()
CLinearFraction.superclass.draw.call(this); CLinearFraction.superclass.draw.call(this);
} }
CLinearFraction.prototype.getNumerator = function()
{
return this.elements[0][0];
}
CLinearFraction.prototype.getDenominator = function()
{
return this.elements[0][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", "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",""]; var Diff = ["dx","dy",""];
function CLogarithm() function CLogarithm()
...@@ -13,7 +14,7 @@ CLogarithm.prototype.setContent = function() ...@@ -13,7 +14,7 @@ CLogarithm.prototype.setContent = function()
GParams.bMText = false; GParams.bMText = false;
oBase.init(GParams); oBase.init(GParams);
oBase.relate(this); oBase.relate(this);
oBase.addText(NameFunctions[3]); oBase.addText("log");
//oBase.setContent.apply(oBase, NameFunctions.minimax[3] ); //oBase.setContent.apply(oBase, NameFunctions.minimax[3] );
...@@ -32,40 +33,81 @@ CLogarithm.prototype.setContent = function() ...@@ -32,40 +33,81 @@ CLogarithm.prototype.setContent = function()
CLogarithm.superclass.setContent.call(this, oFunc, oArg); CLogarithm.superclass.setContent.call(this, oFunc, oArg);
} }
CLogarithm.prototype.getFunction = function()
function CMinimax(num)
{ {
CSubMathBase.call(this, 1, 2); return this.elements[0][0].getBase();
if(this.num !== this.num - 0 && this.num < 0 && this.num > 2) }
this.num = 0; CLogarithm.prototype.getBase = function()
else {
this.num = num; return this.elements[0][0].getIterator();
}
CLogarithm.prototype.getArgument = function()
{
return this.elements[0][1];
}
function CMinimaxFunc(num)
{
this.num = num;
CMathBase.call(this, 2, 1);
} }
extend(CMinimax, CSubMathBase); extend(CMinimaxFunc, CMathBase);
CMinimax.prototype.setContent = function() CMinimaxFunc.prototype.setContent = function()
{ {
var oBase = new CMathContent(); var oBase = new CMathContent();
var GParams = Common_CopyObj(this.params); var GParams = Common_CopyObj(this.params);
GParams.bMText = false; GParams.bMText = false;
oBase.init(GParams); oBase.init(GParams);
oBase.relate(this); oBase.relate(this);
oBase.addText(NameFunctions[this.num]);
var oIter = new CMathBase(1,1); if(this.num == 0)
oBase.addText("min");
else if(this.num == 1)
oBase.addText("max");
else
oBase.addText("lim");
var oIter = new CMathContent();
GParams = Common_CopyObj(this.params); GParams = Common_CopyObj(this.params);
GParams.font = getTypeDegree(this.params.font); GParams.font = getTypeDegree(this.params.font);
oIter.init(GParams); oIter.init(GParams);
oIter.relate(this); oIter.relate(this);
oIter.fillPlaceholders(); oIter.fillPlaceholders();
var oFunc = new CMathBase(2, 1); CMinimaxFunc.superclass.setContent.call(this, oBase, oIter);
oFunc.getCenter = function() { return this.elements[0][0].size.center; }; }
CMinimaxFunc.prototype.getCenter = function()
{
return this.elements[0][0].size.center;
}
CMinimaxFunc.prototype.getBase = function()
{
return this.elements[0][0];
}
CMinimaxFunc.prototype.getIterator = function()
{
return this.elements[1][0];
}
function CMinimax(num)
{
CSubMathBase.call(this, 1, 2);
if(this.num !== this.num - 0 && this.num < 0 && this.num > 2)
this.num = 0;
else
this.num = num;
}
extend(CMinimax, CSubMathBase);
CMinimax.prototype.setContent = function()
{
var oFunc = new CMinimaxFunc(this.num);
oFunc.init(this.params); oFunc.init(this.params);
oFunc.relate(this); oFunc.relate(this);
oFunc.setContent(oBase, oIter); oFunc.setContent();
var oArg = new CMathBase(1, 1);
var oArg = new CMathContent();
oArg.init(this.params); oArg.init(this.params);
oArg.relate(this); oArg.relate(this);
oArg.fillPlaceholders(); oArg.fillPlaceholders();
...@@ -80,8 +122,20 @@ CMinimax.prototype.setDistance = function() ...@@ -80,8 +122,20 @@ CMinimax.prototype.setDistance = function()
this.dW = slashWidth(this.params.font); this.dW = slashWidth(this.params.font);
this.dH = 0; this.dH = 0;
} }
CMinimax.prototype.getFunction = function()
{
return this.elements[0][0].getBase();
}
CMinimax.prototype.getIterator = function()
{
return this.elements[0][0].getIterator();
}
CMinimax.prototype.getArgument = function()
{
return this.elements[0][1];
}
function CMathFunc(num) function old_CMathFunc(num)
{ {
if(num > 19) if(num > 19)
return; return;
...@@ -90,9 +144,9 @@ function CMathFunc(num) ...@@ -90,9 +144,9 @@ function CMathFunc(num)
CMathBase.call(this, 1,2); CMathBase.call(this, 1,2);
} }
//extend(CMathFunc,CSubMathBase); //extend(old_CMathFunc,CSubMathBase);
extend(CMathFunc, CMathBase); extend(old_CMathFunc, CMathBase);
CMathFunc.prototype.setContent = function() old_CMathFunc.prototype.setContent = function()
{ {
var oFunc = new CMathContent(); var oFunc = new CMathContent();
var GParms = Common_CopyObj(this.params); var GParms = Common_CopyObj(this.params);
...@@ -105,16 +159,16 @@ CMathFunc.prototype.setContent = function() ...@@ -105,16 +159,16 @@ CMathFunc.prototype.setContent = function()
oArg.init(this.params); oArg.init(this.params);
oArg.fillPlaceholders(); oArg.fillPlaceholders();
CMathFunc.superclass.setContent.call(this, oFunc, oArg); old_CMathFunc.superclass.setContent.call(this, oFunc, oArg);
} }
CMathFunc.prototype.setDistance = function() old_CMathFunc.prototype.setDistance = function()
{ {
//todo //todo
//переделать! //переделать!
this.dW = slashWidth(this.params.font); this.dW = slashWidth(this.params.font);
this.dH = 0; this.dH = 0;
} }
CMathFunc.prototype.addText = function(txt) old_CMathFunc.prototype.addText = function(txt)
{ {
this.elements[0][1].addText(txt); this.elements[0][1].addText(txt);
} }
...@@ -131,5 +185,38 @@ CDifferential.prototype.setContent = function() ...@@ -131,5 +185,38 @@ CDifferential.prototype.setContent = function()
oDiff.init(this.params); oDiff.init(this.params);
oDiff.addText(Diff[this.num]); oDiff.addText(Diff[this.num]);
CMathFunc.superclass.setContent.call(this, oDiff); old_CMathFunc.superclass.setContent.call(this, oDiff);
}
function CMathFunc()
{
CMathBase.call(this, 1,2);
}
extend(CMathFunc, CMathBase);
CMathFunc.prototype.setContent = function()
{
var oFunc = new CMathContent();
var GParms = Common_CopyObj(this.params);
GParms.bMText = false; //!!
oFunc.init(GParms);
var oArg = new CMathContent();
oArg.init(this.params);
oArg.fillPlaceholders();
CMathFunc.superclass.setContent.call(this, oFunc, oArg);
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.params.font.FontSize/6*g_dKoef_pt_to_mm;
this.dH = 0;
}
CMathFunc.prototype.getFunction = function()
{
return this.elements[0][0];
}
CMathFunc.prototype.getArgument = function()
{
return this.elements[0][1];
} }
\ No newline at end of file
This diff is collapsed.
...@@ -422,7 +422,11 @@ CMathText.prototype = ...@@ -422,7 +422,11 @@ CMathText.prototype =
flag = true; flag = true;
return flag; return flag;
} },
ResizeDirect: function()
{
this.recalculateSize();
}
} }
function CSymbol(IFont) function CSymbol(IFont)
......
...@@ -376,10 +376,7 @@ CMathMatrix.prototype.addRow = function() ...@@ -376,10 +376,7 @@ CMathMatrix.prototype.addRow = function()
//this.setDistance(); //this.setDistance();
this.recalculateSize(); this.recalculateSize();
} }
CMathMatrix.prototype.getElement = function(x, y)
{
return this.elements[x][y];
}
CMathMatrix.prototype.setRowGapRule = function(rule, gap) CMathMatrix.prototype.setRowGapRule = function(rule, gap)
{ {
this.spaceRow.rule = rule; this.spaceRow.rule = rule;
...@@ -389,7 +386,8 @@ CMathMatrix.prototype.setColumnGapRule = function(rule, gap, minGap) ...@@ -389,7 +386,8 @@ CMathMatrix.prototype.setColumnGapRule = function(rule, gap, minGap)
{ {
this.spaceColumn.rule = rule; this.spaceColumn.rule = rule;
this.spaceColumn.gap = gap; this.spaceColumn.gap = gap;
this.spaceColumn.minGap = minGap; if(minGap != null && typeof(minGap) !== "undefined")
this.spaceColumn.minGap = minGap;
} }
CMathMatrix.prototype.getLineGap = function(space) CMathMatrix.prototype.getLineGap = function(space)
{ {
......
...@@ -74,6 +74,18 @@ CNary.prototype.setContent = function() ...@@ -74,6 +74,18 @@ CNary.prototype.setContent = function()
CNary.superclass.setContent.call(this, oBase, oArg); CNary.superclass.setContent.call(this, oBase, oArg);
} }
CNary.prototype.getBase = function()
{
return this.elements[0][1];
}
CNary.prototype.getUpperIterator = function()
{
return this.elements[0][0].getUpperIterator();
}
CNary.prototype.getLowerIterator = function()
{
return this.elements[0][0].getLowerIterator();
}
function CBaseNaryOrder(id, IterType ) function CBaseNaryOrder(id, IterType )
{ {
...@@ -148,6 +160,21 @@ CBaseNaryOrder.prototype.IsJustDraw = function() ...@@ -148,6 +160,21 @@ CBaseNaryOrder.prototype.IsJustDraw = function()
{ {
return this.IterType == 0; // если только один значок n-арного оператора return this.IterType == 0; // если только один значок n-арного оператора
} }
CBaseNaryOrder.prototype.getUpperIterator = function()
{
return this.elements[0][0];
}
CBaseNaryOrder.prototype.getLowerIterator = function()
{
var iter = null;
if(this.IterType == 2)
iter = this.elements[1][0];
else if(this.IterType == 3)
iter = this.elements[2][0];
return iter;
}
function CNaryOperator(flip) function CNaryOperator(flip)
{ {
......
...@@ -377,7 +377,7 @@ function CDelimiter(type, loc, turn1, turn2) ...@@ -377,7 +377,7 @@ function CDelimiter(type, loc, turn1, turn2)
this.type = type; this.type = type;
this.loc = loc; this.loc = loc;
this.base = null;
var countRow, countCol; var countRow, countCol;
...@@ -505,6 +505,8 @@ CDelimiter.prototype.setContent = function() ...@@ -505,6 +505,8 @@ CDelimiter.prototype.setContent = function()
argument.relate(this); argument.relate(this);
argument.fillPlaceholders(); argument.fillPlaceholders();
this.base = argument;
if(this.loc == 0 || this.loc == 2) if(this.loc == 0 || this.loc == 2)
{ {
CDelimiter.superclass.setContent.call(this, operator1, argument); CDelimiter.superclass.setContent.call(this, operator1, argument);
...@@ -612,32 +614,9 @@ CDelimiter.prototype.recalculateSize = function() ...@@ -612,32 +614,9 @@ CDelimiter.prototype.recalculateSize = function()
this.size = {width: width, height: height, center: center}; this.size = {width: width, height: height, center: center};
} }
CDelimiter.prototype.getBase = function()
function CStructOperator(type, loc, turn)
{
this.type = type;
this.loc = loc;
this.turn = turn;
var countRow, countCol;
if(loc == 0 || loc == 1)
{
countRow = 2;
countCol = 1;
}
else
{
countRow = 1;
countCol = 2;
}
CMathBase.call(this, countRow, countCol);
}
extend(CStructOperator, CMathBase);
CStructOperator.prototype.setContent = function()
{ {
return this.base;
} }
function COperatorBracket() function COperatorBracket()
...@@ -2126,6 +2105,16 @@ CStructArrow.prototype.recalculateSize = function() ...@@ -2126,6 +2105,16 @@ CStructArrow.prototype.recalculateSize = function()
CStructArrow.superclass.recalculateSize.call(this); CStructArrow.superclass.recalculateSize.call(this);
} }
CStructArrow.prototype.getBase = function()
{
var res;
if(this.loc == 0)
res = this.elements[1][0];
else
res = this.elements[0][0];
return res;
}
function CSingleArrow() function CSingleArrow()
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -32,4 +32,11 @@ CTrigFunc.prototype.setDistance = function() ...@@ -32,4 +32,11 @@ CTrigFunc.prototype.setDistance = function()
this.dW = slashWidth(this.params.font); this.dW = slashWidth(this.params.font);
this.dH = 0; this.dH = 0;
} }
CTrigFunc.prototype.getFunction = function()
{
return this.elemens[0][0];
}
CTrigFunc.prototype.getArgument = function()
{
return this.elemens[0][1];
}
...@@ -174,14 +174,15 @@ ...@@ -174,14 +174,15 @@
<script type="text/javascript" src ="Math/degree.js"></script> <script type="text/javascript" src ="Math/degree.js"></script>
<script type="text/javascript" src = "Math/matrix.js"></script> <script type="text/javascript" src = "Math/matrix.js"></script>
<script type="text/javascript" src = "Math/matrix.js"></script> <script type="text/javascript" src = "Math/matrix.js"></script>
<script type="text/javascript" src = "Math/minimax.js"></script> <!--<script type="text/javascript" src = "Math/minimax.js"></script>-->
<script type="text/javascript" src = "Math/logarithm.js"></script> <script type="text/javascript" src = "Math/logarithm.js"></script>
<script type="text/javascript" src = "Math/nary.js"></script> <script type="text/javascript" src = "Math/nary.js"></script>
<script type="text/javascript" src = "Math/radical.js"></script> <script type="text/javascript" src = "Math/radical.js"></script>
<script type="text/javascript" src = "Math/diacritical.js"></script> <script type="text/javascript" src = "Math/diacritical.js"></script>
<script type="text/javascript" src = "Math/parenthesis.js"></script> <!--<script type="text/javascript" src = "Math/parenthesis.js"></script>-->
<script type="text/javascript" src = "Math/operators.js"></script> <script type="text/javascript" src = "Math/operators.js"></script>
<script type="text/javascript" src = "Math/drawingUnion.js"></script> <script type="text/javascript" src = "Math/drawingUnion.js"></script>
<script type="text/javascript" src = "Math/borderBox.js"></script>
<!----> <!---->
......
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