Skip to content

Commit 8badf0e

Browse files
committed
Merge branch 'develop'
2 parents b3b3158 + 11e51da commit 8badf0e

16 files changed

+205
-82
lines changed

SimpleStateMachineNodeEditor/SimpleStateMachineNodeEditor.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77
<StartupObject>SimpleStateMachineNodeEditor.App</StartupObject>
88
<ApplicationIcon>StateMachine.ico</ApplicationIcon>
99
<SignAssembly>false</SignAssembly>
10-
<Version>1.0.2</Version>
10+
<Version>1.0.3</Version>
1111
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1212
<PackageProjectUrl>https://github.com/SimpleStateMachine/SimpleStateMachineNodeEditor</PackageProjectUrl>
1313
<PackageIcon>SimpleStateMachine.png</PackageIcon>
1414
<RepositoryUrl>https://github.com/SimpleStateMachine/SimpleStateMachineNodeEditor</RepositoryUrl>
1515
<PackageTags>statemachine state-machine finite-state-machine</PackageTags>
1616
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
1717
<Description>Node editor for SimpleStateMachine</Description>
18+
<AssemblyVersion>1.0.3.0</AssemblyVersion>
19+
<FileVersion>1.0.3.0</FileVersion>
20+
<PackageReleaseNotes>Some fix
21+
Some optimization
22+
Feature with opacity
23+
Custom for drag and drop textbox
24+
Undo - Redo for renaming</PackageReleaseNotes>
1825
</PropertyGroup>
1926

2027
<ItemGroup>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<TextBox x:Class="SimpleStateMachineNodeEditor.Styles.MyTextBox"
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"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800" AllowDrop="True" IsUndoEnabled="True" TextWrapping="NoWrap" BorderThickness="0,0,0,0" Background="{x:Null}" BorderBrush="{x:Null}" Style="{DynamicResource StyleEmptyTextBox}">
9+
</TextBox>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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
15+
{
16+
/// <summary>
17+
/// Логика взаимодействия для TestBox.xaml
18+
/// </summary>
19+
public partial class MyTextBox : TextBox
20+
{
21+
public MyTextBox()
22+
{
23+
InitializeComponent();
24+
this.ContextMenu = null;
25+
}
26+
27+
protected override void OnDragEnter(DragEventArgs e)
28+
{
29+
if(e.Effects != DragDropEffects.Move)
30+
{
31+
base.OnDragEnter(e);
32+
}
33+
}
34+
35+
36+
protected override void OnDragOver(DragEventArgs e)
37+
{
38+
if (e.Effects != DragDropEffects.Move)
39+
{
40+
base.OnDragOver(e);
41+
}
42+
}
43+
}
44+
}

SimpleStateMachineNodeEditor/Styles/Node/ElementNodeHeader.xaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
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 ColorNodeHeader}">
10-
<Grid>
6+
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.Styles.Node"
7+
xmlns:styles="clr-namespace:SimpleStateMachineNodeEditor.Styles"
8+
mc:Ignorable="d" >
9+
<Border CornerRadius="5,5,0,0" VerticalAlignment="Stretch" >
10+
<Border.Background>
11+
<SolidColorBrush Color="{DynamicResource ColorNodeHeader}" />
12+
</Border.Background>
13+
<Grid >
1114
<Grid.ColumnDefinitions>
1215
<ColumnDefinition Width="*" />
1316
<ColumnDefinition Width="*" />
1417
</Grid.ColumnDefinitions>
1518
<Grid.RowDefinitions>
1619
<RowDefinition />
1720
</Grid.RowDefinitions>
18-
<TextBox Name="TextBox" Grid.Column="0" VerticalAlignment="Center" VerticalContentAlignment="Center" Style="{DynamicResource StyleEmptyTextBox}" HorizontalContentAlignment="Center" BorderThickness="0,0,0,0" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{DynamicResource ColorNodeHeaderForeground}" Padding="10,2,0,2" ScrollViewer.CanContentScroll="True" HorizontalAlignment="Center" />
19-
<Button Name ="ButtonCollapse" Grid.Column="1" Style="{DynamicResource StyleNodeCollapseButton}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">
21+
<styles:MyTextBox x:Name="TextBoxElement" Grid.Column="0" VerticalAlignment="Center" ScrollViewer.CanContentScroll="True" HorizontalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Foreground="{DynamicResource ColorNodeHeaderForeground}" Padding="10,2,0,2" />
22+
<Button Name ="ButtonCollapse" Grid.Column="1" Style="{DynamicResource StyleNodeCollapseButton}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5" >
2023
<Button.RenderTransform>
2124
<TransformGroup>
2225
<RotateTransform x:Name="ButtonRotate" Angle="0" CenterX="4" CenterY="2" />

