Skip to content

Commit

Permalink
Added guide steps for layouts overview, changed some keybinds, disall…
Browse files Browse the repository at this point in the history
…owed certain characters during creation or renaming of objects, increased opacity for error highlighting, fixed some layout validator issues
  • Loading branch information
BlackTasty committed Jun 10, 2024
1 parent 6ef1dfa commit c4d931b
Show file tree
Hide file tree
Showing 45 changed files with 631 additions and 285 deletions.
3 changes: 3 additions & 0 deletions SLC_LayoutEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Production|Any CPU.ActiveCfg = Release|Any CPU
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Production|Any CPU.Build.0 = Release|Any CPU
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5ECF69D3-D893-4491-9B9B-8B6A892AD13F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
Expand Down
14 changes: 14 additions & 0 deletions SLC_LayoutEditor/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ public partial class App : Application, IUIManager

public static DateTime SessionStart { get; set; }

public static bool IsDebugMode
{
get
{
#if DEBUG
return true;
#else
return false;
#endif
}
}

public static bool IsDesignMode => DesignerProperties.GetIsInDesignMode(new DependencyObject());

public static string DefaultEditorLayoutsPath => defaultEditorLayoutsPath;
Expand All @@ -67,6 +79,7 @@ public partial class App : Application, IUIManager
[STAThread]
public static void Main(string[] args)
{
Logger.Default.ApplyLineLimit();
#if DEBUG
RunApp(args);
#else
Expand All @@ -89,6 +102,7 @@ public static void Main(string[] args)
"This is awkward but...", MessageBoxButton.OK);
}
#endif
Logger.Default.ApplyLineLimit();
}

public void RefreshTheme()
Expand Down
58 changes: 30 additions & 28 deletions SLC_LayoutEditor/Controls/AircraftLayoutsViewControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
</DockPanel>
</UniformGrid>
</Border>
<Border Height="55" MinWidth="460" x:Name="card_layoutTitle"
<Border Height="55" MinWidth="460" x:Name="card_aircraftTitle"
IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=IsHeaderEnabled}">
<Border.Style>
<Style TargetType="Border" BasedOn="{StaticResource CardLayoutTitleStyle}">
Expand All @@ -263,46 +263,48 @@
</Style>
</Border.Style>
<DockPanel Margin="-1.5,0,-1.5,-1.5">
<Button DockPanel.Dock="Left" Click="CreateTemplate_Click"
<Button x:Name="btn_createTemplate" DockPanel.Dock="Left" Click="CreateTemplate_Click"
Style="{StaticResource MakeTemplateButtonStyle}"
Content="{StaticResource Add}"
ToolTip="Create a new template for this aircraft"
local:GuideAssist.Title="{StaticResource GuideCreateTemplateTitle}"
local:GuideAssist.Description="{StaticResource GuideCreateTemplateDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-24"
local:GuideAssist.RadiusOffset="-30"
local:GuideAssist.HighlightXOffset="-2"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=GuideMenu}"
Margin="-10.5,-10.5,15.5,-8.5"
Padding="14.5,16,16.5,14.5"
Width="53" Height="53"/>
<Button DockPanel.Dock="Right" Content="{DynamicResource Add}" Click="CreateLayout_Click"
Style="{StaticResource AddDeckButtonStyle}"
ToolTip="Create a new layout for this aircraft"
local:GuideAssist.Title="{StaticResource GuideCreateLayoutTitle}"
local:GuideAssist.Description="{StaticResource GuideCreateLayoutDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-28"
local:GuideAssist.HighlightXOffset="2"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=GuideMenu}"
Margin="15.5,-9,-6.5,-7"
Padding="16.5,16,14.5,14.5"
Width="53" Height="53"/>
<Button DockPanel.Dock="Right" Content="{DynamicResource Trash}" Click="DeleteAircraft_Click"
Style="{StaticResource ErrorCardButtonStyle}"
ToolTip="Delete this aircraft and all of its layouts. This cannot be undone!"
Margin="24,0,0,0"
local:GuideAssist.Title="{StaticResource GuideDeleteAircraftTitle}"
local:GuideAssist.Description="{StaticResource GuideDeleteAircraftDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-24"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=GuideMenu}"/>
<Button x:Name="btn_createLayout" DockPanel.Dock="Right" Content="{DynamicResource Add}" Click="CreateLayout_Click"
Style="{StaticResource AddDeckButtonStyle}"
ToolTip="Create a new layout for this aircraft"
local:GuideAssist.Title="{StaticResource GuideCreateLayoutTitle}"
local:GuideAssist.Description="{StaticResource GuideCreateLayoutDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-34"
local:GuideAssist.HighlightXOffset="2"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=GuideMenu}"
Margin="15.5,-9,-6.5,-7"
Padding="16.5,16,14.5,14.5"
Width="53" Height="53"/>
<Button x:Name="btn_deleteAircraft" DockPanel.Dock="Right" Content="{DynamicResource Trash}" Click="DeleteAircraft_Click"
Style="{StaticResource ErrorCardButtonStyle}"
ToolTip="Delete this aircraft and all of its layouts. This cannot be undone!"
Margin="24,0,0,0"
local:GuideAssist.Title="{StaticResource GuideDeleteAircraftTitle}"
local:GuideAssist.Description="{StaticResource GuideDeleteAircraftDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-36"
local:GuideAssist.HighlightXOffset="1"
local:GuideAssist.HighlightYOffset="-.5"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AircraftLayoutsViewControl}, Path=GuideMenu}"/>
<StackPanel Margin="52,0,0,0">
<TextBlock Margin="0,2,0,0" Text="Aircraft" Style="{StaticResource CabinLayoutTitleStyle}"/>

