Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add orientation change btn for 2 vert and 2 hort #71

Merged
merged 8 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DCS-SR-Client/DCS-SR-Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Resource Include="SRS_Orientation_Toggle.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="UI\ClientWindow\vanguardsrsback.png" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
Expand Down
Binary file added DCS-SR-Client/SRS_Orientation_Toggle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ private void ToggleOverlay(bool uiButton, int switchTo)
switch (switchTo)
{
case 0:
windows[switchTo] = new RadioOverlayWindowTwoVertical();
windows[switchTo] = new RadioOverlayWindowTwoVertical(ToggleOverlay);
break;
case 1:
windows[switchTo] = new RadioOverlayWindowThreeVertical();
Expand All @@ -1473,7 +1473,7 @@ private void ToggleOverlay(bool uiButton, int switchTo)
windows[switchTo] = new RadioOverlayWindowTenVertical();
break;
case 4:
windows[switchTo] = new RadioOverlayWindowTwoHorizontal();
windows[switchTo] = new RadioOverlayWindowTwoHorizontal(ToggleOverlay);
break;
case 5:
windows[switchTo] = new RadioOverlayWindowThreeHorizontal();
Expand Down
60 changes: 35 additions & 25 deletions DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTwoHorizontal.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Name="RadioOverlayWin"
Title="DCS-SimpleRadio"
Width="340"
Height="160"
Height="150"
MinWidth="340"
MinHeight="160"
MinHeight="150"
AllowsTransparency="True"
Background="#444"
Opacity="1.0"
Expand All @@ -19,7 +19,7 @@

<Grid Name="containerPanel"
SizeChanged="containerPanel_SizeChanged"
Style="{x:Null}">
Style="{x:Null}" HorizontalAlignment="Left" Width="340">

<Grid.LayoutTransform>
<ScaleTransform x:Name="ApplicationScaleTransform"
Expand All @@ -35,8 +35,8 @@
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition />
<RowDefinition Height="16" />
<RowDefinition Height="80"/>
<RowDefinition Height="55" />

</Grid.RowDefinitions>
Expand All @@ -46,19 +46,17 @@
Grid.ColumnSpan="5"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Name="ControlText"
Width="200"
Height="16"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="13"
<TextBlock x:Name="ControlText"
Width="160"
Height="12"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="2 Radio Panel Horizontal" />
<TextBlock Name="ControlSubText"
Width="100"
Text="2 Radio Panel" />
<TextBlock x:Name="ControlSubText"
Width="80"
Text="VNGD is best"
FontSize="11"
FontSize="8"
TextAlignment="Center"
VerticalAlignment="Center"
Foreground="#E7E7E7"
Expand All @@ -76,38 +74,50 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Name="Orientation"
Width="38"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Horizontal" />
<Button Height="15" Margin="0,0,2,0" ToolTip="Swap to vertical orientation"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}">
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button>
<Button Height="15"
Margin="0,0,0,0"
VerticalAlignment="Center"
Click="Button_Minimise"
Style="{StaticResource DarkStyle-Button}">
<Button.Content>
<Grid Width="10" Height="10">
<TextBlock HorizontalAlignment="Center"
<Grid Width="10" Height="10">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Marlett"
FontSize="14"
Padding="3.5,0,0,3"
Text="0" />
</Grid>
</Button.Content>
</Grid>
</Button>

<Button Height="15"
Margin="2,0,5,0"
VerticalAlignment="Center"
Click="Button_Close"
Style="{StaticResource DarkStyle-Button}">
<Button.Content>
<Grid Width="10" Height="10">
<TextBlock HorizontalAlignment="Center"
<Grid Width="10" Height="10">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Marlett"
FontSize="14"
Padding="0,0,0,1"
Text="r" />
</Grid>
</Button.Content>
</Grid>
</Button>

</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public partial class RadioOverlayWindowTwoHorizontal : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

public RadioOverlayWindowTwoHorizontal()
private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowTwoHorizontal(Action<bool, int> ToggleOverlay)
{
InitializeComponent();

Expand All @@ -42,7 +44,6 @@ public RadioOverlayWindowTwoHorizontal()
AllowsTransparency = true;
Opacity = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalOpacity).DoubleValue;
windowOpacitySlider.Value = Opacity;

Left = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalX).DoubleValue;
Top = _globalSettings.GetPositionSetting(GlobalSettingsKeys.RadioTwoHorizontalY).DoubleValue;

Expand All @@ -66,6 +67,8 @@ public RadioOverlayWindowTwoHorizontal()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();

this._toggleOverlay = ToggleOverlay;
}

private void Location_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -166,6 +169,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 0); // index 0 is the vertical orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down
29 changes: 24 additions & 5 deletions DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayTwoVertical.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,44 @@
</WrapPanel.LayoutTransform>

<TextBlock Name="ControlText"
Width="118"
Width="70"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Top"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="" />
Text="2 Radio Panel" />
<TextBlock Name="Orientation"
Width="28"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Vertical" />
<Button Margin="0,0,0,0"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}"
ToolTip="Swap to horizon orientation">
<Button.Content>
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button.Content>
</Button>
<Button Margin="0,0,0,0"
Click="Button_About"
Style="{StaticResource DarkStyle-Button}">
<Button.Content>
<Grid Width="10" Height="10">
<TextBlock HorizontalAlignment="Center"
<TextBlock HorizontalAlignment="Right"
VerticalAlignment="Center"
FontWeight="Bold"
FontSize="10"
Padding="0"
Text="?" />
Text="?" Margin="0,0,3,0" />
</Grid>
</Button.Content>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public partial class RadioOverlayWindowTwoVertical : Window

private long _lastUnitId;

private readonly Action<bool, int> _toggleOverlay;

public RadioOverlayWindowTwoVertical()
public RadioOverlayWindowTwoVertical(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -87,6 +88,7 @@ public RadioOverlayWindowTwoVertical()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();
this._toggleOverlay = ToggleOverlay;
}

private void Location_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -272,6 +274,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 4); // index 4 is the horizontal orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down