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

промежуточная версия

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48738 954022d7-b5bf-4e40-9824-e11837661b57
parent 0ca55c66
This diff is collapsed.
...@@ -19,8 +19,11 @@ function CMathBase() ...@@ -19,8 +19,11 @@ function CMathBase()
this.Parent = null; this.Parent = null;
this.Composition = null; // ссылка на общую формулу this.Composition = null; // ссылка на общую формулу
this.textPrp = new CMathTextPrp(); // для рассчета размера расстояний this.TxtPrp = new CMathTextPrp();
this.RunPrp = new CMathTextPrp(); // запоминаем, если передаются спец. настройки для контента this.OwnTPrp = new CMathTextPrp();
//this.textPrp = new CMathTextPrp(); // для рассчета размера расстояний
//this.RunPrp = new CMathTextPrp(); // запоминаем, если передаются спец. настройки для контента
//todo //todo
//переделать //переделать
...@@ -53,9 +56,9 @@ CMathBase.prototype = ...@@ -53,9 +56,9 @@ CMathBase.prototype =
{ {
this.elements[i][j] = new CMathContent(); this.elements[i][j] = new CMathContent();
this.elements[i][j].relate(this); this.elements[i][j].relate(this);
//this.elements[i][j].setReduct(this.reduct);
this.elements[i][j].setComposition(this.Composition); this.elements[i][j].setComposition(this.Composition);
this.elements[i][j].setRunPrp(this.RunPrp); //this.elements[i][j].setReduct(this.reduct);
//this.elements[i][j].setRunPrp(this.RunPrp);
} }
} }
...@@ -75,7 +78,7 @@ CMathBase.prototype = ...@@ -75,7 +78,7 @@ CMathBase.prototype =
this.alignment.wdt[u] = CENTER; this.alignment.wdt[u] = CENTER;
}, },
getTxtPrp: function() old_getTxtPrp: function()
{ {
var txtPrp = new CMathTextPrp(); var txtPrp = new CMathTextPrp();
Common_CopyObj2(txtPrp, this.Composition.TxtPrp); Common_CopyObj2(txtPrp, this.Composition.TxtPrp);
...@@ -86,17 +89,20 @@ CMathBase.prototype = ...@@ -86,17 +89,20 @@ CMathBase.prototype =
return txtPrp; return txtPrp;
}, },
setTxtPrp: function()
{
this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
this.TxtPrp.Merge(this.OwnTPrp);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].setTxtPrp(TxtPrp);
},
getOwnTPrp: function() getOwnTPrp: function()
{ {
return this.textPrp; return this.textPrp;
}, },
/*getTxtPrp_2: function()
{
var txtPrp = this.getTxtPrp();
txtPrp.FontSize *= this.reduct;
return txtPrp;
},*/
setComposition: function(Compos) setComposition: function(Compos)
{ {
this.Composition = Compos; this.Composition = Compos;
...@@ -110,9 +116,9 @@ CMathBase.prototype = ...@@ -110,9 +116,9 @@ CMathBase.prototype =
}, },
getRunPrp: function() getRunPrp: function()
{ {
return this.textPrp; return this.TxtPrp;
}, },
setRunPrp: function(txtPrp) old_setRunPrp: function(txtPrp)
{ {
this.RunPrp.Merge(txtPrp); this.RunPrp.Merge(txtPrp);
this.setTxtPrp(txtPrp); this.setTxtPrp(txtPrp);
...@@ -158,7 +164,7 @@ CMathBase.prototype = ...@@ -158,7 +164,7 @@ CMathBase.prototype =
{ {
this.elements[i][j].setComposition(this.Composition); this.elements[i][j].setComposition(this.Composition);
//this.elements[i][j].setReduct(this.reduct); //this.elements[i][j].setReduct(this.reduct);
this.elements[i][j].setRunPrp(this.RunPrp); //this.elements[i][j].setRunPrp(this.RunPrp);
} }
this.elements[i][j].bMObjs = true; this.elements[i][j].bMObjs = true;
} }
...@@ -882,7 +888,7 @@ CMathBase.prototype = ...@@ -882,7 +888,7 @@ CMathBase.prototype =
{ {
return this.elements[x][y]; return this.elements[x][y];
}, },
setTxtPrp: function(txtPrp) old_setTxtPrp: function(txtPrp)
{ {
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++)
......
...@@ -34,7 +34,7 @@ CBorderBox.prototype.recalculateSize = function() ...@@ -34,7 +34,7 @@ CBorderBox.prototype.recalculateSize = function()
var height = ss.height; var height = ss.height;
var center = ss.center; var center = ss.center;
this.gapBrd = this.getTxtPrp().FontSize *0.08104587131076388; this.gapBrd = this.getTxtPrp().FontSize*0.08104587131076388;
if(this.bTop) if(this.bTop)
{ {
...@@ -49,7 +49,6 @@ CBorderBox.prototype.recalculateSize = function() ...@@ -49,7 +49,6 @@ CBorderBox.prototype.recalculateSize = function()
if(this.bRight) if(this.bRight)
width += this.gapBrd; width += this.gapBrd;
this.size = {width : width, height: height, center: center}; this.size = {width : width, height: height, center: center};
} }
CBorderBox.prototype.draw = function() CBorderBox.prototype.draw = function()
......
...@@ -80,9 +80,6 @@ CNumerator.prototype.recalculateSize = function() ...@@ -80,9 +80,6 @@ CNumerator.prototype.recalculateSize = function()
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
var txtPrp = this.getTxtPrp(); var txtPrp = this.getTxtPrp();
/*var font = GetMathFont(txtPrp);
var plH = font.metrics.Placeholder.Height/2;*/
var Descent = arg.height - arg.ascent; // baseLine var Descent = arg.height - arg.ascent; // baseLine
var gap = 7.832769097222222 * txtPrp.FontSize/36, var gap = 7.832769097222222 * txtPrp.FontSize/36,
minGap = txtPrp.FontSize* 25.4/96 * 0.16; minGap = txtPrp.FontSize* 25.4/96 * 0.16;
...@@ -98,54 +95,6 @@ CNumerator.prototype.recalculateSize = function() ...@@ -98,54 +95,6 @@ CNumerator.prototype.recalculateSize = function()
this.size = {width : width, height: height, center: center}; this.size = {width : width, height: height, center: center};
} }
CNumerator.prototype.new_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var penW = this.params.font.FontSize* 25.4/96 * 0.08;
var Descent = arg.height - arg.center - metrics.Placeholder.Height*DIV_CENTER; // baseLine
//var gap = metrics.Height - metrics.Placeholder.Height + metrics.Descender,
var gap = metrics.Descender + 2*penW *1.8,
minGap = 2*penW;
var delta = gap - Descent;
var GapNum = delta > minGap ? delta : minGap;
var width = arg.width;
var height = arg.height + GapNum;
var center = arg.center;
this.size = {width : width, height: height, center: center};
}
CNumerator.prototype.n_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
//var penW = this.params.font.FontSize* 25.4/96 * 0.08;
var DescentFirst = arg.height - arg.center - metrics.Placeholder.Height*DIV_CENTER; // baseLine
//var gap = metrics.Height - 2.8*metrics.Descender; // 8 pt
//var gap = metrics.Height - 1.5*metrics.Descender;
var gap = metrics.Height - (2.96 - 0.02*this.params.font.FontSize)*metrics.Descender;
var penW = this.params.font.FontSize/47;
// 20 7
// 60 21
var gapNum = DescentFirst - 2*penW < 0.55*gap ? 0.55*gap - DescentFirst : 2*penW;
var width = arg.width;
var height = arg.height + gapNum;
var center = arg.center;
this.size = {width : width, height: height, center: center};
}
CNumerator.prototype.findDisposition = function(mCoord) CNumerator.prototype.findDisposition = function(mCoord)
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
...@@ -203,52 +152,6 @@ CDenominator.prototype.recalculateSize = function() ...@@ -203,52 +152,6 @@ CDenominator.prototype.recalculateSize = function()
this.size = {width : width, height: height, center: center}; this.size = {width : width, height: height, center: center};
} }
CDenominator.prototype.new_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var gap = metrics.Height - metrics.Placeholder.Height - metrics.Descender,
Ascent = arg.center + metrics.Placeholder.Height*DIV_CENTER - metrics.Placeholder.Height,
minGap = this.params.font.FontSize* 25.4/96 * 0.24 * 1.23;
var delta = gap - Ascent;
var GapDen = delta > minGap ? delta : minGap;
var width = arg.width;
var height = arg.height + GapDen;
var center = arg.center + GapDen;
this.size = {width : width, height: height, center: center};
}
CDenominator.prototype.n_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var AscentSecond = arg.center + metrics.Placeholder.Height*DIV_CENTER;
//var gap = metrics.Height - 2.8*metrics.Descender; // 8 pt
//var gap = metrics.Height - 1.5*metrics.Descender; // 72 pt
var gap = metrics.Height - (2.96 - 0.02*this.params.font.FontSize)*metrics.Descender;
// a*x + b = c
// a*8 + b = 2.8
// a*72 + b = 1.5
// a = - 1.3/64
// b = 2.96
var penW = this.params.font.FontSize/47;
var gapDen = AscentSecond - 3*penW < 0.45*gap ? 0.45*gap - AscentSecond : 3*penW;
var width = arg.width;
var height = arg.height + gapDen;
var center = arg.center + gapDen;
this.size = {width : width, height: height, center: center};
}
CDenominator.prototype.findDisposition = function(mCoord) CDenominator.prototype.findDisposition = function(mCoord)
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
...@@ -283,7 +186,6 @@ CDenominator.prototype.getReduct = function() ...@@ -283,7 +186,6 @@ CDenominator.prototype.getReduct = function()
return this.Parent.getReduct(); return this.Parent.getReduct();
} }
////////// //////////
function CSkewedFraction() function CSkewedFraction()
......
This diff is collapsed.
...@@ -53,7 +53,9 @@ function CMathText() ...@@ -53,7 +53,9 @@ function CMathText()
this.SUBCONTENT = false; this.SUBCONTENT = false;
this.empty = false; this.empty = false;
this.Parent = null; this.Parent = null;
this.textPrp = new CMathTextPrp();
this.TxtPrp = new CMathTextPrp();
this.OwnTPrp = new CMathTextPrp();
//this.sizeSymbol = null; // размер символа без учета трансформации //this.sizeSymbol = null; // размер символа без учета трансформации
...@@ -75,9 +77,8 @@ CMathText.prototype = ...@@ -75,9 +77,8 @@ CMathText.prototype =
getCode: function() getCode: function()
{ {
var code = this.value; var code = this.value;
var Italic = this.getTxtPrp().Italic;
if(Italic) if( this.TxtPrp.Italic )
{ {
if(code == 0x0068) // h if(code == 0x0068) // h
code = 0x210E; code = 0x210E;
...@@ -132,7 +133,7 @@ CMathText.prototype = ...@@ -132,7 +133,7 @@ CMathText.prototype =
{ {
this.value = StartTextElement; this.value = StartTextElement;
}, },
getTxtPrp: function() old_getTxtPrp: function()
{ {
var txtPrp = this.Parent.getTxtPrp(); var txtPrp = this.Parent.getTxtPrp();
txtPrp.Merge(this.textPrp); txtPrp.Merge(this.textPrp);
...@@ -146,7 +147,10 @@ CMathText.prototype = ...@@ -146,7 +147,10 @@ CMathText.prototype =
}, },
setTxtPrp: function(txtPrp) setTxtPrp: function(txtPrp)
{ {
this.textPrp.Merge(txtPrp); this.TxtPrp = new CMathTextPrp();
this.TxtPrp.Merge(txtPrp);
this.TxtPrp.Merge(this.OwnTPrp);
}, },
setLIterator: function(bIterator) setLIterator: function(bIterator)
{ {
...@@ -154,7 +158,7 @@ CMathText.prototype = ...@@ -154,7 +158,7 @@ CMathText.prototype =
}, },
getRunPrp: function() getRunPrp: function()
{ {
return this.textPrp; return this.TxtPrp;
}, },
getOwnTPrp: function() getOwnTPrp: function()
{ {
...@@ -169,10 +173,11 @@ CMathText.prototype = ...@@ -169,10 +173,11 @@ CMathText.prototype =
// gap = FontHeight - FontDescent - Placeholder.Height + FontDescent // gap = FontHeight - FontDescent - Placeholder.Height + FontDescent
recalculateSize: function() recalculateSize: function()
{ {
var txtPrp = this.getTxtPrp(); var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp);
txtPrp.Italic = false; txtPrp.Italic = false;
g_oTextMeasurer.SetFont ( txtPrp ); g_oTextMeasurer.SetFont( txtPrp );
var letter = this.getCode(); var letter = this.getCode();
var metricsTxt = g_oTextMeasurer.Measure2Code(letter); var metricsTxt = g_oTextMeasurer.Measure2Code(letter);
...@@ -199,8 +204,7 @@ CMathText.prototype = ...@@ -199,8 +204,7 @@ CMathText.prototype =
old_draw: function() old_draw: function()
{ {
var txtPrp = this.getTxtPrp(); var txtPrp = this.getTxtPrp();
g_oTextMeasurer.SetFont ( txtPrp ); g_oTextMeasurer.SetFont( txtPrp );
MathControl.pGraph.b_color1(0,0,0,255); MathControl.pGraph.b_color1(0,0,0,255);
MathControl.pGraph.SetFont(txtPrp); MathControl.pGraph.SetFont(txtPrp);
...@@ -247,9 +251,9 @@ CMathText.prototype = ...@@ -247,9 +251,9 @@ CMathText.prototype =
}, },
draw: function() draw: function()
{ {
var txtPrp = this.getTxtPrp(); var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.TxtPrp);
txtPrp.Italic = false; txtPrp.Italic = false;
g_oTextMeasurer.SetFont ( txtPrp );
MathControl.pGraph.b_color1(0,0,0,255); MathControl.pGraph.b_color1(0,0,0,255);
MathControl.pGraph.SetFont(txtPrp); MathControl.pGraph.SetFont(txtPrp);
......
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