SimpleStateMachineNodeEditor/Styles/StyleEmptyTextBox.xaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
<Setter.Value>
1313
<ControlTemplate TargetType="{x:Type TextBox}">
1414
<Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" >
15-
<Border.ContextMenu>
16-
<ContextMenu Visibility="Collapsed"/>
17-
</Border.ContextMenu>
1815
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
16+
1917
</Border>
2018
</ControlTemplate>
2119
</Setter.Value>

SimpleStateMachineNodeEditor/Styles/Themes/Dark.xaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<SolidColorBrush x:Key="ColorSelectedElement" Color="#D23030"/>
1414

15-
<SolidColorBrush x:Key="ColorConnect" Color="White"/>
15+
<SolidColorBrush x:Key="ColorConnect" Color="White" />
1616

1717
<SolidColorBrush x:Key="ColorConnector" Color="White"/>
1818

@@ -79,21 +79,22 @@
7979
<!--#endregion Menu-->
8080

8181
<!--#region Node-->
82-
<SolidColorBrush x:Key="ColorNodeBackground" Color="#FF2D2D2D"/>
83-
82+
<Color x:Key="ColorNodeBackground">#E52D2D2D</Color>
8483
<SolidColorBrush x:Key="ColorNodeBorderBrush" Color="LightGray"/>
85-
8684

87-
<SolidColorBrush x:Key="ColorNodeHeader" Color="#FF123D6A"/>
88-
85+
86+
<!--<Color x:Key="ColorNodeHeader" R="18" G="61" B="106" A="200"/>-->
87+
<Color x:Key="ColorNodeHeader">#90123d6a</Color>
88+
<!--<SolidColorBrush x:Key="ColorNodeHeader" Color="#123d6a" Opacity="0.5"/>-->
89+
8990
<SolidColorBrush x:Key="ColorNodeHeaderForeground" Color="White"/>
90-
9191

92-
<SolidColorBrush x:Key="ColorNodeCollapseButtonBackground" Color="White"/>
93-
<SolidColorBrush x:Key="ColorNodeCollapseButtonBorderBrush" Color="White"/>
9492

95-
<SolidColorBrush x:Key="ColorNodeCollapseButtonMouseOverBackground" Color="#D23030"/>
96-
<SolidColorBrush x:Key="ColorNodeCollapseButtonMouseOverBorderBrush" Color="#D23030"/>
93+
<SolidColorBrush x:Key="ColorNodeCollapseButtonBackground" Color="White" />
94+
<SolidColorBrush x:Key="ColorNodeCollapseButtonBorderBrush" Color="White" />
95+
96+
<SolidColorBrush x:Key="ColorNodeCollapseButtonMouseOverBackground" Color="#D23030" />
97+
<SolidColorBrush x:Key="ColorNodeCollapseButtonMouseOverBorderBrush" Color="#D23030" />
9798
<!--#endregion Node-->
9899

99100
</ResourceDictionary>

SimpleStateMachineNodeEditor/Styles/Themes/Light.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
<SolidColorBrush x:Key="ColorSelectedElement" Color="#D23030"/>
1414

15-
<SolidColorBrush x:Key="ColorConnect" Color="#414141"/>
15+
<SolidColorBrush x:Key="ColorConnect" Color="#98989a"/>
1616

17-
<SolidColorBrush x:Key="ColorConnector" Color="#414141"/>
17+
<SolidColorBrush x:Key="ColorConnector" Color="#98989a"/>
1818

1919
<SolidColorBrush x:Key="ColorConnectorForeground" Color="Black"/>
2020

@@ -76,12 +76,12 @@
7676
<!--#endregion Menu-->
7777

7878
<!--#region Node-->
79-
<SolidColorBrush x:Key="ColorNodeBackground" Color="#eeeef2"/>
80-
79+
80+
<Color x:Key="ColorNodeBackground" >#E5eeeef2</Color>
81+
8182
<SolidColorBrush x:Key="ColorNodeBorderBrush" Color="#c2c3c9"/>
8283

