Add support for larger codeplugs with many channels

pull/1/head
php 1 year ago
parent f2d2bf1eeb
commit ab67de1668

@ -4,7 +4,12 @@
xmlns:local="clr-namespace:WhackerLinkConsoleV2.Controls"
Title="WhackerLinkConsoleV2" Height="600" Width="1000" Background="#1e1e1e">
<Grid>
<Menu VerticalAlignment="Top" Height="25">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Menu VerticalAlignment="Top" Height="25" Grid.Row="0">
<MenuItem Header="File">
<MenuItem Header="Open Codeplug" Click="OpenCodeplug_Click"/>
</MenuItem>
@ -18,7 +23,8 @@
</MenuItem>
</Menu>
<Canvas x:Name="ChannelsCanvas" Margin="0,25,0,0" Background="#1e1e1e">
</Canvas>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Grid.Row="1">
<Canvas x:Name="ChannelsCanvas" Background="#1e1e1e" HorizontalAlignment="Stretch"/>
</ScrollViewer>
</Grid>
</Window>

@ -192,6 +192,8 @@ namespace WhackerLinkConsoleV2
ChannelsCanvas.Children.Add(alertTone);
}
AdjustCanvasHeight();
}
private void SelectWidgets_Click(object sender, RoutedEventArgs e)
@ -235,6 +237,8 @@ namespace WhackerLinkConsoleV2
{
_settingsManager.UpdateChannelPosition(channelBox.ChannelName, newLeft, newTop);
}
AdjustCanvasHeight();
}
private void ChannelBox_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
@ -265,6 +269,8 @@ namespace WhackerLinkConsoleV2
_settingsManager.SystemStatusPositions[systemStatusBox.SystemName] = new ChannelPosition { X = x, Y = y };
ChannelBox_MouseRightButtonDown(sender, e);
AdjustCanvasHeight();
}
}
@ -323,6 +329,8 @@ namespace WhackerLinkConsoleV2
ChannelsCanvas.Children.Add(alertTone);
_settingsManager.UpdateAlertTonePaths(alertFilePath);
AdjustCanvasHeight();
}
}
@ -335,13 +343,25 @@ namespace WhackerLinkConsoleV2
double x = Canvas.GetLeft(alertTone);
double y = Canvas.GetTop(alertTone);
_settingsManager.UpdateAlertTonePosition(alertTone.AlertFilePath, x, y);
AdjustCanvasHeight();
}
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
private void AdjustCanvasHeight()
{
_settingsManager.SaveSettings();
base.OnClosing(e);
double maxBottom = 0;
foreach (UIElement child in ChannelsCanvas.Children)
{
double childBottom = Canvas.GetTop(child) + child.RenderSize.Height;
if (childBottom > maxBottom)
{
maxBottom = childBottom;
}
}
ChannelsCanvas.Height = maxBottom + 150;
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
@ -355,5 +375,11 @@ namespace WhackerLinkConsoleV2
GenerateChannelWidgets();
}
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
_settingsManager.SaveSettings();
base.OnClosing(e);
}
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.