Gestiti i diversi tipi di dimensioni per sash
This commit is contained in:
@@ -34,6 +34,21 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Larghezza gruppo ante
|
||||
/// </summary>
|
||||
public double Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Width;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Width = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsMeasureGlass
|
||||
{
|
||||
get
|
||||
@@ -128,7 +143,7 @@ namespace WebWindowComplex.Models
|
||||
// aggiungo area Sash di default
|
||||
for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++)
|
||||
{
|
||||
SashList.Add(new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1));
|
||||
SashList.Add(new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1));
|
||||
}
|
||||
}
|
||||
else if (value < m_SashList.Count)
|
||||
@@ -136,12 +151,16 @@ namespace WebWindowComplex.Models
|
||||
if (value > 0)
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
SashDimension itemDelete = null;
|
||||
for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SashList[SplitIndex].dDimension;
|
||||
//dLastDimension += m_SashList[SplitIndex].dDimension;
|
||||
itemDelete = m_SashList[SplitIndex];
|
||||
SashList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SashList[SashList.Count - 1].dDimension;
|
||||
double deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType);
|
||||
//dLastDimension += m_SashList[SashList.Count - 1].dDimension;
|
||||
dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension;
|
||||
SashList[SashList.Count - 1].SetDimension(dLastDimension);
|
||||
if (value == 1)
|
||||
SashList.First().SetHasHandle(true);
|
||||
@@ -886,10 +905,12 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private List<SashDimension> m_SashList = new List<SashDimension>();
|
||||
private SashTypes m_SashType;
|
||||
private string m_SelFamilyHardware;
|
||||
private string m_SelFamilyHardware = "";
|
||||
private Hardware m_SelHardware;
|
||||
private OrientationSash m_SelOrientationSashType;
|
||||
|
||||
private double m_Width = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace WebWindowComplex.Models
|
||||
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public double dDimension
|
||||
{
|
||||
get
|
||||
@@ -119,13 +119,14 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
case MeasureTypes.ABSOLUT:
|
||||
{
|
||||
valMax = m_Parent.SashList.Sum(x => x.dDimension);
|
||||
valueAccept = (value < valMax && value > 0) ? true: false;
|
||||
valMax = m_Parent.Width;
|
||||
valueAccept = (value < valMax && value > 0) ? true : false;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
valMax = m_Parent.SashList.Sum(x => x.dDimension);
|
||||
valMax = 20;
|
||||
valueAccept = true ;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
@@ -135,69 +136,87 @@ namespace WebWindowComplex.Models
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
if (valueAccept)
|
||||
{
|
||||
if (valueAccept)
|
||||
double widthTot = m_Parent.Width;
|
||||
List <SashDimension> dimensions = m_Parent.SashList;
|
||||
List<double> absolutValList = new List<double>();
|
||||
foreach(var item in m_Parent.SashList)
|
||||
{
|
||||
|
||||
// verifico se ci sono altri in percentuale
|
||||
List<SashDimension> DimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureType)).ToList();
|
||||
if (DimList.Count > 0)
|
||||
absolutValList.Add(item.CalculateAbsolutValue(widthTot));
|
||||
}
|
||||
int nIndex = dimensions.IndexOf(this);
|
||||
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
|
||||
// Le altre dimensioni non sono solo in proporzionale
|
||||
if ( proportionalCount == 0 || proportionalCount < absolutValList.Count - 1)
|
||||
{
|
||||
double valueInAbsolute = 0;
|
||||
switch (MeasureType)
|
||||
{
|
||||
int nIndex = DimList.IndexOf(this);
|
||||
// se diminuisce dimensione
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
if (nIndex < DimList.Count - 1)
|
||||
DimList[nIndex + 1].SetDimension(DimList[nIndex + 1].dDimension + (m_dDimension - value));
|
||||
else if (DimList.Count > 1)
|
||||
DimList[nIndex - 1].SetDimension(DimList[nIndex - 1].dDimension + (m_dDimension - value));
|
||||
else
|
||||
case MeasureTypes.ABSOLUT:
|
||||
{
|
||||
m_dDimension = valMax;
|
||||
return;
|
||||
valueInAbsolute = value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
var pesi = value + dimensions
|
||||
.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
|
||||
.Sum(x => x.m_dDimension);
|
||||
valueInAbsolute = widthTot / pesi * value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
valueInAbsolute = (value / 100) * widthTot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value < dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absolutValList.Count - 1)
|
||||
{
|
||||
absolutValList[nIndex + 1] = absolutValList[nIndex + 1] + (absolutValList[nIndex] - valueInAbsolute);
|
||||
absolutValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// se aumenta dimensione
|
||||
else
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
double dRes = value;
|
||||
// se non ultima anta
|
||||
if (nIndex < DimList.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += DimList[nInd].dDimension;
|
||||
dRes = (100 - dRes) / (DimList.Count - nIndex - 1);
|
||||
for (var Ind = nIndex + 1; Ind <= DimList.Count - 1; Ind++)
|
||||
DimList[Ind].SetDimension(dRes);
|
||||
}
|
||||
// se ultima anta
|
||||
else if (DimList.Count > 1)
|
||||
{
|
||||
if (DimList.Count > 2)
|
||||
{
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += DimList[Ind].dDimension;
|
||||
}
|
||||
dRes = (valMax - dRes);
|
||||
DimList[nIndex - 1].SetDimension(dRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = valMax;
|
||||
return;
|
||||
}
|
||||
absolutValList[nIndex - 1] = absolutValList[nIndex - 1] + (absolutValList[nIndex] - valueInAbsolute);
|
||||
absolutValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
m_dDimension = value;
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
else
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absolutValList.Count - 1)
|
||||
{
|
||||
absolutValList[nIndex + 1] = absolutValList[nIndex + 1] - (valueInAbsolute - absolutValList[nIndex]);
|
||||
absolutValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
absolutValList[nIndex - 1] = absolutValList[nIndex - 1] - (valueInAbsolute - absolutValList[nIndex]);
|
||||
absolutValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
m_dDimension = value;
|
||||
for(int i = 0; i < absolutValList.Count; i++)
|
||||
{
|
||||
var item = m_Parent.SashList.ElementAt(i);
|
||||
item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = value;
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
//// se sono in percentuale
|
||||
//if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE))
|
||||
//{
|
||||
@@ -359,7 +378,13 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
if(m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
m_dDimension = ConvertDimension(m_SelMeasureType, newType);
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,6 +392,57 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
/// </summary>
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUT:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
return Double.Round((m_dDimension / m_Parent.Width) * 100, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ricalculatePropVal();
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUT))
|
||||
{
|
||||
return Double.Round(convertFromPropVal(newType), 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Double.Round(convertFromPropVal(newType));
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUT))
|
||||
{
|
||||
return Double.Round((m_dDimension * m_Parent.Width) / 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Double.Round(ricalculatePropVal());
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per copiare l'intero oggetto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SashDimension Copy()
|
||||
{
|
||||
SashDimension newSashDim = new SashDimension(dDimension, MeasureType, m_Parent, m_nSashId);
|
||||
@@ -382,7 +458,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
internal JsonSashDimension Serialize()
|
||||
{
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, m_bHasHandle, m_dDimension, m_nSashId);
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId);
|
||||
return JsonSashDimension;
|
||||
}
|
||||
|
||||
@@ -406,6 +482,169 @@ namespace WebWindowComplex.Models
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
/// </summary>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateAbsolutValue(double widthTot)
|
||||
{
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUT:
|
||||
{
|
||||
return dDimension;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return calculatePropVal();
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (dDimension / 100) * widthTot;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
/// </summary>
|
||||
/// <param name="absolutVal"> Valore assoluto </param>
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(double absolutVal, MeasureTypes type, double widthTot)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUT:
|
||||
{
|
||||
return absolutVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return calculatePropVal();
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absolutVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double convertFromPropVal(MeasureTypes newType)
|
||||
{
|
||||
double tot = m_Parent.Width;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = m_Parent.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsolutValue(tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = m_Parent.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUT))
|
||||
{
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * dDimension) / tot * 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare il valore proporzionale
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double calculatePropVal()
|
||||
{
|
||||
double tot = m_Parent.Width;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = m_Parent.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsolutValue(tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = m_Parent.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi*dDimension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MCD
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
public static double CalcolaMCD(double a, double b)
|
||||
{
|
||||
while (b != 0)
|
||||
{
|
||||
double temp = b;
|
||||
b = a % b;
|
||||
a = temp;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double ricalculatePropVal()
|
||||
{
|
||||
if(m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
List<double> absolutValue = new List<double>();
|
||||
foreach (var item in m_Parent.SashList)
|
||||
{
|
||||
absolutValue.Add(item.CalculateAbsolutValue(m_Parent.Width));
|
||||
}
|
||||
for(int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
{
|
||||
if(!m_Parent.SashList.ElementAt(i).Equals(this) &&
|
||||
m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
int nIndex = m_Parent.SashList.IndexOf(this);
|
||||
if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i))
|
||||
{
|
||||
var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i));
|
||||
m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absolutValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
else
|
||||
{
|
||||
var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i));
|
||||
m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd;
|
||||
m_dDimension = absolutValue.ElementAt(nIndex) / mcd;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return m_dDimension;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -461,41 +700,5 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero della larghezza del frame
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private double GetWidth()
|
||||
{
|
||||
double width = 0;
|
||||
int indexSash = 0;
|
||||
if (m_Parent.ParentArea != null && m_Parent.ParentArea.ParentArea != null && m_Parent.ParentArea.ParentArea is Split)
|
||||
{
|
||||
Split splitParent = (Split)m_Parent.ParentArea.ParentArea;
|
||||
if(splitParent.SplitVertList.Count > 0)
|
||||
{
|
||||
for(int i = 0; i < splitParent.AreaList.Count; i++)
|
||||
{
|
||||
if (splitParent.AreaList[i].AreaList[0].Equals(this))
|
||||
{
|
||||
indexSash = i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//int indexSash = splitParent.AreaList.Where(x => x.AreaList[0].Equals(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
Frame a = m_Parent.ParentWindow.AreaList[0];
|
||||
FrameDimension? fd = a.DimensionList.Where(x => x.sName == "Width").SingleOrDefault();
|
||||
width = fd.dValue;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,21 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Larghezza gruppo split
|
||||
/// </summary>
|
||||
public double Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Width;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Width = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsPercentage
|
||||
{
|
||||
get
|
||||
@@ -472,6 +487,8 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private List<SplitDimension> m_SplitVertList = new List<SplitDimension>();
|
||||
|
||||
private double m_Width = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowComplex.Json;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
@@ -136,6 +137,54 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
public List<IdNameStruct> MeasureTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureTypeList;
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes SelMeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
if (m_SelMeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
dDimension = 1;
|
||||
}
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
@@ -152,7 +201,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
internal JsonSplitDimension Serialize()
|
||||
{
|
||||
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension);
|
||||
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension, MeasureType);
|
||||
return JsonSplitDimension;
|
||||
}
|
||||
|
||||
@@ -171,6 +220,11 @@ namespace WebWindowComplex.Models
|
||||
m_bIsVertListDim = value;
|
||||
}
|
||||
|
||||
internal void SetMeasureType(MeasureTypes value)
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -181,6 +235,15 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private double m_dDimension;
|
||||
|
||||
private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)MeasureTypes.ABSOLUT, "Absolut"),
|
||||
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
};
|
||||
|
||||
private MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
private Split m_Parent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user