83-
84-
<SolidColorBrush x:Key="ColorNodeHeader" Color="#414141"/>
84+
<Color x:Key="ColorNodeHeader" >#90414141</Color>
8585

8686
<SolidColorBrush x:Key="ColorNodeHeaderForeground" Color="White"/>
8787

SimpleStateMachineNodeEditor/View/ViewConnect.xaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.View"
77
mc:Ignorable="d"
88
d:DesignHeight="450" d:DesignWidth="800" IsHitTestVisible="False">
9-
<Grid>
10-
<Path x:Name="PathElement" StrokeDashCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ColorConnect}" StrokeEndLineCap="Round" StrokeStartLineCap="Round">
11-
<Path.Data>
12-
<PathGeometry x:Name="PathGeometryElement">
13-
<PathFigure x:Name="PathFigureElement" IsClosed="False">
14-
<BezierSegment x:Name="BezierSegmentElement"/>
15-
</PathFigure>
16-
</PathGeometry>
17-
</Path.Data>
18-
</Path>
19-
</Grid>
9+
<Path x:Name="PathElement" StrokeDashCap="Round" StrokeLineJoin="Round" Stroke="{DynamicResource ColorConnect}" StrokeEndLineCap="Round" StrokeStartLineCap="Round">
10+
<Path.Data>
11+
<PathGeometry x:Name="PathGeometryElement">
12+
<PathFigure x:Name="PathFigureElement" IsClosed="False">
13+
<BezierSegment x:Name="BezierSegmentElement"/>
14+
</PathFigure>
15+
</PathGeometry>
16+
</Path.Data>
17+
</Path>
2018
</UserControl>

SimpleStateMachineNodeEditor/View/ViewConnect.xaml.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ private void SetupBinding()
4848
{
4949
this.WhenActivated(disposable =>
5050
{
51+
Canvas.SetZIndex((UIElement)this.VisualParent, this.ViewModel.FromConnector.Node.Zindex + 1);
52+
5153
this.OneWayBind(this.ViewModel, x => x.Stroke, x => x.PathElement.Stroke).DisposeWith(disposable);
5254

5355
this.OneWayBind(this.ViewModel, x => x.StartPoint, x => x.PathFigureElement.StartPoint).DisposeWith(disposable);
@@ -63,9 +65,6 @@ private void SetupBinding()
6365
this.OneWayBind(this.ViewModel, x => x.FromConnector.NodesCanvas.Scale.Value, x => x.PathElement.StrokeThickness).DisposeWith(disposable);
6466

6567
this.WhenAnyValue(x => x.ViewModel.ToConnector).Where(x=>x!=null).Subscribe(_ => UpdateZindex()).DisposeWith(disposable);
66-
67-
Canvas.SetZIndex((UIElement)this.VisualParent, this.ViewModel.FromConnector.Node.Zindex+1);
68-
6968
});
7069
}
7170

SimpleStateMachineNodeEditor/View/ViewLeftConnector.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.View"
6+
xmlns:local="clr-namespace:SimpleStateMachineNodeEditor.View"
7+
xmlns:styles="clr-namespace:SimpleStateMachineNodeEditor.Styles"
78
x:Name="LeftConnector" HorizontalAlignment="Stretch" VerticalAlignment="Top" AllowDrop="True" >
8-
9-
<Grid x:Name="GridElement" Background="{DynamicResource ColorNodeBackground}">
9+
<Grid x:Name="GridElement" Background="#00000000">
1010
<Grid.ColumnDefinitions>
1111
<ColumnDefinition Width="Auto" />
1212
<ColumnDefinition />
1313
</Grid.ColumnDefinitions>
1414
<Grid.RowDefinitions>
1515
<RowDefinition />
1616
</Grid.RowDefinitions>
17-
<TextBox Name="TextBoxElement" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,5,3" TextWrapping="NoWrap" BorderThickness="0,0,0,0" Background="{x:Null}" BorderBrush="{x:Null}" Style="{DynamicResource StyleEmptyTextBox}"/>
17+
<styles:MyTextBox x:Name="TextBoxElement" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,5,3" />
1818
<Ellipse Name="EllipseElement" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="-7,0,0,0" Height="12" Width="12" AllowDrop="True" StrokeThickness="1" />
1919
</Grid>
2020

0 commit comments

Comments
 (0)