diff options
Diffstat (limited to 'Software/Visual_Studio/Embroidery')
11 files changed, 725 insertions, 13 deletions
diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml new file mode 100644 index 000000000..34f1aec7e --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml @@ -0,0 +1,32 @@ +<UserControl x:Class="Tango.EmbroideryUI.EmbroideryFileEditor" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:editor="clr-namespace:Tango.Editors;assembly=Tango.Editors" + xmlns:local="clr-namespace:Tango.EmbroideryUI" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300" Background="Black"> + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition/> + <RowDefinition/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Thumb Grid.ColumnSpan="2" Grid.RowSpan="2" Opacity="0" DragDelta="OnThumbDragging" DragStarted="OnThumbDragStarted" DragCompleted="OnDragCompleted"></Thumb> + + <ItemsControl x:Name="list" Grid.Column="1" Grid.Row="1" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Paths}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs new file mode 100644 index 000000000..f8ae8faa1 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.PMR; +using Tango.PMR.Embroidery; + +namespace Tango.EmbroideryUI +{ + /// <summary> + /// Interaction logic for EmbroideryFileEditor.xaml + /// </summary> + public partial class EmbroideryFileEditor : UserControl + { + [DllImport("Tango.Embroidery.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "AnalyzeEmbroideryFile")] + public static extern int AnalyzeEmbroideryFile(IntPtr data, int size, ref IntPtr output); + + private Thickness _currentMargins; + + #region Properties + + public ObservableCollection<EmbroideryPath> Paths + { + get { return (ObservableCollection<EmbroideryPath>)GetValue(PathsProperty); } + set { SetValue(PathsProperty, value); } + } + public static readonly DependencyProperty PathsProperty = + DependencyProperty.Register("Paths", typeof(ObservableCollection<EmbroideryPath>), typeof(EmbroideryFileEditor), new PropertyMetadata(null, (d, e) => (d as EmbroideryFileEditor).OnPathsChanged())); + + public EmbroideryFile EmbroideryFile + { + get { return (EmbroideryFile)GetValue(EmbroideryFileProperty); } + private set { SetValue(EmbroideryFileProperty, value); } + } + public static readonly DependencyProperty EmbroideryFileProperty = + DependencyProperty.Register("EmbroideryFile", typeof(EmbroideryFile), typeof(EmbroideryFileEditor), new PropertyMetadata(null)); + + public String FileName + { + get { return (String)GetValue(FileNameProperty); } + set { SetValue(FileNameProperty, value); } + } + public static readonly DependencyProperty FileNameProperty = + DependencyProperty.Register("FileName", typeof(String), typeof(EmbroideryFileEditor), new PropertyMetadata(null,(d,e) => (d as EmbroideryFileEditor).OnFileNameChanged())); + + public double ScaleFactor + { + get { return (double)GetValue(ScaleFactorProperty); } + set { SetValue(ScaleFactorProperty, value); } + } + public static readonly DependencyProperty ScaleFactorProperty = + DependencyProperty.Register("ScaleFactor", typeof(double), typeof(EmbroideryFileEditor), new PropertyMetadata(1.0,(d,e) => (d as EmbroideryFileEditor).OnScaleFactorChanged())); + + public EmbroideryPath SelectedPath + { + get { return (EmbroideryPath)GetValue(SelectedPathProperty); } + set { SetValue(SelectedPathProperty, value); } + } + public static readonly DependencyProperty SelectedPathProperty = + DependencyProperty.Register("SelectedPath", typeof(EmbroideryPath), typeof(EmbroideryFileEditor), new PropertyMetadata(null)); + + #endregion + + #region Constructors + + public EmbroideryFileEditor() + { + Paths = new ObservableCollection<EmbroideryPath>(); + InitializeComponent(); + MouseWheel += EmbroideryFileEditor_MouseWheel; + } + + #endregion + + #region Virtual Methods + + protected virtual void OnFileNameChanged() + { + AnalyzeInput input = new AnalyzeInput(); + input.FilePath = FileName; + + + NativePMR<AnalyzeInput, AnalyzeOutput> nativePMR = new NativePMR<AnalyzeInput, AnalyzeOutput>(AnalyzeEmbroideryFile); + AnalyzeOutput output = nativePMR.Invoke(input); + + EmbroideryFile = output.EmbroideryFile; + DrawFile(); + } + + protected virtual void OnPathsChanged() + { + if (Paths != null) + { + Paths.CollectionChanged -= Paths_CollectionChanged; + Paths.CollectionChanged += Paths_CollectionChanged; + + RegisterPathsEvents(); + } + } + + protected virtual void OnScaleFactorChanged() + { + if (EmbroideryFile != null) + { + DrawFile(); + } + } + + #endregion + + #region Event Handlers + + private void EmbroideryFileEditor_MouseWheel(object sender, MouseWheelEventArgs e) + { + double factor = e.Delta > 0 ? 0.5 : -0.5; + Paths.Clear(); + ScaleFactor += factor; + DrawFile(); + } + + private void Paths_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + RegisterPathsEvents(); + } + + private void Path_MouseDown(object sender, MouseButtonEventArgs e) + { + EmbroideryPath path = sender as EmbroideryPath; + + path.IsSelected = !path.IsSelected; + SelectedPath = path; + Paths.Where(x => x != path).ToList().ForEach(x => x.IsSelected = false); + } + + private void OnThumbDragging(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) + { + list.Margin = new Thickness(_currentMargins.Left + e.HorizontalChange, _currentMargins.Top + e.VerticalChange, 0, 0); + this.Cursor = Cursors.SizeAll; + } + + private void OnThumbDragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) + { + _currentMargins = list.Margin; + } + + private void OnDragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) + { + this.Cursor = Cursors.Arrow; + } + + #endregion + + #region Private Methods + + private void RegisterPathsEvents() + { + foreach (var path in Paths) + { + path.MouseDown -= Path_MouseDown; + path.MouseDown += Path_MouseDown; + } + } + + public void DrawFile() + { + if (EmbroideryFile == null) return; + + Point _currentPoint = new Point(); + Point _lastPoint = new Point(); + StitchFlag _mode = StitchFlag.Jump; + + Paths.Clear(); + + Color color = ConvertStitchColorToColor(EmbroideryFile.Colors[0]); + PathFigure path = CreatePathFigure(color, _currentPoint); + + foreach (var stitch in EmbroideryFile.Stitches) + { + _currentPoint = new Point(stitch.XX * ScaleFactor, stitch.YY * -1 * ScaleFactor); + + switch (stitch.Flag) + { + case StitchFlag.Jump: + path = CreatePathFigure(color, _currentPoint); + _mode = StitchFlag.Jump; + break; + case StitchFlag.Stop: + color = ConvertStitchColorToColor(EmbroideryFile.Colors[stitch.ColorIndex]); + break; + case StitchFlag.Normal: + + if (_mode == StitchFlag.Normal) + { + path.Segments.Add(new LineSegment(new Point(_currentPoint.X, _currentPoint.Y), true)); + } + _mode = StitchFlag.Normal; + break; + } + + _lastPoint = _currentPoint; + } + } + + private Color ConvertStitchColorToColor(StitchColor stitchColor) + { + return Color.FromRgb((byte)stitchColor.Red, (byte)stitchColor.Green, (byte)stitchColor.Blue); + } + + private PathFigure CreatePathFigure(Color color, Point startPoint) + { + PathFigure figure = new PathFigure(); + figure.StartPoint = startPoint; + figure.IsClosed = false; + + + EmbroideryPath path = new EmbroideryPath(new PathGeometry(new PathFigureCollection() { figure })); + path.StrokeThickness = 1; + path.Brush = new SolidColorBrush(color); + Paths.Add(path); + return figure; + } + + #endregion + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs new file mode 100644 index 000000000..a45c2a344 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using System.Windows.Shapes; + +namespace Tango.EmbroideryUI +{ + public class EmbroideryPath : Shape + { + private PathGeometry _path; + + public Brush Brush + { + get { return (Brush)GetValue(BrushProperty); } + set { SetValue(BrushProperty, value); } + } + public static readonly DependencyProperty BrushProperty = + DependencyProperty.Register("Brush", typeof(Brush), typeof(EmbroideryPath), new PropertyMetadata(null,(d,e) => (d as EmbroideryPath).OnBrushChanged())); + + private void OnBrushChanged() + { + Stroke = Brush; + } + + public bool IsSelected + { + get { return (bool)GetValue(IsSelectedProperty); } + set { SetValue(IsSelectedProperty, value); } + } + public static readonly DependencyProperty IsSelectedProperty = + DependencyProperty.Register("IsSelected", typeof(bool), typeof(EmbroideryPath), new PropertyMetadata(false,(d,e) => (d as EmbroideryPath).OnSelectedChanged())); + + private void OnSelectedChanged() + { + if (IsSelected) + { + Stroke = Brushes.White; + } + else + { + Stroke = Brush; + } + } + + public EmbroideryPath(PathGeometry path) + { + _path = path; + } + + protected override Geometry DefiningGeometry + { + get + { + return _path; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..83b86417d --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.EmbroideryUI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.EmbroideryUI")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.Designer.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..9b7380fa5 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.EmbroideryUI.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.EmbroideryUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.resx b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.Designer.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..4825e890a --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.EmbroideryUI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.settings b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj new file mode 100644 index 000000000..d8de4fd64 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/Tango.EmbroideryUI.csproj @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{BDBBE284-F564-4F51-AF41-3DF0434CEC62}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.EmbroideryUI</RootNamespace> + <AssemblyName>Tango.EmbroideryUI</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="EmbroideryFileEditor.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="EmbroideryFileEditor.xaml.cs"> + <DependentUpon>EmbroideryFileEditor.xaml</DependentUpon> + </Compile> + <Compile Include="EmbroideryPath.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Editors\Tango.Editors.csproj"> + <Project>{de2f2b86-025b-4f26-83a4-38bd48224ed5}</Project> + <Name>Tango.Editors</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/packages.config b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/packages.config new file mode 100644 index 000000000..6d9929c06 --- /dev/null +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp b/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp index e9c90ebda..7e1f5b01f 100644 --- a/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp +++ b/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp @@ -12,7 +12,7 @@ int main() { EmbPattern* p = embPattern_create(); - int ok = embPattern_read(p, "C:\\Users\\Roy\\Desktop\\RGB_Strips.pes"); + int ok = embPattern_read(p, "C:\\Users\\Roy\\Desktop\\abc.dst"); if (ok) { @@ -34,20 +34,20 @@ int main() EmbStitchList* sList = p->stitchList; - //while (sList) - //{ - // EmbStitch s = sList->stitch; - // //cout << " X: " << setprecision(3) << s.xx << " Y: " << setprecision(3) << s.yy << " Color Index: " << s.color << endl; - - // printf("\"%f\",\"%f\"\n", s.xx, s.yy); - // sList = sList->next; - //} - - for (size_t i = 0; i < 1000; i++) + while (sList) { - EmbStitch stitch = embStitchList_getAt(p->stitchList, i); - cout << i << " X: " << setprecision(3) << stitch.xx << " Y: " << setprecision(3) << stitch.yy << " Color Index: " << stitch.color << endl; + EmbStitch s = sList->stitch; + //cout << " X: " << setprecision(3) << s.xx << " Y: " << setprecision(3) << s.yy << " Color Index: " << s.color << endl; + + printf("\"%f\",\"%f\"\n", s.xx, s.yy); + sList = sList->next; } + + //for (size_t i = 0; i < 1000; i++) + //{ + // EmbStitch stitch = embStitchList_getAt(p->stitchList, i); + // cout << i << " X: " << setprecision(3) << stitch.xx << " Y: " << setprecision(3) << stitch.yy << " Color Index: " << stitch.color << endl; + //} } else { |
