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

1. runPrp, ctrPrp для операторов, accent, group characters, матриц,...

1. runPrp, ctrPrp для операторов, accent, group characters, матриц, минимаксных функций, math functions
2. изменена функция удаления элементов из контента с учетом runPrp

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51574 954022d7-b5bf-4e40-9824-e11837661b57
parent c08fb724
...@@ -592,7 +592,7 @@ CSign.prototype.draw = function(pGraphics) ...@@ -592,7 +592,7 @@ CSign.prototype.draw = function(pGraphics)
CSign.prototype.setTxtPrp = function(txtPrp) CSign.prototype.setTxtPrp = function(txtPrp)
{ {
this.txtPrp = txtPrp; this.txtPrp = txtPrp;
this.sign.setTxtPrp(txtPrp); //this.sign.setTxtPrp(txtPrp);
} }
function old_CAccent() function old_CAccent()
......
...@@ -10,8 +10,6 @@ function CMathBase() ...@@ -10,8 +10,6 @@ function CMathBase()
this.CurPos_X = 0; this.CurPos_X = 0;
this.CurPos_Y = 0; this.CurPos_Y = 0;
this.empty = false;
this.SUBCONTENT = true;
this.reduct = 1; this.reduct = 1;
this.nRow = 0; this.nRow = 0;
......
...@@ -57,7 +57,7 @@ CLimit.prototype.init = function(props) ...@@ -57,7 +57,7 @@ CLimit.prototype.init = function(props)
this.setDimension(2, 1); this.setDimension(2, 1);
var oBase = new CMathContent(); var oBase = new CMathContent();
oBase.setOwnTPrp({Italic: false}); //oBase.setOwnTPrp({Italic: false});
var oIter = new CMathContent(); var oIter = new CMathContent();
oIter.setReduct(DEGR_REDUCT); oIter.setReduct(DEGR_REDUCT);
...@@ -99,7 +99,8 @@ CLimit.prototype.getIterator = function() ...@@ -99,7 +99,8 @@ CLimit.prototype.getIterator = function()
} }
CLimit.prototype.setDistance = function() CLimit.prototype.setDistance = function()
{ {
this.dH = 0.03674768518518519*this.getTxtPrp().FontSize; //this.dH = 0.03674768518518519*this.getTxtPrp().FontSize;
this.dH = 0.03674768518518519*this.getPrpToControlLetter().FontSize;
} }
...@@ -146,9 +147,9 @@ CMathFunc.prototype.init = function() ...@@ -146,9 +147,9 @@ CMathFunc.prototype.init = function()
this.setDimension(1, 2); this.setDimension(1, 2);
this.setContent(); this.setContent();
var runPrp = new CTextPr(); //var runPrp = new CTextPr();
runPrp.Italic = false; //runPrp.Italic = false;
this.elements[0][0].addRunPrp(runPrp); //this.elements[0][0].addToBeginningRPrp(runPrp);
//this.elements[0][0].setOwnTPrp({Italic: false}); // trigonometrical function //this.elements[0][0].setOwnTPrp({Italic: false}); // trigonometrical function
//this.elements[0][0].mergeTxtPrp({Italic: false}); // trigonometrical function //this.elements[0][0].mergeTxtPrp({Italic: false}); // trigonometrical function
......
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
RADICAL RADICAL
LIMIT LIMIT
*/ */
//Bugs
//При добавлении в началло контента элемента , он вставляется с размером шрифта 11, пос мотреть getCurrRunPrp
var historyitem_Math_AddItem = 1; // Добавляем элемент var historyitem_Math_AddItem = 1; // Добавляем элемент
var historyitem_Math_RemoveItem = 2; // Удаляем элемент var historyitem_Math_RemoveItem = 2; // Удаляем элемент
...@@ -95,7 +100,6 @@ CMathRunPrp.prototype = ...@@ -95,7 +100,6 @@ CMathRunPrp.prototype =
function CMathContent() function CMathContent()
{ {
//this.SUBCONTENT = false;
this.bDot = false; this.bDot = false;
this.plhHide = false; this.plhHide = false;
this.bRoot = false; this.bRoot = false;
...@@ -455,11 +459,6 @@ CMathContent.prototype = ...@@ -455,11 +459,6 @@ CMathContent.prototype =
if( mathElem !== null ) if( mathElem !== null )
{ {
//mathElem.relate(this);
//mathElem.setReduct(this.reduct);
//var runPrp = this.getRunPrp(this.CurPos);
//mathElem.setTxtPrp( runPrp );
//mathElem.setRunPrp( runPrp );
//l_gap = r_gap = Math.floor( this.font.FontSize / 5 )*g_dKoef_pix_to_mm; //l_gap = r_gap = Math.floor( this.font.FontSize / 5 )*g_dKoef_pix_to_mm;
...@@ -472,10 +471,6 @@ CMathContent.prototype = ...@@ -472,10 +471,6 @@ CMathContent.prototype =
{ {
ctrPrp = this.getCurrRunPrp(); ctrPrp = this.getCurrRunPrp();
} }
else if(!this.bRoot && this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP) //есть RunPrp
{
ctrPrp.Merge( this.Parent.getCtrPrp() );
}
else if(!this.bRoot && this.content.length == 1) // нет RunPrp, добавляем мат. объект else if(!this.bRoot && this.content.length == 1) // нет RunPrp, добавляем мат. объект
{ {
ctrPrp.Merge( this.Parent.getCtrPrp() ); ctrPrp.Merge( this.Parent.getCtrPrp() );
...@@ -496,6 +491,14 @@ CMathContent.prototype = ...@@ -496,6 +491,14 @@ CMathContent.prototype =
var empty = new CEmpty(); var empty = new CEmpty();
this.addToContent(empty); this.addToContent(empty);
// добавляем RunPrp для текста, они будут такие же как и ctrPrp
if(this.CurPos !== this.content.length - 1 && this.content[this.CurPos + 1].value.typeObj == MATH_TEXT)
{
var rPrp = Common_CopyObj(ctrPrp);
//this.addRunPrpToContent(rPrp);
this.addRunPrp(rPrp);
}
//this.addElementToContent( mathElem, new dist(l_gap, r_gap, 0, 0) ); //this.addElementToContent( mathElem, new dist(l_gap, r_gap, 0, 0) );
//this.addElementToContent(empty); //this.addElementToContent(empty);
...@@ -540,6 +543,7 @@ CMathContent.prototype = ...@@ -540,6 +543,7 @@ CMathContent.prototype =
createEquation: function(ind) createEquation: function(ind)
{ {
var Pos = this.CurPos + 1; var Pos = this.CurPos + 1;
//var lng = this.content.length;
switch(ind) switch(ind)
{ {
...@@ -2041,6 +2045,7 @@ CMathContent.prototype = ...@@ -2041,6 +2045,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("sin"); func.addTxt("sin");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2049,6 +2054,7 @@ CMathContent.prototype = ...@@ -2049,6 +2054,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("cos"); func.addTxt("cos");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2057,6 +2063,7 @@ CMathContent.prototype = ...@@ -2057,6 +2063,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("tan"); func.addTxt("tan");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2065,6 +2072,7 @@ CMathContent.prototype = ...@@ -2065,6 +2072,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("csc"); func.addTxt("csc");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2073,6 +2081,7 @@ CMathContent.prototype = ...@@ -2073,6 +2081,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("sec"); func.addTxt("sec");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2081,6 +2090,7 @@ CMathContent.prototype = ...@@ -2081,6 +2090,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("cot"); func.addTxt("cot");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2092,9 +2102,7 @@ CMathContent.prototype = ...@@ -2092,9 +2102,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("sin"); base.addTxt("sin");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2108,9 +2116,7 @@ CMathContent.prototype = ...@@ -2108,9 +2116,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("cos"); base.addTxt("cos");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2124,9 +2130,7 @@ CMathContent.prototype = ...@@ -2124,9 +2130,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("tan"); base.addTxt("tan");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2140,9 +2144,7 @@ CMathContent.prototype = ...@@ -2140,9 +2144,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("csc"); base.addTxt("csc");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2156,9 +2158,7 @@ CMathContent.prototype = ...@@ -2156,9 +2158,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("sec"); base.addTxt("sec");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2172,9 +2172,7 @@ CMathContent.prototype = ...@@ -2172,9 +2172,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("cot"); base.addTxt("cot");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2186,6 +2184,7 @@ CMathContent.prototype = ...@@ -2186,6 +2184,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("sinh"); func.addTxt("sinh");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2194,6 +2193,7 @@ CMathContent.prototype = ...@@ -2194,6 +2193,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("cosh"); func.addTxt("cosh");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2202,6 +2202,7 @@ CMathContent.prototype = ...@@ -2202,6 +2202,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("tanh"); func.addTxt("tanh");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2210,6 +2211,7 @@ CMathContent.prototype = ...@@ -2210,6 +2211,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("csch"); func.addTxt("csch");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2218,6 +2220,7 @@ CMathContent.prototype = ...@@ -2218,6 +2220,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("sech"); func.addTxt("sech");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2226,6 +2229,7 @@ CMathContent.prototype = ...@@ -2226,6 +2229,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("coth"); func.addTxt("coth");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2238,9 +2242,7 @@ CMathContent.prototype = ...@@ -2238,9 +2242,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("sinh"); base.addTxt("sinh");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2254,9 +2256,7 @@ CMathContent.prototype = ...@@ -2254,9 +2256,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("cosh"); base.addTxt("cosh");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2270,9 +2270,7 @@ CMathContent.prototype = ...@@ -2270,9 +2270,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("tanh"); base.addTxt("tanh");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2286,9 +2284,7 @@ CMathContent.prototype = ...@@ -2286,9 +2284,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("csch"); base.addTxt("csch");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2302,9 +2298,7 @@ CMathContent.prototype = ...@@ -2302,9 +2298,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("sech"); base.addTxt("sech");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2318,9 +2312,7 @@ CMathContent.prototype = ...@@ -2318,9 +2312,7 @@ CMathContent.prototype =
var degr = func.addMComponent(MATH_DEGREE); var degr = func.addMComponent(MATH_DEGREE);
degr.init({type: DEGREE_SUPERSCRIPT}); degr.init({type: DEGREE_SUPERSCRIPT});
var base = degr.getBase(); var base = degr.getBase();
var rPrp = new CTextPr(); base.setItalic(false);
rPrp.Italic = false;
base.addRunPrp(rPrp);
base.addTxt("coth"); base.addTxt("coth");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.addTxt("-1"); iter.addTxt("-1");
...@@ -2331,6 +2323,7 @@ CMathContent.prototype = ...@@ -2331,6 +2323,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("sin"); func.addTxt("sin");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.addTxt("θ"); arg.addTxt("θ");
...@@ -2339,6 +2332,7 @@ CMathContent.prototype = ...@@ -2339,6 +2332,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("cos"); func.addTxt("cos");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.addTxt("2x"); arg.addTxt("2x");
...@@ -2347,6 +2341,7 @@ CMathContent.prototype = ...@@ -2347,6 +2341,7 @@ CMathContent.prototype =
var trig = this.addMComponent(MATH_FUNCTION); var trig = this.addMComponent(MATH_FUNCTION);
trig.init(); trig.init();
var func = trig.getFName(); var func = trig.getFName();
func.setItalic(false);
func.addTxt("tan"); func.addTxt("tan");
var arg = trig.getArgument(); var arg = trig.getArgument();
arg.addTxt("θ"); arg.addTxt("θ");
...@@ -2357,6 +2352,7 @@ CMathContent.prototype = ...@@ -2357,6 +2352,7 @@ CMathContent.prototype =
var sin = num.addMComponent(MATH_FUNCTION); var sin = num.addMComponent(MATH_FUNCTION);
sin.init(); sin.init();
var func1 = sin.getFName(); var func1 = sin.getFName();
func.setItalic(false);
func1.addTxt("sin"); func1.addTxt("sin");
var arg1 = sin.getArgument(); var arg1 = sin.getArgument();
arg1.addTxt("θ"); arg1.addTxt("θ");
...@@ -2365,6 +2361,7 @@ CMathContent.prototype = ...@@ -2365,6 +2361,7 @@ CMathContent.prototype =
cos.init(); cos.init();
var func2 = cos.getFName(); var func2 = cos.getFName();
func2.addTxt("cos"); func2.addTxt("cos");
func.setItalic(false);
var arg2 = cos.getArgument(); var arg2 = cos.getArgument();
arg2.addTxt("θ"); arg2.addTxt("θ");
break; break;
...@@ -2499,7 +2496,6 @@ CMathContent.prototype = ...@@ -2499,7 +2496,6 @@ CMathContent.prototype =
var iter = lim.getIterator(); var iter = lim.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
var func = lim.getFName(); var func = lim.getFName();
func.setPrp({Italic: true});
var grCh = func.addMComponent(MATH_GROUP_CHARACTER); var grCh = func.addMComponent(MATH_GROUP_CHARACTER);
var props2 = var props2 =
{ {
...@@ -2520,7 +2516,6 @@ CMathContent.prototype = ...@@ -2520,7 +2516,6 @@ CMathContent.prototype =
var iter = lim.getIterator(); var iter = lim.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
var func = lim.getFName(); var func = lim.getFName();
func.setPrp({Italic: true});
var grCh = func.addMComponent(MATH_GROUP_CHARACTER); var grCh = func.addMComponent(MATH_GROUP_CHARACTER);
var props2 = var props2 =
{ {
...@@ -2532,15 +2527,6 @@ CMathContent.prototype = ...@@ -2532,15 +2527,6 @@ CMathContent.prototype =
grCh.fillPlaceholders(); grCh.fillPlaceholders();
break; break;
case 167: case 167:
/*var delim = this.addMComponent(MATH_GROUP_CHARACTER);
var props =
{
chrType: ARROW_LEFT,
location: LOCATION_TOP,
justif: VJUST_BOT
};
delim.init(props);
delim.fillPlaceholders();*/
var accent = this.addMComponent(MATH_ACCENT); var accent = this.addMComponent(MATH_ACCENT);
props = props =
{ {
...@@ -2676,6 +2662,7 @@ CMathContent.prototype = ...@@ -2676,6 +2662,7 @@ CMathContent.prototype =
degr.init(props); degr.init(props);
var base = degr.getBase(); var base = degr.getBase();
base.setItalic(false);
base.addTxt("log"); base.addTxt("log");
var iter = degr.getIterator(); var iter = degr.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
...@@ -2684,6 +2671,7 @@ CMathContent.prototype = ...@@ -2684,6 +2671,7 @@ CMathContent.prototype =
var log = this.addMComponent(MATH_FUNCTION); var log = this.addMComponent(MATH_FUNCTION);
log.init(); log.init();
var func = log.getFName(); var func = log.getFName();
func.setItalic(false);
func.addTxt("log"); func.addTxt("log");
var arg = log.getArgument(); var arg = log.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2696,6 +2684,7 @@ CMathContent.prototype = ...@@ -2696,6 +2684,7 @@ CMathContent.prototype =
var min = fName.addMComponent(MATH_LIMIT); var min = fName.addMComponent(MATH_LIMIT);
min.init({type: LIMIT_LOW}); min.init({type: LIMIT_LOW});
var base = min.getFName(); var base = min.getFName();
base.setItalic(false);
base.addTxt("lim"); base.addTxt("lim");
var iter = min.getIterator(); var iter = min.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
...@@ -2711,6 +2700,7 @@ CMathContent.prototype = ...@@ -2711,6 +2700,7 @@ CMathContent.prototype =
var min = fName.addMComponent(MATH_LIMIT); var min = fName.addMComponent(MATH_LIMIT);
min.init({type: LIMIT_LOW}); min.init({type: LIMIT_LOW});
var base = min.getFName(); var base = min.getFName();
base.setItalic(false);
base.addTxt("min"); base.addTxt("min");
var iter = min.getIterator(); var iter = min.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
...@@ -2726,6 +2716,7 @@ CMathContent.prototype = ...@@ -2726,6 +2716,7 @@ CMathContent.prototype =
var min = fName.addMComponent(MATH_LIMIT); var min = fName.addMComponent(MATH_LIMIT);
min.init({type: LIMIT_LOW}); min.init({type: LIMIT_LOW});
var base = min.getFName(); var base = min.getFName();
base.setItalic(false);
base.addTxt("max"); base.addTxt("max");
var iter = min.getIterator(); var iter = min.getIterator();
iter.fillPlaceholders(); iter.fillPlaceholders();
...@@ -2737,6 +2728,7 @@ CMathContent.prototype = ...@@ -2737,6 +2728,7 @@ CMathContent.prototype =
var log = this.addMComponent(MATH_FUNCTION); var log = this.addMComponent(MATH_FUNCTION);
log.init(); log.init();
var func = log.getFName(); var func = log.getFName();
func.setItalic(false);
func.addTxt("ln"); func.addTxt("ln");
var arg = log.getArgument(); var arg = log.getArgument();
arg.fillPlaceholders(); arg.fillPlaceholders();
...@@ -2754,6 +2746,7 @@ CMathContent.prototype = ...@@ -2754,6 +2746,7 @@ CMathContent.prototype =
var iter = limit.getIterator(); var iter = limit.getIterator();
iter.addTxt("n→∞"); iter.addTxt("n→∞");
var fName2 = limit.getFName(); var fName2 = limit.getFName();
fName2.setItalic(false);
fName2.addTxt("lim"); fName2.addTxt("lim");
var arg = func.getArgument(); var arg = func.getArgument();
...@@ -2800,6 +2793,7 @@ CMathContent.prototype = ...@@ -2800,6 +2793,7 @@ CMathContent.prototype =
}; };
max.init(props); max.init(props);
var fName2 = max.getFName(); var fName2 = max.getFName();
fName2.setItalic(false);
fName2.addTxt("max"); fName2.addTxt("max");
var iter = max.getIterator(); var iter = max.getIterator();
iter.addTxt("0≤x≤1"); iter.addTxt("0≤x≤1");
...@@ -2830,25 +2824,41 @@ CMathContent.prototype = ...@@ -2830,25 +2824,41 @@ CMathContent.prototype =
break; break;
case 186: case 186:
var box = this.addMComponent(MATH_BOX); var box = this.addMComponent(MATH_BOX);
box.init(); var props =
{
opEmu: true
};
box.init(props);
var arg = box.getBase(); var arg = box.getBase();
arg.addTxt("∶="); arg.addTxt("∶=");
break; break;
case 187: case 187:
var box = this.addMComponent(MATH_BOX); var box = this.addMComponent(MATH_BOX);
box.init(); var props =
{
opEmu: true
};
box.init(props);
var arg = box.getBase(); var arg = box.getBase();
arg.addTxt("=="); arg.addTxt("==");
break; break;
case 188: case 188:
var box = this.addMComponent(MATH_BOX); var box = this.addMComponent(MATH_BOX);
box.init(); var props =
{
opEmu: true
};
box.init(props);
var arg = box.getBase(); var arg = box.getBase();
arg.addTxt("+="); arg.addTxt("+=");
break; break;
case 189: case 189:
var box = this.addMComponent(MATH_BOX); var box = this.addMComponent(MATH_BOX);
box.init(); var props =
{
opEmu: true
};
box.init(props);
var arg = box.getBase(); var arg = box.getBase();
arg.addTxt("-="); arg.addTxt("-=");
break; break;
...@@ -3474,6 +3484,7 @@ CMathContent.prototype = ...@@ -3474,6 +3484,7 @@ CMathContent.prototype =
} }
var EndPos = this.CurPos + 1; var EndPos = this.CurPos + 1;
//var EndPos = Pos + this.content.length - lng; // запоминаем ве элементы, которые были добавлены, не только до той позиции, где стоит курсор (для текста могут быть добавлены дополнительно RunPrp)
if(!TEST) if(!TEST)
{ {
...@@ -3580,7 +3591,7 @@ CMathContent.prototype = ...@@ -3580,7 +3591,7 @@ CMathContent.prototype =
CurrContent = this; CurrContent = this;
} }
//пришли из базового класса //пришли из базового класса
else if( this.content[this.CurPos].value.SUBCONTENT ) else if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
this.CurPos++; this.CurPos++;
...@@ -3593,7 +3604,7 @@ CMathContent.prototype = ...@@ -3593,7 +3604,7 @@ CMathContent.prototype =
//если нет селекта, то просто перемещаемся по контенту //если нет селекта, то просто перемещаемся по контенту
this.CurPos++; this.CurPos++;
if( this.content[this.CurPos].value.SUBCONTENT ) if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
CurrContent = SelectContent = this.content[this.CurPos].value.goToFirstElement(); CurrContent = SelectContent = this.content[this.CurPos].value.goToFirstElement();
} }
...@@ -3630,7 +3641,7 @@ CMathContent.prototype = ...@@ -3630,7 +3641,7 @@ CMathContent.prototype =
if(this.selection.endPos < this.content.length) if(this.selection.endPos < this.content.length)
{ {
if( this.content[this.selection.startPos - 1].value.SUBCONTENT) if( this.content[this.selection.startPos - 1].value.typeObj === MATH_COMP)
{ {
if ( ! this.content[this.CurPos].value.select_moveRight() ) if ( ! this.content[this.CurPos].value.select_moveRight() )
{ {
...@@ -3641,7 +3652,7 @@ CMathContent.prototype = ...@@ -3641,7 +3652,7 @@ CMathContent.prototype =
this.setEnd_Selection(this.CurPos + 1); this.setEnd_Selection(this.CurPos + 1);
} }
} }
else if(this.content[this.selection.endPos].value.SUBCONTENT && ( this.selection.startPos - this.selection.endPos == 2) ) else if(this.content[this.selection.endPos].value.typeObj === MATH_COMP && ( this.selection.startPos - this.selection.endPos == 2) )
{ {
//селект одного мат. эелемента //селект одного мат. эелемента
...@@ -3650,7 +3661,7 @@ CMathContent.prototype = ...@@ -3650,7 +3661,7 @@ CMathContent.prototype =
} }
else else
{ {
if(this.content[this.selection.endPos].value.SUBCONTENT) // если последнюю позицию занимает мат. формула/объект, то селектим вместе с CEMpty if(this.content[this.selection.endPos].value.typeObj === MATH_COMP) // если последнюю позицию занимает мат. формула/объект, то селектим вместе с CEMpty
this.setEnd_Selection(this.selection.endPos + 1); this.setEnd_Selection(this.selection.endPos + 1);
else else
this.setEnd_Selection(this.selection.endPos); // для обычного случая this.setEnd_Selection(this.selection.endPos); // для обычного случая
...@@ -3700,7 +3711,7 @@ CMathContent.prototype = ...@@ -3700,7 +3711,7 @@ CMathContent.prototype =
} }
//пришли из базового класса //пришли из базового класса
else if( this.content[this.CurPos].value.SUBCONTENT ) else if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
if( this.selection.active ) if( this.selection.active )
{ {
...@@ -3721,9 +3732,18 @@ CMathContent.prototype = ...@@ -3721,9 +3732,18 @@ CMathContent.prototype =
else else
{ {
//если нет селекта, то просто перемещаемся по контенту //если нет селекта, то просто перемещаемся по контенту
this.CurPos--;
if( this.content[this.CurPos].value.SUBCONTENT ) var bFirstRunPrp = this.CurPos == 1 && this.content[this.CurPos].value.typeObj == MATH_RUN_PRP;
if(!bFirstRunPrp) // иначе, по контенту не перемещаемся
{
if(this.content[this.CurPos - 1].value.typeObj === MATH_RUN_PRP && this.CurPos > 2)
this.CurPos -= 2;
else
this.CurPos--;
}
if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
CurrContent = SelectContent = this.content[this.CurPos].value.goToLastElement(); CurrContent = SelectContent = this.content[this.CurPos].value.goToLastElement();
} }
...@@ -3820,7 +3840,7 @@ CMathContent.prototype = ...@@ -3820,7 +3840,7 @@ CMathContent.prototype =
start = end; start = end;
end = tmp; end = tmp;
} }
if(bSingle && this.content[this.CurPos].value.SUBCONTENT) if(bSingle && this.content[this.CurPos].value.typeObj === MATH_COMP)
{ {
var end_select = this.CurPos > 0 ? this.CurPos - 1 : 0; var end_select = this.CurPos > 0 ? this.CurPos - 1 : 0;
this.setStart_Selection(end_select); this.setStart_Selection(end_select);
...@@ -3890,7 +3910,7 @@ CMathContent.prototype = ...@@ -3890,7 +3910,7 @@ CMathContent.prototype =
if( this.selection.active ) if( this.selection.active )
{ {
this.selection.active = false; this.selection.active = false;
if( this.content[this.CurPos].value.SUBCONTENT ) if( this.content[this.CurPos].value.typeObj === MATH_COMP )
this.content[this.CurPos].value.mouseUp(); this.content[this.CurPos].value.mouseUp();
} }
}, },
...@@ -3916,7 +3936,7 @@ CMathContent.prototype = ...@@ -3916,7 +3936,7 @@ CMathContent.prototype =
else else
this.CurPos = this.findPosition( msCoord ); this.CurPos = this.findPosition( msCoord );
if( this.content[this.CurPos].value.SUBCONTENT ) if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
var coord = this.getCoordElem(this.CurPos, msCoord); var coord = this.getCoordElem(this.CurPos, msCoord);
result = this.content[this.CurPos].value.mouseDown(coord); result = this.content[this.CurPos].value.mouseDown(coord);
...@@ -3944,7 +3964,7 @@ CMathContent.prototype = ...@@ -3944,7 +3964,7 @@ CMathContent.prototype =
var pos = this.findPosition( msCoord ); var pos = this.findPosition( msCoord );
//селект внутри элемента (дроби и пр.) //селект внутри элемента (дроби и пр.)
if(this.CurPos === pos && this.content[pos].value.SUBCONTENT) if(this.CurPos === pos && this.content[pos].value.typeObj === MATH_COMP)
{ {
this.setStart_Selection( pos - 1 ); this.setStart_Selection( pos - 1 );
var coord = this.getCoordElem(this.CurPos, msCoord ); var coord = this.getCoordElem(this.CurPos, msCoord );
...@@ -3965,7 +3985,7 @@ CMathContent.prototype = ...@@ -3965,7 +3985,7 @@ CMathContent.prototype =
var direction = ( this.CurPos < pos ) ? 1 : -1; var direction = ( this.CurPos < pos ) ? 1 : -1;
if ( this.content[this.CurPos].value.SUBCONTENT ) if ( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
if( direction == 1 ) if( direction == 1 )
this.setStart_Selection( this.CurPos - 1); this.setStart_Selection( this.CurPos - 1);
...@@ -3975,7 +3995,7 @@ CMathContent.prototype = ...@@ -3975,7 +3995,7 @@ CMathContent.prototype =
else else
this.setStart_Selection( this.CurPos ); this.setStart_Selection( this.CurPos );
if( this.content[pos].value.SUBCONTENT ) if( this.content[pos].value.typeObj === MATH_COMP )
{ {
if( direction == 1 ) if( direction == 1 )
this.setEnd_Selection( pos + 1); this.setEnd_Selection( pos + 1);
...@@ -3989,7 +4009,29 @@ CMathContent.prototype = ...@@ -3989,7 +4009,29 @@ CMathContent.prototype =
return {state: state, SelectContent: SelectContent }; //для CMathContent state всегда true return {state: state, SelectContent: SelectContent }; //для CMathContent state всегда true
}, },
///////// home: function()
{
if( !this.IsEmpty() )
{
if(!this.IsPlaceholder())
{
if(this.content[1].value.typeObj === MATH_RUN_PRP)
this.CurPos = 2;
else // первым идет мат объект
this.CurPos = 1;
}
}
},
end: function()
{
if( !this.IsEmpty() )
{
if(!this.IsPlaceholder())
this.CurPos = this.content.length - 1;
}
},
//////////////////////////////////////
// не вызываем из mouseDown эту ф-ию, тк иначе не установим селект для внутреннего объекта (setStart_Selection) // не вызываем из mouseDown эту ф-ию, тк иначе не установим селект для внутреннего объекта (setStart_Selection)
afterDisplacement: function(coord) //аналог mouseDown для goToUpperLevel и goToLowerLever afterDisplacement: function(coord) //аналог mouseDown для goToUpperLevel и goToLowerLever
{ {
...@@ -3998,7 +4040,7 @@ CMathContent.prototype = ...@@ -3998,7 +4040,7 @@ CMathContent.prototype =
this.CurPos = this.findPosition( msCoord ); this.CurPos = this.findPosition( msCoord );
if( this.content[this.CurPos].value.SUBCONTENT ) if( this.content[this.CurPos].value.typeObj === MATH_COMP )
{ {
var _coord = this.getCoordElem(this.CurPos, msCoord); var _coord = this.getCoordElem(this.CurPos, msCoord);
content = this.content[this.CurPos].value.afterDisplacement(_coord); content = this.content[this.CurPos].value.afterDisplacement(_coord);
...@@ -4008,16 +4050,6 @@ CMathContent.prototype = ...@@ -4008,16 +4050,6 @@ CMathContent.prototype =
return content; return content;
}, },
home: function()
{
if(!this.IsPlaceholder())
this.CurPos = 0;
},
end: function()
{
if(!this.IsPlaceholder())
this.CurPos = this.content.length - 1;
},
old_recalculateSize: function() old_recalculateSize: function()
{ {
var _width = 0 ; var _width = 0 ;
...@@ -4036,7 +4068,7 @@ CMathContent.prototype = ...@@ -4036,7 +4068,7 @@ CMathContent.prototype =
var sAscent; var sAscent;
if( !this.content[i].value.SUBCONTENT ) if( !this.content[i].value.typeObj === MATH_COMP )
sAscent = Size.ascent; sAscent = Size.ascent;
else else
sAscent = Size.center; sAscent = Size.center;
...@@ -4167,10 +4199,8 @@ CMathContent.prototype = ...@@ -4167,10 +4199,8 @@ CMathContent.prototype =
rPrp.Merge(DEFAULT_RUN_PRP); rPrp.Merge(DEFAULT_RUN_PRP);
rPrp.Merge( this.content[i].value.getRunPrp() ); rPrp.Merge( this.content[i].value.getRunPrp() );
var ital = rPrp.Italic;
rPrp.Italic = false; rPrp.Italic = false;
pGraphics.SetFont(rPrp); pGraphics.SetFont(rPrp);
rPrp.Italic = ital;
} }
else if(this.content[i].value.typeObj == MATH_PLACEHOLDER) else if(this.content[i].value.typeObj == MATH_PLACEHOLDER)
{ {
...@@ -4181,10 +4211,9 @@ CMathContent.prototype = ...@@ -4181,10 +4211,9 @@ CMathContent.prototype =
var rPrp = new CMathTextPrp(); var rPrp = new CMathTextPrp();
rPrp.Merge(DEFAULT_RUN_PRP); rPrp.Merge(DEFAULT_RUN_PRP);
rPrp.Merge(ctrPrp); rPrp.Merge(ctrPrp);
//var ital = rPrp.Italic;
rPrp.Italic = false; rPrp.Italic = false;
pGraphics.SetFont(rPrp); pGraphics.SetFont(rPrp);
//rPrp.Italic = ital;
this.content[i].value.draw(pGraphics); this.content[i].value.draw(pGraphics);
} }
...@@ -4204,7 +4233,7 @@ CMathContent.prototype = ...@@ -4204,7 +4233,7 @@ CMathContent.prototype =
{ {
//var sizeCursor = this.getRunPrp(this.CurPos).FontSize*g_dKoef_pt_to_mm; //var sizeCursor = this.getRunPrp(this.CurPos).FontSize*g_dKoef_pt_to_mm;
var sizeCursor = this.getCurrRunPrp().FontSize*g_dKoef_pt_to_mm; var sizeCursor = this.getCurrRunPrp().FontSize*g_dKoef_pt_to_mm;
var position = {x: this.pos.x + this.content[this.CurPos].widthToEl, y: this.pos.y + this.size.center - sizeCursor/2 }; var position = {x: this.pos.x + this.content[this.CurPos].widthToEl, y: this.pos.y + this.size.center - sizeCursor*0.8 };
editor.WordControl.m_oLogicDocument.DrawingDocument.SetTargetSize( sizeCursor ); editor.WordControl.m_oLogicDocument.DrawingDocument.SetTargetSize( sizeCursor );
editor.WordControl.m_oDrawingDocument.UpdateTargetFromPaint = true; editor.WordControl.m_oDrawingDocument.UpdateTargetFromPaint = true;
...@@ -4245,7 +4274,7 @@ CMathContent.prototype = ...@@ -4245,7 +4274,7 @@ CMathContent.prototype =
var gps = this.content[pos].g_mContext; var gps = this.content[pos].g_mContext;
if(pos !== 0) if(pos !== 0)
{ {
if( this.content[ pos ].value.SUBCONTENT ) if( this.content[ pos ].value.typeObj === MATH_COMP )
{ {
if( this.content[ pos - 1].widthToEl <= mouseX && mouseX < (this.content[pos - 1].widthToEl + gps.left) ) if( this.content[ pos - 1].widthToEl <= mouseX && mouseX < (this.content[pos - 1].widthToEl + gps.left) )
pos--; pos--;
...@@ -4287,122 +4316,6 @@ CMathContent.prototype = ...@@ -4287,122 +4316,6 @@ CMathContent.prototype =
return {x: X, y: Y}; return {x: X, y: Y};
}, },
old_remove: function()
{
var state =
{
bRecPosition: false, /*нужно ли пересчитывать позицию или нет, работает при backspace */
bBeginning: false /*в начале контента или нет*/
//bTargetAfterRemove: false /*нужно ли селектить target, этот флаг выставляется в CMathBase*/
};
var CurrContent = SelectContent = null;
if( this.IsTarget() )
{
if ( !this.bRoot )
{
var removal = this.Parent.remove();
SelectContent = removal.SelectContent;
CurrContent = this;
}
else
{
//в основном контенте и элемент target
//переделать : вставлять объект типа placeholder
this.content.length = 0;
state.bRecPosition = true;
SelectContent = this;
CurrContent = this;
}
}
else
{
if( this.CurPos != 0 || (this.selection.startPos != this.selection.endPos) ) //последнее условие, чтобы избежать ситуации, когда стоим в нулевой позиции и при этом есть селект
{
//курсор перед мат. элементом
if( (this.selection.startPos == this.selection.endPos) && this.content[this.CurPos].value.empty)
{
this.setStart_Selection(this.CurPos);
this.setEnd_Selection( this.CurPos-2 );
this.selection.active = false;
SelectContent = this;
CurrContent = this;
}
//пришли из базового класса
else if( this.content[this.CurPos].value.SUBCONTENT && (this.selection.startPos == this.selection.endPos) )
{
this.setStart_Selection(this.CurPos + 1);
this.setEnd_Selection(this.CurPos - 1);
this.selection.active = false;
SelectContent = this;
CurrContent = null; // т.к. пришли из другого контента
}
//просто удаляем элементы из контента
else
{
var start, end;
if( this.selection.startPos != this.selection.endPos )
{
start = this.selection.startPos;
end = this.selection.endPos;
if(start > end)
{
tmp = start;
start = end;
end = tmp;
}
}
else //backspace
{
start = this.CurPos;
end = this.CurPos + 1;
}
var tmp = new Array();
for(var i = 0; i< start; i++)
tmp.push(this.content[i]);
for (var j = end; j < this.content.length; j++)
tmp.push(this.content[j]);
this.content.length = 0;
this.content = tmp;
this.CurPos = start - 1;
this.setStart_Selection(this.CurPos);
this.selection.active = false;
SelectContent = this;
CurrContent = this;
state.bRecPosition = true;
/*if(this.content.length == 1 && ! this.bRoot )//только CEmpty
{
this.add(StartTextElement);
}*/
//this.recalculate();
}
}
else if ( !this.bRoot )
{
var removal = this.Parent.remove();
SelectContent = removal.SelectContent;
CurrContent = this;
}
else
{
CurrContent = SelectContent = this;
state.bBeginning = true;
}
}
return {CurrContent : CurrContent, SelectContent: SelectContent, state: state };
},
remove: function(order) remove: function(order)
{ {
var state = var state =
...@@ -4483,24 +4396,85 @@ CMathContent.prototype = ...@@ -4483,24 +4396,85 @@ CMathContent.prototype =
{ {
var bDelete = false; var bDelete = false;
var bSelect = this.selection.startPos !== this.selection.endPos; var bSelect = this.selection.startPos !== this.selection.endPos;
var bMEDirect = order == 1 && this.content[this.CurPos].value.empty, var currType = this.content[this.CurPos].value.typeObj,
bMEReverse = order == -1 && this.content[this.CurPos + 1].value.SUBCONTENT; prevType = this.CurPos > 1 ? this.content[this.CurPos - 1].value.typeObj : null,
prev2_Type = this.CurPos > 2 ? this.content[this.CurPos - 2].value.typeObj : null,
prev3_Type = this.CurPos > 3 ? this.content[this.CurPos - 3].value.typeObj : null,
prev4_Type = this.CurPos > 4 ? this.content[this.CurPos - 4].value.typeObj : null,
nextType = this.CurPos > this.content.length -1 ? this.content[this.CurPos + 1].value.typeObj : null;
var bPrevComp = prevType === MATH_EMPTY && prev2_Type === MATH_COMP,
bPrev2_Comp = prev3_Type === MATH_EMPTY && prev4_Type === MATH_COMP;
//var bMEDirect = order == 1 && this.content[this.CurPos].value.empty,
var bMEDirect = order == 1 && currType === MATH_EMPTY, // работает, если только в конце формулы стоим или после идет еще одна формула
bMEDirectRPrp = order == 1 && currType === MATH_RUN_PRP && bPrevComp, //стоим после формулы, после RunPrp
bMEReverse = order == -1 && nextType === MATH_COMP,
bFirstRunPrp = this.CurPos == 1 && currType == MATH_RUN_PRP;
var items = null; var items = null;
if(!bSelect && bMEDirect) // если курсор после мат. объекта if(!bSelect && bMEDirect) // если курсор после мат. объекта и нет RunPrp
{ {
this.setStart_Selection(this.CurPos); this.setStart_Selection(this.CurPos);
this.setEnd_Selection( this.CurPos-2 ); this.setEnd_Selection( this.CurPos-2 );
this.selection.active = false; this.selection.active = false;
} }
else if(!bSelect && bMEReverse) else if(!bSelect && bMEDirectRPrp)
{
/*if(this.CurPos === 3) // стоим в начале, после мат объекта
{
start = this.CurPos - 1;
end = this.CurPos - 3;
}
else if(bPrev2_Comp)
{
start = this.CurPos - 1;
end = this.CurPos - 3;
}*/
var bDelRunPrp = false;
if(prev3_Type === MATH_TEXT)
{
for(var i = this.CurPos - 3; i > 0; i--)
{
if(this.content[i].value.typeObj === MATH_RUN_PRP)
{
currRPrp = this.content[this.CurPos].value;
prevRPrp = this.content[i].value;
bDelRunPrp = currRPrp.isEqual(currRPrp, prevRPrp);
break;
}
}
}
if(bDelRunPrp)
{
this.setStart_Selection(this.CurPos);
this.setEnd_Selection(this.CurPos-3);
this.selection.active = false;
}
else
{
this.setStart_Selection(this.CurPos-1);
this.setEnd_Selection(this.CurPos-3);
this.selection.active = false;
}
/*else
{
start = this.CurPos - 1;
end = this.CurPos - 3;
}*/
}
else if(!bSelect && bMEReverse) //аналогично для delete
{ {
this.setStart_Selection(this.CurPos); this.setStart_Selection(this.CurPos);
this.setEnd_Selection( this.CurPos + 2 ); this.setEnd_Selection( this.CurPos + 2 );
this.selection.active = false; this.selection.active = false;
} }
else else if( !bFirstRunPrp || bSelect) // исключаем если стоим в начале и есть RunPrp
{ {
var start, end; var start, end;
...@@ -4562,8 +4536,6 @@ CMathContent.prototype = ...@@ -4562,8 +4536,6 @@ CMathContent.prototype =
History.Add(this, {Type: historyitem_Math_RemoveItem, Items: items, Pos: start}); History.Add(this, {Type: historyitem_Math_RemoveItem, Items: items, Pos: start});
} }
this.CurPos = start - 1; this.CurPos = start - 1;
this.setStart_Selection(this.CurPos); this.setStart_Selection(this.CurPos);
this.selection.active = false; this.selection.active = false;
...@@ -4576,9 +4548,7 @@ CMathContent.prototype = ...@@ -4576,9 +4548,7 @@ CMathContent.prototype =
setPlaceholderAfterRemove: function() // чтобы не выставлялся тагет при вставке, когда заселекчен весь контент и мы добавляем, например, другой мат элемент setPlaceholderAfterRemove: function() // чтобы не выставлялся тагет при вставке, когда заселекчен весь контент и мы добавляем, например, другой мат элемент
{ {
if(this.content.length == 1 && ! this.bRoot )//только CEmpty if(this.content.length == 1 && ! this.bRoot )//только CEmpty
{ this.fillPlaceholders();
this.addLetter(StartTextElement);
}
}, },
selectUse: function() selectUse: function()
{ {
...@@ -4734,8 +4704,13 @@ CMathContent.prototype = ...@@ -4734,8 +4704,13 @@ CMathContent.prototype =
this.plhHide = flag; this.plhHide = flag;
}, },
///// RunPrp, CtrPrp ///////// RunPrp, CtrPrp
addRunPrp: function(runPrp) // for "edit" addRunPrp: function(runPrp) // for "edit"
{
this.addRunPrpToContent(runPrp);
this.CurPos++;
},
addRunPrpToContent: function(runPrp)
{ {
var rPrp = new CMathRunPrp(); var rPrp = new CMathRunPrp();
rPrp.Merge(runPrp); rPrp.Merge(runPrp);
...@@ -4748,9 +4723,8 @@ CMathContent.prototype = ...@@ -4748,9 +4723,8 @@ CMathContent.prototype =
this.content.length = 0; this.content.length = 0;
this.content = tmp; this.content = tmp;
this.CurPos++;
}, },
addRunPrpToContent: function(runPrp) // for "read" addRunPrpToContent_2: function(runPrp) // for "read"
{ {
var rPrp = new CMathRunPrp(); var rPrp = new CMathRunPrp();
rPrp.Merge(runPrp); rPrp.Merge(runPrp);
...@@ -4781,11 +4755,11 @@ CMathContent.prototype = ...@@ -4781,11 +4755,11 @@ CMathContent.prototype =
runPrp.Merge(obj.getRunPrp()); runPrp.Merge(obj.getRunPrp());
break; break;
} }
else if(obj.typeObj == MATH_COMP) /*else if(obj.typeObj == MATH_COMP)
{ {
runPrp.Merge(obj.getCtrPrp()); runPrp.Merge(obj.getCtrPrp());
break; break;
} }*/
} }
} }
} }
...@@ -4818,12 +4792,11 @@ CMathContent.prototype = ...@@ -4818,12 +4792,11 @@ CMathContent.prototype =
return txtPrp; return txtPrp;
}, },
checkRunPrp: function() old_checkRunPrp: function()
{ {
var bEmpty = this.IsEmpty(), var bEmpty = this.IsEmpty(),
OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP; OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP;
if(bEmpty || OnlyRunPrp) if(bEmpty || OnlyRunPrp)
{ {
var txtPrp; var txtPrp;
...@@ -4848,6 +4821,93 @@ CMathContent.prototype = ...@@ -4848,6 +4821,93 @@ CMathContent.prototype =
} }
}, },
checkRunPrp: function()
{
var bEmpty = this.IsEmpty(),
OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP,
bComposition = this.content[this.CurPos].value.typeObj == MATH_EMPTY && this.content.length > 1;
if(this.bRoot && bEmpty)
{
var rPrp = this.Composition.DefaultTxtPrp;
this.addRunPrp(rPrp);
}
else if(bEmpty)
{
var rPrp = this.Parent.getCtrPrp();
this.addRunPrp(rPrp);
}
else if(OnlyRunPrp)
{
var rPrp = this.Parent.getCtrPrp();
var Run = this.content[1].value.runPrp;
var currRun = new CTextPr();
currRun.Merge(Run);
Run.Merge(rPrp);
Run.Merge(currRun);
}
else if(bComposition)
{
//возможны два случая:
// 1. если стоим в начале перед CEmpty и после идет Composition
// 2. стоим после CEmpty, который относится к Composition
var rPrp;
if(this.CurPos == 1 && this.content[this.CurPos].value.typeObj == MATH_COMP)
rPrp = this.content[this.CurPos].value.getCtrPrp();
else if(this.content[this.CurPos - 2].value.typeObj == MATH_COMP)
rPrp = this.content[this.CurPos - 2].value.getCtrPrp();
else // на всякий случай
rPrp = DEFAULT_RUN_PRP;
this.addRunPrp(rPrp);
}
//this.addToBeginningRPrp(txtPrp);
},
old_addToBeginningRPrp: function(rPrp) // чтобы не возникало ошибок при добавлении RunPrp в начало, если уже выставлены некоторые RunPrp
{
var bEmpty = this.IsEmpty(),
OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP;
if(bEmpty)
{
this.addRunPrp(rPrp);
}
else if( OnlyRunPrp)
{
var Run = this.content[1].value.runPrp;
var currRun = new CTextPr();
currRun.Merge(Run);
Run.Merge(rPrp);
Run.Merge(currRun);
}
},
setItalic: function(flag)
{
var rPrp = new CTextPr();
rPrp.Italic = flag;
if(bEmpty)
{
this.addRunPrp(rPrp);
}
else
{
for(var i = 1; i < this.content.length; i++)
{
if(this.content[i].value.typeObj == MATH_RUN_PRP)
this.content[i].value.Merge(rPrp);
}
}
},
////////////////////////
//////// ///////// //////// /////////
getMetricsLetter: function(pos) getMetricsLetter: function(pos)
{ {
...@@ -4868,7 +4928,7 @@ CMathContent.prototype = ...@@ -4868,7 +4928,7 @@ CMathContent.prototype =
return res; return res;
}, },
// (!) повторяется функция (IsHighElement) // (!) повторяется функция (IsHighElement)
IsIncline: function() IsIncline: function()
{ {
...@@ -5066,7 +5126,7 @@ CMathContent.prototype = ...@@ -5066,7 +5126,7 @@ CMathContent.prototype =
if ( historyitem_Paragraph_AddItem === Type1 && historyitem_Paragraph_AddItem === Type2 ) if ( historyitem_Paragraph_AddItem === Type1 && historyitem_Paragraph_AddItem === Type2 )
{ {
if ( 1 === Data1.Items.length && 1 === Data2.Items.length && Data1.Pos === Data2.Pos - 1 && !this.content[Data1.Pos].SUBCONTENT && !this.content[Data2.Pos].SUBCONTENT ) if ( 1 === Data1.Items.length && 1 === Data2.Items.length && Data1.Pos === Data2.Pos - 1 && !this.content[Data1.Pos].typeObj === MATH_COMP && !this.content[Data2.Pos].typeObj === MATH_COMP )
return true; return true;
} }
return false return false
...@@ -5773,10 +5833,6 @@ CMathComposition.prototype = ...@@ -5773,10 +5833,6 @@ CMathComposition.prototype =
function CEmpty() function CEmpty()
{ {
//this.SUBCONTENT = false;
//this.empty = true;
//this.TxtPrp = new CMathTextPrp();
this.typeObj = MATH_EMPTY; this.typeObj = MATH_EMPTY;
this.pos = null; this.pos = null;
......
...@@ -55,9 +55,6 @@ function CMathText() ...@@ -55,9 +55,6 @@ function CMathText()
this.bJDraw = false; this.bJDraw = false;
this.bMText = false; this.bMText = false;
/*this.SUBCONTENT = false;
this.empty = false;*/
//this.Parent = null; //this.Parent = null;
/*this.TxtPrp = new CMathTextPrp(); /*this.TxtPrp = new CMathTextPrp();
...@@ -512,10 +509,6 @@ function old_CMathText(params) ...@@ -512,10 +509,6 @@ function old_CMathText(params)
this.bMText = params.bMText ? true : false; this.bMText = params.bMText ? true : false;
this.SUBCONTENT = false;
this.empty = false;
this.transform = this.transform =
{ {
sx: 1, sx: 1,
......
...@@ -159,7 +159,8 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap) ...@@ -159,7 +159,8 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap)
} }
CMathMatrix.prototype.recalculateSize = function() CMathMatrix.prototype.recalculateSize = function()
{ {
var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
var txtPrp = this.getPrpToControlLetter();
var interval = this.getLineGap(txtPrp); var interval = this.getLineGap(txtPrp);
this.gaps.column[0] = 0; this.gaps.column[0] = 0;
...@@ -514,5 +515,5 @@ CEqArray.prototype.old_init = function(props) ...@@ -514,5 +515,5 @@ CEqArray.prototype.old_init = function(props)
} }
CEqArray.prototype.getElement = function(num) CEqArray.prototype.getElement = function(num)
{ {
return this.elements[num][y]; return this.elements[num][0];
} }
\ No newline at end of file
...@@ -4625,6 +4625,11 @@ CCharacter.prototype.recalculateSize = function() ...@@ -4625,6 +4625,11 @@ CCharacter.prototype.recalculateSize = function()
{ {
var content = this.elements[0][0]; var content = this.elements[0][0];
var rPrp = this.getPrpToControlLetter();
rPrp.Italic = false;
g_oTextMeasurer.SetFont(rPrp);
this.operator.fixSize(this.elements[0][0].size.width); 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, var width = content.size.width > this.operator.size.width ? content.size.width : this.operator.size.width,
...@@ -4664,6 +4669,11 @@ CCharacter.prototype.align = function(element) ...@@ -4664,6 +4669,11 @@ CCharacter.prototype.align = function(element)
CCharacter.prototype.draw = function(pGraphics) CCharacter.prototype.draw = function(pGraphics)
{ {
this.elements[0][0].draw(pGraphics); this.elements[0][0].draw(pGraphics);
var rPrp = this.getPrpToControlLetter();
rPrp.Italic = false;
pGraphics.SetFont(rPrp);
this.operator.draw(pGraphics); this.operator.draw(pGraphics);
} }
CCharacter.prototype.findDisposition = function(pos) CCharacter.prototype.findDisposition = function(pos)
......
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