aggiunti bottoni per copiare singola anta

This commit is contained in:
Annamaria Sassi
2025-09-08 18:43:28 +02:00
parent 7c41a000c2
commit 1baeeb1b1e
5 changed files with 410 additions and 89 deletions
+179 -46
View File
@@ -232,6 +232,8 @@ namespace WebWindowComplex
AreaList[1] = tempArea;
}
}
public abstract Area Copy();
}
public class Frame : Area
@@ -634,6 +636,11 @@ namespace WebWindowComplex
}
}
public override Frame Copy()
{
return null;
}
internal override JsonArea Serialize()
{
JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty);
@@ -693,14 +700,16 @@ namespace WebWindowComplex
}
else
{
// Se tolgo singola anta, ma tengo split
SashList.RemoveAt(0);
}
}
if(m_SashList.Count == 0)
{
Area child = AreaList[0];
// Se nella singola anta ho uno split
if(!(child is Fill))
if (!(child is Fill))
{
child = child.AreaList[0].AreaList[0];
}
@@ -708,64 +717,110 @@ namespace WebWindowComplex
this.ParentArea.AreaList.Remove(this);
this.ParentArea.AreaList.Add(child);
}
// Se ho singola anta
else if (m_SashList.Count == 1)
{
// Metto come padre dell'area nello splitted l'anta stessa
List<Area> ContentArea = new List<Area>();
while (AreaList.Count > 0)
{
if (AreaList.Count == 1 & AreaList[0].AreaList.Count > 0)
{
foreach (Area selArea in AreaList[0].AreaList)
{
ContentArea.Add(selArea);
}
}
AreaList.Remove(AreaList[AreaList.Count - 1]);
}
if (ContentArea.Count > 0)
{
AreaList = ContentArea;
}
ContentArea.Add(AreaList[0].AreaList[0]);
ContentArea[0].SetParentArea(this);
AreaList.Clear();
AreaList.Add(ContentArea[0]);
//while (AreaList.Count > 0)
//{
// if (AreaList.Count == 1 & AreaList[0].AreaList.Count > 0)
// {
// foreach (Area selArea in AreaList[0].AreaList)
// {
// ContentArea.Add(selArea);
// }
// }
// AreaList.Remove(AreaList[AreaList.Count - 1]);
//}
//if (ContentArea.Count > 0)
//{
// AreaList = ContentArea;
//}
}
else
{
List<Area> ContentArea = new List<Area>();
if (AreaList.Count == 1 & SashList.Count > AreaList.Count)
// Se aggiungo ante
if(SashList.Count > AreaList.Count)
{
ContentArea.Add(AreaList.ElementAt(0));
AreaList.Clear();
}
for (int SplitIndex = AreaList.Count; SplitIndex <= SashList.Count - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
}
for (int SplitIndex = SashList.Count; SplitIndex <= AreaList.Count() - 1; SplitIndex++)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
}
if (AreaList[AreaList.Count - 1].AreaList.Count == 0)
{
if (ContentArea.Count > 0)
List<Area> ContentArea = new List<Area>();
// Salvo in ContentArea il sottoalbero delle singole aree che mantengo
if (AreaList.Count >= 1 & SashList.Count > AreaList.Count)
{
for (int SplitIndex = 0; SplitIndex <= AreaList.Count() - 1; SplitIndex++)
foreach (Area area in AreaList)
{
if (SplitIndex == 0)
{
AreaList[0].AreaList.Add(ContentArea[0]);
}
if (area is Splitted)
ContentArea.Add(area.AreaList[0]);
else
{
Fill f1 = (Fill)ContentArea[0];
AreaList[SplitIndex].AreaList.Add(Fill.CreateFill(AreaList[SplitIndex], f1.FillType));
}
ContentArea.Add(area);
}
AreaList.Clear();
}
else
for (int SplitIndex = AreaList.Count; SplitIndex <= SashList.Count - 1; SplitIndex++)
{
Fill f1 = (Fill)AreaList[AreaList.Count - 2].AreaList[0];
AreaList[AreaList.Count - 1].AreaList.Add(Fill.CreateFill(AreaList[AreaList.Count - 1], f1.FillType));
AreaList.Add(Splitted.CreateSplitted(this));
}
// Riaggiungo i sottoalberi che avevo salvato
for (int i = 0; i < AreaList.Count - 1; i++)
{
if (AreaList.Count == 2)
{
ContentArea[i].SetParentArea(AreaList[i]);
}
AreaList[i].AreaList.Add(ContentArea[i]);
}
// Aggiungo all'ultimo Splitted l'area di vetro
Fill newFill = new Fill(AreaList[1], ParentWindow);
newFill.SetFillType(FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se tolgo anta
else
{
for (int SplitIndex = SashList.Count; SplitIndex <= AreaList.Count() - 1; SplitIndex++)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
break;
}
}
//if (AreaList[AreaList.Count - 1].AreaList.Count == 0)
//{
// if (ContentArea.Count > 0)
// {
// if (ContentArea[0] is Fill)
// {
// for (int SplitIndex = 0; SplitIndex <= AreaList.Count() - 1; SplitIndex++)
// {
// if (SplitIndex == 0)
// {
// AreaList[0].AreaList.Add(ContentArea[0]);
// }
// else
// {
// Fill f1 = (Fill)ContentArea[0];
// AreaList[SplitIndex].AreaList.Add(Fill.CreateFill(AreaList[SplitIndex], f1.FillType));
// }
// }
// }
// else
// {
// AreaList[0].AreaList.Add(ContentArea[0]);
// AreaList[1].AreaList.Add(ContentArea[0]);
// }
// }
// else
// {
// Fill f1 = (Fill)AreaList[AreaList.Count - 2].AreaList[0];
// AreaList[AreaList.Count - 1].AreaList.Add(Fill.CreateFill(AreaList[AreaList.Count - 1], f1.FillType));
// }
//}
}
}
//RefreshHardwareList();
@@ -858,7 +913,6 @@ namespace WebWindowComplex
}
}
private bool m_bIsSashVertical;
public bool bIsSashVertical
{
@@ -1278,6 +1332,32 @@ namespace WebWindowComplex
}
}
public override Sash Copy()
{
Sash newSash = new Sash(ParentArea, m_ParentWindow);
newSash.SetAreaType(AreaType);
newSash.SetSashQty(nSashQty);
newSash.SetIsSashVertical(bIsSashVertical);
newSash.SetOrientationSashType(OrientationSashType);
newSash.SetSashBottomRailQty(SashBottomRailQty);
foreach (var item in SashList)
{
SashDimension dim = item.Copy();
newSash.SashList.Add(dim);
}
foreach (var item in JointList)
{
Joint j = item.Copy();
newSash.JointList.Add(j);
}
foreach (var item in AreaList)
{
Area a = item.Copy();
newSash.AreaList.Add(a);
}
return newSash;
}
internal override JsonArea Serialize()
{
JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty/*, m_SelHardware.sId*/);
@@ -1479,6 +1559,20 @@ namespace WebWindowComplex
return Split;
}
public override Split Copy()
{
Split newSplit = new Split(ParentArea, ParentWindow);
newSplit.SetSplitQty(nSplitQty);
newSplit.SetSplitShape(SelSplitShape, true);
newSplit.SetAreaType(AreaType);
foreach(var item in AreaList)
{
Area a = item.Copy();
newSplit.AreaList.Add(a);
}
return newSplit;
}
internal override JsonArea Serialize()
{
JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape);
@@ -1504,6 +1598,18 @@ namespace WebWindowComplex
return Splitted;
}
public override Splitted Copy()
{
Splitted newSplitted = new Splitted(ParentArea, ParentWindow);
newSplitted.SetAreaType(AreaType);
foreach (var item in AreaList)
{
Area a = item.Copy();
newSplitted.AreaList.Add(a);
}
return newSplitted;
}
internal override JsonArea Serialize()
{
JsonSplitted JsonSplitted = new JsonSplitted();
@@ -1576,6 +1682,14 @@ namespace WebWindowComplex
return Fill;
}
public override Fill Copy()
{
Fill newFill = new Fill(ParentArea, m_ParentWindow);
newFill.SetFillType(SelFillType);
newFill.SetAreaType(AreaType);
return newFill;
}
internal override JsonArea Serialize()
{
JsonFill JsonFill = new JsonFill(FillType);
@@ -1647,6 +1761,13 @@ namespace WebWindowComplex
m_SelJointType = value;
//NotifyPropertyChanged(nameof(SelJointTypeIndex));
}
public Joint Copy()
{
Joint newJoint = new Joint(ParentArea,nIndex, SelJointType);
return newJoint;
}
public Joint(Area ParentArea, int nIndex, Joints SelJointType)
{
m_ParentArea = ParentArea;
@@ -2006,7 +2127,6 @@ namespace WebWindowComplex
//m_Parent.SetFirstHardware();
}
}
public Openings OpeningType
{
get
@@ -2132,6 +2252,14 @@ namespace WebWindowComplex
m_dDimension = dValue;
}
public SashDimension Copy()
{
SashDimension newSashDim = new SashDimension(dDimension, bIsRelative, m_Parent);
newSashDim.SetOpeningType(SelOpeningType);
newSashDim.SetHasHandle(bHasHandle);
return newSashDim;
}
public SashDimension(double dDimension, bool bIsRelative, Sash Parent)
{
m_dDimension = dDimension;
@@ -2322,6 +2450,11 @@ namespace WebWindowComplex
m_dDimension = dValue;
}
public SplitDimension Copy()
{
SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent);
return newSplitDim;
}
public SplitDimension(double dDimension, bool bIsRelative, Split Parent)
{
m_dDimension = dDimension;