- Gestito salvataggio e chiusura componente con salvataggio jwd
- Correzioni valori nulli - Aggiunta funzione per calcolare altezza sashGroup
This commit is contained in:
+38
-180
@@ -160,12 +160,12 @@ namespace WebWindowComplex.Models
|
||||
newSplittedList[0].AreaList.Add(ContentArea[0]);
|
||||
if (ContentArea[0] is Fill fill1)
|
||||
{
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[0], fill1.FillType);
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[1], fill1.FillType);
|
||||
newSplittedList[1].AreaList.Add(fill2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[0], FillTypes.GLASS);
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[1], FillTypes.GLASS);
|
||||
newSplittedList[1].AreaList.Add(fill2);
|
||||
}
|
||||
// All'area Split aggiunto le due aree Splitted
|
||||
@@ -174,7 +174,7 @@ namespace WebWindowComplex.Models
|
||||
Frame frame = ParentWindow.AreaList.First();
|
||||
if(frame != null)
|
||||
{
|
||||
frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width");
|
||||
//frame.SearchAreaList(frame, frame.AvailWidthArea(), "Width");
|
||||
frame.SearchAreaList(frame, frame.AvailHeightArea(), "Height");
|
||||
}
|
||||
}
|
||||
@@ -201,13 +201,28 @@ namespace WebWindowComplex.Models
|
||||
public void SwapAree()
|
||||
{
|
||||
Area tempArea;
|
||||
if (this is Sash || this is Split)
|
||||
Frame frame = ParentWindow.AreaList.First();
|
||||
if (this is Split)
|
||||
{
|
||||
tempArea = AreaList[0];
|
||||
AreaList[0] = AreaList[1];
|
||||
AreaList[1] = tempArea;
|
||||
if(frame.SelThreshold.Name.Equals("Threshold") && AreaList.First().AreaList.First() is Fill)
|
||||
{
|
||||
frame.SetSelThresholdFromName("Bottom") ;
|
||||
string profileName = "Frame_Sash_Bottom";
|
||||
frame.ElementDimensionList.First().SetNameElement(profileName);
|
||||
frame.ElementDimensionList.First().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimMin"));
|
||||
frame.ElementDimensionList.First().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimMax"));
|
||||
frame.ElementDimensionList.First().SetDimension(Window.m_ParameterList.GetValueOrDefault(profileName + "_DimStd"));
|
||||
string overlapName = "Sash_Bottom_Overlap";
|
||||
frame.ElementDimensionList.First().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName));
|
||||
if (frame.AreaList.Count > 0)
|
||||
{
|
||||
SearchAreaList(frame, frame.AvailHeightArea(), "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
Frame frame = ParentWindow.AreaList.First();
|
||||
switch (frame.Shape)
|
||||
{
|
||||
case Shapes.RECTANGLE:
|
||||
@@ -275,15 +290,16 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
Sash s = (Sash)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
double dimTot = dim;
|
||||
foreach (var item in s.SashList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if (nameDim.Equals("Width") && s.SashList.First().ElementDimensionList.Count > 0)
|
||||
{
|
||||
double widthSash = dim;
|
||||
|
||||
if (s.ParentArea.ParentArea is Split)
|
||||
widthSash = dim + s.SashList.First().ElementDimensionList.Last().dOverlap
|
||||
dimTot = dim + s.SashList.First().ElementDimensionList.Last().dOverlap
|
||||
+ s.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap;
|
||||
double widthAnta = s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, widthSash);
|
||||
double widthAnta = s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dimTot);
|
||||
if(s.bIsDimensionLight || s.AreaList.ElementAt(i) is Split)
|
||||
widthAnta = widthAnta - s.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- s.SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
@@ -299,22 +315,23 @@ namespace WebWindowComplex.Models
|
||||
else if(s.SashList.First().ElementDimensionList.Count > 0)
|
||||
{
|
||||
if(s.ParentArea is Split split && split.SplitHorizList.Count > 0)
|
||||
dim = dim + s.SashList.ElementAt(i).ElementDimensionList.First().dOverlap
|
||||
+ s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap;
|
||||
dimTot = dimTot + s.SashList.ElementAt(i).ElementDimensionList.First().dOverlap
|
||||
+ s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dOverlap;
|
||||
if(s.SashBottomRailQty > 0)
|
||||
{
|
||||
foreach (var bottomRail in s.BottomRailElemDimList)
|
||||
dim = dim - bottomRail.dDimension
|
||||
+ bottomRail.dOverlap;
|
||||
dimTot = dimTot - bottomRail.dDimension
|
||||
+ bottomRail.dOverlap;
|
||||
}
|
||||
dim = dim - s.SashList.ElementAt(i).ElementDimensionList.First().dDimension
|
||||
- s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension;
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
dimTot = dimTot - s.SashList.ElementAt(i).ElementDimensionList.First().dDimension
|
||||
- s.SashList.ElementAt(i).ElementDimensionList.ElementAt(s.SashList.ElementAt(i).ElementDimensionList.Count() - 2).dDimension;
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim);
|
||||
}
|
||||
}
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
{
|
||||
Split s = (Split)node;
|
||||
double dimTot = dim;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count)
|
||||
{
|
||||
@@ -322,14 +339,13 @@ namespace WebWindowComplex.Models
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if (nameDim.Equals("Width"))
|
||||
{
|
||||
double widthTot = dim;
|
||||
if(s.AreaList.ElementAt(i).AreaList.First() is Sash sash && sash != null)
|
||||
widthTot = widthTot + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap
|
||||
dimTot = dimTot + sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap
|
||||
+ sash.SashList.First().ElementDimensionList.Last().dOverlap;
|
||||
SearchAreaList(node.AreaList.ElementAt(i), widthTot, nameDim);
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim);
|
||||
}
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitHorizList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitHorizList.ElementAt(i).CalculateAbsoluteValue(dimList, dimTot), nameDim);
|
||||
}
|
||||
if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count)
|
||||
{
|
||||
@@ -337,13 +353,12 @@ namespace WebWindowComplex.Models
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent));
|
||||
if (nameDim.Equals("Width"))
|
||||
{
|
||||
double width = dim;
|
||||
foreach (var elem in s.ElemDimVertList)
|
||||
width = width - elem.dDimension;
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, width), nameDim);
|
||||
dimTot = dimTot - elem.dDimension;
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dimTot), nameDim);
|
||||
}
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dimTot, nameDim);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -557,163 +572,6 @@ namespace WebWindowComplex.Models
|
||||
return res / sumPesi * splitDim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza area
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
public double CalculateWidthArea(Area area, double width)
|
||||
{
|
||||
if(width > 0)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(this))
|
||||
return width;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split split)
|
||||
{
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(split.SplitVertList, split.SplitVertList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthArea(item, width);
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else if (area is Sash sash)
|
||||
{
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthArea(item, width);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza area
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="height"> altezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
public double CalculateHeightArea(Area area, double height)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(this))
|
||||
return height;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split split)
|
||||
{
|
||||
if (split.SplitHorizList.Count > 0)
|
||||
{
|
||||
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(split.SplitHorizList, split.SplitHorizList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height) );
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateHeightArea(item, height);
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else if (area is Sash sash)
|
||||
{
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension * height / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateHeightArea(item, height);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
@@ -70,10 +70,15 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
if (split.SplitHorizList.Count > 0)
|
||||
{
|
||||
SplitElementDimension currSplitElem = (SplitElementDimension)this;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in split.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double height = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
|
||||
// Per calcolare larghezza split gorup mi basta una qualsiasi dimensione
|
||||
double height = 0;
|
||||
if (frame != null)
|
||||
height =split.SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
//double height = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
|
||||
List<SplitElementDimension> horizElemList = split.ElemDimHorizList.Where(x=>x.m_nIndex== 1).ToList();
|
||||
foreach (var elem in horizElemList)
|
||||
height = height - elem.dDimension;
|
||||
@@ -94,7 +99,11 @@ namespace WebWindowComplex.Models
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in split.SplitVertList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
// Per calcolare larghezza split gorup mi basta una qualsiasi dimensione
|
||||
double width = 0;
|
||||
if (frame != null)
|
||||
width = split.SplitVertList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
//double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
List<SplitElementDimension> vertElemList = split.ElemDimVertList.Where(x => x.m_nIndex == 1).ToList();
|
||||
foreach (var elem in vertElemList)
|
||||
width = width - elem.dDimension;
|
||||
@@ -148,8 +157,13 @@ namespace WebWindowComplex.Models
|
||||
Frame? frame = sash.ParentWindow.AreaList.FirstOrDefault();
|
||||
if(frame != null)
|
||||
{
|
||||
double height = sash.CalculateHeightSashGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension
|
||||
- sash.SashList.First().ElementDimensionList.First().dDimension
|
||||
- sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dDimension;
|
||||
for (int i = 0; i < sash.AreaList.Count; i++)
|
||||
sash.AreaList.ElementAt(i).SearchAreaList(sash.AreaList.ElementAt(i), sash.AreaList.ElementAt(i).CalculateHeightArea(frame, frame.AvailHeightArea()), "Height");
|
||||
{
|
||||
sash.AreaList.ElementAt(i).SearchAreaList(sash.AreaList.ElementAt(i), height, "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace WebWindowComplex.Models
|
||||
ElementDimensionList.First().SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName));
|
||||
if (AreaList.Count > 0)
|
||||
{
|
||||
SearchAreaList(this, AvailWidthArea(), "Width");
|
||||
SearchAreaList(this, AvailHeightArea(), "Height");
|
||||
}
|
||||
}
|
||||
@@ -719,7 +718,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SelThreshold = m_ThresholdList.FirstOrDefault() ?? new Threshold(3, "Bottom");
|
||||
m_SelThreshold = m_ThresholdList!.FirstOrDefault() ?? new Threshold(3, "Bottom");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace WebWindowComplex.Models
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
double width = SashList.ElementAt(i).dDimension;
|
||||
if(SashList.ElementAt(i).ElementDimensionList.Count > 0)
|
||||
if(SashList.ElementAt(i).ElementDimensionList.Count > 0 && !bIsDimensionLight)
|
||||
width = width - SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension
|
||||
- SashList.ElementAt(i).ElementDimensionList.Last().dDimension;
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width");
|
||||
@@ -1159,7 +1159,7 @@ namespace WebWindowComplex.Models
|
||||
else
|
||||
{
|
||||
double dim = width;
|
||||
if(split.SplitHorizList.Count > 0 && split.AreaList.First().AreaList.First() is Sash sash)
|
||||
if (split.SplitHorizList.Count > 0 && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
|
||||
{
|
||||
dim = dim + sash.SashList.First().ElementDimensionList.Last().dOverlap
|
||||
+ sash.SashList.Last().ElementDimensionList.ElementAt(1).dOverlap;
|
||||
@@ -1209,6 +1209,80 @@ namespace WebWindowComplex.Models
|
||||
return res;
|
||||
}
|
||||
|
||||
internal AreaFound CalculateHeightSashGroup(Area area, double height, AreaFound res)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
if (area.Equals(this))
|
||||
{
|
||||
res.m_Dimension = height;
|
||||
res.m_Found = true;
|
||||
return res;
|
||||
}
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split split)
|
||||
{
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
double dim = height;
|
||||
res = CalculateHeightSashGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
double dim = height;
|
||||
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
dim = split.SplitHorizList.ElementAt(i).dDimension;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
double widthGlass = height;
|
||||
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(i).dDimension, split.SplitHorizList.ElementAt(i).SelMeasureType, split.SplitHorizList.ElementAt(i).Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitHorizList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
foreach (var elem in split.ElemDimHorizList)
|
||||
{
|
||||
widthGlass = widthGlass - elem.dDimension;
|
||||
}
|
||||
dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
foreach (var elem in split.ElemDimHorizList)
|
||||
{
|
||||
dim = dim - elem.dDimension;
|
||||
}
|
||||
dim = split.SplitHorizList.ElementAt(i).dDimension * dim / 100;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
|
||||
dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
+ sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
res = CalculateHeightSashGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSashGroup(item, height, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace WebWindowComplex.Models
|
||||
double dim = dDimension;
|
||||
if (!(MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double width = Parent.CalculateWidthArea(frame, frame.AvailWidthArea());
|
||||
double width = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
dim = ConvertDimension(dimList, MeasureType, MeasureTypes.ABSOLUTE, width, -1);
|
||||
}
|
||||
if (item.AreaList.First() is Split s)
|
||||
@@ -414,7 +414,7 @@ namespace WebWindowComplex.Models
|
||||
Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
if (Parent.bIsDimensionLight)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
@@ -430,13 +430,20 @@ namespace WebWindowComplex.Models
|
||||
+ m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SashList.Count - 1; i++)
|
||||
{
|
||||
widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap;
|
||||
}
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent));
|
||||
newDimensions.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
double overlap = 0;
|
||||
//double overlap = 0;
|
||||
//if (!Parent.bIsDimensionLight)
|
||||
//{
|
||||
// int index = m_Parent.SashList.IndexOf(this);
|
||||
@@ -445,7 +452,7 @@ namespace WebWindowComplex.Models
|
||||
// else
|
||||
// overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap;
|
||||
//}
|
||||
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId - 1);
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, nSashId - 1);
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ namespace WebWindowComplex.Models
|
||||
Frame? frame = ParentWindow.AreaList.FirstOrDefault();
|
||||
if(frame != null)
|
||||
{
|
||||
double heightTot = CalculateHeightArea(frame, frame.AvailHeightArea());
|
||||
double heightTot = SplitHorizList.First().CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
//double heightTot = CalculateHeightArea(frame, frame.AvailHeightArea());
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitHorizList.Count - 1)
|
||||
{
|
||||
@@ -238,7 +239,8 @@ namespace WebWindowComplex.Models
|
||||
Frame? frame = ParentWindow.AreaList.FirstOrDefault();
|
||||
if (frame != null)
|
||||
{
|
||||
double widthTot = CalculateWidthArea(frame, frame.AvailWidthArea());
|
||||
double widthTot = SplitHorizList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
//double widthTot = CalculateWidthArea(frame, frame.AvailWidthArea());
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitVertList.Count - 1)
|
||||
{
|
||||
@@ -624,19 +626,23 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
double thickness = 78;
|
||||
if (ParentArea.ParentArea is Sash)
|
||||
thickness = 60;
|
||||
// Un Elemento per ogni dimensione principale e per ogni sotto dimensione
|
||||
if (bSplitStartVert)
|
||||
{
|
||||
|
||||
for (int subArea = 0; subArea <= QtyVert; subArea++)
|
||||
{
|
||||
for (int i = 0; i < QtyHoriz; i++)
|
||||
ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1));
|
||||
ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, thickness, subArea + 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < QtyHoriz; i++)
|
||||
ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, 0));
|
||||
ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, thickness, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -671,18 +677,21 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
else
|
||||
{
|
||||
double thickness = 78;
|
||||
if (ParentArea.ParentArea is Sash)
|
||||
thickness = 60;
|
||||
// Un Elemento per ogni dimensione principale e per ogni sotto dimensione
|
||||
if (bSplitStartVert)
|
||||
{
|
||||
for (int i = 0; i < QtyVert; i++)
|
||||
ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, 0));
|
||||
ElemDimVertList.Add(new SplitElementDimension(this, i + 1, thickness, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int subArea = 0; subArea <= QtyHoriz; subArea++)
|
||||
{
|
||||
for (int i = 0; i < QtyVert; i++)
|
||||
ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1));
|
||||
ElemDimVertList.Add(new SplitElementDimension(this, i + 1, thickness, subArea + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,12 +754,16 @@ namespace WebWindowComplex.Models
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var itemDim in SplitHorizList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width");
|
||||
//double width = SplitHorizList.First().CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
////double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
//AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), width, "Width");
|
||||
double dim = currSplitDim.dDimension;
|
||||
double height = 0;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double height = ParentArea.CalculateHeightArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailHeightArea());
|
||||
Frame frame = ParentArea.ParentWindow.AreaList[0];
|
||||
if (frame != null)
|
||||
height = currSplitDim.CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
foreach (var elem in ElemDimHorizList)
|
||||
height = height - elem.dDimension;
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, height, -1);
|
||||
@@ -770,9 +783,12 @@ namespace WebWindowComplex.Models
|
||||
foreach (var itemDim in SplitVertList)
|
||||
dimList.Add(new AreaDimension(itemDim.dDimension, itemDim.MeasureType, itemDim.Parent));
|
||||
double dim = currSplitDim.dDimension;
|
||||
double width = 0;
|
||||
if (!(currSplitDim.MeasureType.Equals(MeasureTypes.ABSOLUTE)))
|
||||
{
|
||||
double width = ParentArea.CalculateWidthArea(ParentArea.ParentWindow.AreaList[0], ParentArea.ParentWindow.AreaList[0].AvailWidthArea());
|
||||
Frame frame = ParentArea.ParentWindow.AreaList[0];
|
||||
if(frame != null)
|
||||
width = currSplitDim.CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
foreach (var elem in ElemDimVertList)
|
||||
width = width - elem.dDimension;
|
||||
dim = currSplitDim.ConvertDimension(dimList, currSplitDim.MeasureType, MeasureTypes.ABSOLUTE, width, -1);
|
||||
|
||||
@@ -281,28 +281,22 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
List<SplitDimension> splitList = new List<SplitDimension>();
|
||||
List<SplitElementDimension> splitElemList = new List<SplitElementDimension>();
|
||||
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
{
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()!;
|
||||
double tot = 0;
|
||||
double dimSplitGroup = 0;
|
||||
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.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimVertList)
|
||||
{
|
||||
tot = tot - item.dDimension;
|
||||
}
|
||||
splitElemList = m_Parent.ElemDimVertList;
|
||||
dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
splitList = m_Parent.SplitHorizList;
|
||||
tot = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
foreach (var item in m_Parent.ElemDimHorizList)
|
||||
{
|
||||
tot = tot - item.dDimension;
|
||||
}
|
||||
splitElemList = m_Parent.ElemDimHorizList;
|
||||
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
@@ -310,7 +304,11 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
|
||||
foreach (var item in splitElemList)
|
||||
{
|
||||
dimSplitGroup = dimSplitGroup - item.dDimension;
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, dimSplitGroup, splitList.IndexOf(this));
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
@@ -510,32 +508,31 @@ namespace WebWindowComplex.Models
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
|
||||
{
|
||||
dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
+ sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
}
|
||||
//if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
|
||||
//{
|
||||
// dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
//}
|
||||
res = CalculateHeightSplitGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
double dim = height;
|
||||
//if (split.ParentArea is Frame frame && split.AreaList.ElementAt(i).AreaList.First() is Sash sash)
|
||||
//{
|
||||
// dim = dim + sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
//}
|
||||
res = CalculateHeightSplitGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else if (area is Sash sash)
|
||||
{
|
||||
double overlap = 0;
|
||||
double bottomRail = 0;
|
||||
//if (sash.ParentArea is Split)
|
||||
// overlap = sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
//if (sash.ParentArea.ParentArea is Split)
|
||||
// overlap = sash.SashList.First().ElementDimensionList.First().dOverlap
|
||||
// + sash.SashList.First().ElementDimensionList.ElementAt(sash.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
if(sash.SashBottomRailQty > 0)
|
||||
{
|
||||
foreach (var bottom in sash.BottomRailElemDimList)
|
||||
@@ -549,6 +546,21 @@ namespace WebWindowComplex.Models
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else if (area is Splitted splitted)
|
||||
{
|
||||
double dim = height;
|
||||
if (splitted.ParentArea is Split sp && splitted.AreaList.First() is Sash sh)
|
||||
{
|
||||
if (sp.SplitHorizList.Count > 0)
|
||||
{
|
||||
dim = dim + sh.SashList.First().ElementDimensionList.First().dOverlap
|
||||
+ sh.SashList.First().ElementDimensionList.ElementAt(sh.SashList.First().ElementDimensionList.Count - 2).dOverlap;
|
||||
}
|
||||
}
|
||||
res = CalculateHeightSplitGroup(item, dim, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
@@ -585,61 +597,35 @@ namespace WebWindowComplex.Models
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
List<SplitDimension> splitList = new List<SplitDimension>();
|
||||
List<SplitElementDimension> splitElemList = new List<SplitElementDimension>();
|
||||
if (m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
|
||||
{
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()!;
|
||||
double dimSplitGroup = 0;
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
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, item.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this));
|
||||
//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);
|
||||
// }
|
||||
//}
|
||||
splitList = m_Parent.SplitVertList;
|
||||
splitElemList = m_Parent.ElemDimVertList;
|
||||
dimSplitGroup = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
splitList = m_Parent.SplitHorizList;
|
||||
splitElemList = m_Parent.ElemDimHorizList;
|
||||
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension;
|
||||
List<SplitElementDimension> elemList = new List<SplitElementDimension>();
|
||||
if (Parent.bSplitStartVert)
|
||||
{
|
||||
elemList = m_Parent.ElemDimHorizList.Where(x => x.nSubArea == 1).ToList();
|
||||
}
|
||||
else
|
||||
elemList = m_Parent.ElemDimHorizList;
|
||||
foreach (var item in elemList)
|
||||
{
|
||||
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, item.Parent));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this));
|
||||
//if(newType is MeasureTypes.PROPORTIONAL)
|
||||
//{
|
||||
// for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
|
||||
// {
|
||||
// m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
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, it.Parent));
|
||||
}
|
||||
foreach (var item in splitElemList)
|
||||
{
|
||||
dimSplitGroup = dimSplitGroup - item.dDimension;
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, dimSplitGroup, splitList.IndexOf(this));
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user