Commit b7835aa0 authored by Ilya Kirillov's avatar Ilya Kirillov

First version of moving cursor left in footnotes.

parent 3966e0ff
......@@ -1899,26 +1899,7 @@ CDocumentContent.prototype.Cursor_MoveToEndPos = function(AddToSelect)
for (var Index = StartPos + 1; Index <= EndPos; Index++)
{
var Item = this.Content[Index];
Item.Selection.Use = true;
var ItemType = Item.GetType();
if (type_Paragraph === ItemType)
{
Item.Selection.Set_StartPos(Item.Internal_GetStartPos(), -1);
Item.Selection.Set_EndPos(Item.Content.length - 1, -1);
}
else //if ( type_Table === ItemType )
{
var Row = Item.Content.length - 1;
var Cell = Item.Content[Row].Get_CellsCount() - 1;
var Pos0 = {Row : 0, Cell : 0};
var Pos1 = {Row : Row, Cell : Cell};
Item.Selection.StartPos.Pos = Pos0;
Item.Selection.EndPos.Pos = Pos1;
Item.Internal_Selection_UpdateCells();
}
this.Content[Index].Select_All(1);
}
this.Content[StartPos].Cursor_MoveToEndPos(true);
......
......@@ -336,24 +336,11 @@ CFootnotesController.prototype.StartSelection = function(X, Y, PageAbs, MouseEve
this.Selection.Start.Footnote.Selection_SetStart(X, Y, 0, MouseEvent);
this.Selection.Start.Pos = {
X : X,
Y : Y,
PageAbs : PageAbs,
MouseEvent : MouseEvent
};
this.Selection.End.Pos = {
X : X,
Y : Y,
PageAbs : PageAbs,
MouseEvent : MouseEvent
};
this.CurFootnote = this.Selection.Start.Footnote;
this.Selection.Footnotes = {};
this.Selection.Footnotes[this.Selection.Start.Footnote.Get_Id()] = this.Selection.Start.Footnote;
this.Selection.Direction = 0;
};
CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent)
{
......@@ -366,12 +353,6 @@ CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent
}
this.Selection.End = oResult;
this.Selection.End.Pos = {
X : X,
Y : Y,
PageAbs : PageAbs,
MouseEvent : MouseEvent
};
this.CurFootnote = this.Selection.End.Footnote;
var sStartId = this.Selection.Start.Footnote.Get_Id();
......@@ -390,12 +371,14 @@ CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent
if (this.Selection.Start.Page > this.Selection.End.Page || this.Selection.Start.Index > this.Selection.End.Index)
{
this.Selection.Start.Footnote.Selection_SetEnd(-MEASUREMENT_MAX_MM_VALUE, -MEASUREMENT_MAX_MM_VALUE, 0, MouseEvent);
this.Selection.End.Footnote.Selection_SetStart(MEASUREMENT_MAX_MM_VALUE, MEASUREMENT_MAX_MM_VALUE, 0, this.Selection.Start.Pos.MouseEvent);
this.Selection.End.Footnote.Selection_SetStart(MEASUREMENT_MAX_MM_VALUE, MEASUREMENT_MAX_MM_VALUE, 0, MouseEvent);
this.Selection.Direction = -1;
}
else
{
this.Selection.Start.Footnote.Selection_SetEnd(MEASUREMENT_MAX_MM_VALUE, MEASUREMENT_MAX_MM_VALUE, 0, MouseEvent);
this.Selection.End.Footnote.Selection_SetStart(-MEASUREMENT_MAX_MM_VALUE, -MEASUREMENT_MAX_MM_VALUE, 0, this.Selection.Start.Pos.MouseEvent);
this.Selection.End.Footnote.Selection_SetStart(-MEASUREMENT_MAX_MM_VALUE, -MEASUREMENT_MAX_MM_VALUE, 0, MouseEvent);
this.Selection.Direction = 1;
}
this.Selection.End.Footnote.Selection_SetEnd(X, Y, 0, MouseEvent);
......@@ -415,6 +398,7 @@ CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent
this.Selection.End.Footnote.Selection_SetEnd(X, Y, 0, MouseEvent);
this.Selection.Footnotes = {};
this.Selection.Footnotes[this.Selection.Start.Footnote.Get_Id()] = this.Selection.Start.Footnote;
this.Selection.Direction = 0;
}
};
CFootnotesController.prototype.Undo = function()
......@@ -619,6 +603,18 @@ CFootnotesController.prototype.private_CheckFootnotesSelectionBeforeAction = fun
return true;
};
CFootnotesController.prototype.private_SetCurrentFootnoteNoSelection = function(oFootnote)
{
this.Selection.Use = false;
this.CurFootnote = oFootnote;
this.Selection.Start.Footnote = oFootnote;
this.Selection.End.Footnote = oFootnote;
this.Selection.Direction = 0;
this.Selection.Footnotes = {};
this.Selection.Footnotes[oFootnote.Get_Id()] = oFootnote;
};
//CF
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Controller area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -746,6 +742,7 @@ CFootnotesController.prototype.MoveCursorToStartPos = function(AddToSelect)
if (arrRange.length <= 0)
return;
if (true !== this.Selection.Use)
this.LogicDocument.Start_SelectionFromCurPos();
this.Selection.End.Footnote = arrRange[0];
......@@ -764,28 +761,107 @@ CFootnotesController.prototype.MoveCursorToStartPos = function(AddToSelect)
this.Selection.Footnotes[oTempFootnote.Get_Id()] = oTempFootnote;
}
}
if (this.Selection.Start.Footnote !== this.Selection.End.Footnote)
this.Selection.Direction = -1;
else
this.Selection.Direction = 0;
}
};
CFootnotesController.prototype.MoveCursorToEndPos = function(AddToSelect)
{
// TODO: Реализовать
if (true !== AddToSelect)
{
this.LogicDocument.controller_MoveCursorToEndPos(false);
}
else
{
var oFootnote = this.CurFootnote;
if (true === this.Selection.Use)
oFootnote = this.Selection.Start.Footnote;
var arrRange = this.LogicDocument.Get_FootnotesList(oFootnote, null);
if (arrRange.length <= 0)
return;
if (true !== this.Selection.Use)
this.LogicDocument.Start_SelectionFromCurPos();
this.Selection.End.Footnote = arrRange[arrRange.length - 1];
this.Selection.Start.Footnote = oFootnote;
this.Selection.Footnotes = {};
oFootnote.Cursor_MoveToEndPos(true);
this.Selection.Footnotes = {};
this.Selection.Footnotes[oFootnote.Get_Id()] = oFootnote;
for (var nIndex = 0, nCount = arrRange.length; nIndex < nCount; ++nIndex)
{
var oTempFootnote = arrRange[nIndex];
if (oTempFootnote !== oFootnote)
{
oTempFootnote.Select_All(1);
this.Selection.Footnotes[oTempFootnote.Get_Id()] = oTempFootnote;
}
}
if (this.Selection.Start.Footnote !== this.Selection.End.Footnote)
this.Selection.Direction = 1;
else
this.Selection.Direction = 0;
}
};
CFootnotesController.prototype.MoveCursorLeft = function(AddToSelect, Word)
{
var bRetValue = false;
// TODO: Доделать селект и курсор
if (true === this.Selection.Use)
{
if (true !== AddToSelect)
{
var oFootnote = this.CurFootnote;
if (0 === this.Selection.Direction)
oFootnote = this.CurFootnote;
else if (1 === this.Selection.Direction)
oFootnote = this.Selection.Start.Footnote;
else
oFootnote = this.Selection.End.Footnote;
for (var sId in this.Selection.Footnotes)
{
if (oFootnote !== this.Selection.Footnotes[sId])
this.Selection.Footnotes[sId].Selection_Remove();
}
oFootnote.Cursor_MoveLeft(false, Word);
oFootnote.Selection_Remove();
this.private_SetCurrentFootnoteNoSelection(oFootnote);
}
else
{
if (null !== this.CurFootnote)
bRetValue = this.CurFootnote.Cursor_MoveLeft(AddToSelect, Word);
var oFootnote = this.Selection.End.Footnote;
if (false === oFootnote.Cursor_MoveLeft(true, Word))
{
}
}
}
else
{
if (true === AddToSelect)
{
return bRetValue;
}
else
{
var oFootnote = this.CurFootnote;
if (false === oFootnote.Cursor_MoveLeft(false, Word))
{
}
}
}
return true;
};
CFootnotesController.prototype.MoveCursorRight = function(AddToSelect, Word, FromPaste)
{
......
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