- Gestita dimensione standard e solo luce per i cambi di tipologie di misure per sash e split
- Aggiornato metodo per cambiare numero di split - Aggiornato metodo che calcola larghezza sashGroup e splitGroup
This commit is contained in:
@@ -258,7 +258,7 @@ namespace WebWindowComplex.Models
|
||||
Sash s = (Sash)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var item in s.SashList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
@@ -271,7 +271,7 @@ namespace WebWindowComplex.Models
|
||||
if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
else
|
||||
@@ -280,7 +280,7 @@ namespace WebWindowComplex.Models
|
||||
if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitVertList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
@@ -313,13 +313,13 @@ namespace WebWindowComplex.Models
|
||||
else
|
||||
frame = (Frame)sash.ParentArea;
|
||||
foreach (var i in frame.DimensionList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Split s = (Split)sash.ParentArea.ParentArea;
|
||||
foreach (var i in split.SplitVertList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent));
|
||||
}
|
||||
if (countAbsolute == sash.SashList.Count)
|
||||
{
|
||||
@@ -414,7 +414,7 @@ namespace WebWindowComplex.Models
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sashGroup.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = sashGroup.SashList
|
||||
@@ -451,7 +451,7 @@ namespace WebWindowComplex.Models
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = splitList
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AreaDimension(double dDimension, MeasureTypes MeasureType)
|
||||
public AreaDimension(double dDimension, MeasureTypes MeasureType, Area Parent)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_SelMeasureType = MeasureType;
|
||||
//m_Parent = Parent;
|
||||
m_Parent = Parent;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -34,17 +34,17 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
//public Area Parent
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_Parent;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_Parent = value;
|
||||
// }
|
||||
//}
|
||||
public Area Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Parent;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Parent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
@@ -105,7 +105,7 @@ namespace WebWindowComplex.Models
|
||||
protected MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
// protected Area m_Parent;
|
||||
protected Area m_Parent;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace WebWindowComplex.Models
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(List<AreaDimension> itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash)
|
||||
public double ConvertDimension(List<AreaDimension> itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash, double overlap)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
@@ -130,8 +130,17 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
double overlapElem = 0;
|
||||
if (m_Parent is Sash)
|
||||
{
|
||||
// Calcolo overlap
|
||||
Sash s = (Sash)m_Parent;
|
||||
int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1;
|
||||
if (!s.bIsDimensionLight)
|
||||
overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2;
|
||||
}
|
||||
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
return (dDimension / widthTot) * 100;
|
||||
return ((dDimension - overlapElem) / widthTot) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,8 +151,17 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
double overlapElem = 0;
|
||||
if(m_Parent is Sash)
|
||||
{
|
||||
// Calcolo overlap
|
||||
Sash s = (Sash)m_Parent;
|
||||
int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1;
|
||||
if (!s.bIsDimensionLight)
|
||||
overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2;
|
||||
}
|
||||
//return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot) + overlapElem;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,8 +173,17 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
double overlapElem = 0;
|
||||
if (m_Parent is Sash)
|
||||
{
|
||||
// Calcolo overlap
|
||||
Sash s = (Sash)m_Parent;
|
||||
int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1;
|
||||
if (!s.bIsDimensionLight)
|
||||
overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap;
|
||||
}
|
||||
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
return (dDimension * widthTot) / 100;
|
||||
return (dDimension * widthTot) / 100 + overlapElem;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -250,7 +277,17 @@ namespace WebWindowComplex.Models
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
//return Double.Round(dDimension, 2);
|
||||
return dDimension;
|
||||
double overlapElem = 0;
|
||||
if (m_Parent is Sash)
|
||||
{
|
||||
// Calcolo overlap
|
||||
Sash s = (Sash)m_Parent;
|
||||
int indexSash = itemList.IndexOf(this);
|
||||
int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1;
|
||||
if (!s.bIsDimensionLight)
|
||||
overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2;
|
||||
}
|
||||
return dDimension - overlapElem;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
|
||||
@@ -402,29 +402,41 @@ namespace WebWindowComplex.Models
|
||||
m_ThresholdList = m_AllThresholdList;
|
||||
}
|
||||
|
||||
public double HeightFrame()
|
||||
public double AvailHeightFrame()
|
||||
{
|
||||
double dim = 0;
|
||||
switch (SelShapeIndex)
|
||||
{
|
||||
case (int)Shapes.RECTANGLE:
|
||||
case (int)Shapes.TRIANGLE:
|
||||
case (int)Shapes.ARC_FULL:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Height").First().dDimension;
|
||||
dim = DimensionList.Where(x => x.sName == "Height").First().dDimension;
|
||||
break;
|
||||
}
|
||||
case (int)Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
|
||||
dim = DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
|
||||
break;
|
||||
}
|
||||
case (int)Shapes.LEFTCHAMFER:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
|
||||
dim = DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
|
||||
dim = DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
|
||||
break;
|
||||
}
|
||||
}
|
||||
double overlap = 0;
|
||||
if (AreaList.First() is Sash)
|
||||
overlap = ElementDimensionList.ElementAt(1).dOverlap +
|
||||
ElementDimensionList.ElementAt(ElementDimensionList.Count() - 2).dOverlap;
|
||||
return dim - ElementDimensionList.ElementAt(0).dDimension -
|
||||
ElementDimensionList.Last().dDimension +
|
||||
overlap;
|
||||
}
|
||||
|
||||
public override Frame Copy(Area ParentArea)
|
||||
@@ -432,6 +444,26 @@ namespace WebWindowComplex.Models
|
||||
return new Frame(null, ParentWindow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare l'area disponibile
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double AvailWidthArea()
|
||||
{
|
||||
if (DimensionList.Count > 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null)
|
||||
{
|
||||
double dim = DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension;
|
||||
double overlap = 0;
|
||||
if(AreaList.First() is Sash)
|
||||
overlap = ElementDimensionList.ElementAt(1).dOverlap +
|
||||
ElementDimensionList.Last().dOverlap;
|
||||
return dim - ElementDimensionList.ElementAt(0).dDimension -
|
||||
ElementDimensionList.Last().dDimension +
|
||||
overlap;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
@@ -661,24 +693,6 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare l'area disponibile
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double AvailArea()
|
||||
{
|
||||
if(DimensionList.Count> 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null)
|
||||
{
|
||||
// larghezza - elementDim(1) - elementDim(last) + overlapDd + overlapSx
|
||||
return DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension -
|
||||
ElementDimensionList.ElementAt(1).dDimension -
|
||||
ElementDimensionList.Last().dDimension +
|
||||
ElementDimensionList.ElementAt(1).dOverlap +
|
||||
ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE)
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE, ParentFrame)
|
||||
{
|
||||
m_ParentFrame = ParentFrame;
|
||||
m_nIndex = nIndex;
|
||||
|
||||
+168
-10
@@ -267,8 +267,17 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (value > 0 && value <= 3)
|
||||
{
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension); // TODO: width se anta è in un'area di split
|
||||
//double widthTot = ((Frame)ParentArea).AvailArea();
|
||||
Frame frame = (Frame)ParentWindow.AreaList.First();
|
||||
double widthTot = 0;
|
||||
if (bIsDimensionLight)
|
||||
{
|
||||
foreach (var item in m_SashList)
|
||||
widthTot = widthTot + item.dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
widthTot = CalculateWidthSashGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
}
|
||||
if (value > m_SashList.Count)
|
||||
{
|
||||
// recupero larghezza ultimo
|
||||
@@ -277,9 +286,20 @@ namespace WebWindowComplex.Models
|
||||
if (m_SashList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SashList[m_SashList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSashQty);
|
||||
if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
else if (m_SashList[m_SashList.Count - 1].MeasureType is MeasureTypes.PERCENTAGE)
|
||||
dNewDimension = dLastDimension / (value + 1 - nSashQty);
|
||||
else
|
||||
{
|
||||
if (bIsDimensionLight)
|
||||
dNewDimension = (dLastDimension - m_SashList.Last().ElementDimensionList.ElementAt(1).dDimension
|
||||
- m_SashList.Last().ElementDimensionList.Last().dDimension
|
||||
+ m_SashList.Last().ElementDimensionList.Last().dOverlap) / 2;
|
||||
else
|
||||
dNewDimension = dLastDimension / (value + 1 - nSashQty)
|
||||
+ (m_SashList.Last().ElementDimensionList.Last().dOverlap / 2);
|
||||
}
|
||||
m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension);
|
||||
}
|
||||
else
|
||||
@@ -301,28 +321,37 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
SashDimension itemDelete = new SashDimension(0, MeasureTypes.NULL, this, 0);
|
||||
double deleteDim;
|
||||
double deleteDim = 0;
|
||||
double splitDelete = 0;
|
||||
for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
{
|
||||
//dLastDimension += m_SashList[SplitIndex].dDimension;
|
||||
itemDelete = m_SashList[SplitIndex];
|
||||
if(itemDelete.SelMeasureType is MeasureTypes.ABSOLUTE)
|
||||
{
|
||||
if (bIsDimensionLight)
|
||||
splitDelete = m_SashList[m_SashList.Count - 2].ElementDimensionList.ElementAt(1).dDimension
|
||||
+ m_SashList.Last().ElementDimensionList.Last().dDimension
|
||||
- m_SashList.Last().ElementDimensionList.Last().dOverlap;
|
||||
else
|
||||
splitDelete = - m_SashList.Last().ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
SashList.RemoveAt(SplitIndex);
|
||||
}
|
||||
if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType))
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType, itemDelete.Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete));
|
||||
deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete), SashList.Last().ElementDimensionList.Last().dOverlap);
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteDim = itemDelete.dDimension;
|
||||
}
|
||||
dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension;
|
||||
dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension + splitDelete;
|
||||
SashList[SashList.Count - 1].SetDimension(dLastDimension);
|
||||
if (value == 1)
|
||||
SashList.First().SetHasHandle(true);
|
||||
@@ -741,6 +770,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
m_IsbDimensionLight = DimensionLight;
|
||||
}
|
||||
|
||||
internal static Sash CreateSash(Area Area)
|
||||
{
|
||||
Sash newSash = new Sash(Area, Area.ParentWindow);
|
||||
@@ -1056,6 +1086,135 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
internal AreaFound CalculateWidthSashGroup(Area area, double width, AreaFound res)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
if (area.Equals(this))
|
||||
{
|
||||
res.m_Dimension = width;
|
||||
res.m_Found = true;
|
||||
return res;
|
||||
}
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
double dim = width;
|
||||
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
dim = split.SplitVertList.ElementAt(i).dDimension;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
double widthGlass = width;
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType, split.SplitVertList.ElementAt(i).Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
foreach (var elem in split.ElemDimVertList)
|
||||
{
|
||||
widthGlass = widthGlass - elem.dDimension;
|
||||
}
|
||||
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
foreach (var elem in split.ElemDimVertList)
|
||||
{
|
||||
dim = dim - elem.dDimension;
|
||||
}
|
||||
dim = split.SplitVertList.ElementAt(i).dDimension * dim / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (split.ParentArea is Frame && split.AreaList.ElementAt(i).AreaList.First() is Sash)
|
||||
{
|
||||
Frame frame = (Frame)split.ParentArea;
|
||||
string overlapName = string.Join("_", split.ElemDimVertList.First().sName.Split('_').Skip(1)) + "_Top_Overlap";
|
||||
if (i == 0)
|
||||
{
|
||||
dim = dim + frame.ElementDimensionList.Last().dOverlap
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
else if (i == split.SplitVertList.Count - 1)
|
||||
{
|
||||
dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
else
|
||||
{
|
||||
dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName)
|
||||
+ Window.m_ParameterList.GetValueOrDefault(overlapName);
|
||||
}
|
||||
}
|
||||
res = CalculateWidthSashGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateWidthSashGroup(item, width, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
SashDimension anta = sash.SashList.ElementAt(i);
|
||||
AreaDimension ad = new AreaDimension(anta.dDimension, anta.SelMeasureType, anta.Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
res = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else if (area is Frame)
|
||||
{
|
||||
Frame f = (Frame)area;
|
||||
res = CalculateWidthSashGroup(item, f.AvailWidthArea(), res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateWidthSashGroup(item, width, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -1079,7 +1238,6 @@ namespace WebWindowComplex.Models
|
||||
|
||||
private int m_nSashBottomRailQty;
|
||||
|
||||
private List<ElementDimension> m_ElementDimensionList = new List<ElementDimension>();
|
||||
private List<ElementDimension> m_BottomRailElemDimList = new List<ElementDimension>();
|
||||
private List<IdNameStruct> m_OrientationSashTypeList = new List<IdNameStruct>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
using WebWindowComplex.Json;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
@@ -9,7 +10,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType)
|
||||
public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType, Parent)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_nSashId = nSashId;
|
||||
@@ -149,25 +150,25 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
//double widthTot = ((Frame)m_Parent.ParentArea).AvailArea();
|
||||
//if (m_Parent.bIsDimensionLight)
|
||||
//{
|
||||
// for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
// {
|
||||
// if(i == 0)
|
||||
// widthTot = widthTot
|
||||
// - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
// - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
// else
|
||||
// widthTot = widthTot
|
||||
// - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
// - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
|
||||
// + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap;
|
||||
// }
|
||||
//}
|
||||
double widthTot = (Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
if (m_Parent.bIsDimensionLight)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
widthTot = widthTot
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
else
|
||||
widthTot = widthTot
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
|
||||
+ m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
}
|
||||
double valMinAbsolute = 100;
|
||||
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
|
||||
bool valueAccept = false;
|
||||
@@ -196,11 +197,11 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
List<SashDimension> dimensions = m_Parent.SashList;
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
int index = 0;
|
||||
foreach (var item in m_Parent.SashList)
|
||||
@@ -403,25 +404,41 @@ namespace WebWindowComplex.Models
|
||||
if(SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
if (m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
// TODO: availArea per aree che non sono frame
|
||||
//double widthTot = ((Frame)m_Parent.ParentArea).AvailArea();
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
if (Parent.bIsDimensionLight)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
widthTot = widthTot
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
else
|
||||
widthTot = widthTot
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
|
||||
+ m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
//if (it.SelMeasureType is MeasureTypes.ABSOLUTE)
|
||||
//{
|
||||
// if (it.bHasHandle)
|
||||
// adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.ElementAt(1).dOverlap) / 2, it.SelMeasureType));
|
||||
// else
|
||||
// adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.Last().dOverlap) / 2, it.SelMeasureType));
|
||||
//}
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1);
|
||||
double overlap = 0;
|
||||
if (!Parent.bIsDimensionLight)
|
||||
{
|
||||
int index = m_Parent.SashList.IndexOf(this);
|
||||
if (index == 0)
|
||||
overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap;
|
||||
else
|
||||
overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId - 1, overlap);
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
@@ -464,100 +481,6 @@ namespace WebWindowComplex.Models
|
||||
m_dDimension = Dimension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza intera sash group
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateWidthSashGroup(Area area, double width)
|
||||
{
|
||||
if (width < 1)
|
||||
return width;
|
||||
for(int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(m_Parent))
|
||||
return width;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach(var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, width);
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, ConvertFromPropVal(MeasureTypes.ABSOLUTE, width, sash.SashList.ElementAt(i).dDimension));
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, width);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
internal JsonSashDimension Serialize()
|
||||
{
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, dDimension, m_nSashId);
|
||||
@@ -593,17 +516,41 @@ namespace WebWindowComplex.Models
|
||||
if (SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
if (Parent.bIsDimensionLight)
|
||||
{
|
||||
for(int i = 0; i < Parent.SashList.Count; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
else
|
||||
widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension
|
||||
+ Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
//if(SelMeasureType is MeasureTypes.ABSOLUTE)
|
||||
// ad = new AreaDimension(dDimension - ElementDimensionList.ElementAt(1).dOverlap, SelMeasureType);
|
||||
//else
|
||||
// ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach(var item in m_Parent.SashList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
int index = m_Parent.SashList.IndexOf(this);
|
||||
double overlap = 0;
|
||||
if (index == 0)
|
||||
overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap;
|
||||
else
|
||||
overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap;
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash, overlap);
|
||||
if (newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < newDimensions.Count; i++)
|
||||
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace WebWindowComplex.Models
|
||||
if (m_SplitHorizList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
|
||||
dNewDimension = (dLastDimension - m_ElemDimHorizList.Last().dDimension) / (value + 1 - nSplitQtyHoriz);
|
||||
if (m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension);
|
||||
@@ -133,7 +133,7 @@ namespace WebWindowComplex.Models
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SplitHorizList[SplitIndex].dDimension;
|
||||
dLastDimension += m_SplitHorizList[SplitIndex].dDimension + m_ElemDimHorizList[SplitIndex - 1].dDimension;
|
||||
m_SplitHorizList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
@@ -213,9 +213,10 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
Frame? frame = ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
double widthTot = CalculateWidthArea(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitVertList.Count - 1)
|
||||
{
|
||||
@@ -225,7 +226,7 @@ namespace WebWindowComplex.Models
|
||||
if (m_SplitVertList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
|
||||
dNewDimension = (dLastDimension - ElemDimVertList.Last().dDimension) / (value + 1 - nSplitQtyVert);
|
||||
if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
|
||||
@@ -276,7 +277,7 @@ namespace WebWindowComplex.Models
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
|
||||
dLastDimension += m_SplitVertList[SplitIndex].dDimension + ElemDimVertList[SplitIndex - 1].dDimension;
|
||||
m_SplitVertList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType)
|
||||
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType, Parent)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_bIsRelative = bIsRelative;
|
||||
@@ -61,7 +61,7 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
dimensions = m_Parent.SplitHorizList;
|
||||
//dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimensionTot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimensionTot = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
}
|
||||
double valMinAbsolute = 100;
|
||||
double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1);
|
||||
@@ -90,11 +90,11 @@ namespace WebWindowComplex.Models
|
||||
if (valueAccept)
|
||||
{
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in dimensions)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
foreach (var item in dimensions)
|
||||
{
|
||||
@@ -260,20 +260,29 @@ namespace WebWindowComplex.Models
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
splitList = m_Parent.SplitVertList;
|
||||
tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
//tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
tot = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimVertList)
|
||||
{
|
||||
tot = tot - item.dDimension;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
splitList = m_Parent.SplitHorizList;
|
||||
tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
tot = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimHorizList)
|
||||
{
|
||||
tot = tot - item.dDimension;
|
||||
}
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this), 0);
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
@@ -329,11 +338,11 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res);
|
||||
break;
|
||||
@@ -361,23 +370,40 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension, res);
|
||||
double dim = sash.SashList.ElementAt(i).dDimension;
|
||||
if (!sash.bIsDimensionLight)
|
||||
dim = dim -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
res = CalculateWidthSplitGroup(item, dim, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res);
|
||||
int index = adList.IndexOf(ad) == 0 ? 1 : adList.Count - 1;
|
||||
double dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width) + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(index).dOverlap / 2;
|
||||
dim = dim -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
res = CalculateWidthSplitGroup(item, dim, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res);
|
||||
double overlapElem = 0;
|
||||
int indElem = i == 0 ? 1 : sash.SashList.ElementAt(i).ElementDimensionList.Count - 1;
|
||||
if (!sash.bIsDimensionLight)
|
||||
overlapElem = sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(indElem).dOverlap / 2;
|
||||
double dim = sash.SashList.ElementAt(i).dDimension * width / 100 + overlapElem -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension -
|
||||
sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
res = CalculateWidthSplitGroup(item, dim, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -430,11 +456,11 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType);
|
||||
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitHorizList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
double heightItemGroup = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height);
|
||||
res = CalculateHeightSplitGroup(item, heightItemGroup, res);
|
||||
@@ -457,6 +483,15 @@ namespace WebWindowComplex.Models
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash s = (Sash)area;
|
||||
height = height - s.SashList.First().ElementDimensionList.First().dDimension
|
||||
- s.SashList.First().ElementDimensionList.ElementAt(s.SashList.First().ElementDimensionList.Count - 2).dDimension;
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
@@ -499,32 +534,42 @@ namespace WebWindowComplex.Models
|
||||
double dimSplitGroup = 0;
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension;
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
//dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension;
|
||||
dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimVertList)
|
||||
{
|
||||
dimSplitGroup = dimSplitGroup - item.dDimension;
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitVertList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this));
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this), 0);
|
||||
if (newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SplitVertList.Count; i++)
|
||||
{
|
||||
m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
} }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimHorizList)
|
||||
{
|
||||
dimSplitGroup = dimSplitGroup - item.dDimension;
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitHorizList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this));
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this), 0);
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
|
||||
|
||||
Reference in New Issue
Block a user