Skip to content

Commit bf4005f

Browse files
committed
before
1 parent c659304 commit bf4005f

19 files changed

Lines changed: 916 additions & 85 deletions

SetupProject/SetupProject.vdproj

Lines changed: 708 additions & 0 deletions
Large diffs are not rendered by default.

SimpleStateMachineNodeEditor/App.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<Application.Resources>
77
<ResourceDictionary>
88
<ResourceDictionary.MergedDictionaries>
9+
10+
911
<ResourceDictionary Source="Styles/Colors.xaml"/>
1012

1113
<!--#region Test-->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SimpleStateMachineNodeEditor.Helpers.Enums
6+
{
7+
public enum ConnectType
8+
{
9+
noCorrect = 0,
10+
Simple,
11+
Loop
12+
}
13+
}

SimpleStateMachineNodeEditor/Styles/Colors.xaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<!--#region -->
66
<!--#endregion-->
77
<!--White-->
8-
<SolidColorBrush x:Key="ColorConnector" Color="Red"/>
8+
<SolidColorBrush x:Key="ColorConnector" Color="White"/>
99

1010
<!--#region Node-->
1111

1212
<!--#region LeftConnector-->
1313

1414
<SolidColorBrush x:Key="ColorLeftConnectorBackground" Color="#FF2D2D2D"/>
1515
<SolidColorBrush x:Key="ColorLeftConnectorEllipse" Color="#FF2D2D2D"/>
16-
<SolidColorBrush x:Key="ColorLeftConnectorText" Color="#FF2D2D2D"/>
16+
<SolidColorBrush x:Key="ColorLeftConnectorText" Color="White"/>
1717

1818
<!--#region LeftConnectorEllipse-->
1919

@@ -106,14 +106,14 @@
106106

107107
<!--#region ButtonRollUp-->
108108

109-
<SolidColorBrush x:Key="ColorNodeButtonRollUpStaticBackground" Color="Black"/>
110-
<SolidColorBrush x:Key="ColorNodeButtonRollStaticBorder" Color="Black"/>
111-
<SolidColorBrush x:Key="ColorNodeButtonRollUpMouseOverBackground" Color="Black"/>
109+
<SolidColorBrush x:Key="ColorNodeButtonRollUpStaticBackground" Color="White"/>
110+
<SolidColorBrush x:Key="ColorNodeButtonRollStaticBorder" Color="White"/>
111+
<SolidColorBrush x:Key="ColorNodeButtonRollUpMouseOverBackground" Color="White"/>
112112
<SolidColorBrush x:Key="ColorNodeButtonRollUpMouseOverBorder" Color="White"/>
113-
<SolidColorBrush x:Key="ColorNodeButtonRollUpPressedBackground" Color="Black"/>
114-
<SolidColorBrush x:Key="ColorNodeButtonRollUpPressedBorder" Color="Black"/>
115-
<SolidColorBrush x:Key="ColorNodeButtonRollUpDisabledBackground" Color="Black"/>
116-
<SolidColorBrush x:Key="ColorNodeButtonRollUpDisabledBorder" Color="Black"/>
113+
<SolidColorBrush x:Key="ColorNodeButtonRollUpPressedBackground" Color="White"/>
114+
<SolidColorBrush x:Key="ColorNodeButtonRollUpPressedBorder" Color="White"/>
115+
<SolidColorBrush x:Key="ColorNodeButtonRollUpDisabledBackground" Color="White"/>
116+
<SolidColorBrush x:Key="ColorNodeButtonRollUpDisabledBorder" Color="White"/>
117117

118118
<!--#endregion ButtonRollUp-->
119119

SimpleStateMachineNodeEditor/Styles/Node/NodeButtonRollUpStyle.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Setter Property="Control.Template">
66
<Setter.Value>
77
<ControlTemplate>
8-
<Path Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" Data="M0,7 L7,0 L14,7 Z" />
8+
<Path Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" Data="M0,6 L5,0 L10,6 Z" />
99
</ControlTemplate>
1010
</Setter.Value>
1111
</Setter>
@@ -18,7 +18,9 @@
1818
<Setter Property="Template">
1919
<Setter.Value>
2020
<ControlTemplate TargetType="{x:Type Button}">
21-
<Path Name="border" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Data="M2,7 L9,0 L16,7 Z" />
21+
<!--<Path Name="border" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Data="M2,7 L9,0 L16,7 Z" />-->
22+
<Path Name="border" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Data="M0,4 L4,0 L8,4 Z" />
23+
2224
<ControlTemplate.Triggers>
2325
<Trigger Property="IsDefaulted" Value="true">
2426
<Setter Property="Stroke" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<UserControl x:Class="SimpleStateMachineNodeEditor.Styles.Node.NodeHeader"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles.Node"
7+
mc:Ignorable="d"
8+
>
9+
<Border CornerRadius="5,5,0,0" VerticalAlignment="Stretch" Background="{DynamicResource ColorNodeHeaderStaticBackground}" >
10+
<Grid>
11+
<Grid.ColumnDefinitions>
12+
<ColumnDefinition Width="*" />
13+
<ColumnDefinition Width="*" />
14+
</Grid.ColumnDefinitions>
15+
<Grid.RowDefinitions>
16+
<RowDefinition />
17+
</Grid.RowDefinitions>
18+
<!--<TextBox Name="Header" Text="State 1" VerticalAlignment="Top" VerticalContentAlignment="Center" Style="{DynamicResource NodeHeaderStyle}" BorderBrush="{x:Null}" HorizontalContentAlignment="Center" BorderThickness="0" Padding="10,2" Foreground="{DynamicResource ColorNodeText}" />-->
19+
<TextBox Name="TextBox" Grid.Column="0" Text="State 1" VerticalAlignment="Center" VerticalContentAlignment="Center" Style="{DynamicResource NodeHeaderStyle}" HorizontalContentAlignment="Center" BorderThickness="0,0,0,0" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{DynamicResource ColorNodeText}" Padding="10,2,0,2" ScrollViewer.CanContentScroll="True" HorizontalAlignment="Center" />
20+
<!--<Path Name="border" Grid.Column="2" Stroke="White" Fill="White" HorizontalAlignment="Left" VerticalAlignment="Center" Data="M0,3 L3,0 L6,3 Z" Margin="5" />-->
21+
<Button Name ="ButtonCollapse" Grid.Column="1" Style="{DynamicResource NodeButtonRollUpStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">
22+
<Button.RenderTransform>
23+
<TransformGroup>
24+
<RotateTransform x:Name="ButtonRotate" Angle="0" CenterX="4" CenterY="2" />
25+
</TransformGroup>
26+
</Button.RenderTransform>
27+
</Button>
28+
</Grid>
29+
</Border>
30+
</UserControl>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Windows;
5+
using System.Windows.Controls;
6+
using System.Windows.Data;
7+
using System.Windows.Documents;
8+
using System.Windows.Input;
9+
using System.Windows.Media;
10+
using System.Windows.Media.Imaging;
11+
using System.Windows.Navigation;
12+
using System.Windows.Shapes;
13+
14+
namespace SimpleStateMachineNodeEditor.Styles.Node
15+
{
16+
/// <summary>
17+
/// Interaction logic for NodeHeader.xaml
18+
/// </summary>
19+
public partial class NodeHeader : UserControl
20+
{
21+
public NodeHeader()
22+
{
23+
InitializeComponent();
24+
}
25+
}
26+
}