Expand Down
11 changes: 7 additions & 4 deletions SLC_LayoutEditor/Controls/CabinLayoutControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
local:GuideAssist.Description="{StaticResource GuideMakeTemplateDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-24"
local:GuideAssist.RadiusOffset="-30"
local:GuideAssist.HighlightXOffset="-2"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CabinLayoutControl}, Path=GuideMenu}"
Expand All @@ -186,7 +186,7 @@
local:GuideAssist.Description="{StaticResource GuideAddDeckDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-28"
local:GuideAssist.RadiusOffset="-34"
local:GuideAssist.HighlightXOffset="2"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CabinLayoutControl}, Path=GuideMenu}"
Expand All @@ -199,7 +199,8 @@
local:GuideAssist.Description="{StaticResource GuideReloadLayoutDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-20"
local:GuideAssist.RadiusOffset="-32"
local:GuideAssist.HighlightYOffset="-.5"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CabinLayoutControl}, Path=GuideMenu}">
<Button.Style>
Expand All @@ -219,7 +220,9 @@
local:GuideAssist.Description="{StaticResource GuideDeleteLayoutDescription}"
local:GuideAssist.HasGuide="True"
local:GuideAssist.TextPosition="Bottom"
local:GuideAssist.RadiusOffset="-24"
local:GuideAssist.RadiusOffset="-36"
local:GuideAssist.HighlightXOffset="1"
local:GuideAssist.HighlightYOffset="-.5"
Cursor="Help"
ContextMenu="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CabinLayoutControl}, Path=GuideMenu}">
<Button.Style>
Expand Down
19 changes: 12 additions & 7 deletions SLC_LayoutEditor/Controls/CabinLayoutControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tasty.Logging;
using Tasty.ViewModel.Communication;

Expand Down Expand Up @@ -99,7 +98,7 @@ private static string GetCabinLayoutValueForLog(CabinLayout cabinLayout)
{
return cabinLayout != null ?
string.Format("{0} (type: {1})", cabinLayout.LayoutName, cabinLayout.IsTemplate ? "template" : "layout") :
"Unset";
"<UNSET>";
}
#endregion

Expand Down Expand Up @@ -221,7 +220,7 @@ public CabinLayoutControl()
}, ViewModelMessage.Deselect_Slots);
}

public void GenerateThumbnailForLayout(bool overwrite = false)
public void GenerateThumbnailsForLayout(bool overwrite = false)
{
if (CabinLayout != null)
{
Expand All @@ -232,7 +231,8 @@ public void GenerateThumbnailForLayout(bool overwrite = false)
{
deckLayoutControl.GenerateThumbnailForDeck(CabinLayout.ThumbnailDirectory, overwrite);
}
Logger.Default.WriteLog("{0} saved successfully!", CabinLayout.IsTemplate ? "template" : "layout");

CabinLayout.CheckThumbnailStore();
}
}

Expand Down Expand Up @@ -433,13 +433,13 @@ private void AddCabinDeck_Click(object sender, RoutedEventArgs e)
}
else
{
ShowDeckSizeDialog(12, 7);
ShowDeckSizeDialog(7, 15);
}
}

