diff --git a/Test.UI/Components/Pages/BaseEdit.razor.cs b/Test.UI/Components/Pages/BaseEdit.razor.cs index 48bd8d7..846b90b 100644 --- a/Test.UI/Components/Pages/BaseEdit.razor.cs +++ b/Test.UI/Components/Pages/BaseEdit.razor.cs @@ -379,10 +379,11 @@ namespace Test.UI.Components.Pages /// Effettua chiusura oggetto con eventuale save /// /// - private void CloseObj(bool reqSave) + private void CloseObj(DataSave reqSave) { - outClose = !reqSave ? "Richiesto chiusura!" : ""; - outSave = reqSave ? "Richiesto salvataggio!" : ""; + currJwd = reqSave.currJwd; + outClose = !reqSave.open ? "Richiesto chiusura!" : ""; + outSave = reqSave.open ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 11f04c5..d1a90e2 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -423,10 +423,11 @@ namespace Test.UI.Components.Pages /// Effettua chiusura oggetto con eventuale save /// /// - private void CloseObj(bool reqSave) + private void CloseObj(DataSave reqSave) { - outClose = !reqSave ? "Richiesto chiusura!" : ""; - outSave = reqSave ? "Richiesto salvataggio!" : ""; + currJwd = reqSave.currJwd; + outClose = !reqSave.open ? "Richiesto chiusura!" : ""; + outSave = reqSave.open ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Components/Pages/Home.razor.cs index 09fc270..2c3dfac 100644 --- a/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Components/Pages/Home.razor.cs @@ -164,10 +164,11 @@ namespace Test.UI.Components.Pages /// Effettua chiusura oggetto con eventuale save /// /// - private void CloseObj(bool reqSave) + private void CloseObj(DataSave reqSave) { - outClose = !reqSave ? "Richiesto chiusura!" : ""; - outSave = reqSave ? "Richiesto salvataggio!" : ""; + currJwd = reqSave.currJwd; + outClose = !reqSave.open ? "Richiesto chiusura!" : ""; + outSave = reqSave.open ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 4801899..61d504e 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -302,9 +302,13 @@ namespace WebWindowComplex.Compo // Rimuovo riempimento da anta selezionata sashSplitted.AreaList.RemoveAt(0); // Creo la copia dell'anta scelta - Area a = CurrSashGroup.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted); - // Aggiungo copia all'anta selezionata - CurrSashGroup.AreaList[IndexModify].AreaList.Add(a); + Area a; + if (CurrSashGroup.AreaList[IndexCopy].AreaList.FirstOrDefault() != null) + { + a = CurrSashGroup.AreaList[IndexCopy].AreaList.FirstOrDefault()!.Copy(sashSplitted); + // Aggiungo copia all'anta selezionata + CurrSashGroup.AreaList[IndexModify].AreaList.Add(a); + } DataUpdateProfile args = new DataUpdateProfile() { sash = CurrSashGroup, diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index c67171f..a497069 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -106,7 +106,10 @@ namespace WebWindowComplex.Compo { if (CurrFrameWindow.SelThresholdFromType != value) { - string valueName = CurrFrameWindow.ThresholdList.Where(x => x.Type.Equals(value)).First().Name; + Threshold? threshold = CurrFrameWindow.ThresholdList.Where(x => x.Type.Equals(value)).FirstOrDefault(); + string valueName = ""; + if (threshold != null) + valueName = threshold.Name; if (SashList.Count > 0 || (SashList.Count == 0 && !valueName.Equals("Threshold"))) { CurrFrameWindow.SelThresholdFromType = value; diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 909017c..6534975 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -263,9 +263,13 @@ namespace WebWindowComplex.Compo //isOpen = !isOpen; for (int i = 0; i < CurrSashGroup.SashList.Count; i++) { - CurrSashGroup.SashList.ElementAt(i).SetSelMeasureType(type, i); + CurrSashGroup.SashList.ElementAt(i).SelMeasureTypeIndex = (int)type; } - var args = new DataUpdateSash { currSash = CurrSashGroup, noSvg = true }; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + noSvg = true + }; return EC_UpdateSashGroup.InvokeAsync(args); } diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 392d273..5a12aba 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -340,11 +340,13 @@ namespace WebWindowComplex.Compo isOpen = !isOpen; foreach (var item in CurrSplit.SplitVertList) { - item.SetSelMeasureType(type); + item.SelMeasureTypeIndex = (int)type; + //item.SetSelMeasureType(type); } foreach (var item in CurrSplit.SplitHorizList) { - item.SetSelMeasureType(type); + item.SelMeasureTypeIndex = (int)type; + //item.SetSelMeasureType(type); } var args = new DataUpdateSplit() { diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index 233d574..de22354 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -231,7 +231,11 @@ namespace WebWindowComplex.Compo continue; } if(itemSameCol.Count > 0) - return RowCollapsedDict.GetValueOrDefault(itemSameCol.First().Row - 1); + { + ItemTable? firstItem = itemSameCol.FirstOrDefault(); + if (firstItem != null) + return RowCollapsedDict.GetValueOrDefault(firstItem.Row - 1); + } return false; } diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 4fc71e0..9d757c1 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -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 dimList = new List(); + 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 dimList = new List(); 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; } - /// - /// Metodo per calcolare larghezza area - /// - /// area di partenza - /// larghezza di partenza - /// - 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; - } - - /// - /// Metodo per calcolare larghezza area - /// - /// area di partenza - /// altezza di partenza - /// - 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 diff --git a/WebWindowComplex/Models/ElementDimension.cs b/WebWindowComplex/Models/ElementDimension.cs index 392b3be..b402e69 100644 --- a/WebWindowComplex/Models/ElementDimension.cs +++ b/WebWindowComplex/Models/ElementDimension.cs @@ -70,10 +70,15 @@ namespace WebWindowComplex.Models } if (split.SplitHorizList.Count > 0) { + SplitElementDimension currSplitElem = (SplitElementDimension)this; List dimList = new List(); 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 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 dimList = new List(); 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 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"); + } } } } diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index 2507ee4..9df4b76 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -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"); } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 5d522f7..d468d76 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -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 adList = new List(); + 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 diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 4d936cd..b7963b2 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -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 adList = new List(); + List newDimensions = new List(); 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; } } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 3d8268f..46784a4 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -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 dimList = new List(); 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); diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index e9d7741..2a404b5 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -281,28 +281,22 @@ namespace WebWindowComplex.Models { MeasureTypes newType = (MeasureTypes)value; List splitList = new List(); + List splitElemList = new List(); 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 adList = new List(); @@ -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 splitList = new List(); + List splitElemList = new List(); + 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 newDimensions = new List(); - 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 elemList = new List(); - 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 newDimensions = new List(); - 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 adList = new List(); + 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; } } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index e2d6293..40b7cca 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -79,7 +79,7 @@ namespace WebWindowComplex /// se torna false --> richiesta revert /// [Parameter] - public EventCallback EC_OnClose { get; set; } + public EventCallback EC_OnClose { get; set; } /// /// Sollevo evento errore validazione con una lista di errori rilevati @@ -398,7 +398,23 @@ namespace WebWindowComplex { editLock = false; Log.Info("Richietsa Chiusura"); - return EC_OnClose.InvokeAsync(false); + //return EC_OnClose.InvokeAsync(false); + if (m_CurrWindow != null) + { +#if DEBUG + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); +#else + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); +#endif + //manca salvataggio JWD + DataSave dataSave = new DataSave() + { + currJwd = CurrJwd, + open = false, + }; + return EC_OnClose.InvokeAsync(dataSave); + } + return null; } /// @@ -544,8 +560,23 @@ namespace WebWindowComplex { editLock = false; Log.Info("Richietsa Salvataggio"); - //manca salvataggio JWD - return EC_OnClose.InvokeAsync(true); + //return EC_OnClose.InvokeAsync(false); + if (m_CurrWindow != null) + { +#if DEBUG + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); +#else + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); +#endif + //manca salvataggio JWD + DataSave dataSave = new DataSave() + { + currJwd = CurrJwd, + open = true, + }; + return EC_OnClose.InvokeAsync(dataSave); + } + return null; } protected override void OnAfterRender(bool firstRender) @@ -1259,6 +1290,11 @@ namespace WebWindowComplex double valStd = Window.m_ParameterList.GetValueOrDefault(profileNameList.ElementAt(index) + "_DimStd"); anta.ElementDimensionList.Add(new ElementDimension(sash, index + 1, valStd)); } + int numElemDelete = anta.ElementDimensionList.Count - profileNameList.Count; + for (int i = 0; i < numElemDelete; i++) + { + anta.ElementDimensionList.RemoveAt(anta.ElementDimensionList.Count - 1); + } for (int index = profileNameList.Count; index < anta.ElementDimensionList.Count; index++) anta.ElementDimensionList.RemoveAt(index); for (int i = 0; i < anta.ElementDimensionList.Count; i++) @@ -1953,4 +1989,9 @@ namespace WebWindowComplex #endregion Private Methods } -} \ No newline at end of file + public class DataSave + { + public string currJwd { get; set; } + public bool open { get; set; } = false; + } +} diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 63ae3a0..0ebabf6 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.218 + 3.1.3.318 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -267,5 +267,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index d2b9906..87e651f 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.218 + 3.1.3.318 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -215,6 +215,10 @@ + + + +