Commit ef45a769 authored by Ilya Kirillov's avatar Ilya Kirillov

Now changes can be added in an old style like objects and in a new style like classes.

parent 5f9d129f
......@@ -2882,6 +2882,15 @@
// В большинстве случаев загрузка чужого изменения работает как простое Redo
this.Redo();
};
CChangesBase.prototype.IsChangesClass = function()
{
// TODO: Эта функция добавлена пока все изменения не переделаны на классы
return true;
};
CChangesBase.prototype.GetClass = function()
{
return this.Class;
};
window['AscDFH'].CChangesBase = CChangesBase;
/**
* Базовый класс для изменения свойств.
......@@ -2896,7 +2905,7 @@
this.Old = Old;
this.New = New;
}
AscCommon.extendClass(CChangesBase, CChangesBaseProperty);
AscCommon.extendClass(CChangesBaseProperty, CChangesBase);
CChangesBaseProperty.prototype.Undo = function()
{
this.private_SetValue(this.Old);
......@@ -2919,7 +2928,7 @@
{
CChangesBaseBoolProperty.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseProperty, CChangesBaseBoolProperty);
AscCommon.extendClass(CChangesBaseBoolProperty, CChangesBaseProperty);
CChangesBaseBoolProperty.prototype.WriteToBinary = function(Writer)
{
// Long : Flag
......@@ -2986,7 +2995,7 @@
{
CChangesBaseDoubleProperty.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseProperty, CChangesBaseDoubleProperty);
AscCommon.extendClass(CChangesBaseDoubleProperty, CChangesBaseProperty);
CChangesBaseDoubleProperty.prototype.WriteToBinary = function(Writer)
{
// Long : Flag
......@@ -3052,7 +3061,7 @@
{
CChangesBaseObjectProperty.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseProperty, CChangesBaseObjectProperty);
AscCommon.extendClass(CChangesBaseObjectProperty, CChangesBaseProperty);
CChangesBaseObjectProperty.prototype.WriteToBinary = function(Writer)
{
// Long : Flag
......@@ -3144,7 +3153,7 @@
{
CChangesBaseLongProperty.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseProperty, CChangesBaseLongProperty);
AscCommon.extendClass(CChangesBaseLongProperty, CChangesBaseProperty);
CChangesBaseLongProperty.prototype.WriteToBinary = function(Writer)
{
// Long : Flag
......@@ -3210,7 +3219,7 @@
{
CChangesBaseStringProperty.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesBaseProperty, CChangesBaseStringProperty);
AscCommon.extendClass(CChangesBaseStringProperty, CChangesBaseProperty);
CChangesBaseStringProperty.prototype.WriteToBinary = function(Writer)
{
// Long : Flag
......
......@@ -381,7 +381,7 @@ CHistory.prototype =
// Регистрируем новое изменение:
// Class - объект, в котором оно произошло
// Data - сами изменения
Add : function(Class, Data)
Add : function(_Class, Data)
{
if (0 !== this.TurnOffHistory || this.Index < 0)
return;
......@@ -393,25 +393,35 @@ CHistory.prototype =
if ( this.RecIndex >= this.Index )
this.RecIndex = this.Index - 1;
var Binary_Pos = this.BinaryWriter.GetCurPosition();
var Binary_Pos = this.BinaryWriter.GetCurPosition();
this.BinaryWriter.WriteString2(Class.Get_Id());
Class.Save_Changes( Data, this.BinaryWriter );
var Class;
if (_Class && _Class.IsChangesClass && _Class.IsChangesClass())
{
Class = _Class.GetClass();
Data = _Class;
var Binary_Len = this.BinaryWriter.GetCurPosition() - Binary_Pos;
this.BinaryWriter.WriteString2(Class.Get_Id());
_Class.WriteToBinary(this.BinaryWriter);
}
else
{
Class = _Class;
this.BinaryWriter.WriteString2(Class.Get_Id());
Class.Save_Changes(Data, this.BinaryWriter);
}
var Binary_Len = this.BinaryWriter.GetCurPosition() - Binary_Pos;
var Item = {
Class : Class,
Data : Data,
Binary : {
Pos : Binary_Pos,
Len : Binary_Len
},
var Item =
{
Class : Class,
Data : Data,
Binary:
{
Pos : Binary_Pos,
Len : Binary_Len
},
NeedRecalc : !this.MinorChanges
};
NeedRecalc : !this.MinorChanges
};
this.Points[this.Index].Items.push( Item );
......
This diff is collapsed.
This diff is collapsed.
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