Commit 6d969c15 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Перенес классы в apiCommon

Перенес переменные в c_oAscColor
ToDo избавиться от дублирования функций CreateAscColor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61288 954022d7-b5bf-4e40-9824-e11837661b57
parent 31053555
......@@ -5936,17 +5936,6 @@ DrawingObjectsController.prototype =
this.startRecalculate();
},
applyColorScheme: function()
{
// var aObjects = this.drawingObjects.getDrawingObjects();
// for (var i = 0; i < aObjects.length; i++)
// {
// if(typeof aObjects[i].graphicObject.recalculateColors === "function")
// aObjects[i].graphicObject.recalculateColors();
// }
},
// layers
setGraphicObjectLayer: function(layerType)
{
......@@ -6463,18 +6452,18 @@ function CreateAscColorEx(unicolor) {
var _color = unicolor.color;
switch (_color.type)
{
case COLOR_TYPE_SRGB:
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SYS:
{
break;
}
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_PRST:
{
ret.type = c_oAscColor.COLOR_TYPE_PRST;
ret.value = _color.id;
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
ret.type = c_oAscColor.COLOR_TYPE_SCHEME;
ret.value = _color.id;
......
......@@ -354,15 +354,6 @@ var TYPE_TRACK_GROUP_PASSIVE = 1;
var TYPE_TRACK_TEXT = 2;
var TYPE_TRACK_EMPTY_PH = 3;
var GLOBAL_BLIP_FILL_MAP = {};
var COLOR_TYPE_NONE = 0;
var COLOR_TYPE_SRGB = 1;
var COLOR_TYPE_PRST = 2;
var COLOR_TYPE_SCHEME = 3;
var COLOR_TYPE_SYS = 4;
var SLIDE_KIND = 0;
var LAYOUT_KIND = 1;
var MASTER_KIND = 2;
......@@ -1215,7 +1206,7 @@ CColorModifiers.prototype =
function CSysColor()
{
this.type = COLOR_TYPE_SYS;
this.type = c_oAscColor.COLOR_TYPE_SYS;
this.id = "";
this.RGBA = {
R: 0,
......@@ -1224,10 +1215,6 @@ function CSysColor()
A: 255,
needRecalc: true
};
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add(this, this.Id);
}
CSysColor.prototype =
......@@ -1243,17 +1230,14 @@ CSysColor.prototype =
setR: function(pr)
{
//History.Add(this, {Type:historyitem_SysColor_SetR, oldPr: this.RGBA.R, newPr:pr});
this.RGBA.R = pr;
},
setG: function(pr)
{
//History.Add(this, {Type:historyitem_SysColor_SetG, oldPr: this.RGBA.G, newPr:pr});
this.RGBA.G = pr;
},
setB: function(pr)
{
//History.Add(this, {Type:historyitem_SysColor_SetB, oldPr: this.RGBA.B, newPr:pr});
this.RGBA.B = pr;
},
......@@ -1283,7 +1267,7 @@ CSysColor.prototype =
Write_ToBinary: function (w)
{
w.WriteLong(COLOR_TYPE_SYS);
w.WriteLong(this.type);
w.WriteString2(this.id);
w.WriteLong(((this.RGBA.R << 16) & 0xFF0000) + ((this.RGBA.G << 8) & 0xFF00) + this.RGBA.B);
},
......@@ -1354,7 +1338,6 @@ CSysColor.prototype =
setId: function(id)
{
//History.Add(this, {Type: historyitem_SysColor_SetId, oldId: this.id, newId: id});
this.id = id;
},
......@@ -1414,7 +1397,7 @@ CSysColor.prototype =
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SYS && color.id == this.id;
return color && color.type == this.type && color.id == this.id;
},
Calculate : function(obj)
{
......@@ -1433,13 +1416,11 @@ CSysColor.prototype =
};
function CPrstColor()
{
this.type = COLOR_TYPE_PRST;
this.type = c_oAscColor.COLOR_TYPE_PRST;
this.id = "";
this.RGBA = {
R:0, G:0, B:0, A:255, needRecalc: true
};
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add(this, this.Id);
}
CPrstColor.prototype =
......@@ -1471,7 +1452,7 @@ CPrstColor.prototype =
Write_ToBinary: function (w)
{
w.WriteLong(COLOR_TYPE_PRST);
w.WriteLong(this.type);
w.WriteString2(this.id);
},
......@@ -1482,7 +1463,6 @@ CPrstColor.prototype =
setId: function(id)
{
//History.Add(this, {Type: historyitem_PrstColor_SetId, oldId: this.id, newId: id});
this.id = id;
},
......@@ -1512,7 +1492,7 @@ CPrstColor.prototype =
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_PRST && color.id == this.id;
return color && color.type == this.type && color.id == this.id;
},
createDuplicate : function()
......@@ -1567,10 +1547,8 @@ CPrstColor.prototype =
};
function CRGBColor()
{
this.type = COLOR_TYPE_SRGB;
this.type = c_oAscColor.COLOR_TYPE_SRGB;
this.RGBA = {R:0, G:0, B:0, A:255, needRecalc: true};
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add(this, this.Id);
}
CRGBColor.prototype =
......@@ -1611,7 +1589,7 @@ CRGBColor.prototype =
Write_ToBinary: function(w)
{
w.WriteLong(COLOR_TYPE_SRGB);
w.WriteLong(this.type);
w.WriteLong(((this.RGBA.R << 16) & 0xFF0000) + ((this.RGBA.G << 8) & 0xFF00) + this.RGBA.B);
},
......@@ -1625,8 +1603,6 @@ CRGBColor.prototype =
setColor: function(r, g, b)
{
var rgba = this.RGBA;
// History.Add(this, {Type: historyitem_RGBColor_SetColor, oldColor: {r: rgba.R, g: rgba.G, b: rgba.B}, newColor: {r: r, g: g, b: b}});
this.RGBA.R = r;
this.RGBA.G = g;
this.RGBA.B = b;
......@@ -1704,7 +1680,7 @@ CRGBColor.prototype =
},
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SRGB && color.RGBA.R == this.RGBA.R && color.RGBA.G == this.RGBA.G && color.RGBA.B == this.RGBA.B && color.RGBA.A == this.RGBA.A;
return color && color.type == this.type && color.RGBA.R == this.RGBA.R && color.RGBA.G == this.RGBA.G && color.RGBA.B == this.RGBA.B && color.RGBA.A == this.RGBA.A;
},
createDuplicate : function()
......@@ -1725,7 +1701,7 @@ CRGBColor.prototype =
function CSchemeColor()
{
this.type = COLOR_TYPE_SCHEME;
this.type = c_oAscColor.COLOR_TYPE_SCHEME;
this.id = 0;
this.RGBA = {
R:0,
......@@ -1734,8 +1710,6 @@ function CSchemeColor()
A:255,
needRecalc: true
};
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add(this, this.Id);
}
CSchemeColor.prototype =
......@@ -1804,7 +1778,7 @@ CSchemeColor.prototype =
Write_ToBinary: function (w)
{
w.WriteLong(COLOR_TYPE_SCHEME);
w.WriteLong(this.type);
w.WriteLong(this.id);
},
......@@ -1815,7 +1789,6 @@ CSchemeColor.prototype =
setId: function(id)
{
//History.Add(this, {Type: historyitem_SchemeColor_SetId, oldId: this.id, newId: id});
this.id = id;
},
......@@ -1874,7 +1847,7 @@ CSchemeColor.prototype =
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SCHEME && color.id == this.id;
return color && color.type == this.type && color.id == this.id;
},
createDuplicate : function()
{
......@@ -1933,8 +1906,6 @@ function CUniColor()
B: 0,
A: 255
};
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add(this, this.Id);
}
CUniColor.prototype =
......@@ -1949,7 +1920,7 @@ CUniColor.prototype =
checkPhColor: function(unicolor)
{
if(this.color && this.color.type === COLOR_TYPE_SCHEME && this.color.id === 14)
if(this.color && this.color.type === c_oAscColor.COLOR_TYPE_SCHEME && this.color.id === 14)
{
if(unicolor)
{
......@@ -2187,29 +2158,29 @@ CUniColor.prototype =
var type = r.GetLong();
switch(type)
{
case COLOR_TYPE_NONE:
case c_oAscColor.COLOR_TYPE_NONE:
{
break;
}
case COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SRGB:
{
this.color = new CRGBColor();
this.color.Read_FromBinary(r);
break;
}
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_PRST:
{
this.color = new CPrstColor();
this.color.Read_FromBinary(r);
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
this.color = new CSchemeColor();
this.color.Read_FromBinary(r);
break;
}
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SYS:
{
this.color = new CSysColor();
this.color.Read_FromBinary(r);
......@@ -2289,11 +2260,11 @@ CUniColor.prototype =
switch(this.color.type)
{
case COLOR_TYPE_NONE:
case c_oAscColor.COLOR_TYPE_NONE:
{
break;
}
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_PRST:
{
_ret.color = new CPrstColor();
if(unicolor.color.id == this.color.id)
......@@ -2310,7 +2281,7 @@ CUniColor.prototype =
}
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
_ret.color = new CSchemeColor();
if(unicolor.color.id == this.color.id)
......@@ -2327,7 +2298,7 @@ CUniColor.prototype =
}
break;
}
case COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SRGB:
{
_ret.color = new CRGBColor();
var _RGBA1 = this.color.RGBA;
......@@ -2350,7 +2321,7 @@ CUniColor.prototype =
break;
}
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SYS:
{
if(unicolor.color.id == this.color.id)
{
......@@ -5053,11 +5024,11 @@ function CompareUniColor(u1, u2)
return false;
switch (u1.color.type)
{
case COLOR_TYPE_NONE:
case c_oAscColor.COLOR_TYPE_NONE:
{
break;
}
case COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SRGB:
{
if(u1.color.RGBA.R !== u2.color.RGBA.R
|| u1.color.RGBA.G !== u2.color.RGBA.G
......@@ -5068,14 +5039,14 @@ function CompareUniColor(u1, u2)
}
break;
}
case COLOR_TYPE_PRST:
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
if(u1.color.id !== u2.color.id)
return false;
break;
}
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SYS:
{
if(u1.color.RGBA.R !== u2.color.RGBA.R
|| u1.color.RGBA.G !== u2.color.RGBA.G
......
......@@ -1382,7 +1382,7 @@ function BinaryPPTYLoader()
switch (_type)
{
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_PRST:
{
s.Skip2(2);
uni_color.setColor(new CPrstColor());
......@@ -1399,7 +1399,7 @@ function BinaryPPTYLoader()
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
s.Skip2(2);
uni_color.setColor(new CSchemeColor());
......@@ -1416,7 +1416,7 @@ function BinaryPPTYLoader()
break;
}
case COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SRGB:
{
var r, g, b;
s.Skip2(1);
......@@ -1439,7 +1439,7 @@ function BinaryPPTYLoader()
break;
}
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SYS:
{
s.Skip2(1);
uni_color.setColor(new CSysColor());
......
......@@ -1959,7 +1959,7 @@ function CBinaryFileWriter()
oThis._WriteLimit2(19, bodyPr.wrap);
oThis.WriteUChar(g_nodeAttributeEnd);
}
};
// fill-stroke ---------------------------------------------------------------
this.WriteUniColor = function(unicolor)
......@@ -1970,9 +1970,9 @@ function CBinaryFileWriter()
var color = unicolor.color;
switch (color.type)
{
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_PRST:
{
oThis.StartRecord(COLOR_TYPE_PRST);
oThis.StartRecord(c_oAscColor.COLOR_TYPE_PRST);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteString1(0, color.id);
......@@ -1983,9 +1983,9 @@ function CBinaryFileWriter()
oThis.EndRecord();
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
oThis.StartRecord(COLOR_TYPE_SCHEME);
oThis.StartRecord(c_oAscColor.COLOR_TYPE_SCHEME);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteUChar1(0, color.id);
......@@ -1996,9 +1996,9 @@ function CBinaryFileWriter()
oThis.EndRecord();
break;
}
case COLOR_TYPE_SRGB:
case c_oAscColor.c_oAscColor.COLOR_TYPE_SRGB:
{
oThis.StartRecord(COLOR_TYPE_SRGB);
oThis.StartRecord(c_oAscColor.COLOR_TYPE_SRGB);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteUChar1(0, color.RGBA.R);
......@@ -2011,9 +2011,9 @@ function CBinaryFileWriter()
oThis.EndRecord();
break;
}
case COLOR_TYPE_SYS:
case c_oAscColor.COLOR_TYPE_SYS:
{
oThis.StartRecord(COLOR_TYPE_SYS);
oThis.StartRecord(c_oAscColor.COLOR_TYPE_SYS);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteString1(0, color.id);
......@@ -2028,7 +2028,7 @@ function CBinaryFileWriter()
break;
}
}
}
};
this.WriteMods = function(mods)
{
......
......@@ -1140,4 +1140,88 @@ CAscMathCategory.prototype["get_Id"] = function(){ return this.Id; };
CAscMathCategory.prototype["get_Data"] = function(){ return this.Data; };
CAscMathCategory.prototype["get_W"] = function(){ return this.W; };
CAscMathCategory.prototype["get_H"] = function(){ return this.H; };
CAscMathCategory.prototype.private_Sort = function(){ this.Data.sort( function(a,b){ return a.Id- b.Id; } ); };
\ No newline at end of file
CAscMathCategory.prototype.private_Sort = function(){ this.Data.sort( function(a,b){ return a.Id- b.Id; } ); };
function CAscTexture()
{
this.Id = 0;
this.Image = "";
}
CAscTexture.prototype.get_id = function() { return this.Id; };
CAscTexture.prototype.get_image = function() { return this.Image; };
function CAscColorScheme()
{
this.Colors = [];
this.Name = "";
}
CAscColorScheme.prototype.get_colors = function() { return this.Colors; };
CAscColorScheme.prototype.get_name = function() { return this.Name; };
// цвет. может быть трех типов:
// c_oAscColor.COLOR_TYPE_SRGB : value - не учитывается
// c_oAscColor.COLOR_TYPE_PRST : value - имя стандартного цвета (map_prst_color)
// c_oAscColor.COLOR_TYPE_SCHEME : value - тип цвета в схеме
// c_oAscColor.COLOR_TYPE_SYS : конвертируется в srgb
function CAscColor()
{
this.type = c_oAscColor.COLOR_TYPE_SRGB;
this.value = null;
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 255;
this.Auto = false;
this.Mods = [];
this.ColorSchemeId = -1;
if (1 === arguments.length) {
this.r = arguments[0].r;
this.g = arguments[0].g;
this.b = arguments[0].b;
} else {
if (3 <= arguments.length) {
this.r = arguments[0];
this.g = arguments[1];
this.b = arguments[2];
}
if (4 === arguments.length)
this.a = arguments[3];
}
}
CAscColor.prototype.get_r = function(){return this.r};
CAscColor.prototype.put_r = function(v){this.r = v; this.hex = undefined;};
CAscColor.prototype.get_g = function(){return this.g;};
CAscColor.prototype.put_g = function(v){this.g = v; this.hex = undefined;};
CAscColor.prototype.get_b = function(){return this.b;};
CAscColor.prototype.put_b = function(v){this.b = v; this.hex = undefined;};
CAscColor.prototype.get_a = function(){return this.a;};
CAscColor.prototype.put_a = function(v){this.a = v; this.hex = undefined;};
CAscColor.prototype.get_type = function(){return this.type;};
CAscColor.prototype.put_type = function(v){this.type = v;};
CAscColor.prototype.get_value = function(){return this.value;};
CAscColor.prototype.put_value = function(v){this.value = v;};
CAscColor.prototype.put_auto = function(v){this.Auto = v;};
CAscColor.prototype.get_auto = function(){return this.Auto;};
CAscColor.prototype.get_hex = function()
{
if(!this.hex)
{
var a = this.a.toString(16);
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
this.hex = ( a.length == 1? "0" + a: a) +
( r.length == 1? "0" + r: r) +
( g.length == 1? "0" + g: g) +
( b.length == 1? "0" + b: b);
}
return this.hex;
};
CAscColor.prototype.get_color = function()
{
return new CColor(this.r, this.g, this.b);
};
\ No newline at end of file
......@@ -505,9 +505,11 @@ var c_oAscSaveTypes = {
};
var c_oAscColor = {
COLOR_TYPE_NONE : 0,
COLOR_TYPE_SRGB : 1,
COLOR_TYPE_PRST : 2,
COLOR_TYPE_SCHEME : 3
COLOR_TYPE_SCHEME : 3,
COLOR_TYPE_SYS : 4
};
var c_oAscFill = {
......
......@@ -3166,8 +3166,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}
this.chartPreviewManager.clearPreviews();
}
var ws = this.wb.getWorksheet();
//ws.objectRender.controller.applyColorScheme();
// На view-режиме не нужно отправлять стили
if (true !== this.asc_getViewerMode() && !this.isMobileVersion) {
......
"use strict";
function CAscTexture()
{
this.Id = 0;
this.Image = "";
}
CAscTexture.prototype.get_id = function() { return this.Id; }
CAscTexture.prototype.get_image = function() { return this.Image; }
function CAscColorScheme()
{
this.Colors = [];
this.Name = "";
}
CAscColorScheme.prototype.get_colors = function() { return this.Colors; }
CAscColorScheme.prototype.get_name = function() { return this.Name; }
function CAscColor()
{
this.type = c_oAscColor.COLOR_TYPE_SRGB;
this.value = null;
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 255;
this.Auto = false;
this.Mods = [];
this.ColorSchemeId = -1;
if (1 === arguments.length) {
this.r = arguments[0].r;
this.g = arguments[0].g;
this.b = arguments[0].b;
} else {
if (3 <= arguments.length) {
this.r = arguments[0];
this.g = arguments[1];
this.b = arguments[2];
}
if (4 === arguments.length)
this.a = arguments[3];
}
}
CAscColor.prototype.get_r = function(){return this.r}
CAscColor.prototype.put_r = function(v){this.r = v; this.hex = undefined;}
CAscColor.prototype.get_g = function(){return this.g;}
CAscColor.prototype.put_g = function(v){this.g = v; this.hex = undefined;}
CAscColor.prototype.get_b = function(){return this.b;}
CAscColor.prototype.put_b = function(v){this.b = v; this.hex = undefined;}
CAscColor.prototype.get_a = function(){return this.a;}
CAscColor.prototype.put_a = function(v){this.a = v; this.hex = undefined;}
CAscColor.prototype.get_type = function(){return this.type;}
CAscColor.prototype.put_type = function(v){this.type = v;}
CAscColor.prototype.get_value = function(){return this.value;}
CAscColor.prototype.put_value = function(v){this.value = v;}
CAscColor.prototype.put_auto = function(v){this.Auto = v;}
CAscColor.prototype.get_auto = function(){return this.Auto;}
CAscColor.prototype.get_hex = function()
{
if(!this.hex)
{
var a = this.a.toString(16);
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
this.hex = ( a.length == 1? "0" + a: a) +
( r.length == 1? "0" + r: r) +
( g.length == 1? "0" + g: g) +
( b.length == 1? "0" + b: b);
}
return this.hex;
}
CAscColor.prototype.get_color = function()
{
var ret = new CColor(this.r, this.g, this.b);
return ret;
}
function CDocOpenProgress()
{
this.Type = c_oAscAsyncAction.Open;
......@@ -93,11 +11,11 @@ function CDocOpenProgress()
this.CurrentImage = 0;
}
CDocOpenProgress.prototype.get_Type = function(){return this.Type}
CDocOpenProgress.prototype.get_FontsCount = function(){return this.FontsCount}
CDocOpenProgress.prototype.get_CurrentFont = function(){return this.CurrentFont}
CDocOpenProgress.prototype.get_ImagesCount = function(){return this.ImagesCount}
CDocOpenProgress.prototype.get_CurrentImage = function(){return this.CurrentImage}
CDocOpenProgress.prototype.get_Type = function(){return this.Type};
CDocOpenProgress.prototype.get_FontsCount = function(){return this.FontsCount};
CDocOpenProgress.prototype.get_CurrentFont = function(){return this.CurrentFont};
CDocOpenProgress.prototype.get_ImagesCount = function(){return this.ImagesCount};
CDocOpenProgress.prototype.get_CurrentImage = function(){return this.CurrentImage};
function CDocInfo (obj){
if(obj){
......
"use strict";
// ---------------------------------------------------------------
function CAscColorScheme()
{
this.Colors = [];
this.Name = "";
}
CAscColorScheme.prototype.get_colors = function() { return this.Colors; }
CAscColorScheme.prototype.get_name = function() { return this.Name; }
// ---------------------------------------------------------------
// ---------------------------------------------------------------
function CAscTexture()
{
this.Id = 0;
this.Image = "";
}
CAscTexture.prototype.get_id = function() { return this.Id; }
CAscTexture.prototype.get_image = function() { return this.Image; }
// ---------------------------------------------------------------
// цвет. может быть трех типов:
// COLOR_TYPE_SRGB : // value - не учитывается
// COLOR_TYPE_PRST : // value - имя стандартного цвета (map_prst_color)
// COLOR_TYPE_SCHEME : // value - тип цвета в схеме
// sys color - конвертируется в srgb
function CAscColor()
{
this.type = c_oAscColor.COLOR_TYPE_SRGB;
this.value = null;
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 255;
this.Auto = false;
this.Mods = [];
this.ColorSchemeId = -1;
if (1 === arguments.length) {
this.r = arguments[0].r;
this.g = arguments[0].g;
this.b = arguments[0].b;
} else {
if (3 <= arguments.length) {
this.r = arguments[0];
this.g = arguments[1];
this.b = arguments[2];
}
if (4 === arguments.length)
this.a = arguments[3];
}
}
CAscColor.prototype.get_r = function(){return this.r}
CAscColor.prototype.put_r = function(v){this.r = v; this.hex = undefined;}
CAscColor.prototype.get_g = function(){return this.g;}
CAscColor.prototype.put_g = function(v){this.g = v; this.hex = undefined;}
CAscColor.prototype.get_b = function(){return this.b;}
CAscColor.prototype.put_b = function(v){this.b = v; this.hex = undefined;}
CAscColor.prototype.get_a = function(){return this.a;}
CAscColor.prototype.put_a = function(v){this.a = v; this.hex = undefined;}
CAscColor.prototype.get_type = function(){return this.type;}
CAscColor.prototype.put_type = function(v){this.type = v;}
CAscColor.prototype.get_value = function(){return this.value;}
CAscColor.prototype.put_value = function(v){this.value = v;}
CAscColor.prototype.put_auto = function(v){this.Auto = v;}
CAscColor.prototype.get_auto = function(){return this.Auto;}
CAscColor.prototype.get_hex = function()
{
if(!this.hex)
{
var a = this.a.toString(16);
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
this.hex = ( a.length == 1? "0" + a: a) +
( r.length == 1? "0" + r: r) +
( g.length == 1? "0" + g: g) +
( b.length == 1? "0" + b: b);
}
return this.hex;
}
CAscColor.prototype.get_color = function()
{
var ret = new CColor(this.r, this.g, this.b);
return ret;
}
// эта функция ДОЛЖНА минимизироваться
function CreateAscColorCustom(r, g, b, auto)
......@@ -120,20 +28,15 @@ function CreateAscColor(unicolor)
var _color = unicolor.color;
switch (_color.type)
{
case COLOR_TYPE_SRGB:
case COLOR_TYPE_SYS:
{
break;
}
case COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_SRGB:
case c_oAscColor.COLOR_TYPE_SYS:
{
ret.type = c_oAscColor.COLOR_TYPE_PRST;
ret.value = _color.id;
break;
}
case COLOR_TYPE_SCHEME:
case c_oAscColor.COLOR_TYPE_PRST:
case c_oAscColor.COLOR_TYPE_SCHEME:
{
ret.type = c_oAscColor.COLOR_TYPE_SCHEME;
ret.type = _color.type;
ret.value = _color.id;
break;
}
......@@ -165,7 +68,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
{
case c_oAscColor.COLOR_TYPE_PRST:
{
if (ret.color == null || ret.color.type != COLOR_TYPE_PRST)
if (ret.color == null || ret.color.type != c_oAscColor.COLOR_TYPE_PRST)
{
ret.color = new CPrstColor();
}
......@@ -177,7 +80,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
}
case c_oAscColor.COLOR_TYPE_SCHEME:
{
if (ret.color == null || ret.color.type != COLOR_TYPE_SCHEME)
if (ret.color == null || ret.color.type != c_oAscColor.COLOR_TYPE_SCHEME)
{
ret.color = new CSchemeColor();
}
......@@ -239,7 +142,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
}
default:
{
if (ret.color == null || ret.color.type != COLOR_TYPE_SRGB)
if (ret.color == null || ret.color.type != c_oAscColor.COLOR_TYPE_SRGB)
{
ret.color = new CRGBColor();
}
......
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