SimpleStateMachineNodeEditor/Styles/Node/NodeHeaderStyle.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
<Style x:Key="NodeHeaderStyle" TargetType="{x:Type TextBox}">
7-
<Setter Property="BorderThickness" Value="1"/>
87
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
98
<Setter Property="HorizontalContentAlignment" Value="Left"/>
109
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
@@ -14,8 +13,8 @@
1413
<Setter Property="Template">
1514
<Setter.Value>
1615
<ControlTemplate TargetType="{x:Type TextBox}">
17-
<Border x:Name="border" CornerRadius="5,5,0,0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{DynamicResource ColorNodeHeaderStaticBackground}" SnapsToDevicePixels="True">
18-
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Padding="14,0,10,0"/>
16+
<Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
17+
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
1918
</Border>
2019
<ControlTemplate.Triggers>
2120
<Trigger Property="IsMouseOver" Value="true">

SimpleStateMachineNodeEditor/Styles/Node/RightConnector/RightConnectorEllipseStyle.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@
55
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke">
66
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseMouseEnterBorder}" />
77
</ObjectAnimationUsingKeyFrames>
8-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
8+
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
99
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseMouseEnterBackground}" />
10-
</ObjectAnimationUsingKeyFrames>
10+
</ObjectAnimationUsingKeyFrames>-->
1111
</Storyboard>
1212

1313
<Storyboard x:Key="MouseLeaveStoryboard">
1414
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke">
1515
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseMouseLeaveBorder}" />
1616
</ObjectAnimationUsingKeyFrames>
17-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
17+
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
1818
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseMouseLeaveBackground}" />
19-
</ObjectAnimationUsingKeyFrames>
19+
</ObjectAnimationUsingKeyFrames>-->
2020
</Storyboard>
2121

2222
<Storyboard x:Key="DragEnterStoryboard">
2323
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke">
2424
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseDropEnterBorder}" />
2525
</ObjectAnimationUsingKeyFrames>
26-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
26+
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
2727
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseDropEnterBackground}" />
28-
</ObjectAnimationUsingKeyFrames>
28+
</ObjectAnimationUsingKeyFrames>-->
2929
</Storyboard>
3030
<Storyboard x:Key="DragLeaveStoryboard">
3131
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke">
3232
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseDropLeaveBorder}" />
3333
</ObjectAnimationUsingKeyFrames>
34-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
34+
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill">
3535
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ColorRightConnectorEllipseDropLeaveBackground}" />
36-
</ObjectAnimationUsingKeyFrames>
36+
</ObjectAnimationUsingKeyFrames>-->
3737
</Storyboard>
3838

3939
<Style x:Key="RightConnectorEllipseStyle" TargetType="{x:Type Ellipse}">

SimpleStateMachineNodeEditor/View/ViewConnect.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ private void SetupBinding()
7171

7272
this.WhenAnyValue(x => x.ViewModel.ToConnector).Where(x=>x!=null).Subscribe(_ => UpdateZindex()).DisposeWith(disposable);
7373

74+
Canvas.SetZIndex((UIElement)this.VisualParent, this.ViewModel.FromConnector.Node.Zindex+1);
75+
7476
});
7577
}
7678
#endregion SetupBinding
@@ -85,7 +87,8 @@ private void SetupEvents()
8587
}
8688
private void UpdateZindex()
8789
{
88-
Canvas.SetZIndex((UIElement)this.VisualParent, this.ViewModel.ToConnector.Node.Zindex);
90+
if(this.ViewModel.FromConnector.Node!=this.ViewModel.ToConnector.Node)
91+
Canvas.SetZIndex((UIElement)this.VisualParent, this.ViewModel.ToConnector.Node.Zindex);
8992
}
9093

9194
#endregion SetupEvents

0 commit comments

Comments
 (0)