Skip to content

Commit 8af614e

Browse files
committed
Merge branch 'master' of github.com:Nat-Lab/chunithm-vcontroller
2 parents 5d24c4c + 9d41fc6 commit 8af614e

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

ChuniVController/ChuniVController/MainWindow.xaml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:ChuniVController"
77
mc:Ignorable="d"
88
Loaded="OnLoad"
9-
Title="ChuniController" Height="450" Width="800" Topmost="True" ShowActivated="False" ResizeMode="NoResize" SizeToContent="WidthAndHeight">
9+
Title="ChuniController" Height="450" Width="1000" Topmost="True" ShowActivated="False" ResizeMode="NoResize" SizeToContent="WidthAndHeight" Opacity="{Binding Value, ElementName=OpacitySlider}" AllowsTransparency="True" WindowStyle="None" BorderBrush="Black" BorderThickness="2" MouseDown="DoMove">
1010
<Grid>
1111

1212
<local:TouchPad x:Name="Air" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" idleColor="#ffffff" activeColor="#000000" keyCode="0x20" />
@@ -28,13 +28,27 @@
2828
<local:TouchPad x:Name="Key15" HorizontalAlignment="Left" VerticalAlignment="Top" idleColor="#ffffff" activeColor="#000000" keyCode="0x4F" />
2929
<local:TouchPad x:Name="Key16" HorizontalAlignment="Left" VerticalAlignment="Top" idleColor="#ffffff" activeColor="#000000" keyCode="0x50" />
3030

31-
<Label Content="Key width" HorizontalAlignment="Left" Margin="1" VerticalAlignment="Bottom"/>
32-
<TextBox x:Name="KeyWidth" HorizontalAlignment="Left" Margin="70,0,0,5" Text="120" VerticalAlignment="Bottom" Width="60" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" />
33-
<Label Content="Key height" HorizontalAlignment="Left" Margin="134,1,1,1" VerticalAlignment="Bottom"/>
34-
<TextBox x:Name="KeyHeight" HorizontalAlignment="Left" Margin="207,0,0,5" Text="250" VerticalAlignment="Bottom" Width="60" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" />
35-
<Label Content="Air sensor height" HorizontalAlignment="Left" Margin="270,1,1,1" VerticalAlignment="Bottom"/>
36-
<TextBox x:Name="AirHeight" HorizontalAlignment="Left" Margin="378,0,0,5" Text="300" VerticalAlignment="Bottom" Width="60" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" />
37-
<Button Content="Apply" HorizontalAlignment="Left" Margin="450,0,0,5" VerticalAlignment="Bottom" Width="75" Click="DoApply" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" />
38-
<CheckBox x:Name="AllowMouse" Content="Allow Mouse" HorizontalAlignment="Right" Margin="10" VerticalAlignment="Bottom" Checked="SetAllowMouse" Unchecked="UnsetAllowMouse" />
31+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" >
32+
<Label Content="Key width:" />
33+
<TextBox x:Name="KeyWidth" Text="120" Width="60" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" Height="17" />
34+
<Label Margin="3,0,0,0" Content="Key height:" HorizontalAlignment="Left" />
35+
<TextBox x:Name="KeyHeight" HorizontalAlignment="Left" Text="250" Width="60" Height="17" />
36+
<Label Margin="3,0,0,0" Content="Sensor height:" />
37+
<TextBox x:Name="AirHeight" Text="300" Margin="3,0,0,0" Width="60" Height="17" />
38+
<Button Margin="3" Content="Apply" HorizontalAlignment="Left" Width="75" Click="DoApply" IsDefault="True" />
39+
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
40+
<Label Content="Opacity" />
41+
<Slider Margin="3" x:Name="OpacitySlider" Width="100" Maximum="1" Minimum="0.1" Value="1" TickFrequency="0.01" SmallChange="0.01" LargeChange="0.1"/>
42+
<CheckBox Margin="3" Content="Allow Mouse" Checked="SetAllowMouse" Unchecked="UnsetAllowMouse" Height="17" />
43+
<CheckBox Margin="3" Content="Lock Window" Checked="SetLockWindow" Unchecked="UnsetLockWindow" Height="17" />
44+
</StackPanel>
45+
46+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="1" MouseEnter="SetAllowFocus" MouseLeave="SetDenyFocus" >
47+
<Button Margin="3" Content="Exit" Width="75" Click="DoExit" IsCancel="True" />
48+
</StackPanel>
49+
50+
51+
52+
3953
</Grid>
4054
</Window>

ChuniVController/ChuniVController/MainWindow.xaml.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public MainWindow()
2424
InitializeComponent();
2525
}
2626

27-
27+
private bool drag_locked = false;
2828
private const int WS_EX_NOACTIVATE = 0x08000000;
2929
private const int GWL_EXSTYLE = -20;
3030

@@ -96,6 +96,11 @@ private void SetDenyFocus(object sender, RoutedEventArgs e)
9696
DenyFocus();
9797
}
9898

99+
private void DoExit(object sender, RoutedEventArgs e)
100+
{
101+
System.Windows.Application.Current.Shutdown();
102+
}
103+
99104
private void DoApply(object sender, RoutedEventArgs e)
100105
{
101106
Render();
@@ -112,5 +117,20 @@ private void UnsetAllowMouse(object sender, RoutedEventArgs e)
112117
Air.allowMouse = false;
113118
foreach (TouchPad t in touchpads) t.allowMouse = false;
114119
}
120+
121+
private void SetLockWindow(object sender, RoutedEventArgs e)
122+
{
123+
drag_locked = true;
124+
}
125+
126+
private void UnsetLockWindow(object sender, RoutedEventArgs e)
127+
{
128+
drag_locked = false;
129+
}
130+
131+
private void DoMove(object sender, MouseButtonEventArgs e)
132+
{
133+
if (e.LeftButton == MouseButtonState.Pressed && !drag_locked) DragMove();
134+
}
115135
}
116136
}

0 commit comments

Comments
 (0)