From 5cfc31f008134a952d608fee7bca7f9108d4bd3e Mon Sep 17 00:00:00 2001 From: UnclePetros Date: Thu, 10 Dec 2020 19:34:00 +0100 Subject: [PATCH] Settings update and minor changes - Added mountain and valley fold settings - Fixed .net compatibilty bugs - Added borders on saved svg images --- App.config | 16 +-- Main.xaml | 6 ++ Main.xaml.cs | 177 ++++++++++++++++++++------------ OriFlagTess.csproj | 13 +++ Properties/Settings.Designer.cs | 2 +- Settings.xaml | 40 ++++++++ Settings.xaml.cs | 79 ++++++++++++++ Utils.cs | 27 ++++- images/logo.ico | Bin 0 -> 5694 bytes images/logo.png | Bin 0 -> 13514 bytes images/settings.png | Bin 790 -> 1979 bytes logo.ico | Bin 0 -> 5694 bytes 12 files changed, 285 insertions(+), 75 deletions(-) create mode 100644 Settings.xaml create mode 100644 Settings.xaml.cs create mode 100644 images/logo.ico create mode 100644 images/logo.png create mode 100644 logo.ico diff --git a/App.config b/App.config index eb4ad7e..0fdbcc5 100644 --- a/App.config +++ b/App.config @@ -18,22 +18,26 @@ along with OriFlagTess. If not, see --> - + - - + + + + + + - + - + - \ No newline at end of file + diff --git a/Main.xaml b/Main.xaml index 9f37bb4..1b08d55 100644 --- a/Main.xaml +++ b/Main.xaml @@ -151,6 +151,7 @@ + @@ -175,6 +176,11 @@ + diff --git a/Main.xaml.cs b/Main.xaml.cs index 115b3b2..f33533b 100644 --- a/Main.xaml.cs +++ b/Main.xaml.cs @@ -208,12 +208,19 @@ private void DisposeUI(int numPleats) private List> renderInputNode() { + int MOUNTAIN_FOLD = int.Parse(System.Configuration.ConfigurationManager.AppSettings["mountainFold"]); + int VALLEY_FOLD = int.Parse(System.Configuration.ConfigurationManager.AppSettings["valleyFold"]); + var MOUNTAIN_FOLD_HTML_COLOR = System.Configuration.ConfigurationManager.AppSettings["mountainFoldColor"]; + var mountainFoldColor = ((SolidColorBrush)new BrushConverter().ConvertFromString(MOUNTAIN_FOLD_HTML_COLOR)); + var VALLEY_FOLD_HTML_COLOR = System.Configuration.ConfigurationManager.AppSettings["valleyFoldColor"]; + var valleyFoldColor = ((SolidColorBrush)new BrushConverter().ConvertFromString(VALLEY_FOLD_HTML_COLOR)); + this.inputNodeCanvas.Children.Clear(); Point canvasCenter = new Point(this.inputNodeCanvas.Width / 2, this.inputNodeCanvas.Height / 2); //Center of the node canvas panel Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node Point trs = new Point(canvasCenter.X - inputCenter.X, canvasCenter.Y + inputCenter.Y); //Translation needed to move the node figure to the center of the node canvas panel - this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, inputCenter.X + trs.X - 2, -inputCenter.Y + trs.Y - 2, Brushes.Brown)); + this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, inputCenter.X + trs.X - 2, -inputCenter.Y + trs.Y - 2, mountainFoldColor)); List> pleatsRotTras = new List>(); Point traslation = new Point(0, 0); @@ -251,10 +258,10 @@ private List> renderInputNode() pleatsRotTras.Add(pleatRotTras); - this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, Brushes.Brown)); - this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V1-END"].X + trs.X, -pleatRotTras["V1-END"].Y + trs.Y, Brushes.Brown)); - this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["V2-END"].X + trs.X, -pleatRotTras["V2-END"].Y + trs.Y, Brushes.Brown)); - this.inputNodeCanvas.Children.Add(Utils.lineDash(pleatRotTras["C"].X + trs.X, -pleatRotTras["C"].Y + trs.Y, pleatRotTras["C-END"].X + trs.X, -pleatRotTras["C-END"].Y + trs.Y, Brushes.Brown)); + this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V1-END"].X + trs.X, -pleatRotTras["V1-END"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["V2-END"].X + trs.X, -pleatRotTras["V2-END"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.inputNodeCanvas.Children.Add(Utils.line(pleatRotTras["C"].X + trs.X, -pleatRotTras["C"].Y + trs.Y, pleatRotTras["C-END"].X + trs.X, -pleatRotTras["C-END"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); } for (int i = 0; i < this.numPleats; i++) @@ -274,6 +281,13 @@ private List> renderInputNode() public void renderCreasePattern() { + int MOUNTAIN_FOLD = int.Parse(System.Configuration.ConfigurationManager.AppSettings["mountainFold"]); + int VALLEY_FOLD = int.Parse(System.Configuration.ConfigurationManager.AppSettings["valleyFold"]); + var MOUNTAIN_FOLD_HTML_COLOR = System.Configuration.ConfigurationManager.AppSettings["mountainFoldColor"]; + var mountainFoldColor = ((SolidColorBrush)new BrushConverter().ConvertFromString(MOUNTAIN_FOLD_HTML_COLOR)); + var VALLEY_FOLD_HTML_COLOR = System.Configuration.ConfigurationManager.AppSettings["valleyFoldColor"]; + var valleyFoldColor = ((SolidColorBrush)new BrushConverter().ConvertFromString(VALLEY_FOLD_HTML_COLOR)); + this.creasePatternCanvas.Children.Clear(); Point moleculeCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); Molecule mol = new Molecule(moleculeCenter, this.numPleats); @@ -284,8 +298,9 @@ public void renderCreasePattern() mol.calculatePleats(); Point canvasCenter = new Point(this.creasePatternCanvas.Width / 2, this.creasePatternCanvas.Height / 2); //Center of the crease pattern canvas panel + Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node Point trs = new Point(canvasCenter.X - mol.getCenter().X, canvasCenter.Y + mol.getCenter().Y); - this.creasePatternCanvas.Children.Add(Utils.ellipse(4, 4, mol.getCenter().X + trs.X - 2, -mol.getCenter().Y + trs.Y - 2, Brushes.Brown)); + this.creasePatternCanvas.Children.Add(Utils.ellipse(4, 4, mol.getCenter().X + trs.X - 2, -mol.getCenter().Y + trs.Y - 2, mountainFoldColor)); List> pleats;//, pleatsRotTras; pleats = mol.getPleats(); @@ -324,30 +339,36 @@ public void renderCreasePattern() pleatRotTras.Add(item.Key, Utils.RotTras(item.Value, angle, traslation)); if (item.Key == "V1" || item.Key == "V2" || item.Key == "M" || item.Key == "N") - pleatRotTras.Add(item.Key + "-END", Utils.RotTras(new Point(item.Value.X, item.Value.Y - canvasCenter.Y), angle, traslation)); + pleatRotTras.Add(item.Key + "-END", Utils.RotTras(new Point(item.Value.X, - canvasCenter.Y + inputCenter.Y), angle, traslation)); } pleatsRotTras.Add(pleatRotTras); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V1-END"].X + trs.X, -pleatRotTras["V1-END"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, pleatRotTras["M-END"].X + trs.X, -pleatRotTras["M-END"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, pleatRotTras["N-END"].X + trs.X, -pleatRotTras["N-END"].Y + trs.Y, Brushes.Brown)); - this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["V2-END"].X + trs.X, -pleatRotTras["V2-END"].Y + trs.Y, Brushes.Brown)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V1"].X + trs.X, -pleatRotTras["V1"].Y + trs.Y, pleatRotTras["V1-END"].X + trs.X, -pleatRotTras["V1-END"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["M"].X + trs.X, -pleatRotTras["M"].Y + trs.Y, pleatRotTras["M-END"].X + trs.X, -pleatRotTras["M-END"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["N"].X + trs.X, -pleatRotTras["N"].Y + trs.Y, pleatRotTras["N-END"].X + trs.X, -pleatRotTras["N-END"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatRotTras["V2"].X + trs.X, -pleatRotTras["V2"].Y + trs.Y, pleatRotTras["V2-END"].X + trs.X, -pleatRotTras["V2-END"].Y + trs.Y, mountainFoldColor, MOUNTAIN_FOLD)); if (i > 0) { - this.creasePatternCanvas.Children.Add(Utils.line(pleatsRotTras[i - 1]["L"].X + trs.X, -pleatsRotTras[i - 1]["L"].Y + trs.Y, pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, Brushes.Brown)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatsRotTras[i - 1]["L"].X + trs.X, -pleatsRotTras[i - 1]["L"].Y + trs.Y, pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); if (i == mol.getNumPleats() - 1) - this.creasePatternCanvas.Children.Add(Utils.line(pleatsRotTras[0]["L"].X + trs.X, -pleatsRotTras[0]["L"].Y + trs.Y, pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, Brushes.Brown)); + this.creasePatternCanvas.Children.Add(Utils.line(pleatsRotTras[0]["L"].X + trs.X, -pleatsRotTras[0]["L"].Y + trs.Y, pleatRotTras["L"].X + trs.X, -pleatRotTras["L"].Y + trs.Y, valleyFoldColor, VALLEY_FOLD)); } } + + //Borders + this.creasePatternCanvas.Children.Add(Utils.line(0, 0, 1500, 0, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(1500, 0, 1500, 1500, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(0, 1500, 1500, 1500, mountainFoldColor, MOUNTAIN_FOLD)); + this.creasePatternCanvas.Children.Add(Utils.line(0, 0, 0, 1500, mountainFoldColor, MOUNTAIN_FOLD)); } private void renderAllCanvasWithAngleFocus(int inputIndex) @@ -528,48 +549,54 @@ private void centerX_KeyUp(object sender, KeyEventArgs e) private void centerX_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { - if (e.NewValue != null) - { - List> pleatsRotTras; - pleatsRotTras = renderInputNode(); - - //Highlight focused input on input node canvas - Point canvasCenter = new Point(this.inputNodeCanvas.Width / 2, this.inputNodeCanvas.Height / 2); //Center of the node canvas panel - Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node - Point trs = new Point(canvasCenter.X - inputCenter.X, canvasCenter.Y + inputCenter.Y); //Translation needed to move the node figure to the center of the node canvas panel - Line hl = Utils.line(pleatsRotTras[0]["V1"].X + trs.X, -pleatsRotTras[0]["V1"].Y - inputCenter.Y + trs.Y, inputCenter.X + trs.X, -pleatsRotTras[0]["V1"].Y - inputCenter.Y + trs.Y, Brushes.Red); - hl.StrokeThickness = 1.5d; - this.inputNodeCanvas.Children.Add(hl); - this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X1 - 2, hl.Y1 - 2, Brushes.Red)); - this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X2 - 2, hl.Y2 - 2, Brushes.Red)); - - renderCreasePattern(); + if (e.OldValue != null) + { + if (e.NewValue != null) + { + List> pleatsRotTras; + pleatsRotTras = renderInputNode(); + + //Highlight focused input on input node canvas + Point canvasCenter = new Point(this.inputNodeCanvas.Width / 2, this.inputNodeCanvas.Height / 2); //Center of the node canvas panel + Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node + Point trs = new Point(canvasCenter.X - inputCenter.X, canvasCenter.Y + inputCenter.Y); //Translation needed to move the node figure to the center of the node canvas panel + Line hl = Utils.line(pleatsRotTras[0]["V1"].X + trs.X, -pleatsRotTras[0]["V1"].Y - inputCenter.Y + trs.Y, inputCenter.X + trs.X, -pleatsRotTras[0]["V1"].Y - inputCenter.Y + trs.Y, Brushes.Red); + hl.StrokeThickness = 1.5d; + this.inputNodeCanvas.Children.Add(hl); + this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X1 - 2, hl.Y1 - 2, Brushes.Red)); + this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X2 - 2, hl.Y2 - 2, Brushes.Red)); + + renderCreasePattern(); + } + else + ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } - else - ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } private void centerY_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { - if (e.NewValue != null) + if (e.OldValue != null) { - List> pleatsRotTras; - pleatsRotTras = renderInputNode(); - - //Highlight focused input on input node canvas - Point canvasCenter = new Point(this.inputNodeCanvas.Width / 2, this.inputNodeCanvas.Height / 2); //Center of the node canvas panel - Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node - Point trs = new Point(canvasCenter.X - inputCenter.X, canvasCenter.Y + inputCenter.Y); //Translation needed to move the node figure to the center of the node canvas panel - Line hl = Utils.line(pleatsRotTras[0]["V1"].X + inputCenter.X + trs.X, -pleatsRotTras[0]["V1"].Y + trs.Y, pleatsRotTras[0]["V1"].X + inputCenter.X + trs.X, -inputCenter.Y + trs.Y, Brushes.Red); - hl.StrokeThickness = 1.5d; - this.inputNodeCanvas.Children.Add(hl); - this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X1 - 2, hl.Y1 - 2, Brushes.Red)); - this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X2 - 2, hl.Y2 - 2, Brushes.Red)); - - renderCreasePattern(); + if (e.NewValue != null) + { + List> pleatsRotTras; + pleatsRotTras = renderInputNode(); + + //Highlight focused input on input node canvas + Point canvasCenter = new Point(this.inputNodeCanvas.Width / 2, this.inputNodeCanvas.Height / 2); //Center of the node canvas panel + Point inputCenter = new Point((double)this.centerX.Value, (double)this.centerY.Value); //Center of the node + Point trs = new Point(canvasCenter.X - inputCenter.X, canvasCenter.Y + inputCenter.Y); //Translation needed to move the node figure to the center of the node canvas panel + Line hl = Utils.line(pleatsRotTras[0]["V1"].X + inputCenter.X + trs.X, -pleatsRotTras[0]["V1"].Y + trs.Y, pleatsRotTras[0]["V1"].X + inputCenter.X + trs.X, -inputCenter.Y + trs.Y, Brushes.Red); + hl.StrokeThickness = 1.5d; + this.inputNodeCanvas.Children.Add(hl); + this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X1 - 2, hl.Y1 - 2, Brushes.Red)); + this.inputNodeCanvas.Children.Add(Utils.ellipse(4, 4, hl.X2 - 2, hl.Y2 - 2, Brushes.Red)); + + renderCreasePattern(); + } + else + ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } - else - ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } private void creasePatternCanvas_MouseWheel(object sender, MouseWheelEventArgs e) @@ -623,12 +650,10 @@ private void Save_Click(object sender, RoutedEventArgs e) if (saveFileDialog.FilterIndex == 1) { var svg = new SvgDocument(); - svg.Width = 500; - svg.Height = 500; - - var colorServer = new SvgColourServer(System.Drawing.Color.Black); + svg.Width = 1500; + svg.Height = 1500; - var group = new SvgGroup { Fill = SvgPaintServer.None, Stroke = colorServer }; + var group = new SvgGroup { Fill = SvgPaintServer.None, Stroke = new SvgColourServer(System.Drawing.Color.Black) }; svg.Children.Add(group); @@ -647,6 +672,15 @@ private void Save_Click(object sender, RoutedEventArgs e) var pathGeometry = PathGeometry.CreateFromGeometry((Geometry)geometry); var s = XamlWriter.Save(pathGeometry); + var scb = ((SolidColorBrush)(((Line)draw).Stroke)).Color; + var color = System.Drawing.Color.FromArgb(scb.A,scb.R,scb.G,scb.B); + var dashPatternSvg = new SvgUnitCollection(); + var dashPattern = ((Line)draw).StrokeDashArray; + for (int i = 0; i < dashPattern.Count; i++) + { + dashPatternSvg.Add(new SvgUnit((float)dashPattern[i])); + } + if (!String.IsNullOrEmpty(s)) { var element = XElement.Parse(s); @@ -659,7 +693,8 @@ private void Save_Click(object sender, RoutedEventArgs e) { PathData = SvgPathBuilder.Parse(data), Fill = SvgPaintServer.None, - Stroke = colorServer + Stroke = new SvgColourServer(color), + StrokeDashArray = dashPatternSvg }); } } @@ -707,6 +742,14 @@ private void Save_Click(object sender, RoutedEventArgs e) } + private void Settings_Click(object sender, RoutedEventArgs e) + { + Settings settings = new Settings(); + settings.ShowDialog(); + renderInputNode(); + renderCreasePattern(); + } + private void Reset_Click(object sender, RoutedEventArgs e) { DisposeUI(this.numPleats); @@ -755,12 +798,14 @@ private void autoCenter_Click(object sender, RoutedEventArgs e) private void spacing_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { - if (e.NewValue != null) - { - renderCreasePattern(); + if(e.OldValue != null) { + if (e.NewValue != null) + { + renderCreasePattern(); + } + else + ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } - else - ((DecimalUpDown)sender).Value = (decimal)e.OldValue; } } } diff --git a/OriFlagTess.csproj b/OriFlagTess.csproj index 98be196..377fad1 100644 --- a/OriFlagTess.csproj +++ b/OriFlagTess.csproj @@ -50,6 +50,9 @@ prompt 4 + + logo.ico + packages\Svg.3.0.49\lib\net35\Svg.dll @@ -94,7 +97,14 @@ Main.xaml + + Settings.xaml + + + Designer + MSBuild:Compile + @@ -154,5 +164,8 @@ + + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 9d67acd..d6fae87 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Flagstone_Tessellation___Molecule_construction.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Settings.xaml b/Settings.xaml new file mode 100644 index 0000000..c1c03b1 --- /dev/null +++ b/Settings.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + +