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

all delimiters (new)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48136 954022d7-b5bf-4e40-9824-e11837661b57
parent af057ca9
......@@ -116,7 +116,10 @@ CMathBase.prototype =
this.reduct = this.reduct*coeff;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].setReduct(coeff);
{
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].setReduct(coeff);
}
},
addMCToContent: function()
{
......
......@@ -208,6 +208,9 @@ CMathContent.prototype =
case 9:
mathElem = new CDelimiter();
break;
case 10:
mathElem = new CSeparatorDelimiter();
break;
case 30:
mathElem = new CMathBase();
break;
......@@ -736,8 +739,9 @@ CMathContent.prototype =
sigma.init(6,0,2);
var iter = sigma.getLowerIterator();
iter.addTxt("k");
var base = sigma.getBase();
var fract = base.createMComponent(0);
var delim = sigma.getBase().createMComponent(9);
delim.init(0, 4, 0, 1);
var fract = delim.getBase().createMComponent(0);
fract.init();
fract.hideBar(true);
var num = fract.getNumerator();
......@@ -759,6 +763,39 @@ CMathContent.prototype =
case 81:
break;
case 82:
var union = this.createMComponent(8);
union.init(9,0,3);
var iterUp = union.getUpperIterator();
iterUp.addTxt("m");
var iterLow = union.getLowerIterator();
iterLow.addTxt("n=1");
var base = union.getBase();
var delim = base.createMComponent(9);
delim.init(0, 4, 0, 1);
var base2 = delim.getBase();
var degrX = base2.createMComponent(3);
degrX.init();
degrX.setIndex(-1);
var baseX = degrX.getBase();
baseX.addTxt("X");
var iterX = degrX.getIterator();
iterX.addTxt("n");
base2.addTxt("");
var degrY = base2.createMComponent(3);
degrY.init();
degrY.setIndex(-1);
var baseY = degrY.getBase();
baseY.addTxt("Y");
var iterY = degrY.getIterator();
iterY.addTxt("n");
break;
case 83:
var delim = this.createMComponent(9);
......@@ -820,17 +857,160 @@ CMathContent.prototype =
delim.init(7, 4, 0, 1);
delim.fillPlaceholders();
break;
case 95:
var delim = this.createMComponent(10);
delim.init(0, 2);
delim.fillPlaceholders();
break;
case 96:
var delim = this.createMComponent(10);
delim.init(1, 2);
delim.fillPlaceholders();
break;
case 97:
var delim = this.createMComponent(10);
delim.init(3, 2);
delim.fillPlaceholders();
break;
case 98:
var delim = this.createMComponent(10);
delim.init(3, 3);
delim.fillPlaceholders();
break;
case 99:
var delim = this.createMComponent(9);
delim.init(0,2,0);
delim.fillPlaceholders();
break;
case 100:
var delim = this.createMComponent(9);
delim.init(0,3,1);
delim.fillPlaceholders();
break;
case 101:
var delim = this.createMComponent(9);
delim.init(2,2,0);
delim.fillPlaceholders();
break;
case 102:
var delim = this.createMComponent(9);
delim.init(2,3,1);
delim.fillPlaceholders();
break;
case 103:
var delim = this.createMComponent(9);
delim.init(1,2,0);
delim.fillPlaceholders();
break;
case 104:
var delim = this.createMComponent(9);
delim.init(1,3,1);
delim.fillPlaceholders();
break;
case 105:
var delim = this.createMComponent(9);
delim.init(3,2,0);
delim.fillPlaceholders();
break;
case 106:
var delim = this.createMComponent(9);
delim.init(3,3,1);
delim.fillPlaceholders();
break;
case 107:
var delim = this.createMComponent(9);
delim.init(4,2,0);
delim.fillPlaceholders();
break;
case 108:
var delim = this.createMComponent(9);
delim.init(4,3,1);
delim.fillPlaceholders();
break;
case 109:
var delim = this.createMComponent(9);
delim.init(4,2,2);
delim.fillPlaceholders();
break;
case 110:
var delim = this.createMComponent(9);
delim.init(4,3,3);
delim.fillPlaceholders();
break;
case 111:
var delim = this.createMComponent(9);
delim.init(5,2,0);
delim.fillPlaceholders();
break;
case 112:
var delim = this.createMComponent(9);
delim.init(5,3,1);
delim.fillPlaceholders();
break;
case 113:
var delim = this.createMComponent(9);
delim.init(6,2,0);
delim.fillPlaceholders();
break;
case 114:
var delim = this.createMComponent(9);
delim.init(6,3,1);
delim.fillPlaceholders();
break;
case 115:
var delim = this.createMComponent(9);
delim.init(7,2,0);
delim.fillPlaceholders();
break;
case 116:
var delim = this.createMComponent(9);
delim.init(7,3,1);
delim.fillPlaceholders();
break;
case 117:
break;
case 118:
break;
case 119:
var fract = this.createMComponent(0);
fract.init();
fract.hideBar(true);
fract.fillPlaceholders();
break;
case 120:
var delim = this.createMComponent(9);
delim.init(0, 4, 0, 1);
var fract = delim.getBase().createMComponent(0);
fract.init();
fract.hideBar(true);
fract.fillPlaceholders();
break;
case 121:
break;
case 122:
var delim = this.createMComponent(9);
delim.init(0, 4, 0, 1);
var fract = delim.getBase().createMComponent(0);
fract.init();
fract.hideBar(true);
var num = fract.getNumerator();
num.addTxt("n");
/*case 24:
var integr = this.createMComponent(8);
integr.init(0,0,1);
integr.fillPlaceholders();
var den = fract.getDenominator();
den.addTxt("k");
break;
case 123:
var delim = this.createMComponent(9);
delim.init(3, 4, 0, 1);
var fract = delim.getBase().createMComponent(0);
fract.init();
fract.hideBar(true);
var num = fract.getNumerator();
num.addTxt("n");
var den = fract.getDenominator();
den.addTxt("k");
break;
case 26:
var integr = this.createMComponent(8);
integr.init(0,0,2);
integr.fillPlaceholders();
break;*/
}
},
removeAreaSelect: function()
......
......@@ -384,54 +384,70 @@ function CDelimiter()
extend(CDelimiter, CMathBase);
CDelimiter.prototype.init = function(type, loc, turn1, turn2)
{
this.type = type;
this.loc = loc;
var base = new CMathContent();
var params =
{
type: type,
loc: loc,
turn1: turn1,
turn2: turn2
};
this.init_2(params, base);
}
CDelimiter.prototype.init_2 = function(params, base)
{
this.type = params.type;
this.loc = params.loc;
this.base = base;
var nRow, nCol,
tturn1, tturn2;
if(loc== 0)
if(this.loc== 0)
{
nRow = 2;
nCol = 1;
tturn1 = turn1;
tturn1 = params.turn1;
}
else if(loc == 1)
else if(this.loc == 1)
{
nRow = 2;
nCol = 1;
tturn2 = turn1;
tturn2 = params.turn1;
}
else if(loc == 2)
else if(this.loc == 2)
{
nRow = 1;
nCol = 2;
tturn1 = turn1;
tturn1 = params.turn1;
}
else if(loc == 3)
else if(this.loc == 3)
{
nRow = 1;
nCol = 2;
tturn2 = turn1;
tturn2 = params.turn1;
}
else if(loc == 4)
else if(this.loc == 4)
{
nRow = 1;
nCol = 3;
tturn1 = turn1;
tturn2 = turn2;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else
{
nRow = 3;
nCol = 1;
tturn1 = turn1;
tturn2 = turn2;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
this.setDimension(nRow, nCol);
var operator1, operator2,
......@@ -502,25 +518,35 @@ CDelimiter.prototype.init = function(type, loc, turn1, turn2)
operator1.relate(this);
operator2.setLocation(loc2, tturn2);
operator2.relate(this);
var argument = new CMathContent();
argument.relate(this);
this.base = argument;
if(this.loc == 0 || this.loc == 2)
{
this.addMCToContent(operator1, argument);
this.addMCToContent(operator1, base);
}
else if(this.loc == 1 || this.loc == 3)
{
this.addMCToContent(argument, operator2);
this.addMCToContent(base, operator2);
}
else
{
this.addMCToContent(operator1, argument, operator2);
this.addMCToContent(operator1, base, operator2);
}
//выравнивание для случая когда центр смещен (не середина), для вложенных дробей и т.п.
if(this.loc == 2)
{
this.alignVer(0, 0.5);
}
else if(this.loc == 3)
{
this.alignVer(1, 0.5);
}
if(this.loc == 4)
{
this.alignVer(0, 0.5);
this.alignVer(2, 0.5);
}
}
CDelimiter.prototype.old_setContent = function(arg)
{
......@@ -720,27 +746,17 @@ CDelimiter.prototype.getBase = function()
{
return this.base;
}
CDelimiter.prototype.setPosition = function(pos)
CDelimiter.prototype.Resize = function()
{
var w = 0,
h = 0;
this.pos = {x: pos.x, y: pos.y - this.size.center};
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
for(var i = 0; i < this.nRow; i++)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
this.elements[i][j].setPosition({x: this.pos.x + w, y: this.pos.y + h});
w += Widths[j];
}
h += Heights[i];
}
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].Resize();
this.recalculateSize();
}
function COperatorBracket()
{
CGlyphOperator.call(this);
......@@ -2933,14 +2949,26 @@ CCombiningDoubleArrow.prototype.calcCoord = function(measure)
}
function CSeparatorDelimiter(type, column)
function CSeparatorDelimiter()
{
this.column = column;
CDelimiter.call(this, type, 4, 0, 1);
CDelimiter.call(this);
}
extend(CSeparatorDelimiter, CDelimiter);
CSeparatorDelimiter.prototype.setContent = function()
CSeparatorDelimiter.prototype.init = function(type, column)
{
var base = new CSeparator();
base.init(column);
var params =
{
type: type,
loc: 4,
turn1: 0,
turn2: 1
};
this.init_2(params, base);
}
CSeparatorDelimiter.prototype.old_setContent = function()
{
var arg = new CSeparator(this.column);
arg.init(this.params);
......@@ -2969,15 +2997,19 @@ CSeparatorDelimiter.prototype.mouseMove = function(mCoord)
return {state: state, SelectContent: SelectContent};
}
function CSeparator(column)
function CSeparator()
{
CMathBase.call(this, 1, column);
CMathBase.call(this);
}
extend(CSeparator, CMathBase);
CSeparator.prototype.init = function(column)
{
this.setDimension(1, column);
this.setContent();
}
CSeparator.prototype.setDistance = function()
{
this.dH = 0;
this.dW = this.params.font.FontSize/3*g_dKoef_pt_to_mm;
this.dW = this.Parent.getTxtPrp().FontSize/3*g_dKoef_pt_to_mm;
}
CSeparator.prototype.draw = function()
{
......@@ -2991,7 +3023,7 @@ CSeparator.prototype.draw = function()
MathControl.pGraph.p_width(1000);
MathControl.pGraph.b_color1(0,0,0, 255);
pW = this.params.font.FontSize/18*g_dKoef_pt_to_mm;
pW = this.Parent.getTxtPrp().FontSize/18*g_dKoef_pt_to_mm;
for(var i = 0; i < this.nCol - 1; i++)
{
......
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