| 1 | namespace CascadeIDE.Services.Presentation; |
| 2 | |
| 3 | /// <summary>MainGrid geometry for compact tier (ADR 0171): editor center, optional auxiliary column, optional bottom MFD dock.</summary> |
| 4 | public static class PresentationCompactMainGridLayoutBuilder |
| 5 | { |
| 6 | public const string CockpitRowDefinitions = "Auto,Auto,*"; |
| 7 | |
| 8 | public static string BuildRowDefinitions(bool intercomBottomVisible, bool mfdBottomVisible) |
| 9 | { |
| 10 | if (!intercomBottomVisible && !mfdBottomVisible) |
| 11 | return CockpitRowDefinitions; |
| 12 | |
| 13 | if (intercomBottomVisible && mfdBottomVisible) |
| 14 | return "Auto,Auto,*,4,Auto,4,Auto"; |
| 15 | |
| 16 | return "Auto,Auto,*,4,Auto"; |
| 17 | } |
| 18 | |
| 19 | public static PresentationMainGridLayoutFrame Build( |
| 20 | bool auxiliaryPanelExpanded, |
| 21 | bool suppressAuxiliaryForHost, |
| 22 | int auxiliaryPanelWidthPx, |
| 23 | int collapsedAuxiliaryWidthPx) |
| 24 | { |
| 25 | if (suppressAuxiliaryForHost || !auxiliaryPanelExpanded) |
| 26 | { |
| 27 | return new PresentationMainGridLayoutFrame( |
| 28 | "0,4,*,4,0", |
| 29 | 1, |
| 30 | false, |
| 31 | new[] { 1.0 }, |
| 32 | new[] { new PresentationZoneBound(PresentationAnchorKind.Forward, 0.0, 1.0) }); |
| 33 | } |
| 34 | |
| 35 | var aux = Math.Max(collapsedAuxiliaryWidthPx, auxiliaryPanelWidthPx); |
| 36 | var columns = $"0,4,*,4,{aux}"; |
| 37 | return new PresentationMainGridLayoutFrame( |
| 38 | columns, |
| 39 | 2, |
| 40 | false, |
| 41 | new[] { 0.75, 0.25 }, |
| 42 | new[] |
| 43 | { |
| 44 | new PresentationZoneBound(PresentationAnchorKind.Forward, 0.0, 0.75), |
| 45 | new PresentationZoneBound(PresentationAnchorKind.Mfd, 0.75, 0.25), |
| 46 | }); |
| 47 | } |
| 48 | |
| 49 | /// <summary>Compact right chrome column width (Intercom aux and/or PFD right).</summary> |
| 50 | public static PresentationMainGridLayoutFrame BuildWithRightChromeWidth( |
| 51 | int rightChromeWidthPx, |
| 52 | int collapsedAuxiliaryWidthPx) |
| 53 | { |
| 54 | if (rightChromeWidthPx <= 0) |
| 55 | { |
| 56 | return new PresentationMainGridLayoutFrame( |
| 57 | "0,4,*,4,0", |
| 58 | 1, |
| 59 | false, |
| 60 | new[] { 1.0 }, |
| 61 | new[] { new PresentationZoneBound(PresentationAnchorKind.Forward, 0.0, 1.0) }); |
| 62 | } |
| 63 | |
| 64 | var aux = Math.Max(collapsedAuxiliaryWidthPx, rightChromeWidthPx); |
| 65 | var columns = $"0,4,*,4,{aux}"; |
| 66 | return new PresentationMainGridLayoutFrame( |
| 67 | columns, |
| 68 | 2, |
| 69 | false, |
| 70 | new[] { 0.75, 0.25 }, |
| 71 | new[] |
| 72 | { |
| 73 | new PresentationZoneBound(PresentationAnchorKind.Forward, 0.0, 0.75), |
| 74 | new PresentationZoneBound(PresentationAnchorKind.Mfd, 0.75, 0.25), |
| 75 | }); |
| 76 | } |
| 77 | } |
| 78 | |