This commit is contained in:
Wiesław Šoltés 2015-08-07 16:26:25 +02:00
Родитель 0adcb19dfb
Коммит 5ea33337f1
1 изменённых файлов: 232 добавлений и 170 удалений

Просмотреть файл

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:SpiroNet.Wpf"
xmlns:spiro="clr-namespace:SpiroNet;assembly=SpiroNet"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="1000"
d:DesignHeight="700" d:DesignWidth="1040"
Background="White"
SnapsToDevicePixels="True" UseLayoutRounding="True"
TextOptions.TextFormattingMode="Display">
@ -75,10 +75,9 @@
ItemsSource="{Binding Drawing.Shapes}"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Background="White"
BorderBrush="{x:Null}"
BorderThickness="0"
Margin="4,2,4,2"
Margin="4,4,4,2"
Grid.Row="0">
<ListBox.ItemTemplate>
<DataTemplate>
@ -95,6 +94,7 @@
Height="240"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Margin="4,2,4,4"
Grid.Row="1">
<TextBox.Text>
<MultiBinding Converter="{StaticResource ShapeToDataConverterKey}" FallbackValue="{x:Null}">
@ -112,7 +112,7 @@
Editor="{Binding}"
Width="{Binding Drawing.Width}"
Height="{Binding Drawing.Height}"
Background="WhiteSmoke"
Background="LightGray"
Focusable="True"
FocusVisualStyle="{x:Null}">
<local:SpiroCanvas.InputBindings>
@ -131,179 +131,241 @@
</local:SpiroCanvas.InputBindings>
</local:SpiroCanvas>
</ScrollViewer>
<StackPanel VerticalAlignment="Center"
Background="White"
Grid.Column="2"
Grid.Row="1">
<GroupBox Header="Drawing Size" Margin="4,2,4,2">
<StackPanel>
<TextBox Text="{Binding Drawing.Width}" Margin="1"/>
<TextBox Text="{Binding Drawing.Height}" Margin="1"/>
</StackPanel>
</GroupBox>
<GroupBox Header="New Shape" Margin="4,2,4,2">
<StackPanel>
<CheckBox IsChecked="{Binding State.IsStroked}"
VerticalContentAlignment="Center"
Content="Is Stroked k"
Margin="1">
<CheckBox.ToolTip>
<TabControl Grid.Column="2" Grid.Row="1" Width="200" Margin="4,0,4,4">
<TabItem Header="State">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<StackPanel>
<GroupBox Header="Drawing Size" Margin="4,2,4,2">
<StackPanel>
<TextBlock Text="Is stroked path shape" FontWeight="Bold"/>
<TextBox Text="{Binding Drawing.Width}" Margin="1"/>
<TextBox Text="{Binding Drawing.Height}" Margin="1"/>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsFilled}"
VerticalContentAlignment="Center"
Content="Is Filled f"
Margin="1">
<CheckBox.ToolTip>
</GroupBox>
<GroupBox Header="Snap Mode" Margin="4,2,4,2">
<StackPanel>
<TextBlock Text="Is filled path shape" FontWeight="Bold"/>
<TextBox Text="{Binding State.SnapX}" Margin="1"/>
<TextBox Text="{Binding State.SnapY}" Margin="1"/>
<CheckBox IsChecked="{Binding State.EnableSnap}"
VerticalContentAlignment="Center"
Content="Enable Snap"
Margin="1">
</CheckBox>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsClosed}"
VerticalContentAlignment="Center"
Content="Is Closed d"
Margin="1">
<CheckBox.ToolTip>
</GroupBox>
<GroupBox Header="New/Selected Shape" Margin="4,2,4,2">
<StackPanel>
<TextBlock Text="Is closed spiro shape" FontWeight="Bold"/>
<TextBlock Text="Whether points describe a closed (True) or open (False) contour."/>
<CheckBox IsChecked="{Binding State.IsStroked, Mode=OneWay}"
Command="{Binding Commands.IsStrokedCommand}"
VerticalContentAlignment="Center"
Content="Is Stroked k"
Margin="1">
<CheckBox.ToolTip>
<StackPanel>
<TextBlock Text="Is stroked path shape" FontWeight="Bold"/>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsFilled, Mode=OneWay}"
Command="{Binding Commands.IsFilledCommand}"
VerticalContentAlignment="Center"
Content="Is Filled f"
Margin="1">
<CheckBox.ToolTip>
<StackPanel>
<TextBlock Text="Is filled path shape" FontWeight="Bold"/>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsClosed, Mode=OneWay}"
Command="{Binding Commands.IsClosedCommand}"
VerticalContentAlignment="Center"
Content="Is Closed d"
Margin="1">
<CheckBox.ToolTip>
<StackPanel>
<TextBlock Text="Is closed spiro shape" FontWeight="Bold"/>
<TextBlock Text="Whether points describe a closed (True) or open (False) contour."/>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsTagged, Mode=OneWay}"
Command="{Binding Commands.IsTaggedCommand}"
VerticalContentAlignment="Center"
Content="Is Tagged t"
Margin="1">
<CheckBox.ToolTip>
<StackPanel>
<TextBlock Text="Is tagged spiro shape" FontWeight="Bold"/>
<TextBlock Text="This requires that spiro control points be tagged according to convention. A closed curve will have an extra control point attached to the end of it with a type of 'End'."/>
<TextBlock Text="The location of this last point is irrelevant."/>
<TextBlock Text="In an open contour the point types of the first and last control points are going to be ignored."/>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
<CheckBox IsChecked="{Binding State.IsTagged}"
VerticalContentAlignment="Center"
Content="Is Tagged t"
Margin="1">
<CheckBox.ToolTip>
</GroupBox>
<GroupBox Header="New/Selected Point" Margin="4,2,4,2">
<StackPanel>
<TextBlock Text="Is tagged spiro shape" FontWeight="Bold"/>
<TextBlock Text="This requires that spiro control points be tagged according to convention. A closed curve will have an extra control point attached to the end of it with a type of 'End'."/>
<TextBlock Text="The location of this last point is irrelevant."/>
<TextBlock Text="In an open contour the point types of the first and last control points are going to be ignored."/>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Corner}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="Corner"
VerticalContentAlignment="Center"
Content="Corner v"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A corner point" FontWeight="Bold"/>
<TextBlock Text="Where the slopes and curvatures of the incoming and outgoing splines are unconstrained."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.G4}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="G4"
VerticalContentAlignment="Center"
Content="G4 o"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A G4 curve point" FontWeight="Bold"/>
<TextBlock Text="Continuous up to the fourth derivative."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.G2}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="G2"
VerticalContentAlignment="Center"
Content="G2 c"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A G2 curve point" FontWeight="Bold"/>
<TextBlock Text="Continuous up to the second derivative."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Left}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="Left"
VerticalContentAlignment="Center"
Content="Left ["
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A left constraint point" FontWeight="Bold"/>
<TextBlock Text="Used to connect a curved line to a straight one."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Right}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="Right"
VerticalContentAlignment="Center"
Content="Right ]"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A right constraint point" FontWeight="Bold"/>
<TextBlock Text="Used to connect a straight line to a curved one."/>
<TextBlock Text="If you have a contour which is drawn clockwise, and you have a straight segment at the top, then the left point of that straight segment should be a left constraint, and the right point should be a right constraint."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.End}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="End"
VerticalContentAlignment="Center"
Content="End z"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="End point" FontWeight="Bold"/>
<TextBlock Text="For a closed contour add an extra cp with a ty set to 'end'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.OpenContour}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="OpenContour"
VerticalContentAlignment="Center"
Content="OpenContour {"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="Open contour" FontWeight="Bold"/>
<TextBlock Text="For an open contour the first cp must have a ty set to 'open contour'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.EndOpenContour}}"
Command="{Binding Commands.PointTypeCommand}"
CommandParameter="EndOpenContour"
VerticalContentAlignment="Center"
Content="EndOpenContour }"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="End open contour" FontWeight="Bold"/>
<TextBlock Text="For an open contour the last cp must have a ty set to 'end open contour'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
</StackPanel>
</CheckBox.ToolTip>
</CheckBox>
</StackPanel>
</GroupBox>
<GroupBox Header="New Point" Margin="4,2,4,2">
<StackPanel>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Corner}}"
VerticalContentAlignment="Center"
Content="Corner v"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A corner point" FontWeight="Bold"/>
<TextBlock Text="Where the slopes and curvatures of the incoming and outgoing splines are unconstrained."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.G4}}"
VerticalContentAlignment="Center"
Content="G4 o"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A G4 curve point" FontWeight="Bold"/>
<TextBlock Text="Continuous up to the fourth derivative."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.G2}}"
VerticalContentAlignment="Center"
Content="G2 c"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A G2 curve point" FontWeight="Bold"/>
<TextBlock Text="Continuous up to the second derivative."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Left}}"
VerticalContentAlignment="Center"
Content="Left ["
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A left constraint point" FontWeight="Bold"/>
<TextBlock Text="Used to connect a curved line to a straight one."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.Right}}"
VerticalContentAlignment="Center"
Content="Right ]"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="A right constraint point" FontWeight="Bold"/>
<TextBlock Text="Used to connect a straight line to a curved one."/>
<TextBlock Text="If you have a contour which is drawn clockwise, and you have a straight segment at the top, then the left point of that straight segment should be a left constraint, and the right point should be a right constraint."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.End}}"
VerticalContentAlignment="Center"
Content="End z"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="End point" FontWeight="Bold"/>
<TextBlock Text="For a closed contour add an extra cp with a ty set to 'end'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.OpenContour}}"
VerticalContentAlignment="Center"
Content="OpenContour {"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="Open contour" FontWeight="Bold"/>
<TextBlock Text="For an open contour the first cp must have a ty set to 'open contour'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
<RadioButton IsChecked="{Binding Path=State.PointType, Converter={StaticResource EnumToBooleanConverterKey}, ConverterParameter={x:Static spiro:SpiroPointType.EndOpenContour}}"
VerticalContentAlignment="Center"
Content="EndOpenContour }"
Margin="1">
<RadioButton.ToolTip>
<StackPanel>
<TextBlock Text="End open contour" FontWeight="Bold"/>
<TextBlock Text="For an open contour the last cp must have a ty set to 'end open contour'."/>
</StackPanel>
</RadioButton.ToolTip>
</RadioButton>
</StackPanel>
</GroupBox>
<TextBlock Text="Mouse Left:" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Begin Shape" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Add Point" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Move Point" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="Mouse Right" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Finish Shape" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Remove Shape" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="- Remove Point" TextAlignment="Left" Foreground="Gray" Margin="4,0,4,0"/>
<TextBlock Text="Script/plate:" TextAlignment="Left" Foreground="Black" Margin="4,4,4,0"/>
<TextBox x:Name="scriptTextBox"
AcceptsReturn="True"
AcceptsTab="True"
IsReadOnly="False"
Height="120"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Margin="4,0,4,0">
</TextBox>
<Button Content="Run" Command="{Binding Commands.ExecuteScriptCommand}"
CommandParameter="{Binding ElementName=scriptTextBox, Path=Text}"
Margin="4,4,4,0">
</Button>
</StackPanel>
</GroupBox>
<GroupBox Header="Options" Margin="4,2,4,2">
<CheckBox IsChecked="{Binding State.DisplayKnots}"
Command="{Binding Commands.InvalidateCommand}"
VerticalContentAlignment="Center"
Content="Display Knots"
Margin="1">
</CheckBox>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem Header="Script">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Script/plate:" TextAlignment="Left" Foreground="Black" Margin="4,4,4,0"/>
<TextBox x:Name="scriptTextBox"
AcceptsReturn="True"
AcceptsTab="True"
IsReadOnly="False"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Margin="4,0,4,0"
Grid.Row="0">
</TextBox>
<Button Content="Run" Command="{Binding Commands.ExecuteScriptCommand}"
CommandParameter="{Binding ElementName=scriptTextBox, Path=Text}"
Margin="4,4,4,0"
Grid.Row="1">
</Button>
</Grid>
</TabItem>
<TabItem Header="Help">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<StackPanel>
<TextBlock Text="Mouse Left:" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Begin Shape" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Add Point" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Select Shape" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Select Point" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Move Shape" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Move Point" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="Mouse Right" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Finish Shape" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Remove Shape" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Remove Point" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="Mouse Middle:" TextAlignment="Left" Margin="4,0,4,0"/>
<TextBlock Text="- Insert Point" TextAlignment="Left" Margin="4,0,4,0"/>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
</Grid>
</UserControl>