private void ShowDeckSizeDialog(int columns, int rows)
{
SpecifyDeckSizeDialog dialog = new SpecifyDeckSizeDialog(columns, rows);
SpecifyDeckSizeDialog dialog = new SpecifyDeckSizeDialog(rows, columns);

dialog.DialogClosing += SpecifyDeckSize_DialogClosing;
dialog.ShowDialog();
Expand All @@ -460,6 +460,11 @@ private void CreateDeck_DialogClosing(object sender, DialogClosingEventArgs e)

private void SpecifyDeckSize_DialogClosing(object sender, DialogClosingEventArgs e)
{
if (sender is IDialog dialog)
{
dialog.DialogClosing -= SpecifyDeckSize_DialogClosing;
}

if (e.DialogResult == DialogResultType.OK && e.Data is int[] deckData)
{
CreateCabinDeck(deckData[0], deckData[1]);
Expand Down Expand Up @@ -570,7 +575,7 @@ private void deck_scroll_SizeChanged(object sender, SizeChangedEventArgs e)

private void container_decks_Loaded(object sender, RoutedEventArgs e)
{
GenerateThumbnailForLayout();
GenerateThumbnailsForLayout();
}

private void RefreshScrollBarVisibleFlags()
Expand Down
17 changes: 12 additions & 5 deletions SLC_LayoutEditor/Controls/CabinLayoutTile.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private static void OnCabinLayoutChanged(DependencyObject sender, DependencyProp
{
CabinLayoutTileViewModel vm = (CabinLayoutTileViewModel)control.DataContext;
vm.CabinLayout = control.CabinLayout;
vm.LoadThumbnails(control.CabinLayout.ThumbnailDirectory);
vm.LoadThumbnails();
}
}

Expand Down Expand Up @@ -78,10 +78,17 @@ public CabinLayoutTile()

Mediator.Instance.Register(o =>
{
if (o is CabinLayout updated && updated.Guid == CabinLayout.Guid)
if (o is LayoutTileRefreshData data && data.CabinLayout != null && data.CabinLayout.Guid == CabinLayout.Guid)
{
vm.CabinLayout = updated;
vm.GenerateThumbnails(updated);
vm.CabinLayout = data.CabinLayout;
if (!data.IsLoadingOnly)
{
vm.GenerateThumbnails();
}
else
{
vm.LoadThumbnails();
}
}
}, ViewModelMessage.Layout_Tile_RefreshData);
}
Expand All @@ -100,7 +107,7 @@ private void NextThumbnail_Click(object sender, RoutedEventArgs e)

private void GenerateThumbnail_Click(object sender, RoutedEventArgs e)
{
vm.GenerateThumbnails(CabinLayout);
vm.GenerateThumbnails();
}

private void DeleteLayoutTemplate_Click(object sender, RoutedEventArgs e)
Expand Down
3 changes: 1 addition & 2 deletions SLC_LayoutEditor/Controls/IssueTracker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
InvalidSlots="{Binding ActiveLayout.DuplicateSeats}"
ShowEye="True" ShowProblemsChanged="DuplicateSeats_ShowIssuesChanged"
ShowProblems="{Binding ShowDuplicateSeatIssues}"/>

<Separator Margin="0,4"/>
<local:LayoutProblemText ValidText="No duplicate doors"
InvalidText="{Binding ActiveLayout.DuplicateDoors.Count, StringFormat={}{0} duplicate doors found!}"
IsValid="{Binding ActiveLayout.HasNoDuplicateDoors}"
Expand All @@ -72,6 +70,7 @@
ShowAutoFix="True"
AutoFixApplying="DuplicateDoors_AutoFixApplying"
Description="Make sure that each door has a unique number across all decks"/>
<Separator Margin="0,4"/>
<local:LayoutProblemText ValidText="Less than 100 doors/bays"
IsValid="{Binding ActiveLayout.HasNoDoorSurplus}"
ShowEye="False"
Expand Down
15 changes: 12 additions & 3 deletions SLC_LayoutEditor/Controls/IssueTracker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,20 @@ private void StairwayPositions_AutoFixApplying(object sender, AutoFixApplyingEve
{
if (e.Target is CabinLayout target)
{
string message;

AutoFixResult result = target.FixStairwayPositions();

string message = result.FailCount > 0 ?
string.Format("{0} non-aisle slots have been overridden while fixing {1} stairway positions.", result.FailCount, result.SuccessCount) :
string.Format("Fixed {0} stairway positions.", result.SuccessCount);
if (!result.WasAborted)
{
message = result.FailCount > 0 ?
string.Format("{0} non-aisle slots have been overridden while fixing {1} stairway positions.", result.FailCount, result.SuccessCount) :
string.Format("Fixed {0} stairway positions.", result.SuccessCount);
}
else
{
message = "Auto-fix was cancelled by the editor:\nAt least 1 stairway is required for the auto-fix to work.";
}

result.SendNotification(message);
}
Expand Down
10 changes: 5 additions & 5 deletions SLC_LayoutEditor/Controls/LayoutProblemText.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@
<Style TargetType="TextBlock" BasedOn="{StaticResource LayoutProblemTextStyle}">
<Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DockPanel}, Path=ValidText}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=IsRequired, UpdateSourceTrigger=PropertyChanged}"
Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledColorBrush}"/>
<Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=NotRequiredText}"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=IsValid, UpdateSourceTrigger=PropertyChanged}"
Expand All @@ -113,6 +108,11 @@
<Setter Property="Foreground" Value="{StaticResource WarnForegroundColorBrush}"/>
<Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=InvalidText}"/>
</MultiDataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=IsRequired, UpdateSourceTrigger=PropertyChanged}"
Value="False">
<Setter Property="Foreground" Value="{StaticResource ForegroundSecondaryColorBrush}"/>
<Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LayoutProblemText}, Path=NotRequiredText}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
Expand Down
Loading

0 comments on commit c4d931b

Please sign in to comment.