Skip to content

Commit

Permalink
v0.1 released
Browse files Browse the repository at this point in the history
changelog since last pre-release commit:
-Settings are saved at cose and reloaded at opening
  • Loading branch information
villamany committed Feb 16, 2015
1 parent 207753d commit 99e7073
Show file tree
Hide file tree
Showing 14 changed files with 33,698 additions and 6,245 deletions.
116 changes: 116 additions & 0 deletions 3dpBurnerImage2Gcode.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{496E57A8-49C8-44DB-BF07-622A62A882EF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_3dpBurnerImage2Gcode</RootNamespace>
<AssemblyName>3dpBurner Image2Gcode</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>picLas2.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<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>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icon1.ico" />
<None Include="Resources\mar.jpg" />
<None Include="Resources\inv2.png" />
<None Include="Resources\flip_vertical.png" />
<None Include="Resources\flip_horizontal.png" />
<None Include="Resources\inv.jpg" />
<None Include="Resources\1423670303_repeatR.png" />
<None Include="Resources\1423670303_repeat.png" />
</ItemGroup>
<ItemGroup>
<Content Include="picLas2.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
52 changes: 52 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="_3dpBurnerImage2Gcode.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<userSettings>
<_3dpBurnerImage2Gcode.Properties.Settings>
<setting name="autoZoom" serializeAs="String">
<value>True</value>
</setting>
<setting name="units" serializeAs="String">
<value>metric</value>
</setting>
<setting name="width" serializeAs="String">
<value>100</value>
</setting>
<setting name="height" serializeAs="String">
<value>50</value>
</setting>
<setting name="resolution" serializeAs="String">
<value>0.18</value>
</setting>
<setting name="minPower" serializeAs="String">
<value>0</value>
</setting>
<setting name="maxPower" serializeAs="String">
<value>0</value>
</setting>
<setting name="header" serializeAs="String">
<value>(Header)
G0 X0 Y0
(Header end)</value>
</setting>
<setting name="footer" serializeAs="String">
<value>(Footer)
G0 X0 Y0
(Footer end)</value>
</setting>
<setting name="feedrate" serializeAs="String">
<value>0</value>
</setting>
<setting name="powerCommand" serializeAs="String">
<value>S</value>
</setting>
<setting name="pattern" serializeAs="String">
<value>Horizontal scanning</value>
</setting>
<setting name="edgeLines" serializeAs="String">
<value>False</value>
</setting>
</_3dpBurnerImage2Gcode.Properties.Settings>
</userSettings>
</configuration>
8 changes: 2 additions & 6 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 79 additions & 22 deletions Form1.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
/*Changelog since last commit:
* Bug fix ("Use Z" as power command produced wrong lines)
* Some other minor bugs fix
* Added diagonal Gcode generation mode
* Added imperial/metric units
* Added about dialog
* Some gui improvements
/* 3dpBurner Image2Gcode. A Image to GCODE converter for GRBL based devices.
/* 3dpBurner Image2Gcode. A Image to GCODE converter for GRBL based devices.
This file is part of 3dpBurner Image2Gcode application.
Copyright (C) 2015 Adrian V. J. (villamany) contact: villamany@gmail.com
Expand Down Expand Up @@ -38,11 +30,11 @@ You should have received a copy of the GNU General Public License
using System.Runtime.InteropServices;


namespace WindowsFormsApplication1
namespace _3dpBurnerImage2Gcode
{
public partial class Form1 : Form
{
const string ver = "v0.1development";
const string ver = "v0.1";
Bitmap originalImage;
Bitmap adjustedImage;
float lastValue;//Aux for apply processing to image only when a new value is detected
Expand All @@ -51,14 +43,77 @@ public Form1()
InitializeComponent();
}
float ratio; //Used to lock the aspect ratio when the option is selected
//Image manipulatios is as follow.

//-Open image copy to OriginalImage, apply grayscale and sabe into the same ogiginal image, copy originalImage to adjustedImage and display adjusted image

//-Apply resice to original image by user and display
//-Aplly Balance= user brighness, contrast and and gamma inputed by user to adjustedImage and display it
//-Apply dirthering if selected to adjusted image and display it
//The operations as rotate, flip and invert are apllye directly to booth originalImage and adjustedImage
//Save settings
private void saveSettings()
{
try
{
string set;
Properties.Settings.Default.autoZoom=autoZoomToolStripMenuItem.Checked;
if (imperialinToolStripMenuItem.Checked) set = "imperial";
else set = "metric";
Properties.Settings.Default.units =set;
Properties.Settings.Default.width = tbWidth.Text;
Properties.Settings.Default.height = tbHeight.Text;
Properties.Settings.Default.resolution = tbRes.Text;
Properties.Settings.Default.minPower = tbLaserMin.Text;
Properties.Settings.Default.maxPower = tbLaserMax.Text;
Properties.Settings.Default.header = rtbPreGcode.Text;
Properties.Settings.Default.footer = rtbPostGcode.Text;
Properties.Settings.Default.feedrate = tbFeedRate.Text;
if (rbUseZ.Checked) set = "Z";
else set = "S";
Properties.Settings.Default.powerCommand = set;
Properties.Settings.Default.pattern = cbEngravingPattern.Text;
Properties.Settings.Default.edgeLines = cbEdgeLines.Checked;

Properties.Settings.Default.Save();
}
catch (Exception e)
{
MessageBox.Show("Error saving config: " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

}
}
//Load settings
private void loadSettings()
{
try
{
autoZoomToolStripMenuItem.Checked=Properties.Settings.Default.autoZoom;
autoZoomToolStripMenuItem_Click(this, null);

if (Properties.Settings.Default.units=="imperial")
{
imperialinToolStripMenuItem.Checked=true;
imperialinToolStripMenuItem_Click(this,null);
}
else
{
metricmmToolStripMenuItem.Checked=true;
metricmmToolStripMenuItem_Click(this,null);
}
tbWidth.Text=Properties.Settings.Default.width;
tbHeight.Text=Properties.Settings.Default.height;
tbRes.Text=Properties.Settings.Default.resolution;
tbLaserMin.Text=Properties.Settings.Default.minPower;
tbLaserMax.Text=Properties.Settings.Default.maxPower;
rtbPreGcode.Text=Properties.Settings.Default.header;
rtbPostGcode.Text=Properties.Settings.Default.footer;
tbFeedRate.Text=Properties.Settings.Default.feedrate;
if (Properties.Settings.Default.powerCommand == "Z")
rbUseZ.Checked = true;
else rbUseS.Checked = true;
cbEngravingPattern.Text=Properties.Settings.Default.pattern;
cbEdgeLines.Checked=Properties.Settings.Default.edgeLines;

}
catch (Exception e)
{
MessageBox.Show("Error saving config: " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

}
}

//Interpolate a 8 bit grayscale value (0-255) between min,max
private Int32 interpolate(Int32 grayValue, Int32 min, Int32 max)
Expand Down Expand Up @@ -389,6 +444,8 @@ private void Form1_Load(object sender, EventArgs e)
{
Text = "3dpBurner Image2Gcode " + ver;
lblStatus.Text = "Done";
loadSettings();

autoZoomToolStripMenuItem_Click(this, null);//Set preview zoom mode
}
//Width confirmed by user by the enter key
Expand Down Expand Up @@ -937,10 +994,10 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}

private void label10_Click(object sender, EventArgs e)
//On form closing
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{

saveSettings();
}


Expand Down
Loading

0 comments on commit 99e7073

Please sign in to comment.