WebWindowComplex e WebWindowTest: aggiunta pagina di navigazione per ogni split

This commit is contained in:
Annamaria Sassi
2025-10-03 13:29:15 +02:00
parent e1b2c143e2
commit 499ca91019
10 changed files with 509 additions and 470 deletions
+70 -48
View File
@@ -7,7 +7,6 @@ using Newtonsoft.Json.Linq;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices;
using WebWindowComplex;
using WebWindowComplex.DTO;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
@@ -346,6 +345,7 @@ namespace WebWindowComplex
UpdateLists();
currSash = -1;
currFill = -1;
currSplit = -1;
currStep = CompileStep.Gerarchia;
await DoPreviewSvg();
}
@@ -526,9 +526,9 @@ namespace WebWindowComplex
case AreaTypes.FRAME:
{
if (node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, -1, node.AreaList.Count));
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, -1, 0));
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, 0));
row++;
col++;
maxRow++;
@@ -549,9 +549,9 @@ namespace WebWindowComplex
nWIndow = SashList.Count == 1 ? "" : $"{i + 1}";
// Se il nodo ha figli, salvo il numero nell'oggetto
if (node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN" + nWIndow, maxRow, col, -1, i, node.AreaList.Count));
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN" + nWIndow, maxRow, col, i, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN" + nWIndow, maxRow, col, -1, i, 0));
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN" + nWIndow, maxRow, col, i, 0));
}
}
maxCol++;
@@ -560,9 +560,9 @@ namespace WebWindowComplex
{
// Se il nodo ha figli, salvo il numero nell'oggetto
if (node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN", row, col, -1, 0, node.AreaList.Count));
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN", row, col, 0, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN", row, col, -1, 0, 0));
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "WIN", row, col, 0, 0));
maxCol++;
}
row++;
@@ -575,13 +575,13 @@ namespace WebWindowComplex
if ((node.ParentArea.AreaList.Count > 1 && node.ParentArea.AreaList[0].Equals(node)) ||
(node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1 && node.ParentArea.ParentArea.AreaList[0].AreaList[0].Equals(node)))
maxCol++;
int nFill;
string nFill;
for (int i = 0; i < FillList.Count; i++)
{
if (FillList[i].Equals(node))
{
nFill = i + 1;
ItemTableList.Add(new ItemTable(AreaTypes.FILL, "FL" + nFill, maxRow, col, i, -1, 0));
nFill = FillList.Count == 1 ? "" : $"{i + 1}";
ItemTableList.Add(new ItemTable(AreaTypes.FILL, "FL" + nFill, maxRow, col, i, 0));
break;
}
}
@@ -592,22 +592,37 @@ namespace WebWindowComplex
}
case AreaTypes.SPLIT:
{
// Se il nodo ha fratelli o cugini
if (node.ParentArea.AreaList.Count > 1 || (node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1))
{
if (node.ParentArea.AreaList[0].Equals(node) || node.ParentArea.ParentArea.AreaList[0].Equals(node))
maxCol++;
if (node.AreaList.Count >= 1 || node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", maxRow, col, -1, -1, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", maxRow, col, -1, -1, 0));
for (int i = 0; i < SplitList.Count; i++)
{
if (SplitList[i].Equals(node))
{
string nSplit = SplitList.Count == 1 ? "" : $"{i + 1}";
if (node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP" + nSplit, maxRow, col, i, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP" + nSplit, maxRow, col, i, 0));
}
}
}
else
{
if (node.AreaList.Count >= 1 || node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", row, col, -1, -1, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", row, col, -1, -1, 0));
maxCol++;
for (int i = 0; i < SplitList.Count; i++)
{
if (SplitList[i].Equals(node))
{
string nSplit = SplitList.Count == 1 ? "" : $"{i + 1}";
if (node.AreaList.Count >= 1)
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP" + nSplit, row, col, i, node.AreaList.Count));
else
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP" + nSplit, row, col, i, 0));
maxCol++;
}
}
}
row++;
col++;
@@ -819,6 +834,7 @@ namespace WebWindowComplex
private CompileStep currStep;
private int currAnta = 0;
private int currSash = -1;
private int currSplit = -1;
private int currFill = -1;
private Frame? m_Frame;
private List<Sash> m_SashList = new List<Sash>();
@@ -876,14 +892,30 @@ namespace WebWindowComplex
private async void NextStepAndPreview(CompileStep newStep, int Index = -1)
{
currStep = newStep;
if (newStep == CompileStep.Sash)
currSash = Index;
else
currSash = -1;
if (newStep == CompileStep.Fill)
currFill = Index;
else
currFill = -1;
switch (newStep)
{
case CompileStep.Sash:
{
currSash = Index;
currFill = -1;
currSplit = -1;
break;
}
case CompileStep.Fill:
{
currFill = Index;
currSash = -1;
currSplit = -1;
break;
}
case CompileStep.Split:
{
currSplit = Index;
currSash = -1;
currFill = -1;
break;
}
}
await DoPreviewSvg();
}
@@ -896,6 +928,7 @@ namespace WebWindowComplex
currStep = newStep;
currSash = -1;
currFill = -1;
currSplit = -1;
}
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
@@ -927,6 +960,13 @@ namespace WebWindowComplex
else
return "nav-link text-secondary";
}
else if (testStep == CompileStep.Split)
{
if ((currSplit == 0 && Index == 0) || (currSplit == 1 && Index == 1))
return "nav-link active fw-bold";
else
return "nav-link text-secondary";
}
return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary";
}
@@ -939,31 +979,13 @@ namespace WebWindowComplex
return (currStep == CompileStep.Template) ? "col-12" : "col-6";
}
/// <summary>
/// Calcola larghezza border descrizione split
/// </summary>
/// <returns></returns>
private string splitCss(Split currSplit)
{
return (currSplit.SelSplitShape == SplitShapes.GRID) ? "col-sm-12" : "col-sm-6";
}
/// <summary>
/// Calcola larghezza border descrizione split
/// </summary>
/// <returns></returns>
private string splitContentCss(Split currSplit)
{
return (currSplit.SelSplitShape == SplitShapes.GRID) ? "col-sm-6" : "col-sm-12";
}
/// <summary>
/// Calcola larghezza colonna header nav
/// </summary>
/// <returns></returns>
private string headerCss()
{
return (currStep == CompileStep.Template) ? "col-8 d-grid gap-2 d-md-flex justify-content-md-start" : "col-8 d-grid gap-2 d-md-flex justify-content-md-start";
return (currStep == CompileStep.Template) ? "col-8 d-grid px-2 d-md-flex justify-content-md-start" : "col-8 d-grid px-2 d-md-flex justify-content-md-start";
}
/// <summary>
@@ -972,7 +994,7 @@ namespace WebWindowComplex
/// <returns></returns>
private string buttonCss()
{
return (currStep == CompileStep.Template) ? "col-4 d-grid gap-1 d-md-flex justify-content-md-end" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end";
return (currStep == CompileStep.Template) ? "col-4 d-grid gap-1 d-md-flex justify-content-md-end align-items-center" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end align-items-center";
}
/// <summary>
@@ -982,7 +1004,7 @@ namespace WebWindowComplex
private string buttonFillCss(FillTypes currFillTypes)
{
if (FillList.ElementAt(currFill).SelFillType == currFillTypes)
return "btn btn-secondary btn-sm shadow";
return "btn btn-secondary btn-sm";
else
return "btn btn-outline-secondary btn-sm";
}